logistic_sgd module, where to find it? - python

doing a deep learning tutorial and my python cannot find that module.
from logistic_sgd import LogisticRegression, load_data
ImportError: No module named logistic_sgd
How can i install it ?

Download and Save logistic_sgd.py from the following link:
http://deeplearning.net/tutorial/code/logistic_sgd.py
Store it in the working directory. That's it!

Actually, you should download all the code from the following link, it contains all the dependencies you need.
Here is the source code:
http://deeplearning.net/tutorial/code/

To download all the code necessary, you can go to GitHub.
Citing from: http://deeplearning.net/tutorial/
The code is available on the Deep Learning Tutorial repositories.
If you aren't familiar with Git, you can download the source code in one zip archive file from there.

are you using the Theano library, if you are, that means your project cannot find the Theano library, use
sys.path.append(r'~/TheanoDL')
to declare it at the beginning of your project, change the path of it with your Theano is in.
Note that it works for a project with a customed Theano library.(my situation)
Best luck!

Related

Is it possible to get to the code from egg-link?

I made some modifications to the code for a deep learning model implemented in MxNet.
On my local computer, I installed MxNet by conda/pip, so I could just go to the installation folder, where I found the files where the model architecture is specified and made my changes. The structure is like:
.../environment_folder/lib/python3.8/site-packages/
- gluoncv/model_zoo/action_recognition/i3d_resnet.py
- mxnet/gluon/block.py
and I made my changes to these files.
Now, I need to do the same on another machine, where MxNet has been compiled from source. I looked into the analogous installation folder, and I found the following structure:
.../environment_folder/lib/python3.8/site-packages/
- gluoncv/model_zoo/action_recognition/i3d_resnet.py
- mxnet.egg-link
i.e., I found the gluoncv folder, but instead of the mxnet one there is a egg-link. I honestly didn't know about egg files, I've been searching around and found it was an old way of packaging python files before wheels and pip. Is there any way I can open the link and get to the folder it is presumably pointing to?
If you can open a python shell prompt (with the environment loaded) on the machine in question, try:
import mxnet
mxnet.__file__

how to import proper python module on virtual environment

I have this problem, that cannot import torch and torchvision well.
Currently, I am using the virtual environment, juneon, using Anaconda.
I think I set the library path and python path properly like the first following image.
Running the python file does not matter, However, during debugging, they cannot find those modules via VSCODE. I posted the second following image I've been seeing.
What should I check in order to solve the problem?
FYI, the third image is my file tree
Please let me know what I am missing!
Thank you in advance.

Importing module from Github to use in Python

I'm a beginner in Python and I have no experience with GitHub at all. I want to import the module semsimlib from the following URL: https://github.com/timvdc/semsimlib
I have looked on the internet for help on how to do this but most of it is very unclear and doesn't seem to work for me. Can anyone provide a detailed explanation on how to do this in a easy way?
It looks the repo does not provide appropriate scripts to simply install the package. There is no setup.py file and there is no distribution on pypi.
What you can do is go to site-packages folder inside your python installation or inside your virtual environment. Then run git clone https://github.com/timvdc/semsimlib. You should now be able to import semsimlib. Keep in mind that you will also have to install all the other dependencies your self one by one since there is also no requirements file.
You can also clone the repo into any folder on your computer and at the top of your script put:
import sys
sys.path.append("path/to/semsimlib/folder")
semsimlib will now be importable. However, I would try to get it to work with the first method.

What is the way to specify download directory while using download missing resources in command line?

I am trying to use nltk for lexical parsing. As part of this, whenever I try to run things like stopwords or wordnet, I get "Resource not found" error. In Anaconda, I am able to see the recommended steps to be taken such as:
import nltk
nltk.download('wordnet')
But, this installs the resources under my home directory. I would expect it to be downloaded under the anaconda nltk library. Is there a conda command to update the nltk package to download wordnet or resources found missing?
You could add this (installed) directory that is within your home directory to PYTHONPATH variable, for it to work.
I figured the answer to this issue. Thought of posting it so that it is useful to others.
import nltk
nltk.download('wordnet', download_dir='/users/droy/anaconda/nltk/wordnet')

ImportError: No module named data_utils

I'm extremely new to python and I'm recently trying to understand more about Machine Learning and Neural Nets
I know this is a trivial question but I seem to be having problem importing data_utils on jupyter notebook. Can anyone please help
Note: I am not using Keras, and I am following the tutorial in this video.
I was also following the video and went through the same issue, after searching for a while; Here is the link from Github tensorflow_chatbot_required_files. You can download from here and copy it to your working directory (python file directory).
Now you will be able to import both.
Based on the link that you provided for the video you are using, go to
this link and download both files into your working directory.
The files you need to download are data_utils and seq2seq_model.
But before doing this tutorial try the tensorflow tutorials found on the tensorflow website, to get you started with this library.
Also, if you are very new to python, I recommend this tutorial first.
Since you mentioned about Machine Learning and Neural Nets, I'll assume you're referring to Keras.
I'll also assume that you installed it via
pip install keras
In that case, you need to uninstall it first by running
pip uninstall keras
Then, clone it from Github, cd into its directory and run
sudo python setup.py install
More information here
I'm assuming you are using code from tensorflow's github, in that case you need to download https://github.com/tensorflow/models/blob/master/tutorials/rnn/translate/data_utils.py into your folder also.
what you are trying to do is importing a self-defined module, in order to do that do as follow:
in your case the module is called 'data_util' which contains functions that will be called later as data_util.'function name'.
let say that the data_util which is a python file (.py) is in this directory (C:/Users/xxx/modules), so all what you have to do is to run this line of code in order for python to find your modul when you call import data_util:
import sys
sys.path.append('C:/Users/xxx/modules')
import data_util
I too was using same files.
Just open seq2seq_model.py and in line 35 remove from TensorFlow and keep it just import dat_

Categories

Resources