GUI and Desktop Applications
int64
0
1
A_Id
int64
5.3k
72.5M
Networking and APIs
int64
0
1
Python Basics and Environment
int64
0
1
Other
int64
0
1
Database and SQL
int64
0
1
Available Count
int64
1
13
is_accepted
bool
2 classes
Q_Score
int64
0
1.72k
CreationDate
stringlengths
23
23
Users Score
int64
-11
327
AnswerCount
int64
1
31
System Administration and DevOps
int64
0
1
Title
stringlengths
15
149
Q_Id
int64
5.14k
60M
Score
float64
-1
1.2
Tags
stringlengths
6
90
Answer
stringlengths
18
5.54k
Question
stringlengths
49
9.42k
Web Development
int64
0
1
Data Science and Machine Learning
int64
1
1
ViewCount
int64
7
3.27M
0
51,685,128
0
0
0
0
1
false
0
2018-08-03T14:33:00.000
0
1
0
Opencv step for Triangulate point from stereo image
51,674,917
0
python,image,opencv,point,triangulation
To triangulate you need to now position of cameras. Those position can be presented in different forms, translate, rotation, or affine, depend of needs. Construct two rays from each camera thru the same landmark. In theory find intersection of those two rays. In practice find point that is closest to both rays. That point is what you want.
I'm trying to triangulate points from stereo images.On the web I find a lot of confusion, because there are many different methods. I have two images of the same subject in different angles, with manually defined landmarks,(for example , 2 faces where I scored 3 points: nose and pupils). I would like to go back to the three-dimensional position of these points through their triangulation. It could be listed the various steps to be performed to get this result in OpenCv for python?
0
1
510
0
51,680,611
0
0
0
0
1
true
2
2018-08-03T19:53:00.000
2
1
0
Is Dataset Organization for Image Classification Necessary?
51,679,311
1.2
python,tensorflow,machine-learning,keras,classification
In your example, you have all the images in memory. You can simply call model.fit(trainX, trainY) to train your model. No need to organize the images in specific folder structures. What you are referring to, is the flow_from_directory() method of the ImageDataGenerator. This is an object that will yield images from the directories, and automatically infer the labels from the folder structure. In this case, your images should be arranged in one folder per label. Since the ImageDataGenerator is a generator, you should use it in combination with model.fit_generator(). As a third option, you can write your own custom generator that yields both images and labels. This is advised in case you have a more complex label structure than one label per images; for instance in multi-label classification, object detection or semantic segmentation, where the outputs are also images. A custom generator should also be used with model.fit_generator().
I'm currently working on a program that can do binary image classification with machine learning. I have a list of labels and a list of images that i'm using as inputs which are then fed into the Inception V3 model. Will inputting of the dataset this way work with the inception V3 architecture? Is it necessary to organize the images with labeled folders before feeding it into the model? Thanks for your help!
0
1
145
0
51,758,333
0
0
0
0
1
true
0
2018-08-04T09:24:00.000
0
1
0
google.protobuf.text_format.ParseError: 9:18 : Couldn't parse integer: 03
51,684,220
1.2
python-3.x,ubuntu,tensorflow,video-processing,object-detection-api
I faced a similar problem relating to label_map_path when running on local machine. Solved by removing spaces between lines in the label map pbtxt file. Please check config file as well.
Im using python 3.6 tensorflow 1.5 im following the link But got the error: doe@doe:~/anaconda3/envs/tensorflow/models/research/object_detection$ python3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_mobilenet_v1_coco.config WARNING:tensorflow:From /home/doe/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py:124: main (from main) is deprecated and will be removed in a future version. Instructions for updating: Use object_detection/model_main.py. Traceback (most recent call last): File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 1500, in _ParseAbstractInteger return int(text, 0) ValueError: invalid literal for int() with base 0: '03' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 1449, in _ConsumeInteger result = ParseInteger(tokenizer.token, is_signed=is_signed, is_long=is_long) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 1471, in ParseInteger result = _ParseAbstractInteger(text, is_long=is_long) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 1502, in _ParseAbstractInteger raise ValueError('Couldn\'t parse integer: %s' % text) ValueError: Couldn't parse integer: 03 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "train.py", line 184, in tf.app.run() File "/home/doe/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 124, in run _sys.exit(main(argv)) File "/home/doe/anaconda3/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 136, in new_func return func(*args, **kwargs) File "train.py", line 93, in main FLAGS.pipeline_config_path) File "/home/doe/anaconda3/envs/tensorflow/models/research/object_detection/utils/config_util.py", line 94, in get_configs_from_pipeline_file text_format.Merge(proto_str, pipeline_config) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 536, in Merge descriptor_pool=descriptor_pool) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 590, in MergeLines return parser.MergeLines(lines, message) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 623, in MergeLines self._ParseOrMerge(lines, message) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 638, in _ParseOrMerge self._MergeField(tokenizer, message) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 837, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 837, in _MergeMessageField self._MergeField(tokenizer, sub_message) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 763, in _MergeField merger(tokenizer, message, field) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 871, in _MergeScalarField value = _ConsumeInt32(tokenizer) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 1362, in _ConsumeInt32 return _ConsumeInteger(tokenizer, is_signed=True, is_long=False) File "/home/doe/.local/lib/python3.6/site-packages/google/protobuf/text_format.py", line 1451, in _ConsumeInteger raise tokenizer.ParseError(str(e)) google.protobuf.text_format.ParseError: 9:18 : Couldn't parse integer: 03
0
1
1,370
0
51,694,410
0
0
0
0
1
false
0
2018-08-05T11:54:00.000
1
1
0
ImportError: cannot import name __check_build
51,694,076
0.197375
python,scikit-learn,sklearn-pandas
I've been able to install scikit-learn on a fresh virtualenv here but it seems you need to do some extra job to get it up-and-running: By doing just pip install scikit-learn and then from sklearn import svm you'll get import errors, it seems the library requires numpy and scipy. So you need to do: pip install numpy scipy After that it should work fine.
from sklearn import svm ImportError: cannot import name __check_build
0
1
4,987
0
51,696,373
0
0
0
0
1
false
0
2018-08-05T14:03:00.000
0
1
0
Determine all colors in bounding box in OpenCV/Python
51,695,023
0
python,opencv,colors
It can be done by using a grayscale convertion of your image or of your ROI. You can weather process the histogram of the ROI extract from the gray scale (or convert to grayscale if extracted from the colour image) and count the non zero value. Or you can copy all the gray-scale value of your ROI into a set container, then the lenght of the set is the number of colours presents in your ROI.
Given a bounding box for an image in OpenCV, is there a way to return all the colors inside the box? Ideally, the output would give the information along the lines of "In the bounding box, it is 50% white, 25% blue, 15% green, 10% red." Is there any way to do this? At the very least, is there some function that could tell me all the colors in the box? (without percentages or how much of it there is). Any indication would be huge help Thanks in advance
0
1
672
0
51,729,004
0
0
0
0
1
false
0
2018-08-06T11:25:00.000
0
1
0
Height of a random forest decison tree increasing till 25 and the test accuracy also increases
51,706,535
0
python,random-forest,cross-validation,xgboost,test-data
This is extremely dependent on the dataset at hand. For such a small dataset tree depth of 25 is indeed on the high side and I would say somewhat unusual. But it is not impossible. What it can depend on: relation between features and the target categorical vs numerical features imbalance of 0 vs 1 target your code implementation (bugs, data leakage, other parameters) If I were you i would look deeper to understand why such a deep tree is required. For example, you can start by identifying while feature gets the most splits: extract from the best model feature importances with type split and get the top-5 features. Look how do those correlate with the target.
I have a dataset of [~16k] and am doing binary classsfication [0/1].When i am doing hyperparameter grid search in random forest my train and test accuracy increase as increase the depth[optimum is coming out to be 25].I am getting a test accuracy of as high as 97% and no there is no data leakage as there are three sets [train,test,and valid].My data has ~10 features.Is this fine since usually i have seen trees have 10 depth at max.
0
1
102
0
51,730,840
0
0
0
0
1
true
0
2018-08-07T15:22:00.000
0
1
0
Bokeh Dynamically Update xrange based on a ColumnDataSource
51,730,321
1.2
python,bokeh
No, FactorRange objects are only configurable by setting the factors property of the range. It is not possible to link the factors property to a CDS directly. (Factor ranges support multi-level hierarchical levels, and that does not map naturally to CDS columns.) However, you can change the value of factors to whatever you need, in a CustomJS callback, or Python callback (if are making a Bokeh server application).
Is there a way to update the xaxis of a bar chart using a columndatasource object? I have a chart that updates the bars based off of what is selected, but I want the tick marks in the xaxis to only represent the values that are being displayed. So, I figured the best option would be to dynamically update the xrange as each new value is selected, similar to how the overall plot is changed based on this.
0
1
1,385
0
51,743,453
0
0
0
0
1
false
3
2018-08-07T15:33:00.000
1
2
0
How to compare two 3D curves in Python?
51,730,532
0.099668
python,computational-geometry,curve-fitting
If you subsample the original curve, a simple way to assess the approximation error is by computing the maximum distance between the original curve and the line segments between the resampled vertices. The maximum distance occurs at the original vertices and it suffices to evaluate at these points only. By the way, this provides a simple way to perform the subsampling by setting a maximum tolerance and decimating until the tolerance is exceeded. You can also think of computing the average distance, but this probably involves nasty integrals and might give less visually pleasing results.
I have a huge array with coordinates describing a 3D curves, ~20000 points. I am trying to use less points, by ignoring some, say take 1 every 2 points. When I do this and I plot the reduced number of points the shape looks the same. However I would like to compare the two curves properly, similar to the chi squared test to see how much the reduced plot differs from the original. Is there an easy, built-in way of doing this or does anyone have any ideas on how to approach the problem.
0
1
1,324
0
52,075,500
0
0
0
0
1
false
0
2018-08-08T04:19:00.000
1
2
0
How to add custom colors to Tensorflow object detection python model bound boxes?
51,738,546
0.099668
python,tensorflow,computer-vision,data-science,object-detection
I sort of found a way - after much trouble. I found nothing documenting how to do this. Sort of, as some colors don't seem to work. Open "visualizations_utils.py". Should be in Lib\site-packages\utils. Rows 41 to 63 are your colors. Directly under row 164, draw = ImageDraw.Draw(image), enter a new row color = 'Pink' Save it, and you have now changed the color to a pinkish color. Row 175, you can make the label text smaller. Some colors don't seem to work, like "Red".
Currently i am using the standard Tensorflow object detection script which is custom trained, i would like to change the colors of the bound boxes to suit the nature of my application. However i cannot seem to find a way to do so. For example instead of drawing a green box id like to draw a red box around a detected object. Thank you in advance!
0
1
1,764
0
51,748,887
0
1
0
0
1
false
1
2018-08-08T07:59:00.000
0
1
0
Best way to get the values from dict or list for 3 different dataframes
51,741,482
0
python-3.x,pandas,plotly,plotly-dash
it was easy as [v.columns for k, v in all_options.items()] Thank you :)
So, I have 3 different data frames: all_options = {'free': free, 'paid': paid, 'all': df} What is the best way to iterate over to get the values for each one? I want to make a plot in dash. So when user will click on "free" data frame it will show him the graph with free items only?
0
1
32
0
51,745,774
0
0
0
0
1
false
0
2018-08-08T11:32:00.000
0
3
0
Python | count number of False statements in 3 rows
51,745,679
0
python,pandas,countif
Try this : df[df==false].count()
Columns L,M,N of my dataframe are populated with 'true' and 'false' statements(1000 rows). I would like to create a new column 'count_false' that will return the number of times 'false' statement occurred in columns L,M and N. Any tips appreciated! Thank you.
0
1
1,777
0
51,748,484
0
0
0
0
1
false
0
2018-08-08T13:44:00.000
1
1
0
custom constraint of weight matrix
51,748,305
0.197375
python,keras
By far the easiest way to ensure that is to check wether the trained W has determinant 0. If it doesn't then you're OK to go, if it does you can add a small constant (1e-7) to any weight in the matrix and solve the issue. I can tell you anyway that the odds of zero determinant happenning are almost negligible.
I want to invert a classifier on MNIST dataset on keras, thus the determinant of weight matrix must not be zero. Then I can use x=W-1f-1(y) But there is no custom constraint in keras.
0
1
61
0
51,754,972
0
0
0
0
2
false
39
2018-08-08T13:54:00.000
2
7
0
Does ImageDataGenerator add more images to my dataset?
51,748,514
0.057081
python,tensorflow,machine-learning,keras,computer-vision
Also note that: These augmented images are not stored in the memory, they are generated on the fly while training and lost after training. You can't read again those augmented images. Not storing those images is a good idea because we'd run out of memory very soon storing huge no of images
I'm trying to do image classification with the Inception V3 model. Does ImageDataGenerator from Keras create new images which are added onto my dataset? If I have 1000 images, will using this function double it to 2000 images which are used for training? Is there a way to know how many images were created and now fed into the model?
0
1
20,435
0
68,196,196
0
0
0
0
2
false
39
2018-08-08T13:54:00.000
0
7
0
Does ImageDataGenerator add more images to my dataset?
51,748,514
0
python,tensorflow,machine-learning,keras,computer-vision
Let me try and tell u in the easiest way possible with the help of an example. For example: you have a set of 500 images you applied the ImageDataGenerator to the dataset with batch_size = 25 now you run your model for lets say 5 epochs with steps_per_epoch=total_samples/batch_size so , steps_per_epoch will be equal to 20 now your model will run on all 500 images (randomly transformed according to instructions provided to ImageDataGenerator) in each epoch
I'm trying to do image classification with the Inception V3 model. Does ImageDataGenerator from Keras create new images which are added onto my dataset? If I have 1000 images, will using this function double it to 2000 images which are used for training? Is there a way to know how many images were created and now fed into the model?
0
1
20,435
0
51,751,064
0
0
0
0
1
false
3
2018-08-08T15:50:00.000
0
1
0
CSV file unable to upload
51,750,841
0
python-3.x,jupyter-notebook,linear-regression
try to use the full qualified path, or in the same directory of the main programm
Trying to load CSV file while doing simple linear regression . When I try to run , the error is coming as - "File name" is not exist as file/directory . Do I need to save the file in a particular folder or directory ?
0
1
220
0
51,757,163
0
0
0
0
2
false
3
2018-08-08T22:31:00.000
1
2
0
Is training accuracy of a model calculated on the mini-batch?
51,756,558
0.099668
python,tensorflow,machine-learning
Ideally training accuracy should be calculated including every sample, but practically, it's all right to use a subset of the data as long as its representative of all data. Whether a random batch of 100 samples is representative of your data or not, depends on the problem at hand. For instance if you were classifying a sample as one of one thousand possible classes, this is clearly not enough. I generally keep a running average of the loss over a given epoch during training. Since the training loss is almost always monotonically decreasing, this will tend to overestimate loss (and underestimate accuracy. However, the discrepancy should disappear as the model converges.
I'm trying to record the training accuracy of the model at the end of each epoch, but I wasn't sure if the training accuracy is calculated on the entire training data or the last mini-batch used for training. For example, if I have 10000 training data and I'm training with mini-batches of 100, would I calculate the training accuracy using the last mini-batch of 100 (the 100th and last mini-batch in that epoch) or use the entire 10000 training data?
0
1
1,493
0
51,757,886
0
0
0
0
2
false
3
2018-08-08T22:31:00.000
1
2
0
Is training accuracy of a model calculated on the mini-batch?
51,756,558
0.099668
python,tensorflow,machine-learning
I agree with @Cory that ideally training accuracy should be calculated on every training sample. Instead of using an running average (exponential, perhaps), I keep the sum of last, let's say, 50 mini-batches. Then I report the average loss across these mini-batches. You can easily track the model's recent performance (you can report this number much frequently than every epoch).
I'm trying to record the training accuracy of the model at the end of each epoch, but I wasn't sure if the training accuracy is calculated on the entire training data or the last mini-batch used for training. For example, if I have 10000 training data and I'm training with mini-batches of 100, would I calculate the training accuracy using the last mini-batch of 100 (the 100th and last mini-batch in that epoch) or use the entire 10000 training data?
0
1
1,493
0
51,760,289
0
0
0
0
1
false
0
2018-08-09T00:35:00.000
1
1
0
How to run same Keras model on different GPUs in parallel independently with different data?
51,757,355
0.197375
python,tensorflow,parallel-processing,keras
How about multiprocessing? You just execute you function in a multiprocessing pool twice: What you need to consider: Your model have to be defined or loaded inside the function You need a parameter which mask the GPUs. Masking is possible by setting the env variable CUDA_VISIBLE_DEVICES(you also have to do this inside the function) You could pass the different training data via a parameter it would be best to save the resulting models into different files and then load it from your main program So basically passing keras/tensorflow sessions between your main programm and the functions in the multiprocessing tool is a nogo. But if you keep everything keras/tensorflow related inside the function and mask the GPUs differently then you're good to go.
Let's say I have two instances of a keras model model0 and model1 and datasets data0 and data1. If I have two or more GPUs, is there a way that I can train model0 on data0 on GPU0 and model1 on data1 on GPU1 in parallel? All of the methods I have found so far split the training of a single model over multiple gpus. Thanks!
0
1
196
0
54,832,068
0
0
0
0
1
false
0
2018-08-09T04:57:00.000
3
3
0
difference between `header = None` and `header = 0` in pandas
51,759,122
0.197375
python-3.x,pandas,csv,dataframe
The difference pops up when working with a dataframe with header, so lets say your DataFrame df has header! header=None pandas automatically assign the first row of df (which is the actual column names) to the first row, hence your columns no longer have names header=0, pandas first deletes column names(header) and then assign new column names to them (only if you pass names = [........] while loading your file). read_csv( filepath, header = 0 , names = ['....' , '....' ...]) hope it helps!
I was writing a code to read a csv file using pandas and I saw some weird functioning of the package. My file has column names which I want to ignore, so I use header = 0 or 'infer' instead of None. But I see something weird. When I use None and I want to get a specific column, I just need to do df[column_index] but when I use 0 or 'infer', I need to do df.ix[:,column_index] to get the column otherwise, for df[column_index] I get the following error: Traceback (most recent call last): File "/home/sarvagya/anaconda3/envs/tf/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2525, in get_loc return self._engine.get_loc(key) File "pandas/_libs/index.pyx", line 117, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 139, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1265, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1273, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: column_index During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/home/sarvagya/anaconda3/envs/tf/lib/python3.6/site-packages/pandas/core/frame.py", line 2139, in getitem return self._getitem_column(key) File "/home/sarvagya/anaconda3/envs/tf/lib/python3.6/site-packages/pandas/core/frame.py", line 2146, in _getitem_column return self._get_item_cache(key) File "/home/sarvagya/anaconda3/envs/tf/lib/python3.6/site-packages/pandas/core/generic.py", line 1842, in _get_item_cache values = self._data.get(item) File "/home/sarvagya/anaconda3/envs/tf/lib/python3.6/site-packages/pandas/core/internals.py", line 3843, in get loc = self.items.get_loc(item) File "/home/sarvagya/anaconda3/envs/tf/lib/python3.6/site-packages/pandas/core/indexes/base.py", line 2527, in get_loc return self._engine.get_loc(self._maybe_cast_indexer(key)) File "pandas/_libs/index.pyx", line 117, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 139, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1265, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1273, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: column_index Can someone help with this? Why is this happening?
0
1
23,961
0
52,239,819
0
0
0
0
1
true
2
2018-08-09T05:45:00.000
4
1
0
What is the closest function to R's nlminb in Python?
51,759,606
1.2
r,python-3.x,scipy,nonlinear-optimization
nlminb is an unconstrained and bounds-constrained quasi-Newton method optimizer. This code is based on a FORTRAN PORT library by David Gay in the Bell Labs. As for Pyhon quasi-Newton menthods are: Unconstrained minimization Method BFGS uses the quasi-Newton method of Broyden, Fletcher, Goldfarb, > > and Shanno (BFGS) [5] pp. 136. Bound-Constrained minimization Method L-BFGS-B uses the L-BFGS-B algorithm [6], [7] for bound constrained minimization. L-BFGS-B & BFGS, being a member of quasi-Newton family methods, are the closest analogs of nlminb.
Python scipy.optimize.minimize function supports the following methods: Nelder-Mead Powell CG BFGS Newton-CG L-BFGS-B TNC COBYLA SLSQP trust-constr dogleg trust-ncg trust-exact trust-krylov Which method is closest to R's nlminb?
0
1
761
0
51,861,681
0
0
0
0
1
false
0
2018-08-09T06:07:00.000
0
1
0
Pytorch Convolutional Layer returning Nan
51,759,882
0
python,neural-network,artificial-intelligence,conv-neural-network,pytorch
Try to initialize your weights with random numbers between 0 and 1 and then try different learning rates for your network training. (I suggest test it with learning rates equal to 10, 1, 0.1, 0.01, ...)
so I am using a convolutional layer as the first layer of a neural network for deep reinforcement learning to get the spatial features out of a simulation I built. The simulation gives different maps that are of different lengths and heights to process. If I understand convolutional networks, this should not matter since the channel size is kept constant. In between the convolutional network and the fully connected layers there is a spatial pyramid pooling layer so that the varying image sizes does not matter. Also the spatial data is pretty sparse. Usually it is able to go through a few states and sometimes a few episodes before the first convolutional layer spits out all Nans. Even when I fix the map size this happens. I do not know where the problem lies, where can the problem lie?
0
1
1,443
0
51,777,618
0
0
0
0
1
false
0
2018-08-09T07:22:00.000
0
1
0
How to build a predictive model where there will be unseen categorical variables in the future
51,761,031
0
python,machine-learning,scikit-learn
I don't think that's possible. However, you can do the following: Assume that for each race there are 10 horses. Number them from 0 to 9. Include all the features you want for all the horses, and predict which horse number will win. For example: horse 0: horse_age0, horse_weight0, race_distance0, jockey0 horse 1: horse_age1, horse_weight1, race_distance1, jockey1 ... horse 9: horse_age9, horse_weight9, race_distance9, jockey9 a total of 4*10=40 feature. The model should predict one of the classes 0 to 9, indicating the horse number. Be careful with this approach though, the ordering of the horses doesn't matter, you should take that into account when training/choosing the model. You can simplify the problem by considering a one-vs-one approach, where you evaluate each pair of horses to see which one would win.
Suppose I have built a model to predict the final positions of horses in horse racing using data of races and horses from the past 10 years with the following features: horse_age, horse_weight, race_distance, jockey Now, I would like to predict positions in horse racing for the upcoming season. However, during those 10 years, many of the jockeys have retired, and new ones have joined, so there will be jockeys who were unseen by the trained model, unlike horse age, horse weight and race distance. I would like to know what is a good way to tackle this problem. I realize that one thing I can do is to continually retrain my model to incorporate the new data, but would like to hear more interesting ideas!
0
1
126
0
51,762,007
0
0
0
0
1
false
0
2018-08-09T08:05:00.000
1
1
0
After clustering, How do i choose the best customers (subset) from the top cluster?
51,761,810
0.197375
python,cluster-analysis,unsupervised-learning
Try some good old filtering! Select one or several features, create your own metric (maybe top customers are those who buy the most, or those who are more loyal/have stayedlonger with the company, or a weighted sum of those two factors), sort the 660 customers in your cluster and pick only the N first customers, N being your maximum allowed number of customers.
I ran a clustering exercise to identify my top customers based on 12 distinct features, using K-Means (on 3 PCA dimensions and 5 PCA dimensions) and GMM (using 5 PCA dimensions) methodologies. Both the outputs from the K-Means produced almost similar customers as the best set (1182 customers in each case with an overlap of 1156) while the GMM approach gave me 660 customers as my top customers. These 660 customers were present in both the K-Means approaches. Now i want to identify who my top customers are from among this list. Could you please suggest any statistical approaches that i could use to say that these X number of customers are truly my best set and run some A/B tests on them? I do not want to go with the full identified set as it might cost me more to do what is planned to such a large set of customers.
0
1
50
0
51,766,044
0
0
0
0
1
false
0
2018-08-09T11:06:00.000
1
3
0
scikit-learn deprecated GMM.eval() replacement
51,765,325
0.066568
python,scikit-learn,gmm
Eval(X) Parameters : X: array_like, shape (n_samples, n_features) : List of n_features-dimensional data points. Each row corresponds to a single data point. Returns : logprob: array_like, shape (n_samples,) : Log probabilities of each data point in X responsibilities: array_like, shape (n_samples, n_components) : Posterior probabilities of each mixture component for each observation Clearly , there is no workaround in the newer definition , it is the same and quite concise definition
The eval() method under sklearn.mixture.GMM from the scikit-learn version 0.11 is deprecated. Is there a similar method or a workaround in the newest version 0.19.2 ?
0
1
515
0
51,771,528
0
0
0
0
1
false
1
2018-08-09T15:51:00.000
2
2
0
Pixel correlation / similarity in an image Python
51,771,344
0.197375
python,image,correlation,cross-correlation
Correlation is a measure to evaluate mutual relationship or connection between two or more things, usually vectors, not single point. Pixel is a single point with a single value. So, in your case, I would subtract pixel value form each pixel value of the image, looking at the difference in this case.
I am new in Python. I have an image of size 8*8, and when flattened = 64. Is there any function that measures the correlation between the pixel i and all the other pixels in this image ? So at the end I want to plot a 64*64 matrix of correlation. Thanks !
0
1
1,074
0
51,794,321
0
0
0
0
1
true
1
2018-08-09T19:00:00.000
1
1
0
Regression through reinforcement learning
51,774,091
1.2
python,neural-network,reinforcement-learning
In order to output the correct power and angle, all you need to do is go into your neural network architecture and change the activation of your last layer. In your question, you stated that you are currently using an action classification output, so it is most likely a softmax output layer. We can do two things here: If the power and angle has hard constraints, e.g. the angle cannot be greater than 360°, or the power cannot exceed 700 kW, we can change the softmax output to a TanH output (hyperbolic tangent) and multiply it by the constraint of power/angle. This will create a "scaling effect" because tanh's output is between -1 and 1. Multiplying the tanh's output by the constraint of the power/angle ensures that the constraints are always satisfied and the output is the correct power/angle. If there are no constraints on your problem. We can simply just delete the softmax output all together. Removing the softmax allows for the output to no longer be constrained between 0 and 1. The last layer of the neural network will simply act as a linear mapping, i.e., y = Wx + b. I hope this helps! EDIT: In both cases, your reward function to train your neural network can simply be a MSE loss. Example: loss = (real_power - estimated_power)^2 + (real_angle - estimated_angle)^2
I'm trying to build an Agent that can play Pocket Tanks using RL. The problem I'm facing now is that how can I train a neural network to output the correct Power and Angle. so instead of actions classification. and I want a regression.
0
1
748
0
51,957,181
0
1
0
0
2
false
0
2018-08-09T21:36:00.000
0
3
0
ImportError: dateutil 2.5.0 is the minimum required version
51,776,103
0
python,pandas,pip,easy-install,python-dateutil
The issue was resolved by installing python 3.6. There is a version compatibility issue between pandas package and earlier version of Python
I'm facing this issue while trying to use pandas package. I have installed numpy 1.9.0 and installed dateutil 2.5.0 using the command pip install python-dateutil==2.5.0. Still I see this error. Is there any other way to install dateutil? And this is related only to pandas package Traceback (most recent call last): import pandas as pd File "/Users/xyz/Library/Python/2.7/lib/python/site-packages/pandas/init.py", line 23, in from pandas.compat.numpy import * File "/Users/xyz/Library/Python/2.7/lib/python/site-packages/pandas/compat/init.py", line 422, in raise ImportError('dateutil 2.5.0 is the minimum required version') ImportError: dateutil 2.5.0 is the minimum required version
0
1
4,264
0
53,266,794
0
1
0
0
2
false
0
2018-08-09T21:36:00.000
1
3
0
ImportError: dateutil 2.5.0 is the minimum required version
51,776,103
0.066568
python,pandas,pip,easy-install,python-dateutil
I had this same issue using the newest pandas version, try downgrading to pandas 0.22.0 which fixed my issue
I'm facing this issue while trying to use pandas package. I have installed numpy 1.9.0 and installed dateutil 2.5.0 using the command pip install python-dateutil==2.5.0. Still I see this error. Is there any other way to install dateutil? And this is related only to pandas package Traceback (most recent call last): import pandas as pd File "/Users/xyz/Library/Python/2.7/lib/python/site-packages/pandas/init.py", line 23, in from pandas.compat.numpy import * File "/Users/xyz/Library/Python/2.7/lib/python/site-packages/pandas/compat/init.py", line 422, in raise ImportError('dateutil 2.5.0 is the minimum required version') ImportError: dateutil 2.5.0 is the minimum required version
0
1
4,264
0
59,889,359
0
0
0
0
1
false
0
2018-08-10T09:07:00.000
0
2
0
how to convert tensorflow .meta .data .index to .ckpt file?
51,782,871
0
python,tensorflow
These { model.ckpt.data-00000-of-00001 model.ckpt.index model.ckpt.meta } are the more recent checkpoint format while {model.ckpt} is a previous checkpoint format It will be in the same concept as to convert a Nintendo Switch to NES ... Or a 3 pieces CD bundle to a single ROM cartridge...
As we know, when using tensorflow to save checkpoint, we have 3 files, for e.g.: model.ckpt.data-00000-of-00001 model.ckpt.index model.ckpt.meta I check on the faster rcnn and found that they have an evaluation.py script which helps evaluate the pre-trained model, but the script only accept .ckpt file (as they provided some pre-trained models above). I have run some finetuning from their pre-trained model And then I wonder if there's a way to convert all the .data-00000-of-00001, .index and .meta into one single .ckpt file to run the evaluate.py script on the checkpoint? (I also notice that the pre-trained models they provided in the repo do have only 1 .ckpt file, how can they do that when the save-checkpoint function generates 3 files?)
0
1
658
0
62,967,486
0
0
0
0
1
true
0
2018-08-10T10:31:00.000
2
1
0
How can I hand a to bandwidth for the kde to seaborn's distplot?
51,784,529
1.2
python,plot,seaborn,kernel-density
You can use the bandwidth option(bw) with the optional parameter "kde_kws" in the seaborn distplot to set the desired bandwidth. eg : g = g.map(sns.distplot, "value", kde_kws={'bw':0.1})
I am using sns.distplot with hist=True and kde=True. This works fine but for some datasets (e.g. if they contain only discrete values) the kernel density estimation line is zig-zagging which looks very odd given that the histogram underneath is smooth. A manual adjustment of the kde bandwidth should fix this but how can I set this for sns.distplot? The documentation does not say anything and the "bw" parameter that works for sns.kdeplot does not exist. How can I stop it from zig-zagging?
0
1
3,950
0
51,784,896
0
0
0
0
1
false
1
2018-08-10T10:41:00.000
1
2
0
How to classify between a color image and grey scale image using opencv?
51,784,719
0.099668
python,opencv,image-processing,classification,opencv-python
I suspect, some never were grey-scale images after digitizing (e.g. a color scan of gray-scale picture). Due to noise, there are minimal differences in the RGB values. A low threshold greater than perfect zero should do the trick. Please note that JPEG totally has a gray-scale option. However, when storing the picture, you request that mode. Compressors usually do not pick it up automatically. Also, you explicitly need to set the flag IMREAD_UNCHANGED while reading with OpenCV's imread.
I have a use case where I need to classify some images as grey scale or color. My initial step was based on the feature that grey scale images should have r,g,b values at a pixel, the same values as it is single channel. Were as for color images, r,g,b values at the same pixel may not be the same. So I am checking by getting the difference between (r,g), (b,g) and (r,b) and if all three has only zero, its grey scale else, its color. This approach helped me to identify many grey scale images but still there are some images which does not follow this logic. Can anyone specify some good features on which we can classify an image as color or grey scale using opencv? Do not ask me to check the number of channels and classify, it gives 3 for both the classes as we are loading it in .jpg format. Thanks in advance
0
1
1,021
0
51,878,303
0
0
0
0
1
false
0
2018-08-12T10:05:00.000
0
1
0
Data extraction from wef output file
51,807,792
0
python,netcdf4
1) Change your Registry files (I think it is Registry.EM_COMMON) so that you print latitude and longitude in your wrfout_d01_time.nc files. 2) Go to your WRFV3 map. 3) Clean, configure and recompile. 4) Run your model again the way you are used to.
I have a wrf output netcdf file.File have variables temp abd prec.Dimensions keys are time, south-north and west-east. So how I select different lat long value in region. The problem is south-north and west-east are not variable. I have to find index value of four lat long value
0
1
26
0
51,826,257
0
1
0
0
1
false
0
2018-08-13T06:27:00.000
0
2
0
Text Input and Numerical Output issue for Exam Schedule Predictor
51,816,305
0
python,machine-learning,deep-learning,regression
Create dummy variables or use RandomForest. They accept text input and numerical output.
I'm working on a model that would predict an exam schedule for a given course and term. My input would be the term and the course name, and the output would be the date. I'm currently done with the data cleaning and preprocessing step, however, I can't wrap my head around a way to make a model whose input is two strings and the output is two numbers (the day and month of exam). One approach that I thought of would be encoding my course names, and writing the term as a binary list. I.E input: encoded(course), [0,0,1] output: day, month. and then feeding to a regression model. I hope someone who's more experienced could tell me a better approach.
0
1
21
0
51,833,595
0
0
0
0
1
false
0
2018-08-14T03:34:00.000
0
2
0
Pasting numbers into python so that they may be used as an array
51,833,351
0
python,excel
If I’m reading what you are trying to do correctly, in VS Code, you can do essentially what @sundance suggested by holding Alt and dragging your cursor down the different lines to get a multiline cursor.
Currently I have a large amount of numbers that I am copy and pasting from excel from a column into python and they paste as such: 12 13 14 15 16 ... Each number is on a seperate line. Currently I am having to backspace in front of a number so that it jumps to the previous line then I insert commas between each number so that I can use this array in my code. These numbers come in quantities of hundreds and it is easier currently to copy and paste into excel and then into python versus saving an excel file with these numbers and referencing the excel file in my script. I am using visual studio code for my editor and I tried alt+v and that didnt work(read that as a shot). Let me know if there is an easy way to get my copy and pasted column into a useable array. Thanks
0
1
597
0
51,848,259
0
0
0
0
1
true
1
2018-08-14T18:54:00.000
2
1
0
Find the 10 smallest numbers in a large dataset?
51,848,078
1.2
python-3.x,performance,pseudocode
One approach among many possible: Grab 10 values and sort them. Now compare the largest with the 11th through nth values one at a time. Whenever the new value is smaller replace the 10th smallest with it and resort your 10 values. The list of 10 values, sorting them etc will all be in cache so fast even with rough code. The whole list will be accessed once through so will be fast as well.
I am coding specifically in python, but right now in the phase of designing psuedocode for an algorithm that will take all the data points in a data set that has n values, n being very large and pick out the 10 smallest values (or finite number m << n, where m is the m smallest numbers). I wish to have an optimally efficient algorithm for the requirements. My idea: 1) Heapsort the data then pick the smallest 10 values. O(nlog(n)) 2) Alternatively,use a loop to identify a 'champion' that runs 10 times. With the first 'champion' determined remove from the dataset and then repeat this loop. O(n) (given m is small) Which suggestion or if there is another would be best?
0
1
250
0
51,848,498
0
0
0
0
1
false
4
2018-08-14T19:17:00.000
1
4
0
Resize CSV data using Python and Keras
51,848,406
0.049958
python,python-3.x,python-2.7,keras,deep-learning
You could also convert the csv file to a list, truncate the list, and then convert the list to a numpy array and then use np.reshape.
I have CSV files that I need to feed to a Deep-Learning network. Currently my CSV files are of size 360*480, but the network restricts them to be of size 224*224. I am using Python and Keras for the deep-learning part. So how can I resize the matrices? I was thinking that since aspect ratio is 3:4, so if I resize them to 224:(224*4/3) = 224:299, and then crop the width of the matrix to 224, it could serve the purpose. But I cannot find a suitable function to do that. Please suggest.
0
1
1,515
0
57,182,351
0
1
0
0
4
false
178
2018-08-15T04:34:00.000
2
24
0
How do I install opencv using pip?
51,853,018
0.016665
python,opencv
Open terminal Run the following command pip install --trusted-host=pypi.org --trusted-host=files.pythonhosted.org opencv-python. Hope it will work.
I need to install cv2 for a script that has been written for me. I tried pip install cv2 and pip install open_cv and got the same problem - a warning message from dist.py and complains about zlib being not found. No cv2 installed. I also tried pyopenvc and pip install opencv-python. So, I went to the opencv site and downloaded the relevant exe. Ran it - generated a heap of subdirectories and a make file and stuff. What do I do now?
0
1
506,854
0
54,848,727
0
1
0
0
4
false
178
2018-08-15T04:34:00.000
3
24
0
How do I install opencv using pip?
51,853,018
0.024995
python,opencv
Open anaconda command prompt and type in below command. conda install -c conda-forge opencv Once the 'Solving environment' is done. It will ask to download dependencies. Type 'y'. It will install all the dependencies and then you are ready to code.
I need to install cv2 for a script that has been written for me. I tried pip install cv2 and pip install open_cv and got the same problem - a warning message from dist.py and complains about zlib being not found. No cv2 installed. I also tried pyopenvc and pip install opencv-python. So, I went to the opencv site and downloaded the relevant exe. Ran it - generated a heap of subdirectories and a make file and stuff. What do I do now?
0
1
506,854
0
71,060,884
0
1
0
0
4
false
178
2018-08-15T04:34:00.000
2
24
0
How do I install opencv using pip?
51,853,018
0.016665
python,opencv
->pip install opencv-python you can use this. But if this code does not working then you can check python version on cmd and anaconda because they are different. So you type command in anaconda prompt and cmd, it will work. You can check this -> pip list
I need to install cv2 for a script that has been written for me. I tried pip install cv2 and pip install open_cv and got the same problem - a warning message from dist.py and complains about zlib being not found. No cv2 installed. I also tried pyopenvc and pip install opencv-python. So, I went to the opencv site and downloaded the relevant exe. Ran it - generated a heap of subdirectories and a make file and stuff. What do I do now?
0
1
506,854
0
60,336,465
0
1
0
0
4
false
178
2018-08-15T04:34:00.000
0
24
0
How do I install opencv using pip?
51,853,018
0
python,opencv
if you are using Pycharm navigate settings > Project:name > Project interpreter just search the module by name(in this case OpenCV-python) and install it. worked for me
I need to install cv2 for a script that has been written for me. I tried pip install cv2 and pip install open_cv and got the same problem - a warning message from dist.py and complains about zlib being not found. No cv2 installed. I also tried pyopenvc and pip install opencv-python. So, I went to the opencv site and downloaded the relevant exe. Ran it - generated a heap of subdirectories and a make file and stuff. What do I do now?
0
1
506,854
0
51,853,382
0
0
0
0
1
false
1
2018-08-15T05:21:00.000
0
2
0
Pandas Dataframe Tail Not Working
51,853,350
0
python,pandas
tail is a method of dataframe. You can do this: print(str(all_ssis_data.tail())) if you want to get page around 6800 you can add 50 as parameter .tail(50) will show the last 50 rows
The size of my pandas dataframe is 6844 and is named all_data_frame. When I type print(str(all_ssis_data.tail)) I get rows in the index range of 0-29 and 3633-3662. Why doesn't it show me rows around the 6800 range?
0
1
1,158
0
51,861,092
0
0
0
0
1
false
1
2018-08-15T14:38:00.000
1
1
0
How does shuffling work while training in tensorflow object detection API
51,860,849
0.197375
python,tensorflow,object-detection-api
The framework does not actually shuffle your data, it's memory intensive and time consuming. Instead, there's an array with random indices that are used to access your data. Usually, indices cover the whole dataset, so, you're right, all data is seen by your network, however in random order.
I have been playing around the tensorflow object detection API for instance segmentation. In the pipeline configuration file, as a part of the train_config we specify the num_steps value. So it is the total number of steps that network is trained on. So let us say, I have 10,000 images in training dataset and batch_size is set to 1. In this case, does the data gets shuffled after every 10000 steps? Does it make sure automatically, that entire dataset is seen by the network before shuffling occurs?
0
1
544
0
52,075,651
0
1
0
0
1
true
1
2018-08-15T17:58:00.000
0
1
0
Numpy no module/attribute when importing other packages depending on it
51,864,008
1.2
python,numpy,anaconda,jupyter,miniconda
I had this issue and I think it is related to a broken install. I fixed mine with conda update --all. But I guess you can fix it with uninstalling numpy and reinstalling it back.
On 2 distinct independent systems, I have Anaconda/Miniconda. On my default virtual environment on either one, since 2018-8-15, when I import pandas or matplotlib, I get errors module 'numpy' has no attribute '__version__' and module 'numpy' has no attribute 'square', respectively. An update to conda or one of the modules may have done damage, but I haven't been able to figure out. The computers, one is a Mac and one a Windows PC. The only common features are that I use the Jupyter Notebook environment on both systems, both are default environments, both may have deep learning packages installed on them (as opposed to the other environments which are still functioning well), and I've been using the Jupyter Notebook environment to code on both. Has anyone come across this problem? Is there a solution? Is it waiting for a fix update?
0
1
244
0
51,877,123
0
0
0
1
1
false
0
2018-08-16T03:16:00.000
0
1
0
Why there is binary type after writing to hive table
51,869,125
0
python-2.7,hive
When you read data from oracle to dataframe it's created columns with object datatypes. You can ask pandas dataframe try to infer better datatypes (before saving to Hive) if it can: dataframe.infer_objects()
I read the data from oracle database to panda dataframe, then, there are some columns with type 'object', then I write the dataframe to hive table, these 'object' types are converted to 'binary' type, does any one know how to solve the problem?
0
1
42
0
51,876,979
0
0
0
0
1
true
1
2018-08-16T12:03:00.000
1
1
0
How to decompose affine matrix?
51,876,622
1.2
python-3.x,numpy,transformation,affinetransform,matrix-decomposition
I'm not sure I understand what you're asking. Anyway If you have two sets of 3D points P and Q, you can use Kabsch algorithm to find out a rotation matrix R and a translation vector T such that the sum of square distances between (RP+T) and Q is minimized. You can of course combine R and T into a 4x4 matrix (of rotation and translation only. without shear or scale).
I have a series of points in two 3D systems. With them, I use np.linalg.lstsq to calculate the affine transformation matrix (4x4) between both. However, due to my project, I have to "disable" the shear in the transform. Is there a way to decompose the matrix into the base transformations? I have found out how to do so for Translation and Scaling but I don't know how to separate Rotation and Shear. If not, is there a way to calculate a transformation matrix from the points that doesn't include shear? I can only use numpy or tensorflow to solve this problem btw.
0
1
1,921
0
56,354,392
0
0
0
0
1
false
1
2018-08-16T13:11:00.000
0
1
0
KMeans Clustering on Movielens Dataset
51,877,919
0
python,k-means,data-science,scikit-image
Well, K-Means is a clustering Algorithm so you can use it to cluster the movies based on the genres. Columns: movieId, genres There's a new dataset which includes relevant tags for each movie, so you can also cluster them based on those tags. However, you can also make use of K-Nearest Neighbors to find out how users are similar to each other. In the reviews dataset, you would use the following columns: Columns: userId, rating While in the movies dataset you would use the movieId. The idea is to figure out which movies every user has viewed, then use those movies to compute the similarity index of users (eg; user1, user2)
I am working on the Movielens dataset and I wanted to apply K-Means algorithm on it. I would like to know what columns to choose for this purpose and How can I proceed further Or Should I directly use the KNN algorithm.
0
1
927
0
51,882,505
0
0
0
0
1
true
1
2018-08-16T14:08:00.000
1
3
0
How to get the maximum number of digits after the decimal point in a Pandas series
51,879,063
1.2
python,pandas,dataframe
pd.read_csv() typically returns a DataFrame object. The StringMethods object returned by using .str is only defined for a Series object. Try using pd.read_csv('your_data.csv' , squeeze=True) to have it return a Series object; then you will be able to use .str
I read a list of float values of varying precision from a csv file into a Pandas Series and need the number of digits after the decimal point. So, for 123.4567 I want to get 4. I managed to get the number of digits for randomly generated numbers like this: df = pd.Series(np.random.rand(100)*1000) precision_digits = (df - df.astype(int)).astype(str).str.split(".", expand=True)[1].str.len().max() However, if I read data from disk using pd.read_csv where some of the rows are empty (and thus filled with nan), I get the following error: Traceback (most recent call last): File "<input>", line 1, in <module> File "/home/tgamauf/workspace/mostly-sydan/venv/lib/python3.6/site-packages/pandas/core/generic.py", line 4376, in __getattr__ return object.__getattribute__(self, name) AttributeError: 'DataFrame' object has no attribute 'str' What is going wrong here? Is there a better way to do what I need?
0
1
1,611
0
51,881,699
0
0
0
0
1
false
0
2018-08-16T16:24:00.000
2
3
0
Can you download OpenCV with Python 3.5.2?
51,881,545
0.132549
python,opencv,python-3.5
yes, OpenCV 3 works with Python 2.7, 3.4, 3.5, 3.6 and 3.7
Can you download OpenCV with Python 3.5.2? I want to set up OpenCV. But I don't know if I need 2.7 or can I use my already downloaded Python 3.5.2 version. Will it be compatible? I want learn computer vision so I can make some projects. Like a automated waste sorter. But I need to download OpenCV first. Just need some guidance. It's not like it's a straight download but a process. So if anyone can tell be if my version (on windows 10) Python 3.5.2 will work with the current OpenCV that would be great. Thanks
0
1
482
0
51,891,386
0
0
0
0
1
false
0
2018-08-16T23:52:00.000
0
1
0
Keras Callback to Monitor Both Validation and Training Accuracy at the Same Time
51,886,718
0
python,callback,keras
But the model may be overfitted to validation data. Thats basically not possible. If you split your traing data into validation and training correctly, your model does never see the validation data, before it validates the hypothesis, it learned. You can overfit your training data, but you can not overfit your validation data, because the model does not learn, while validating. Thats the idea behind validation split.
I recently came to know about Modelcheckpoint Callback in Keras. But it can only monitor Validation Accuracy or Training Acc. It can save best model weights when validation accuracy is maximum. But the model may be overfitted to validation data. Thus, I feel a need to monitor training accuracy as well. I want to save that model for which Validation Accuracy is maximum and Training Accuracy is also good. Is there way or callback for it? Thanks
0
1
202
0
51,921,611
0
0
0
0
2
true
2
2018-08-17T03:21:00.000
1
2
0
Loading a saved model in Keras with a custom layer and prediction results are different?
51,887,958
1.2
python,tensorflow,machine-learning,keras,keras-layer
I finally found the answer. I have implemented a custom Lambda layer to handle reshaping. This layer has difficulties loading. Specifically, it reshapes one dimension into two dimensions on an arbitrary interval. The interval was defaulting to one specific value every time I loaded the model, even though it was incorrect. When I force it to be the correct interval, it works.
My network was achieving 96% accuracy on my dataset (edit: on predicting 9 classes). I saved the entire model for every epoch (weights included) whenever I ran it. I ran it 3 times, each time testing different hyperparameters, each time achieving around 96% accuracy. When I try to load any of these tests now and run it again, it achieves around 50% accuracy. I'm extremely confident I'm running it on the same dataset. Here's the interesting thing: if I train a new network instance of the exact same architecture, same size, shape, etc., it only ever reaches a max of 85% accuracy. Additionally, saving and loading these new training models works correctly, as in the model will reach the same 85% accuracy. So, there's no problem with loading and no problem with my dataset. The only way this could happen is if something is wrong in my custom layer, or something else is happening. Unfortunately I haven't been committing all of my changes to the custom layer to git. While I can't guarantee that my custom layer is the exact same, I'm almost completely confident it is. Any ideas to what could be causing this discrepancy? Edit: To add more context, the layer is ripped from the ConvLSTM2d class but I replaced the call() function to simply be a vanilla RNN that uses convolution instead of the dot product. I am confident that the call() function is the same as before, but I am not confident that the rest of the class is the same. Is there anything else in the class that could affect performance? I've checked activation function already.
0
1
1,125
0
51,891,264
0
0
0
0
2
false
2
2018-08-17T03:21:00.000
1
2
0
Loading a saved model in Keras with a custom layer and prediction results are different?
51,887,958
0.099668
python,tensorflow,machine-learning,keras,keras-layer
Well, let´s think about it, there are basically two possible reasons for your problem. Your custom layer is not the same and therefore some weights are not set up correctly, which leads to missclassification. In case of a binary classification you will end up in 50% accuracy on balanced data. The second possible reason is, that threre is a bug in keras serialization. In this case your new trained and saved models should also show this issue, after deserialization. While I can't guarantee that my custom layer is the exact same, I'm almost completely confident it is. So the problem is not reproducable with a new model, you accuracy is 50% and you cannot guarantee that the custom layer matches. -> I guess it is you custom layer.
My network was achieving 96% accuracy on my dataset (edit: on predicting 9 classes). I saved the entire model for every epoch (weights included) whenever I ran it. I ran it 3 times, each time testing different hyperparameters, each time achieving around 96% accuracy. When I try to load any of these tests now and run it again, it achieves around 50% accuracy. I'm extremely confident I'm running it on the same dataset. Here's the interesting thing: if I train a new network instance of the exact same architecture, same size, shape, etc., it only ever reaches a max of 85% accuracy. Additionally, saving and loading these new training models works correctly, as in the model will reach the same 85% accuracy. So, there's no problem with loading and no problem with my dataset. The only way this could happen is if something is wrong in my custom layer, or something else is happening. Unfortunately I haven't been committing all of my changes to the custom layer to git. While I can't guarantee that my custom layer is the exact same, I'm almost completely confident it is. Any ideas to what could be causing this discrepancy? Edit: To add more context, the layer is ripped from the ConvLSTM2d class but I replaced the call() function to simply be a vanilla RNN that uses convolution instead of the dot product. I am confident that the call() function is the same as before, but I am not confident that the rest of the class is the same. Is there anything else in the class that could affect performance? I've checked activation function already.
0
1
1,125
0
51,895,476
0
0
0
0
1
true
3
2018-08-17T12:16:00.000
6
1
0
How to know when to use fit_generator() in keras when training data gets too big for fit()?
51,895,278
1.2
python-3.x,machine-learning,keras
The moment you run into memory errors when trying to take the training data into memory, you'll have to switch to fit_generator(). There is extra overhead associated with generating data on the fly (and reading from disk to do so), so training a model on a dataset that lives in memory will always be faster.
When using keras for machine learning, model.fit() is used when training data is small. When training data is too big, model.fit_generator() is recommended instead of model.fit(). How does one know when data size has become too large?
0
1
309
0
51,898,927
0
0
0
0
1
true
0
2018-08-17T15:42:00.000
1
2
0
How to display a pandas Series in Python?
51,898,845
1.2
python,pandas
For the first column, you can use targets_test.keys()[i], for the second one targets_test.values[i] where i is the row starting from 0.
I have a variable target_test (for machine learning) and I'd like to display just one element of target_test. type(target_test) print the following statement on the terminal : class 'pandas.core.series.Series' If I do print(target_test) then I get the entire 2 vectors that are displayed. But I'd like to print just the second element of the first column for example. So do you have an idea how I could do that ? I convert target_test to frame or to xarray but it didn't change the error I get. When I write something like : print(targets_test[0][0]) I got the following output : TypeError: 'instancemethod' object has no attribute '__getitem__'
0
1
1,594
0
51,905,252
0
0
0
0
1
false
0
2018-08-18T04:15:00.000
1
1
0
How to implement Region of Interest Pooling layer in tensorflow?
51,905,199
0.197375
python,tensorflow,neural-network,artificial-intelligence
Bilinear sampling - as the name suggests - can actually be used even with end-to-end training as it's basically a linear operation. However, the disadvantage would be that your local maxima (i.e. strong excitations or certain units) could vanish because your sampling points just happen to be close to the minima. To remedy this, you can instead apply a max_pool(features, kernel, stride) operation where kernel and stride are adjusted such that the final output of this max pool operation does always have the same dimensions. An example: your features have size 12x12 and you would like to pool to 4x4, then setting kernel=(3,3) and stride=(3,3) would help you achieve that and for each 3x3 patch, the strongest excitations in the respective feature maps will be contained in the output.
I am trying to create Faster RCNN like model. I get stuck when it comes to the ROI pooling from the feature map. I know here billinear sampling can be used but, it may not help for end to end training. How to implement this ROI pooling layer in tensorflow?
0
1
506
0
51,926,152
0
0
0
0
1
false
0
2018-08-20T07:38:00.000
0
3
0
When running command "python train.py" to train word-rnn, getting "no module named numpy" error.
51,926,059
0
python,numpy,tensorflow,cmd,anaconda
You can use python's pip installer or anaconda's own installer to install numpy. In pip you use: pip install numpy OR you can use anaconda like below: conda install numpy
OS: Windows 10 Using anaconda3 - 5.2, running commands in Anaconda command prompt. Here's the commands I used to locate the word-rnn and activate the conda enviroment, plus the error messages when I attempt to train the model. I am also going off of a Mac based tutorial, so please correct me if "python train.py" is the incorrect command to being training. (base) C:\Users\mower>conda activate tensorflow (tensorflow) C:\Users\mower>cd "C:\Users\mower\Downloads\word-rnn-tensorflow-master" (tensorflow) C:\Users\mower\Downloads\word-rnn-tensorflow-master>python train.py Traceback (most recent call last): File "train.py", line 2, in import numpy as np ImportError: No module named 'numpy' (tensorflow) C:\Users\mower\Downloads\word-rnn-tensorflow-master>
0
1
701
0
52,290,741
0
0
0
0
1
true
0
2018-08-20T13:13:00.000
0
1
0
Training object detection model too long causes model to crack
51,931,564
1.2
python,object-detection
After some research (and a lot of experiments) I have come to some conclusions which might help others facing the same problem. Failing to detect any object probably means that the model has collapsed in some part of training. A possible indication of this in my case was some extremely high values of loss values when training. While I have models that this happened and does not seem to affect the model too much (at least not too much to make it useless) an increasing amount of these values is a good sign that something is fatally wrong. Notice that the frequency of appearance of these values is not necessarily increasing all the time. More classes the better: After the first period I was conducting my experiments with just 1 class. While this is legitimate and nothing has been mentioned (to my knowledge) about avoiding it (I even read tutorials using 1 class object detection) this also intensified the crack rate. Using 2 classes seems to partially alleviate the problem. When I trained my model with 11 classes the problem seems to vanish. Small variation in bbox's sizes helps: Experimenting with bounding boxes varying a lot in size I came to the conclusion that largely homogeneous bbox's sizes help to also alleviate the issue. More classes may increase performance: I have noticed also that while 11 classes problem seem quite heavier task than 1 class due to the limitations in training the model with 1 class performance is some cases was higher in the former case. My final conclusion is that my model for some reason was experiencing at some point an overflow on some weights that prevent it from returning to the normal again. The fact that I have augmented my data (maybe similar images were fed one after the other and intensified certain weights for example) maybe increased the frequency of the problem occurrence but the problem was still present in non-augmented dataset.
I am using object detection from tensorflow. Some background information about the problem I was facing a challenge since I am interested in training a model which will among other things detect also weapons. My regular point of view is from a drone but I couldn't find any publicly available dataset from this point of view containing weapons. So, I collected images with weapons and tried to imitate as much as possible the drone point of view. One of my first thought was to pad my images (to make smaller my actual bounding boxes inside them in respect with the image itself). A second though was to also rotate my images. Since tensorflow has not implemented this feature I made a simple code to create prerotated images. This has limitation but anyway I gave it a shot. I experimented with images of people at the beach and tried to imitate the actual problem: I am using relatively close images of people at the beach for training And at the same time using relatively distant images of people at the beach for testing purposes. The actual problem At one of my experiments I trained my model for longer than usual and noticed that it really blew it. To be more specific: I have an initial 140 "close frame" images for training. From them I had created 4x140=560 images with small padding (resulting image is up to 1.6 times the original in the biggest version) and rotation (up to 5 degrees rotation) resized version. I used this dataset of 560 images to train my model for almost 800k iterations using Faster R-CNN model. I exported the model in various iterations: At 150k, 300k, 500k, 700k and used to test it on my test images. I have also used for comparison models which was trained with the original resized images to check the differences. Un-expected results The first peculiar observation is that my model at 500k and above it does not detect any person at all. (First thought was overtraining) I tried it on the actual training images to check this and here also did not detect anything at my testing images. Also, I would expect my "enhanced" dataset to perform better than the simply resized one but this does not seem the case also. (This though is a minor problem which seem scientifically rational). So, my question is how is that even possible? Training for too long can lead to being unable to detect training samples also? Is there any theoretical explanation for this? (Apart from errors in implementation etc which I think is not really probable but cannot be excluded in any case). P.S.1 My resized version of the image follows the same resize conditions of Faster R-CNN with min. dim. being 600 pixels and max. one 1024 pixels. So, this should not be any resizing problem. P.S.2 I am using tensorflow but I don't think this is tensorflow specific issue. So, I did not include it in tags.
0
1
245
0
51,935,221
0
0
0
0
1
false
3
2018-08-20T16:35:00.000
4
2
0
Is it okay to have non-trainable params in machine learning?
51,935,097
0.379949
python,machine-learning,keras,hyperparameters
Usually, non-trainable params does not mean some weights to which you assign random or predefined values (there would be no way to know the correct values, as they depend on the other weight values). It means some architectural decisions that you have made a priori. For example, in a neural network , such parameters would be the number of layers and the number of nodes per layer. These can be decided by educated guesses, or, usually, by trial-and-error (cross-validation). Having such non-trainable parameters is not only ok, but unavoidable with most training algorithms.
When building a model for machine learning, is it okay to have non-trainable params? Or does this create errors in the model? I'm confused as to what non-trainable params actually are and how to fix your model based on that.
0
1
3,816
0
51,938,930
0
0
0
0
1
false
0
2018-08-20T21:40:00.000
0
2
0
Neural Network Regression
51,938,859
0
python-3.x,tensorflow,neural-network,keras,regression
When you test a case from X with NN0, and it tells you "I'm a 0", that's the exact same thing as it telling you "I'm not a 1", because your class set has size two, like a boolean. Therefor, your NN0 network predicts 1s as well as 0s, so does your NN1.
I had a question, For a given data set X with two classes {0,1}. If I train two separate neural networks NN0 and NN1 for each class 0 and 1 respectively. Can NN0 predict points in the dataset from class 1, even though it was trained on class 0?
0
1
75
0
51,939,645
0
0
0
0
2
true
6
2018-08-20T22:50:00.000
9
2
0
Keras Conv1D or Convolution1D
51,939,468
1.2
python,keras
They are just for different keras versions, before Keras 2.0 the layers were called ConvolutionalND for N = 1, 2, 3, and since Keras 2.0 they are just called ConvND.
I came across multiple implementations of a CNN in Keras and noticed that some people use Conv1D from from keras.layers.convolutional import Conv1D and others use Convolution1D from from keras.layers import Convolution1D. Is there a difference or an advantage to either one or are they possibly simply just different versions of Keras.
0
1
2,001
0
53,997,197
0
0
0
0
2
false
6
2018-08-20T22:50:00.000
-4
2
0
Keras Conv1D or Convolution1D
51,939,468
-1
python,keras
It's not about the versions. The n stands for the dimension of data, for e.g. if you are using a text data you use n=1 i.e. convolution1d. The value of n=2 is used for images. The value for n=3 goes for mri or ct scan. So, depending on the dimensions we use the value.
I came across multiple implementations of a CNN in Keras and noticed that some people use Conv1D from from keras.layers.convolutional import Conv1D and others use Convolution1D from from keras.layers import Convolution1D. Is there a difference or an advantage to either one or are they possibly simply just different versions of Keras.
0
1
2,001
0
51,961,029
0
0
0
0
1
false
1
2018-08-21T13:16:00.000
0
1
0
Is there a way to apply FFT to an unevenly spaced time series?
51,949,595
0
python-3.x,fft
You can try creating a new evenly spaced set of samples, Y', by interpolation. Then FFT Y'. How well this works depends on well the form of interpolation you choose matches the physics that produced your original Y,X data.
i have two series X and Y. X contains time values and Y contains a real function values for those times. I wish to perform FFT of the Y signal in python. The problem is that X is unevenly spaced: X(n+1)-X(n) /= constant. Is there a known way to apply FFT to such data ?
0
1
386
0
51,960,145
0
1
0
0
1
false
0
2018-08-22T03:59:00.000
0
1
0
how to set env if python,pandas are installed in local dir
51,959,670
0
python,pandas
If you install in a virtualenv, then activating the virtualenv will take care of that for you. Otherwise, add the dir to your PYTHONPATH environment variable. (How this is done depends on your operating system.)
If python,numpy,pandas are installed in local dir,how to set env ,so that ,import numpy as np,import pandas as pd can work.
0
1
37
0
51,976,804
0
0
0
0
1
true
3
2018-08-22T10:25:00.000
1
1
0
Downsampling point clouds to specific number of points while retaining shape
51,964,798
1.2
python,numpy,point-clouds,downsampling
Unfortunately, the answer is no. The number of output points using PCL's VoxelGrid is always going to be a function of the number of occupied voxels. The only way to control the number of occupied voxels is by altering the leaf size, and there is no dynamic way of doing this. Alternately, you may have luck using Farthest Point Sampling, as it would allow you to select N points and has nice blue noise properties, but to the best of my knowledge this is not available in PCL.
Environment: Python-PCL, WIndows 10, Python 3.6 I need to downsample point clouds to a specific number of points. These point clouds vary in size and hence I am stuck. From going through documentation, I understand there are only VoxelGrid, ConditionalOutlierRemoval ,StatisticalOutlierRemoval and RadiusOutlierRemoval are the options available. In VoxelGrid, the leaf size doesnt guarantee the number of points, Radius removal doesnt help in retaining the shape, and statistical outlier mostly helps in removing noise. Is there any solution to this? It is possible to use numpy.random.choice()and hoping for a miracle? EDIT: numpy.random.choice works but only if you don't care about the geometric shape of your point cloud, which I do. Anyway to use VoxelGrid dynamically?
0
1
3,390
0
52,174,746
0
0
1
0
1
true
0
2018-08-22T12:17:00.000
0
1
0
Abaqus: parametric geometry/assembly in Inputfile or Python script?
51,966,721
1.2
python,abaqus
In case someon is interested, i was able to do it the following way: I created a model in abaqus till the point, i could have started the job. Then i took the .jnl file (which is created automaticaly by abaqus) and saved it as a .py file. Then i modified this script by defining every single point as a variable and every wire for the parts as tuples, consisting out of the variables. Than i made for loops and for every 9 cases unique wire definitions, which i called during the loop. During the loop also the constraints were changed and the job were started. I also made a field output request for the endnodes of the ropes (representing motors) for there coordinates and reaction force (the same nodes are the bc pinned) Then i saved the fieldoutput in a certain simple txt file which i was able to analyse via matlab. Then i wrote a matlab script which created the points, attached them to the python script, copied it to a unique directory and even started the job. This way, i was able to do geometric parametric studies in abaqus using matlab and python. Code will be uploaded soon
i want to do something as a parametric study in Abaqus, where the parameter i am changing is a part of the assembly/geometry. Imagine the following: A cube is hanging on 8 ropes. Each two of the 8 ropes line up in one corner of a room. the other ends of the ropes merge with the room diagonal of the cube. It's something like a cable-driven parallel robot/rope robot. Now, i want to calculate the forces in the ropes in different positions of the cube, while only 7 of the 8 ropes are actually used. That means i have 8 simulations for each position of my cube. I wrote a matlab script to generate the nodes and wires of the cube in different positions and angle of rotations so i can copy them into an input file for Abaqus. Since I'm new to Abaqus scripting etc, i wonder which is the best way to make this work. would you guys generate 8 input files for one position of the cube and calculate them manually or is there a way to let abaqus somehow iterate different assemblys? I guess i should wright a python script, but i don't know how to make the ropes the parameter that is changing. Any help is appreciated! Thanks, Tobi
0
1
854
0
56,978,954
0
0
0
0
1
false
2
2018-08-22T12:57:00.000
0
1
0
Pandas DataFrame Display in Jupyter Notebook
51,967,445
0
python,pandas,jupyter-notebook
If df is a pandas.DataFrame object. You can do: df.style.set_properties(**{'max-width': '200px', 'font-size': '15pt'})
I want to make my display tables bigger so users can see the tables better when that are used in conjunction with Jupyter RISE (slide shows). How do I do that? I don't need to show more columns, but rather I want the table to fill up the whole width of the Jupyter RISE slide. Any idea on how to do that? Thanks
0
1
509
0
58,063,570
0
0
0
0
1
false
15
2018-08-23T08:10:00.000
3
3
0
How to change Keras/tensorflow version in Google colab?
51,981,095
0.197375
python,tensorflow,keras,google-colaboratory
In the latest colab, when you upgrade or downgrade a module, in the output cell you will automatically see the statement: "WARNING: The following packages were previously imported in this runtime: [scipy] You must restart the runtime in order to use newly installed versions. " asking you to restart the runtime along with a button for it.
I'm using keras/tensorflow on google colaboratory and I need to go back to previous versions of them. The problem is when I run !pip install q keras==1.2.2 , the kernel shows keras 1.2.2 installed but when I check it using keras.__version_ it shows 2.1.6 . And same case is with tensorflow. How do I fix this?
0
1
28,843
0
52,438,763
0
0
0
0
1
false
7
2018-08-23T12:58:00.000
1
2
0
DeprecationWarning: numpy.core.umath_tests
51,986,414
0.099668
python,scikit-learn
Alright so this is a deprecation warning on Python 3.x. Since, this is warning your code will run fine. It is not an error (When the code stops running by graceful degradation). The solution to remove this error is as follow: As I can see you have Scikit-Learn version 0.19.2 installed you need to get the latest version. To do so enter the following command pip3 install --force-reinstall scikit-learn==0.20rc1 This will install the latest versions of scikit-learn, scipy and numpy. Your deprecation warnings will now not exist. Although you'll next get a new warning. This time regarding the file in the scikit-learn library called cloudpickle \sklearn\externals\joblib\externals\cloudpickle\cloudpickle.py. To overcome this warning you got to edit the code which python shows us. Just do a sudo idle3 onto the file and edit the lines which says : import imp from imp import find_module to import importlib Next go to the funtion find_module and change the line file, path, description = find_module(path) to file, path, description = importlib.utils.find_spec(path). This must solve the deprecation warnings in the scikit-learn libraries.
I'm trying to run this python script below: import pandas as pd from sklearn.model_selection import train_test_split from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score from sklearn.metrics import confusion_matrix It gives me the error below. Warning (from warnings module): File "C:\Users\Dipali\AppData\Local\Programs\Python\Python37-32\lib\site-packages\sklearn\ensemble\weight_boosting.py", line 29 from numpy.core.umath_tests import inner1d DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release. What I need to do?
0
1
10,943
0
51,989,369
0
1
0
0
1
false
0
2018-08-23T14:10:00.000
0
1
0
python-openCV module not found error
51,987,825
0
python,opencv,anaconda
Your openCV is probably installed in another python version and pylint is having problem identifying. Try to locate where your openCV is installed and manually change it.
I am getting this error -"module 'cv2' has no attribute 'version' when I try to find version of cv2, but my import is executing fine without any error. I am confused about whether my openCV is working correctly or not?
0
1
94
0
51,993,668
0
0
0
0
1
true
1
2018-08-23T19:57:00.000
4
1
0
Function to create a non equally spaced array in numpy
51,993,428
1.2
python,numpy
Yes, there is also logspace and geomspace in NumPy. np.geomspace(1,32,6) gives you array([ 1., 2., 4., 8., 16., 32.])
I would like to create an array with the form [1, 2, 4, 8, 16, 32, ...]. Not always with that spacing between numbers. Is there a linspace/arange type function which allows me to create vector of non equally spaced numbers? Thanks
0
1
663
0
51,994,159
0
1
0
0
1
true
0
2018-08-23T20:53:00.000
2
2
0
Sort a list, but leave a specified value in place
51,994,112
1.2
python,arrays,sorting
Locate and remove each of the values to ignore, remembering their positions. For instance, in this case, you might store the index and value as ignore = (3, -1). Sort the remaining list as usual. Reinsert the missing element: mylist.insert(ignore[0], ignore[1]) Does that get you moving?
I need to use the numpy.argsort function (or a code that makes the same) but ignoring a concrete value, for example -1, and keeping it in the resulted array If this is the list: [5,8,1,-1,2,4], I need a result like [3,4,0,-1,1,2] How can I do it?
0
1
203
0
52,016,745
0
0
0
0
1
true
0
2018-08-24T08:18:00.000
0
2
0
Python - How to remove duplicates in huge CSV file (200+ Million rows)
52,000,223
1.2
python,pandas,csv,dataframe,duplicates
Two possible approaches: SQL Select Distinct Load the CSV file into a database and us SQL Select Distinct and export the query result as a Csv file. Some database let you define a CSV file as a table and let you run SQL queries on the CSV file Select distinct URL from UrlTable Sort the File You could Sort the file on the URL using your operating systems sort command (both Windows and Linux have Sort commands). Read the file and check if the URL is different from the last URL. You only need check the URL when it changes
We made an Image recognition API that accepts image URL and responds an image description. This process takes about 5-20 seconds. I have a huge CSV file with 200+ million rows of image URLs scraped from different sources. I found that the CSV file has duplicate image URLs from different sources. So I don't need to send all the URLs to image recognition API, I need to send only unique URLs to the API but I need to populate response from API to all the rows. I read the CSV file in chunks of 100K rows and created a set of unique Image URLs and process them in API and again populate the results back to the CSV file. But It ended up in memory issues (16 GB RAM), I can't able to create a set of unique Image URLs with 200+ million rows. Any suggestion?
0
1
995
0
52,006,897
0
0
0
0
1
false
1
2018-08-24T14:36:00.000
0
1
0
how to add the overall "precision" and "recall" metrics to "tensorboard" log file, after training is finished?
52,006,745
0
python,tensorflow,keras,tensorboard,precision-recall
I believe that you've already done that work: it's the same process as the validation (prediction and check) step you do after training. You simply tally the results of the four categories (true/false pos/neg) and plug those counts into the equations (ratios) for precision and recall.
After the training is finished and I did the prediction on my network, I want to calculate "precision" and "recall" of my model, and then send it to log file of "tensorboard" to show the plot. while training, I send "tensorboard" function as a callback to keras. but after training is finished, I dont know how to add some more data to tensorboard to be plotted. I use keras for coding and tensorflow as its backend.
0
1
289
0
52,007,874
0
0
0
0
1
false
0
2018-08-24T15:27:00.000
0
1
0
Pandas find columns with unique values
52,007,555
0
python,sql,pandas,dataframe
Use the Python library that allows you to query your database (pymysql, psycopg2, etc). Programmatically use the metadata available from the DB to iterate over the tables and columns. Dynamically create the SQL queries to compare "select count(field) - count(distinct field) from table". Or you could also potentially use the metadata to see which columns in each table are indexed. The SQL query to pull the relevant metadata will vary based on the kind of DBMS.
I have two databases (each with 1000's of tables) which are supposed to reflect the same data but they come from two different sources. I compared two tables to see what the differences were, but to do that I joined the two on a common ID key. I checked the table manually to see what the ID key was, but when I have to check 1000's of tables its not practical to do so. Is there a way in pandas to find what column (or columns) in a table have only unique values?
0
1
64
0
52,547,503
0
1
0
0
1
true
2
2018-08-25T14:48:00.000
0
1
0
how matplotlib create and deliver plot to jupyter notebook?
52,018,374
1.2
python,matplotlib,jupyter-notebook
The inline backend essentially calls fig.savefig(buffer, format="png", bbox_inches="tight") where fig is the figure to show. It'll then supply the content of buffer inside a <img> tag in the jupyter's output section.
In jupyter notebook, we can use %matplotlib inline to guide inline the image created by python script. Can anyone give a 5 sentence explaining what is happening under the hood to make that happen? If i'd like to have some web page to host the matplotlib created plot, is that possible or not? thanks~
0
1
53
0
52,029,914
0
0
0
0
1
true
2
2018-08-26T20:08:00.000
1
1
0
Does the loss in tensorflow.train.AdamOptimizer have to be positive?
52,029,879
1.2
python,tensorflow,loss
Yes you can. As long as it is a minimization instead of maximization, everything should be exactly the same as in the examples.
My question is quite a simple one: My intention is to minimize loss=a-b where loss is ideally as big a negative number as possible, ie. b much bigger than a. Since in all the examples, the loss is positive, I wanted to ask whether I can just input my loss into compute_gradients and get the desired result. Cheers
0
1
143
0
52,031,095
1
0
0
0
1
false
0
2018-08-26T21:19:00.000
0
1
0
How can I find the number of unique undirected edges of a graph using networkx?
52,030,344
0
python,graph,networkx
You have to convert the graph to an undirected graph the calculate the size. NetworkX does not have a function that does this in one shot like snap does. networkx_Graph.to_undirected().size()
I have a directed bigraph that contains directed and undirected edges. networkx_Graph = nx.read_adjlist('graph.txt', create_using=nx.DiGraph()) I was able to find the number of directed edges using: len(list(networkx_Graph.in_edges(data=False))) But I am trying to find the number of undirected edges. This is quite easy using the python package snap, but I am not finding anything like this in networkx's documentation? What is the networkx equivalent of snap.CntUniqDirEdges()?
0
1
372
0
52,032,920
0
0
0
0
1
false
0
2018-08-27T04:24:00.000
0
2
0
Does the squared error depends on the number of hidden layers?
52,032,541
0
python,neural-network
Though this is not a programming question, I'll try my best to answer it here. The squared error, i.e. the 'loss' of your neural network, depends on your neural network prediction and the ground truth. And it is convex from its definition. The reasons that you're not getting low losses could be: You're not normalizing your inputs. For example, if you got a series of house prices as input, which is around 500k to 1m, and you didn't normalize them, your prediction will be the linear combination of the prices, which is about the same order of magnitude, then pass through the activation function. This could result in large losses. You're not initializing your weights and biases correctly. Similar to above, you could have large weights/biases which lead to large prediction values. You didn't choose the proper activation function. When you're doing classification, your labels are generally one hot encoded, so your activation functions should limit the prediction to [0,1] or similar, so relu won't be a proper option. Also you don't want sigmoid as activation for regression problems. Your labels are not predictable or have too much noise. Or maybe your network is not complex enough to capture important patterns, in that case you could try adding more layers and more nodes per layer. Your learning rate is too small, this leads to slow convergence. That's all I have in mind. You probably need more work to find out the reason to your problem.
I wanted to know if the squared error depends also on the number of hidden layers and the number of neurons on each hidden layer , because I've created a neuron network with one hidden layer but I can't reach a small squared error , so maybe the function is not convex ? Can I optimize weights by adding more hidden layers ?
0
1
34
0
54,873,735
0
0
0
0
1
true
7
2018-08-27T21:20:00.000
2
1
0
Convolutional neural network architectures with an arbitrary number of input channels (more than RGB)
52,047,126
1.2
python,tensorflow,image-processing,keras,conv-neural-network
If you retrain the models, that's not a problem. Only if you want to use a trained model, you have to keep the input the same.
I am very new to image recognition with CNNs and currently using several standard (pre-trained) architectures available within Keras (VGG and ResNet) for image classification tasks. I am wondering how one can generalise the number of input channels to more than 3 (instead of standard RGB). For example, I have an image which was taken through 5 different (optic) filters and I am thinking about passing these 5 images to the network. So, conceptually, I need to pass as an input (Height, Width, Depth) = (28, 28, 5), where 28x28 is the image size and 5 - the number of channels. Any easy way to do it with ResNet or VGG please?
0
1
315
0
52,051,400
0
0
0
0
1
false
1
2018-08-28T06:22:00.000
1
1
0
Difference between arima.predict() and arima.forecast()
52,051,348
0.197375
python,machine-learning,time-series,arima
They will give you the same answers. But the combination of Arima (not arima) and forecast from the forecast package are enhanced versions with additional functionality. Arima calls stats::arima for the estimation, but stores more information in the returned object. It also allows some additional model functionality such as including a drift term in a model with a unit root. forecast calls stats::predict to generate the forecasts. It will automatically handle the drift term from Arima. It returns a forecast object (rather than a simple list) which is useful for plotting, displaying, summarizing and analysing the results.
What is difference between arima.predict() and arima.forecast(). Which function should use for forecasting time series in python?
0
1
1,974
0
52,059,673
0
0
0
0
1
true
0
2018-08-28T13:52:00.000
8
2
0
how to detect upside down face?
52,059,560
1.2
python,opencv,computer-vision,face-detection,dlib
You could use the same library to detect upside down faces. If the library is unable to detect the face initially, transform it 180° and check again. If it is recognized in this condition, you know it was an upside down face.
I would like to detect upright and upside-down faces, however faces weren't recognized in upside-down images. I used the dlib library in Python with shape_predictor_68_face_landmarks.dat. Is there a library that can recognize upright and upside-down faces?
0
1
855
0
52,061,923
0
0
0
0
1
true
0
2018-08-28T15:48:00.000
3
1
0
Transform square matrix into 1D array with NumPy
52,061,828
1.2
python,arrays,numpy,matrix
Use the reshape method: array = matrix.reshape((1,400)). This works for both Numpy Array and Matrix types. UPDATE: As sacul noted, matrix.reshape(-1) is more general in terms of dimensions.
Let's say I have a square matrix with 20 lines and 20 columns. Using NumPy, what should I do to transform this matrix into a 1D array with a single line and 400 columns (that is, 20.20 = 400, all in one line)? So far, I've tried: 1) array = np.ravel(matrix) 2) array = np.squeeze(np.asarray(matrix)) But when I print array, it's still a square matrix.
0
1
679
0
52,083,402
0
1
0
0
1
true
0
2018-08-29T17:09:00.000
1
1
0
Matplotlib in Tensorflow Jupyter Notebook
52,082,814
1.2
python,matplotlib,tensorflow,jupyter-notebook
Add import sys and sys.executable to the top of your notebook, then run it. This shows you the directory of the running kernel. With this information, from a new command-line (not a Python console) run C:\path\to\python.exe -m pip install matplotlib
In Anaconda Navigator, I switched to running applications on tensorflow and installed jupyter 5.6.0. I then open up a Python3 notebook. I then import tensorflow, keras and numpy without issue. Then when I try to import matplotlib, the notebook says ImportError: No module named 'matplotlib'. I tried running the following command in my anaconda prompt in both base and after activating tensorflow: pip3 install matplotlib And it says: (tensorflow) C:\Users\danie>pip3 install matplotlib Requirement already satisfied for 7 different lines. What am I doing wrong?
0
1
940
0
52,091,386
0
0
0
0
1
true
0
2018-08-29T17:41:00.000
4
1
0
Add python_opencv in buildroot image
52,083,346
1.2
python-3.x,opencv,buildroot
Back when opencv was introduced in Buildroot, there was indeed no numpy package, so support for doing OpenCV in Python could not be added, hence this comment. But since then, a python-numpy package was added, and it is even used in the opencv3 package to provide Python support. So, the opencv package simply needs to be updated to leverage the python-numpy package to provide Python support. As a side note: why are you using 2017.08-rc3 ? It is a release candidate, not even a final release. And why this version ? Why not using the LTS version 2018.02.x, which we maintain during one year with security updates and bug fixes ?
How can I generate an image using buildroot with opencv2 in it? In "Target Packages->Libraries->Graphics->opencv2.4" says that python_opencv depends on numpy, which isn't available. An self made app(which is in the built image as well) uses python3.6 and opencv2. Buildroot Version: 2017.08-rc3
0
1
753
0
57,507,051
0
0
0
0
1
false
69
2018-08-29T21:52:00.000
7
3
0
Pandas isna() and isnull(), what is the difference?
52,086,574
1
python,pandas
They both are same. As a best practice, always prefer to use isna() over isnull(). It is easy to remember what isna() is doing because when you look at numpy method np.isnan(), it checks NaN values. In pandas there are other similar method names like dropna(), fillna() that handles missing values and it always helps to remember easily.
Pandas has both isna() and isnull(). I usually use isnull() to detect missing values and have never met the case so that I had to use other than that. So, when to use isna()?
0
1
28,252
0
52,089,011
0
0
0
0
1
true
0
2018-08-30T01:29:00.000
0
1
0
In tf.layers.conv2d, with use_bias=True, are the biases tied or untied?
52,088,059
1.2
python,tensorflow
tied biases is used in tf.layers.conv2d. If you want united biases, just turn off use_bias and create bias variable manually with tf.Variable or tf.get_variable same shape with following feature map, finally sum them up.
One more question: If they are tied biases, how can I implement untied biases? I am using tensorflow 1.10.0 in python.
0
1
213
0
52,104,907
0
0
0
0
1
true
0
2018-08-30T20:23:00.000
4
1
0
Confidence intervals via bootstrapping
52,104,841
1.2
python,statistics-bootstrap
This question isn't related to Python. I think you need to read an intro to bootstrapping. "An Introduciton to Statistical Learning" provides a good one. The idea is not to sample 100 -- you must sample with replacement and taking the same sample size (500). Yes, then you reestimate your parameter many times. And then there's several ways of taking all of these estimates and turning them into a confidence interval. For example, you can use them to estimate the standard error (the standard deviation of the sampling distribution), and then use +/- 2*se.
Yesterday I began to read about using bootstrapping to determine confidence intervals (CIs) in many situations. My current situation is that I am trying to estimate three parameters in a model via maximum likelihood estimation (MLE). This I have done, and now I need to define my CIs. This can obviously be done via profile likelihood, but bootstrapping will give a more broad CI interval as far as I can read. My problem is that I am unsure on how to actually perform bootstrapping ? I have written my own code for the parameter estimation, so no build-in MLE calculators. Basically the observed data I have is binary data, so 1 or 0. And it's from those data (put into a model with three parameters) that I have tried to estimate the parameter values. So let's say my cohort is 500, is the idea then that I take a sample from my cohort, maybe 100, and then expand it to 500 again by just multiplying the sample 5 times, and run the simulation once again, which in turn should result in some new parameter estimates, and then just do this 1000-2000 times in order to get a series of parameter values, which can then be used to define the CI ? Or am I missing something here ?
0
1
763
0
71,774,912
0
0
0
0
1
false
35
2018-09-02T01:38:00.000
0
2
0
How can I clear a model created with Keras and Tensorflow(as backend)?
52,133,347
0
python,tensorflow,keras,jupyter-notebook
I know it is a bit old thread, but I was looking for something to clear the session. For TensorFlow 2.8 I think you need to use tf.keras.backend.clear_session()
I have a problem when training a neural net with Keras in Jupyter Notebook. I created a sequential model with several hidden layers. After training the model and saving the results, I want to delete this model and create a new model in the same session, as I have a for loop that checks the results for different parameters. But as I understand the errors I get, when changing the parameters, when I loop over, I am just adding layers to the model (even though I initialise it again with network = Sequential() inside the loop). So my question is, how can I completely clear the previous model or how can I initialise a completely new model in the same session?
0
1
47,667
1
52,140,437
0
0
0
0
1
false
1
2018-09-02T19:25:00.000
1
3
0
Create a basic Python interface to save images drawn with a mouse
52,140,339
0.066568
python,image,user-interface,draw
I'd take a look at pyautogui to capture the mouse location then "draw" it in matplotlib -- should be able to do this in a loop. You'll want to watch the tkinter window size to sync the mouse coordinates with the relative location. Why not just have your script open create a new blank img and automatically open it with paint - then read it on close? Seems easier than creating a drawing GUI.
I am working on the following project and I am having really difficulties in finding the right way of doing that. I would like to build in Python (but I am open to other possibilities) a very basic interface that allows the user to draw with the mouse (or the pen if used on a surface laptop) something and then save the image. Ideally I would like this to work on a website or at least in a jupyter notebook (at least I imagine this to be utterly difficult). Anyone can point me in the right direction? The goal would be to use the images as input to a neural network model to demonstrate its result with real life examples. I am looking at tk but I don't seem to find much in terms of examples. Thanks in advance, Umberto
0
1
1,360
0
71,867,816
0
0
0
0
1
false
0
2018-09-03T02:29:00.000
0
1
0
Numpy array size different when saved to disk (compared to nbytes)
52,142,524
0
python,numpy
For others references, From numpy documentation: numpy.ndarray.nbytes attribute ndarray.nbytes Total bytes consumed by the elements of the array. Notes Does not include memory consumed by non-element attributes of the array object. So, the nbytes just considers elements of the array.
Is it possible that a flat numpy 1d array's size (nbytes) is 16568 (~16.5kb) but when saved to disk, has a size of >2 mbs? I am saving the array using numpy's numpy.save method. Dtype of array is 'O' (or object). Also, how do I save that flat array to disk such that I get approx similar size to nbytes when saved on disk? Thanks
0
1
138
0
52,145,089
0
0
0
0
1
false
4
2018-09-03T07:02:00.000
2
2
0
Online Learning with Tensorflow
52,144,642
0.197375
python,tensorflow,machine-learning,reinforcement-learning
You don't need to re-initialize the graph. Tensorflow is not explicitly aware of whether you're doing the training or testing phase when you request the output tensor. Rather, back propagation happens whenever you evaluate the optimizer's (e.g. tf.train.AdamOptimizer, tf.train.GradientDescentOptimizer, etc) minimize operation. Normally you don't do this during testing, since you're trying to predict how well it performs on unseen data. But if you want to add that data to the training set after making the initial prediction, you're free to do so as long as you have a way to get the true value so it can compute the error tensor. Even in non-online learning, it's common to intersperse training and testing passes: if you use a validation set to determine early stopping, you alternate between training batches, where you do do backprop, and validation batches, where you don't.
My problem is related to building a recommender system. I am using tensorflow to train the model with user_features, item_features and interactions. How can i handle new data? For example, whenever a use clicks on an item, i wanna record that interaction immediately and learn from that interaction (training the model for just that interaction). How can i do this? Current implementation Right now, i am following the traditional method of training the model first and then making predictions from that. In order to handle new interactions, i have to re-initialize the graph and retrain with all the data to make it work. I hope there is some solution for this. Thanks
0
1
4,565
0
52,182,820
0
0
0
0
1
false
0
2018-09-03T16:33:00.000
0
1
0
External database lookup in TF serving or part of the TF graph
52,153,548
0
python,tensorflow,tensorflow-serving
I'd say that you could wrap the TF server in something like a flask app, which takes in a REST request, applies the additional logic (the DB lookup), and populates and sends a request to the TF server (either via HTTP or gRPC). I don't think it would be possible to do it as 'part of the TF graph'.
I have an tensorflow model that I'm planning to deploy using tensorflow serving for model inference. Just wondering if there is a way to add some custom logic after the service receives the request and before it goes to the tensorflow model. Specifically, I need a lookup step from an external database, that would enrich the data the application receives through the REST call. Alternatively, is that possible as part of the tensorflow graph? It sounds like an overkill to create a separate service just for that, if it can be bundled in the serving layer.
1
1
57
0
52,159,197
0
0
0
0
1
false
1
2018-09-04T04:53:00.000
1
1
0
WEKA and Scikit-Learn Multilayer Perceptron Gives Different Result
52,159,019
0.197375
python,scikit-learn,weka
If you train a neural net with a different optimizer, it will certainly give different results. This difference could be slight or tremendous. All NN optimization algorithms use backpropagation - i.e., LBFGS, Adam, and SGD all use backpropagation. Also - in general - training the same NN twice will likely never give you the exact same result - this is because most optimizers (at least the ones worth your time) take partially stochastic steps.
everyone I'm currently running a research using Multilayer perceptron. I previously run this using WEKA but I have migrated to scikit-learn in python for various reason. I tried to reproduce my prediction results in WEKA to scikit-learn so I made an exact perceptron with the exact same learning rate, momentum, hidden layer, etc However, the prediction results turns out differently for these both platforms. Can anybody gives me some explanation regarding this matter? The only thing that I notice is that scikit learn uses either lbfgs, adam, and sgd to optimize its connection weight while WEKA uses backpropagation. But could it be the only reason? or is there another reason? Best regards
0
1
318
0
57,736,414
0
0
0
0
5
false
20
2018-09-04T08:28:00.000
2
9
0
I am having trouble with this error (-215:Assertion failed) !ssize.empty() in function 'resize' in OpenCV
52,162,004
0.044415
python,opencv,keras
Just enter the precise image format. .jpg instead of .jpeg.
I am trying to apply a Keras' image classifier to my project, but down the road I got stuck with this. Though previously, with the same code I could use OpenCV to read and train images, but after switching to a new batch of images it got caught with the error. So my speculation is that there's something wrong with my file type: This is from the batch that got the error: traf.204.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 480x294, frames 1 This is from the batch that didn't get caught with the error: bear.290.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 224x224, frames 3 But the file type seems to be exactly the same (except for the resolution). How can I fix this problem?
0
1
78,798
0
67,135,915
0
0
0
0
5
false
20
2018-09-04T08:28:00.000
1
9
0
I am having trouble with this error (-215:Assertion failed) !ssize.empty() in function 'resize' in OpenCV
52,162,004
0.022219
python,opencv,keras
In my case there were special characters in the file name. Like "ü", "ä", "/", etc. I had to make a choice: Renaming automatically or just raise an error for the user to know, that the pictures have bad names.
I am trying to apply a Keras' image classifier to my project, but down the road I got stuck with this. Though previously, with the same code I could use OpenCV to read and train images, but after switching to a new batch of images it got caught with the error. So my speculation is that there's something wrong with my file type: This is from the batch that got the error: traf.204.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 480x294, frames 1 This is from the batch that didn't get caught with the error: bear.290.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 224x224, frames 3 But the file type seems to be exactly the same (except for the resolution). How can I fix this problem?
0
1
78,798
0
63,875,303
0
0
0
0
5
false
20
2018-09-04T08:28:00.000
-1
9
0
I am having trouble with this error (-215:Assertion failed) !ssize.empty() in function 'resize' in OpenCV
52,162,004
-0.022219
python,opencv,keras
Put double backslashes in your path inside the imread function.
I am trying to apply a Keras' image classifier to my project, but down the road I got stuck with this. Though previously, with the same code I could use OpenCV to read and train images, but after switching to a new batch of images it got caught with the error. So my speculation is that there's something wrong with my file type: This is from the batch that got the error: traf.204.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 480x294, frames 1 This is from the batch that didn't get caught with the error: bear.290.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 224x224, frames 3 But the file type seems to be exactly the same (except for the resolution). How can I fix this problem?
0
1
78,798
0
67,938,301
0
0
0
0
5
false
20
2018-09-04T08:28:00.000
0
9
0
I am having trouble with this error (-215:Assertion failed) !ssize.empty() in function 'resize' in OpenCV
52,162,004
0
python,opencv,keras
I was facing a similar problem because I was reading multiple images from a directory and that directory had a pdf file(silly), so make sure your specified paths have only images.
I am trying to apply a Keras' image classifier to my project, but down the road I got stuck with this. Though previously, with the same code I could use OpenCV to read and train images, but after switching to a new batch of images it got caught with the error. So my speculation is that there's something wrong with my file type: This is from the batch that got the error: traf.204.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 480x294, frames 1 This is from the batch that didn't get caught with the error: bear.290.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 224x224, frames 3 But the file type seems to be exactly the same (except for the resolution). How can I fix this problem?
0
1
78,798
0
65,369,786
0
0
0
0
5
false
20
2018-09-04T08:28:00.000
0
9
0
I am having trouble with this error (-215:Assertion failed) !ssize.empty() in function 'resize' in OpenCV
52,162,004
0
python,opencv,keras
For me, I had my camera app open in Windows 10, and that's why I was getting that error. I shut it down and reran my code and it worked.
I am trying to apply a Keras' image classifier to my project, but down the road I got stuck with this. Though previously, with the same code I could use OpenCV to read and train images, but after switching to a new batch of images it got caught with the error. So my speculation is that there's something wrong with my file type: This is from the batch that got the error: traf.204.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 480x294, frames 1 This is from the batch that didn't get caught with the error: bear.290.jpg: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 224x224, frames 3 But the file type seems to be exactly the same (except for the resolution). How can I fix this problem?
0
1
78,798
0
52,321,037
0
1
0
0
1
true
1
2018-09-04T09:18:00.000
1
1
0
Is it possible to use custom build cpython in Anaconda environment?
52,162,907
1.2
python,scipy,anaconda,conda,cpython
I was able to resolve my issue by replacing only python DLL that I had in, and the conda environment just worked with it
I build a cpython locally (Windows) with a fix to a problem with multiprocessing that I have, but I also need data science stack of packages like numpy, pandas, scipy, matplotlib, statsmodels and few others. When I try to install them the process appears quite cubersome for many packages and for scipy I wasn't able to resolve it after 3 days of trying. I was thinking that it would be amazing if I can just replace python in my anaconda env, and use conda to install the packages I need. Is it possible to easily replace python with binaries I have or I need to wait while my fix is released with new Python version?
0
1
322
0
70,050,317
0
0
0
0
1
false
67
2018-09-04T19:53:00.000
1
3
0
Getting a list of indices where pandas boolean series is True
52,173,161
0.066568
python,pandas,boolean,series,boolean-indexing
Also works: s.where(lambda x: x).dropna().index, and it has the advantage of being easy to chain pipe - if your series is being computed on the fly, you don't need to assign it to a variable. Note that if s is computed from r: s = cond(r) than you can also use: r.where(lambda x: cond(x)).dropna().index.
I have a pandas series with boolean entries. I would like to get a list of indices where the values are True. For example the input pd.Series([True, False, True, True, False, False, False, True]) should yield the output [0,2,3,7]. I can do it with a list comprehension, but is there something cleaner or faster?
0
1
70,848
0
60,923,830
0
1
0
0
1
false
4
2018-09-04T22:00:00.000
1
2
0
ModuleNotFoundError: No module named 'keras'
52,174,530
0.099668
python,tensorflow,keras
When you start a project in PyCharm, there is an option to use an existing virtual environment or create a new virtual environment. If nothing mentioned while creating the project, new virtual environment will be created. If that is the case, there is no Keras in the new environment which is possibly your issue. It will be better to do this installation in some virtual environments and use it accordingly in Pycharm.
I can't import Keras in PyCharm IDE on a Mac. I have tried installing and uninstalling Keras using both pip, pip3, conda, and easy install, but none worked. I have tried changing interpreters (Python 2.7 and 3.6) but neither worked. In a terminal, when I run: pip3 list | grep -i keras I get: Keras 2.2.2 Keras-Applications 1.0.4 Keras-Preprocessing 1.0.2 I think this means that my Keras installation was successful. I have also checked my environment with: python3 -c 'import sys, pprint; pprint.pprint(sys.path)' I get: '/anaconda3/lib/python36.zip', '/anaconda3/lib/python3.6', '/anaconda3/lib/python3.6/lib-dynload', '/anaconda3/lib/python3.6/site-packages', '/anaconda3/lib/python3.6/site-packages/aeosa'] I have tried running: python -c "import keras" I get: Using TensorFlow backend. But when I run/import Keras on the PyCharm IDE, I get: ModuleNotFoundError: No module named 'keras' What should I do to run Keras on a Mac with PyCharm 3.6?
0
1
14,633