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
55,568,832
0
0
0
0
1
false
0
2019-01-21T00:41:00.000
0
2
0
Can I use tensor flow GPU without a graphics card? Outsource training to AWS/Cloud?
54,282,272
0
python,amazon-web-services,tensorflow,google-cloud-platform,gpu
Use Kaggle kernel to run and save the file in system thats a easy and smart way out.
Background I have a school project that has this specific item I want to construct an object detector for. I was planning on making a custom dataset, labeling the image, and then using tensorflow to train my classifier. I was reading an article and it said if I didn't have a gpu with 2GB or more it would be better to train the dataset on AWS or google cloud. Question My question is could I still write the code and configuration files on my laptop, which has no GPU, and then outsource the training to AWS or google cloud? I'm very new to this so I'm not sure if I'm overlooking some sort of dependencies that will prevent me from moving forward. If I can't move forward with my given hardware what are my other options I guess?
0
1
78
0
54,288,478
0
0
0
0
1
false
0
2019-01-21T10:54:00.000
1
1
0
Classifier for time based data to binary label
54,288,421
0.197375
python,machine-learning,neural-network,recurrent-neural-network
Yes it definitely is feasible and also very common. Search for any document classification tasks (e.g. sentiment) for examples of this kind of tasks.
I have access to a dataframe of 100 persons and how they performed on a certain motion test. This frame contains about 25,000 rows per person since the performance of this person is kept track of (approximately) each centisecond (10^-2). We want to use this data to predict a binary y-label, that is to say, if someone has a motor problem or not. Trained neural networks on mean's and variances of certain columns per person classified +-72% of the data correctly. Naive bayes classifier on mean's and variances of certain columns per person classified +-80% correctly. Now since this is time based data, 'performance on this test through time', we were suggested to use Recurrent Neural Networks. I've looked into this and I find that this is mostly used to predict future events, i.e. the events happening in the next centiseconds. Question is, is it in general feasible to use RNN's on (in a way time-based) data like this to predict a binary label? If not, what is?
0
1
37
0
54,296,537
0
1
0
0
1
false
0
2019-01-21T19:15:00.000
3
3
0
importing numpy in different python versions
54,296,469
0.197375
python,numpy
You can install numpy in python3 with help of pip3 command instead of pip. Yes you should change python3 as default as python2 support is going to end this year.
I have a problem with importing numpy for python3, I'm new in coding and followed all steps. I want to import numpy in python3 but not in python2 which is set by defaultn my mac mojave 10.14.2. I have Python 2.7.10 by default on my mac and can switch now to Python 3.7.2 in shell. I installed pip 18.1 as described in PyPA and now I can import numpy only in Python 2. what should I do to be able to import numpy in Python 3? Is it better to set Python 3 by default on my mac mojave 10.14.2?
0
1
876
0
54,297,972
0
0
0
0
1
false
0
2019-01-21T21:11:00.000
0
1
0
AttributeError: no attribute 'shape'
54,297,834
0
python
Just to give some advice. You could/should describe your problem a bit more clear. I just Googled the file you mentioned yolo_opencsv.py and its part of Object detection (YOLO, SSD, Faster R-CNN) with OpenCV and Python library. It always a good idea to mention the tool/library you are using (and are having problems with) in the title. Also you could/describe the procedure and environment you are using when the error occurs. By doing so, people can try to replicate you problem and have to ask less additional questions trying to help you solve the problem. Your error seems to indicate that the image object has not loaded properly, i.e. the return of cv2.imread(args.image) has returned None. Do you run the command from the command line as described in the README. And are you sure you image path and image format is correct?
When i run the coding in this yolo_opencv.py file : The console shows this error: File "", line 40, in Width = image.shape[1] AttributeError: 'NoneType' object has no attribute 'shape'
0
1
2,273
0
54,303,388
0
0
0
0
1
false
0
2019-01-21T21:13:00.000
0
3
0
Persistent Machine Learning
54,297,846
0
python,machine-learning
Use python pickle library to dump your trained model on your hard drive and load model and test for persistent results.
I have a super basic machine learning question. I've been working through various tutorials and online classes on machine learning and the various techniques to learning how to use it, but what I'm not seeing is the persistent application piece. So, for example, I train a network to recognize what a garden gnome looks like, but, after I run the training set and validate with test data, how do I persist the network so that I can feed it an individual picture and have it tell me whether the picture is of a garden gnome or not? Every tutorial seems to have you run through the training/validation sets without any notion as of how to host the network in a meaningful way for future use. Thanks!
0
1
309
0
54,324,410
0
0
0
0
1
false
1
2019-01-23T09:38:00.000
0
1
0
Python to java image proccesing translation
54,324,148
0
java,python,tensorflow,image-processing,keras
Tensorflow themselves say: Caution: The TensorFlow Java API is not covered by the TensorFlow API stability guarantees. This however doesn't mean that your application will not be stable. The key take-away here is that whatever you will build is not guaranteed to work out of the box when new versions are released. However, if you pin down the version of the Tensorflow API that you use, you should be alright.
I have some Python image processing code that uses Keras and TensorFlow Libs, which is needed to be converted to Java Framework. My main problems are: a. TensorFlow for java is not stable yet, so I have to find another equivalent Java Lib. b. I haven't found Java image processing library that covers the Keras image processing functions and utility (e.g. the class "ImageDataGenerator") c. The program intends to be cross-platform for dummies (biologists....) so it shall not use any native parts that may cause realtime compiling problems for the clients, means it needs to be written in pure Java. Thanks!
1
1
63
0
54,325,913
0
1
0
0
1
false
0
2019-01-23T11:08:00.000
-1
1
0
Is it possible to write large numbers with spaces in the code
54,325,854
-0.197375
python
You can try writing your number in a scientific-style way? Like 1e6 instead of 1000000 or 1,000,000...
I'm trying to run a Monte-Carlo control algorithm, and keep getting frustrated when setting the number of steps in the code. It needs to be a large number (thousands, millions...) and it is hard to read it at a glance so I need to count zeros whenever I change it. I tried entering it as N_EPISODES = 1 000 000 or N_EPISODES = int('1 000 000') or with commas instead of spaces, but none of these work. Is there a way to set large numbers in the code in a human-readable way?
0
1
459
0
54,328,218
0
1
0
0
1
false
0
2019-01-23T13:14:00.000
2
2
0
How to save (write) a list of images from a dataset into a new folder - openCV Python?
54,328,126
0.197375
python,opencv,computer-vision
Assuming you have OpenCV correctly installed on your machine, you can first read the images with img = cv.imread(filename) and then write them with cv.imwrite(filename, img).
I'm so much newbie in openCV/Python tasks. I use Python 3.7 and openCV 4 running by a JNotebook. The question: I wanna save just 1,000 images from a dataset with 10,000 pictures, extracting them from it and write only those 1,000.jpeg in a new folder, is it possible using openCV package in Python? I've already had a list of names (1,000 images).
0
1
3,167
0
54,338,545
0
0
0
0
1
false
0
2019-01-24T02:02:00.000
0
1
0
What does it mean to use K-means clustering on a data set that indicates relative distances from one item to another?
54,338,377
0
python
K-means clustering assigns items to clusters such that the total intra-cluster distance is minimized. Hence, the only input that is needed is a distance function d(a,b). Often, the items are vectors in a normed vector space and d is chosen as d(a,b) = ||a-b|| for some norm ||x||. But in general, any distance function that fulfills d(a,a) = 0 (distance from a point to itself is zero), d(a,b) <= d(a,c) + d(c,b) (triangle inequality), and d(a,b) = d(b,a) (symmetry) can be used. It can even be a matrix where the entry M(i,j) gives the distance between items i and j, as long as the entries obey the rules above.
what does it mean to use K-means clustering on a data set that indicates relative distances from one item to another? For example, each item is given a relative distance to every other item.
0
1
26
0
54,392,629
0
1
0
0
1
true
0
2019-01-24T06:26:00.000
1
2
0
I have installed pandas_datareader in pip but when I try to import the same in Jupyter Notebook it says Module not found
54,340,532
1.2
python,jupyter-notebook
I could resolve this, I went to my venv and executed this command: python -m pip install ipykernel and then upgraded pip and it started working. Thank you, Mohit
(py1) C:\Users\XXXXX>pip list Version ----------------- ---------- certifi 2018.11.29 chardet 3.0.4 idna 2.8 lxml 4.3.0 numpy 1.16.0 pandas 0.23.4 pandas-datareader 0.7.0 pip 18.1 python-dateutil 2.7.5 pytz 2018.9 requests 2.21.0 scipy 1.2.0 setuptools 40.6.3 six 1.12.0 urllib3 1.24.1 wheel 0.32.3 wrapt 1.11.1 and it also works when I type python on my cmd: ` (py1) C:\Users\XXXXX>python Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. import pandas_datareader ` However, when I try importing it in Jupyter Notebook (launching from the same venv) it gives me the error below: (py1) C:\Users\XXXXX>python ` Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. import pandas_datareader `
0
1
546
0
58,307,961
0
0
0
0
1
false
0
2019-01-24T08:33:00.000
0
2
0
Calculate Imbalance Ratio for a multi-class dataset
54,342,353
0
python,dataset,data-mining,data-science
IR = (negative_class/positive_class) Where positive_class is the number of minority class samples and negative_class is the number of majority class samples.
How can i calculate Imbalance Ratio for a dataset which is imbalanced? I came across a way in which it defined (it's taken from a paper): given by the imbalance ratio (IR), defined as the ratio of the number of instances in the majority class to the number of examples in the minority class Now, is this one of the right ways to calculate? Thanks
0
1
1,656
0
54,351,092
0
0
0
0
1
false
1
2019-01-24T09:40:00.000
1
1
0
How to install coco dataset in colab?
54,343,491
0.197375
python,google-colaboratory
I suspect you need a leading / in your path. (Typically, the Drive FUSE mount path is /content/...)
I have coco dataset(19 gb), the dataset upload googledrive but colab is not find this data despite use this code import sys sys.path.insert(0, 'content/gdrive/My Drive/caption').How can I find this file? import sys sys.path.insert(0, 'content/gdrive/My Drive/caption')
0
1
1,305
0
69,872,171
0
0
0
0
4
false
16
2019-01-24T10:11:00.000
0
5
0
Why does my google colab session keep crashing?
54,344,101
0
python,data-visualization,google-colaboratory
I would first suggest closing your browser and restarting the notebook. Look at the run time logs and check to see if cuda is mentioned anywhere. If not then do a factory runtime reset and run the notebook. Check your logs again and you should find cuda somewhere there.
I am using google colab on a dataset with 4 million rows and 29 columns. When I run the statement sns.heatmap(dataset.isnull()) it runs for some time but after a while the session crashes and the instance restarts. It has been happening a lot and I till now haven't really seen an output. What can be the possible reason ? Is the data/calculation too much ? What can I do ?
0
1
32,699
0
69,688,669
0
0
0
0
4
false
16
2019-01-24T10:11:00.000
2
5
0
Why does my google colab session keep crashing?
54,344,101
0.07983
python,data-visualization,google-colaboratory
This error mostly comes if you enable the GPU but do not using it. Change your runtime type to "None". You will not face this issue again.
I am using google colab on a dataset with 4 million rows and 29 columns. When I run the statement sns.heatmap(dataset.isnull()) it runs for some time but after a while the session crashes and the instance restarts. It has been happening a lot and I till now haven't really seen an output. What can be the possible reason ? Is the data/calculation too much ? What can I do ?
0
1
32,699
0
63,649,402
0
0
0
0
4
false
16
2019-01-24T10:11:00.000
0
5
0
Why does my google colab session keep crashing?
54,344,101
0
python,data-visualization,google-colaboratory
For me, passing specific arguments to the tfms augmentation failed the dataloader and crahed the session. Wasted lot of time checking the images not coruppt and clean the gc and more...
I am using google colab on a dataset with 4 million rows and 29 columns. When I run the statement sns.heatmap(dataset.isnull()) it runs for some time but after a while the session crashes and the instance restarts. It has been happening a lot and I till now haven't really seen an output. What can be the possible reason ? Is the data/calculation too much ? What can I do ?
0
1
32,699
0
61,336,224
0
0
0
0
4
false
16
2019-01-24T10:11:00.000
5
5
0
Why does my google colab session keep crashing?
54,344,101
0.197375
python,data-visualization,google-colaboratory
Another cause - if you're using PyTorch and assign your model to the GPU, but don't assign an internal tensor to the GPU (e.g. a hidden layer).
I am using google colab on a dataset with 4 million rows and 29 columns. When I run the statement sns.heatmap(dataset.isnull()) it runs for some time but after a while the session crashes and the instance restarts. It has been happening a lot and I till now haven't really seen an output. What can be the possible reason ? Is the data/calculation too much ? What can I do ?
0
1
32,699
0
54,346,332
0
0
0
0
1
false
0
2019-01-24T11:28:00.000
2
2
0
Scikit-Learn Random Forest regression: mix two sets of true values (y)
54,345,579
0.197375
python,scikit-learn,random-forest
The problem is that an algorithm alone doesn't know which label is better. What you could do: Train a classifier on data which you know is correct. Use the clasifier to predcit a value for each datapoint. Compare this value to the two list of labels which you already have and choose the label which is closer. This solution obviously isn't perfect since the results depends on quality of the classfier which predicts the value and you still need enough labeled data to train the classifier. Additionaly there is also a chance that the classifier itself predicts a better value compared to your two lists of labels.
I am training Random Forests with two sets of "true" y values (empirical). I can easy tell which one is better. However, I was wondering if there is a simple method, other than brute force, to pick up the values from each set that would produce the best model. In other words, I would like to automatically mix both y sets to produce a new ideal one. Say, for instance, biological activity. Different experiments and different databases provide different values. This is a simple example showing two different sets of y values on columns 3 and 4. 4a50,DQ7,47.6,45.4 3atu,ADP,47.7,30.7 5i9i,5HV,47.7,41.9 5jzn,GUI,47.7,34.2 4bjx,73B,48.0,44.0 4a6c,QG9,48.1,45.5 I know that column 3 is better because I have already trained different models against each of them and also because I checked a few articles to verify which value is correct and 3 is right more often than 4. However, I have thousands of rows and cannot read thousands of papers. So I would like to know if there is an algorithm that, for instance, would use 3 as a base for the true y values but would pick values from 4 when the model improves by so doing. It would be useful it it would report the final y column and be able to use more than 2, but I think I can figure out that. The idea now is to find out if there is already a solution out there so that I don't need to reinvent the wheel. Best, Miro NOTE: The features (x) are in a different file.
0
1
314
0
54,356,646
0
0
0
0
2
false
0
2019-01-24T15:26:00.000
0
3
0
How to Measure the difference between features in dataframe?
54,350,062
0
python,machine-learning,statistics,data-mining,feature-selection
Can you try to use KS-test for your features? for example, feature 1, split by it's class. then you get two groups. Then test if they come from different distribution or just record the p-value. when you have all the test result or p-value, make another model with the samples that comes from different distribution / very low p-value. see if the new model is better or similar. not sure if this achieves anything. wanted to comment but couldn't do so.
I have a dataframe with around 20000 rows and 98 features (all the features are numerical) and a target feature with binary values: 0 and 1. Basically, there are two population (first population with target value 1 --50%--, and the second with target value 0 -50%- balanced data). In a classification problem, I tried to predict the target value given the data. So, I have implanted a supervised learning algorithm (e.g., SVM) to predict the target value, and could obtain a very good result with around 0.95 accuracy. This result gives me a point that there is a considerable difference between the features. So, in the next step, I have to know what are the important features which made this difference, and what is best way to quantify this difference in the features between these two group of population. Any idea?
0
1
203
0
54,350,594
0
0
0
0
2
false
0
2019-01-24T15:26:00.000
0
3
0
How to Measure the difference between features in dataframe?
54,350,062
0
python,machine-learning,statistics,data-mining,feature-selection
Aside from using the coefficients of the support vectors from your model, you could try build other models. A decision tree approach will explicitly show you which input features split the data - those nearer the root being more important, for some definition of important. If you try a feature reduction technique, like PCA, and rebuild you model, the coefficients of the components here will tell you which contribute most. Or you could be completely thug-headed, and build lots of models leaving out some features and see which are better. Or you could be lateral, and consider what's so different about the few points that your model doesn't accurately classify.
I have a dataframe with around 20000 rows and 98 features (all the features are numerical) and a target feature with binary values: 0 and 1. Basically, there are two population (first population with target value 1 --50%--, and the second with target value 0 -50%- balanced data). In a classification problem, I tried to predict the target value given the data. So, I have implanted a supervised learning algorithm (e.g., SVM) to predict the target value, and could obtain a very good result with around 0.95 accuracy. This result gives me a point that there is a considerable difference between the features. So, in the next step, I have to know what are the important features which made this difference, and what is best way to quantify this difference in the features between these two group of population. Any idea?
0
1
203
0
54,350,414
0
0
0
0
1
false
0
2019-01-24T15:38:00.000
0
2
0
Smart way to detect too far away point from a row of points?
54,350,293
0
python,math,row,geospatial,point
try arcgis. build two new attributes in arcgis with their X and Y coordinate,then calculate the distance between the points you want
I'm working on a python script whose goal is to detect if a point is out of a row of points (gps statement from an agricultural machine). Input data are shapefile and I use Geopandas library for all geotreatments. My first idea was to make a buffer around the 2 points around considered point. After that, I watch if my point is in the buffer. But results aren't good. So I ask myself if there is a mathematical smart method, maybe with Scikit lib... Somebody is able to help me?
0
1
136
0
54,363,252
0
0
0
0
1
true
0
2019-01-25T09:21:00.000
1
1
0
Predicting values using trained MNB Classifier
54,362,232
1.2
python,python-3.x,classification,sentiment-analysis
I don't know the dataset and what is semantic of individual dictionaries, but you are training your model on a dataset which has form as follows: [[{"word":True, "word2": False}, 'neg'], [{"word":True, "word2": False}, 'pos']] That means your input is in form of a dictionary, and output in form of 'neg' label. If you want to predict you need to input a dictionary in a form: {"I": True, "Hate": False, "you": True}. Then: MNB_classifier.classify({"love": True}) >> 'neg' or MNB_classifier.classify_many([{"love": True}]) >> ['neg']
I am trying to train a model for sentiment analysis and below is my trained Multinomial Naive Bayes Classifier returning an accuracy of 84%. I have been unable to figure out how to use the trained model to predict the sentiment of a sentence. For example, I now want to use the trained model to predict the sentiment of the phrase "I hate you". I am new to this area and any help is highly appreciated.
0
1
119
0
54,380,618
0
1
0
0
1
false
1
2019-01-25T17:25:00.000
1
1
0
Device memory array's life time
54,370,090
0.197375
python,cuda,gpgpu,numba
What is the lifetime of a device array and an array that is copied to GPU memory? Are their value preserved from one kernel call to another? In Numba, global memory allocations are preserved until they are freed. Do I need to put the device arrays definitions inside the loop (before I call the kernel) or do I just do it once before I enter the loop? The latter. Do I need to free/delete the device arrays manually in the code or the CUDA memory manager will do it at the end of the program? The first thing to realize is that there is no CUDA memory manager in the way you imagine. Memory allocations are automatically freed when a context is destroyed, otherwise they are not under any circumstances. The only exception to this is if you use a Numba device_array, which may be garbage collected by Python if it falls out of scope. But you should, in general, assume that anything you allocate remains in memory until you explicitly free it, and always include explicit memory deallocation in your code.
I have a cuda kernel written in numba-cuda that processes large arrays that do not fit in GPU memory at once. So, I have to call the kernel multiple times to process the entire arrays. The kernel is called in a loop and, inside the loop, after GPU is done the computation, I copy and aggregate the results back to a host array. My questions: What is the lifetime of a device array and an array that is copied to GPU memory? Are their value preserved from one kernel call to another? Do I need to put the device arrays definitions inside the loop (before I call the kernel) or do I just do it once before I enter the loop? Do I need to free/delete the device arrays manually in the code or the CUDA memory manager will do it at the end of the program? Thanks.
0
1
476
0
54,374,671
0
0
0
0
1
false
0
2019-01-26T00:38:00.000
0
2
0
Keras LSTM Paradigm
54,374,608
0
python,keras,lstm,recurrent-neural-network
I'm not sure, but your batch_size could be set automatically, time_steps is equal to number of feature sets so for [[0.4, 0.8, -1]] its 1 for [[0.4, 0.8, -1],[1, 1.6, -0.2]] its 2 etc. Try to reshape your data to (shape[0],3).
I have a single time series that has multiple input features and a single output (classification). I would like to create a model that would predict the output at every step. My data looks like this: x: [[0.4, 0.8, -1], [1, 1.6, -0.2], ....] y: [[1], [0], ...] So when given a single feature vector, I would like my model to output 0 or 1. The feature vector is not a sequence of any kind, as this is just a straight-forward time series. I have the following questions: Since Keras requires data to be formatted in (batch_size, time_steps, num_features) and I have fixed num_features = 3, what should I put for batch_size and time_steps? What do I put for the value of stateful? Since my data is in a specific order in that the first event in my list came first, followed by the second and third etc., I'm assuming I put stateful = True?
0
1
108
0
54,446,294
0
0
0
0
1
false
0
2019-01-26T01:26:00.000
0
1
0
Understanding "PREDICT" function output in python lightGBM implementation
54,374,866
0
python-3.x,predict,lightgbm
Suppose that you are doing regression from X ϵ Rn to y ϵ R1. For a given point, x, You can view the model prediction f(x) as a linear function of the feature contributions such as : f(x) = contribution(x1) + contribution (x2) + ... + contribution(xn) + mean(y) The first n columns of your array correspond to the contribution of your n features respectively and the last column is the prediction without any information, here the mean of your output y. If you sum up those n+1 values, you will obtain the prediction f(x). For classification, you obtain the "raw prediction". Depending on the objective you selected, you will have to convert it to probability (the "prediction") using softmax or logit function. PS: Hope its clear despite my poor editing!
When using the Python PREDICT method in lightGBM with predict_contrib = TRUE, I get an array of [n_samples, n_features +1]. What does the n_feature+1 correspond to? I thought first that it could be the log odds of class 1 but the value does not correspond to the right probability.
0
1
862
0
54,376,403
0
0
0
0
1
false
55
2019-01-26T01:39:00.000
34
10
0
How to fix this strange error: "RuntimeError: CUDA error: out of memory"
54,374,935
1
python,pytorch
The error occurs because you ran out of memory on your GPU. One way to solve it is to reduce the batch size until your code runs without this error.
I successfully trained the network but got this error during validation: RuntimeError: CUDA error: out of memory
0
1
201,166
0
63,150,254
0
0
0
0
1
false
1
2019-01-26T08:40:00.000
2
2
0
OpenCV2 createBackgroundSubtractorMOG Attribute not found
54,376,883
0.197375
python-3.x,opencv,background-subtraction
there are two subtraction packages in opencv. BackgroundSubtractorMOG() it's at cv2.bgsegm.BackgroundSubtractorMOG(),to use you must install opencv-contrib-python
I am using cv2 version 4.0.0 and python version 3.7.2. I am trying to subtract Background using this method cv2.createBackgroundSubtractorMOG2() and its working well. But when I use cv2.createBackgroundSubtractorMOG() its not working its showing me AttributeError: module 'cv2.cv2' has no attribute 'createBackgroundSubtractorMOG '. I also tried cv2.BackgroundSubtractorMOG() but i got same error AttributeError: module 'cv2.cv2' has no attribute 'BackgroundSubtractorMOG'. and another subtraction method cv2.createBackgroundSubtractorGMG() also not working. I also refer other stackoverflow answers but I didn't get solution.
0
1
3,478
0
54,395,217
0
0
1
0
1
true
1
2019-01-26T14:10:00.000
0
1
0
Calculating the trace of a large sparse matrix
54,379,162
1.2
python,c++,scipy
The solution was as simple as: np.array(Mat.diagonal()).sum() Thanks @hpaulj !
I have a sparse large matrix (linear dimension of 2*10^6) for which I want to calculate its trace. Calculating it brute force takes 16 seconds to access each diagonal element (hence I could do it in a YEAR!). I was thinking of saving it to the disk using scipy.io.mmwrite and reading it with a c++ code which should be much faster. However I cannot find any package that could help me do that. Any suggestions would be much appreciated! Thanks.
0
1
476
0
54,387,971
0
0
0
0
1
true
1
2019-01-27T11:55:00.000
1
1
0
How to approach variable image sizes for Image Classification?
54,387,850
1.2
python,image-processing,machine-learning,classification,multiclass-classification
The common approach is to crop the tumor on each image. You will obtain different tumor image size. Then rescale the tumor images to the smallest one. Choose wisely the resampling technic for the rescale depending on the algorithm you will use for classification. The fastest one would be nearest neighborhood resampling, a smoother one would be linear interpolation, the ultimate one can be spline interpolation.
I am working on classification of brain tumors. The dataset is comprised of brain images from various angles, with a border and mask of the tumor position. I have cropped the rectangle that contains the tumor, as the other parts of the image are irrelevant and vary due to the different angles from which the image is taken. Now I am left with a series of images of the tumor, each belonging to 1 of 3 possible cases of tumor. But to train this data for classification, I need to have the 2d image array in a uniform shape I believe. Possible approaches: 1) Crop each image to a fixed size (say 100x100). But this would result in loss of data and also depending on position of the tumor in image, I could be facing uneven crops due to reaching the edge of the image. 2) Pad the image to a fixed shape, bigger than the biggest cropped image shape (say 350x350). But again this would introduce noise in the data I suppose, and I'm not sure how can I pad the image uniformly across all 4 sides of the rectangle. As these don't seem viable, I'm looking for other solutions to tackle this problem.
0
1
236
0
54,405,935
0
0
0
0
1
true
0
2019-01-28T15:21:00.000
2
1
0
Why can't I apply sort_values to a dataframe more than once?
54,405,063
1.2
python,pandas,data-analysis
When you use .sort_values(['a', 'b']) you are first sorting the dataframe by the column a, and then within those sortings, sorting by b. Think of it almost as grouping by the first sort, then sorting within those groupings. If there was a c, it would sort the c column within the a b groups. If you do .sort_values('a').sort_values('b') you are sorting the dataframe by a and then taking that returned dataframe, and "starting over" by sorting it by b basically destroying the previous sorting of a. using ['a', 'b'] keeps each of the sorts and sorts within.
Say for example I have a multi-column dataframe. I want to arrange my data by sorting column a ascending first, then by column b ascending also. I am able to achieve this by the ff. code: df.sort_values(['b','a']). Note the reversed order of the arguments. My question is, why doesn't df.sort_values('a').sort_values('b') work?
0
1
78
0
54,614,230
0
0
0
0
1
true
1
2019-01-28T21:49:00.000
1
1
0
Mac OS (Mojave) - Pycharm backend : TkAgg not working, graphs are blank
54,410,776
1.2
python-3.x,matplotlib,backend
if you use virtualenv in Mojave, you have to install matplotliv (v1.3.1) at virtualenv. ** NOT VERSION 2.2.3 **. so, try the below command (btw, in your code, 'TkAgg' is needless): $pip install --no-cache-dir matplotlib==1.3.1 everything will be fine.
I am fairly new to python (and Stackflow) so apologies if this is a repost. I am currently run Pycharm on my iMac (with Mac OS Mojave), python install from Anaconda. I am having some issues with Matplotlib as everytime I plot a graph I don't see anything. The backend currently uses TkAgg. I googled the issue and came across many links and tried to change the backend in matplotlibrc, but that just gave me errors. It is Mojave specific problem? I have another Mac with High Sierra (which uses MacOSX in the backend) and Matplotlib runs fine on it. I tried changing the backend on my iMac to MacOSX but that doesn't work. Any help will be really appreciated as I have already spend more than 3-4 hours (in vain!) to fix the problem If I need to change the backend in matplotlibrc, could you advise what should I be using? thanks, PK
0
1
1,210
0
54,411,400
0
1
0
0
1
false
0
2019-01-28T22:44:00.000
1
3
0
Extracting a date at the end of a pandas dataframe
54,411,374
0.066568
python,string,pandas,datetime,dataframe
row.split(", ")[-1] is the string 23/09/2012, now you can use the date module to extract that into a Date object. And use try/except for error handling.
I have a column of data that is in the following format: bla bla bla, bla bla bla, bla bla bla, bla bla bla bla bla bla, 23/09/2012 Is there an easy way to extract the date at the end of the string from all rows? It is in the same DD/MM/YYYY format every time. I could split on the last , but it would be good if I could specify that I want the date in case of errors in the data.
0
1
96
0
61,452,667
0
1
0
0
1
false
4
2019-01-29T16:22:00.000
0
4
0
Disabling Downloads on Jupyter Notebooks
54,425,431
0
python,security,jupyter
I have achieved this by putting Jupyter Hub behind ALB (Application load balancer), AWS and have a rule that basically routes every request with path "/files" to a 503 error page. This can even be achieved using nginx as well. Just to bear that in mind, the download request path is "/files".
My goal is to disable the downloading of csv data from my JupyterHub environment. Is there any way to do this?
0
1
3,699
0
54,437,112
0
1
0
0
1
false
0
2019-01-30T06:21:00.000
0
1
0
with python 3.6, Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow
54,434,432
0
tensorflow,pip,installation,python-3.6
if you have anaconda do conda install tensorflow. anaconda version of tensorflow is faster than pip anyways.
C:\WINDOWS\system32>pip install tensorflow Collecting tensorflow Could not find a version that satisfies the requirement tensorflow (from versions: ) No matching distribution found for tensorflow I installed the Python (3.6 64-bit), and wanna install tensorflow in Anaconda3. And I upgraded pip to the latest version, 19.0.1. Requirement already up-to-date: pip in c:\anaconda3\lib\site-packages (19.0.1) So, how can I solve this problem?
0
1
450
0
54,451,861
0
0
0
0
1
false
0
2019-01-30T19:13:00.000
1
1
0
How to use NLTK DependencyGrammar package In NER
54,447,937
0.197375
python,nlp,nltk
NER algorithms are normally trained to recognize well known enities such as places,names etc. P1234U does not fall into any of the well known categories. I would suggest a simple regex search with constraints on max length of the invoice id and check the accuracy on that.
How to use NLTK DependencyGrammar package in Named Entity Recognition (NER)? Eg. sentence that I am looking is: “what is the status of my invoice P1234U?” And I would like to extract P1234U as the invoice number. Without much training I would like to do this, so no SPACY solution please. I would prefer to go in a knowledge graph way.
0
1
68
0
54,451,152
0
0
0
0
1
false
0
2019-01-30T22:26:00.000
0
2
0
Apply KNN from small supervised dataset to large unsupervised dataset in Python
54,450,495
0
python,scikit-learn,knn
In machine learning there are two broad types of learners, namely eager learners (Decision trees, neural nets, svms...) and lazy learners such as KNN. In fact, KNN doesn't do any learning at all. It just stores the "labeled" data you have and then uses it to perform inference such that it computes how similar the new sample (unlabeled) is, to all of the samples in the data that it has stored (labeled data). Then based on majority voting of the K nearest instances (K nearest neighbours hence the name) of the new sample, it will infer it's class/value. Now to get to your question, "training" the KNN has nothing to do with the K itself, so when performing inference feel free to use whatever K gives the best result for you.
I have trained and tested a KNN model on a small supervised dataset of about 200 samples in Python. I would like to apply these results to a much larger unsupervised dataset of several thousand samples. My question is: is there a way to fit the KNN model using the small supervised dataset, and then change the K-value for the large unsupervised dataset? I do not want to overfit the model by using the low K-value from the smaller dataset but am unsure how to fit the model and then change the K-value in Python. Is this possible using KNN? Is there some other way to apply KNN to a much larger unsupervised dataset?
0
1
388
0
54,996,195
0
1
0
0
1
true
2
2019-01-31T02:48:00.000
1
1
0
Jupyter: How can you pretty-print many data frames from the code in one cell?
54,452,598
1.2
python,pandas,jupyter,pretty-print
As mentioned in the comment, using display instead of print does the job.
When you run a function that returns a Pandas data frame in a Jupyter cell, it prints out this very aesthetic table. When you give an explicit command to print, it looks much worse. I have a list of data frames and I'd like to print each. Is there a way to get the nice version of the print using a for-loop?
0
1
176
0
54,469,052
0
1
0
0
1
false
4
2019-01-31T19:59:00.000
0
5
0
Sort dict by key and retrieve value
54,468,377
0
python,python-3.x,sorting,dictionary
Another approach would be to create a generator object yielding the values of the dict, cast them to a list and then print it. print(list(val for val in scores.values()))
Given scores = { 0.0: "bob", 5.2: "alex", 2.8: "carl"} To get the output [ "bob", "carl", "alex" ] I can do print([ scores[key] for key in sorted(scores.keys()) ]) Is this the best (most "pythonic") way? I was thinking I could use scores.items() in conjunction with sorted(key=...) to avoid the dictionary lookup, but not sure what that key parameter would be.
0
1
928
0
54,469,054
0
0
0
0
1
false
0
2019-01-31T20:39:00.000
0
1
0
XGBOOST faster than random forest?
54,468,877
0
python-3.x,machine-learning
Mainly, the parameters you choose have strong impact in the speed of your algorithm, (e.g learning rate, depth of the tree, number of features etc.), there's a trade-off between accuracy and speed, so i suggest you put the parameters you've chosen for every model and see how to change it to get faster performance with reasonable accuracy.
I am doing kaggle inclass challege of bosten hosing prices and learnt that XGBoost is faster than RandomForest but when implemented was slower.i Want to ask when XGBoost becomes faster and when RandomForest??.I am new to machine learning and need your help.Thanking in advance
0
1
1,525
0
54,469,843
0
1
0
0
1
false
6
2019-01-31T21:52:00.000
3
3
0
What does [i,:] mean in Python?
54,469,789
0.197375
python,python-3.x,numpy,scikit-learn,linear-regression
I guess you are also using numpy to manipulate data (as matrix) ? If based on numpy, ans[i,:] means to pick the ith 'row' of ans with all of its 'columns'. Note,when dealing with numpy arrays, we should (almost) always use [i, j] instead of [i][j]. This might be counter-intuitive if you used Python or Java to manipulate matrix before.
So I'm finished one part of this assignment I have to do. There's only one part of the assignment that doesn't make any sense to me. I'm doing a LinearRegression model and according to others I need to apply ans[i,:] = y_poly at the very end, but I never got an answer as to why. Can someone please explain to me what [i,:] means? I haven't found any explanations online.
0
1
7,360
0
54,477,319
0
0
0
0
1
true
0
2019-02-01T00:17:00.000
0
1
0
Keras giving error "ModuleNotFoundError: No module named 'tensorflow'" even though tensorflow-gpu is installed
54,471,160
1.2
python,tensorflow,keras
I just reinstalled both tf and keras and now everything is working fine. Don't know what had went wrong. Maybe the installation was not proper first time.
I have tensorflow-gpu and keras installed in Python 3.6.8. But when I tried importing keras, it is giving the the error of Module not found. Also the error statements show the error is at a line inside keras at import tensorflow as tf. How to make keras import tensorflow-gpu instead of tensorflow? Do I have to go to the library code and change it? Or what else is the solution?
0
1
1,130
0
54,485,647
0
0
0
0
2
false
0
2019-02-01T09:06:00.000
0
4
0
Clustering structured data in Deep learning
54,476,162
0
python,deep-learning,cluster-analysis,data-science
Yes. If you do a little bit of literature research yourself you will find that people have repeatedly published clustering with deep neural networks. Except that it doesn't seem to work anywhere but on MNIST data...
Are there any Deep Learning literature/references where they performed clustering in structured data? I know it can be done using Kmeans, GMM etc. But is there any chance that cluster analysis to be done using Deep Neural Nets and the like? Thanks.
0
1
490
0
55,927,272
0
0
0
0
2
false
0
2019-02-01T09:06:00.000
0
4
0
Clustering structured data in Deep learning
54,476,162
0
python,deep-learning,cluster-analysis,data-science
Two other Potential Methods: KMeans + Autoencoder (a simple deep learning architecture with kmeans and reducing the dimensionality of the data using autoencoders). Deep Embedded Clustering algorithm (advanced deep learning)
Are there any Deep Learning literature/references where they performed clustering in structured data? I know it can be done using Kmeans, GMM etc. But is there any chance that cluster analysis to be done using Deep Neural Nets and the like? Thanks.
0
1
490
0
54,650,272
0
0
0
0
1
true
2
2019-02-01T10:12:00.000
0
1
0
AttributeError: type object 'h5py.h5r.Reference' has no attribute '__reduce_cython__' on using "from keras.utils import HDF5Matrix"
54,477,273
1.2
python,tensorflow,keras,hdf5
I got the solution. It was because I was importing both HDF5Matrix and tables in same program. Due to some reason both cannot be imported in same program. I think it is because both make use of h5py in backend, so importing both is causing some conflict.
I just reinstalled python into my system with all necessary modules. But when I run a program with the import statement from keras.utils import HDF5Matrix, it is giving attribute error. The place where the error is coming is: File "h5py\h5r.pxd", line 21, in init h5py._conv File "h5py\h5r.pyx", line 145, in init h5py.h5r. But when I run the same statement in the IDLE directly, it is not giving any error. So, what is the cause of error. I have not posted my code because most of it is irrelevant as the Interpreter is not going past the import statement. Also, before I reinstalled Python, the code was working fine. So, what can be the problem.
0
1
3,723
0
54,485,609
0
0
0
0
1
false
0
2019-02-01T12:53:00.000
0
1
0
Clustering: if my features are all in 0-1 range do i still have to use standard scaling
54,479,965
0
python-3.x,cluster-analysis
You don't "have" to use either. Standard scaling as well as [0;1] scaling (which is not the same) are just two popular heuristics for weighting variables. Neither is "correct*. If you have a better reason to weight variables differently, you may as well just do that. Things don't get more "correct" by scaling. Reducing the weight of that 8000 variable likely is a good idea. But if that question arises, it probably means you have not understood the problem that you are trying to solve... You are just using a huge, without a plan.
I am trying to run clustering algorithm on a dataset with 14 features. Of those features, except for one, every feature lies between 0 to 1. The remaining one feature is a continuous variable between 0 to 8000. Do i need to use the standard scaler on all the features or just this one feature ( 0 - 8000) before clustering?? OR do i just use the min-max scaler for this one feature alone??
0
1
20
0
54,485,944
0
0
0
0
1
true
0
2019-02-01T19:12:00.000
1
1
0
PyTorch: Is there a way to store model in CPU ram, but run all operations on the GPU for large models?
54,485,815
1.2
python,gpu,cpu,pytorch
I do not believe this is possible. However, one easy work around would be to split you model into sections that will fit into gpu memory along with your batch input. Send the first part(s) of the model to gpu and calculate outputs Release the former part of the model from gpu memory, and send the next section of the model to the gpu. Input the output from 1 into the next section of the model and save outputs. Repeat 1 through 3 until you reach your models final output.
From what I see, most people seem to be initializing an entire model, and sending the whole thing to the GPU. But I have a neural net model that is too big to fit entirely on my GPU. Is it possible to keep the model saved in ram, but run all the operations on the GPU?
0
1
162
0
54,488,348
0
1
0
0
1
false
0
2019-02-01T23:10:00.000
0
1
0
Error when trying to import matplotlib: "import is not recognized as internal or external command"
54,488,308
0
python,anaconda
You are not running import matplotlib in a python interpreter. Run python.exe first
On my Anaconda navigator, matplotlib is installed however when I run import matplotlib it will give me an error message saying: "import is not recognized as internal or external command, operable program or batch file." Did I not download it? How do I check that I've successfully installed it?
0
1
323
0
54,777,333
0
0
0
0
1
false
0
2019-02-02T00:39:00.000
0
1
0
innerjoin between two large pandas dataframe using dask
54,488,890
0
python,pandas,distributed-computing,dask
You might try using smaller partitions. Recall that the memory use of joins depend on how many shared rows there are. Depending on your data the memory use of an output partition may be much larger than the memory use of your input partitions.
I have two large tables with one of them is relatively small ~8Million rows and one column. Other is large 173Million rows and one column. The index of the first data frame is IntervalIndex (eg (0,13], (13, 20], (20, 23], ...) and the second one is ordered numbers (1,2,3, ...). Both DataFrame are sorted so DF1 category (0,13] 1 (13 20] 2 .... Df2 Value 1 5.2 2 3.4 3 7.8 Desired Df3 index value category 1 5.2 1 2 3.4 1 3 7.8 1 I want two obtain inner join (faster algorithm) that returns inner join similar to MySQL on data_frame2.index I would like to be able to perform it in an elaborate way in a cluster because when I PRODUCED THE INNERJOIN WITH SMALLER SECOND DATASET THE RESULT ARE SO MEMORY CONSUMING IMAGINE 105MEGABYTE for 10 rows using map_partitions. Another problem is that I cannot use scatter twice, given if first DaskDF=client.scatter(dataframe2) followed by DaskDF=client.submit(fun1,DaskDF) I am unable to do sth like client.submit(fun2,DaskDF).
0
1
343
0
54,505,574
0
0
0
0
1
false
0
2019-02-02T02:41:00.000
0
2
0
Loading and using a trained TensorFlow model in Python
54,489,497
0
python,tensorflow
(Answering my own question) I realized that the easiest way to do this was to use the tf.estimator API. By initializing an estimator that warm starts from the model directory, it's possible to just call estimator.predict and pass the correct args (predict_fn) and get the predictions immediately. It's not required to deal with the graph variables in any way.
I trained a model in TensorFlow using the tf.estimator API, more specifically using tf.estimator.train_and_evaluate. I have the output directory of the training. How do I load my model from this and then use it? I have tried using the tf.train.Saver class by loading the most recent ckpt file and restoring the session. However, then to call sess.run() I need to know what the name of the output node of the graph is so I can pass this to the fetches argument. What is the name/how can I access this output node? Is there a better way to load and use the trained model? Note that I have already trained and saved the model in a ckpt file, so please do not suggest that I use the simple_save function.
0
1
215
0
54,490,809
0
0
0
0
2
false
0
2019-02-02T05:43:00.000
2
2
0
Finding corners of a polygon represented in a 2D array
54,490,347
0.197375
python
i have an idea about how u can make a function for this by your self. according to what i understand only the for corners can have more than one "0" next to it. if you take array[x,y] to be a point. array[x-1,y],array[x+1,y],array[x,y+1],array[x,y-1] are the 4 point close to it. you can make a loop to go through the array checking the four neighbors if the value is "1" and count the number of neighbors which has value "0". those point that has more than one(has two) neighbors with value "0" are you four corners.
I have a 2D array of 0's and 1's where the 1's represent the edges and inside of a quadrilateral, and 0's are everything outside. What is the best way to find the coordinates of the four corners? I'm using Python so any libraries that can help are fine, but an algorithm in any language would be helpful as well.
0
1
815
0
54,490,817
0
0
0
0
2
true
0
2019-02-02T05:43:00.000
1
2
0
Finding corners of a polygon represented in a 2D array
54,490,347
1.2
python
In the absolutely general case (e.g. allowing for concave hulls or darn-near-triangular shapes) this will involve some uncertainty. But since you are dealing with a restricted subclass, it's easier. You might start with kernel convolution. Consider overlapping squares of (say) 3x3 pixels: you can design a function that tells you if the center is inside (all ones), outside (all zeros), on an edge, or at a corner, based on patterns of points. On the other hand, you could take the "convex hull" approach: the leftmost and rightmost 1-pixels are probably corners; if several appear at the same column, take the uppermost/lowermost respectively. Using the line between them, you can tell if the bulk of 1-pixels are above, below, or on both sides of the line; this tells you where to look for the other corners.
I have a 2D array of 0's and 1's where the 1's represent the edges and inside of a quadrilateral, and 0's are everything outside. What is the best way to find the coordinates of the four corners? I'm using Python so any libraries that can help are fine, but an algorithm in any language would be helpful as well.
0
1
815
0
57,942,410
0
0
0
0
4
false
3
2019-02-02T15:59:00.000
4
6
0
How to set fixed step size with scipy.integrate?
54,494,770
0.132549
python,scipy,integrate,runge-kutta
Scipy.integrate is usually used with changeable step method by controlling the TOL(one step error) while integrating numerically. The TOL is usually computed by checking with another numerical method. For example RK45 uses the 5th order Runge-Kutta to check the TOL of the 4th order Runge-Kutta method to determine the integrating step. Hence if you must integrate ODEs with fixed step, just turn off the TOL check by setting atol, rtol with a rather large constant. For example, like the form: solve_ivp(your function, t_span=[0, 10], y0=..., method="RK45", max_step=0.01, atol = 1, rtol = 1) The TOL check is set to be so large that the integrating step would be the max_step you choose.
I am looking for a way to set a fixed step size for solving my initial value problem by Runge-Kutta method in Python. Accordingly, how I can tell the scipy.integrate.RK45 to keep a constant update (step size) for its integration procedure? Thank you very much.
0
1
5,393
0
64,495,201
0
0
0
0
4
false
3
2019-02-02T15:59:00.000
2
6
0
How to set fixed step size with scipy.integrate?
54,494,770
0.066568
python,scipy,integrate,runge-kutta
If you are interested in data-wise fix step size, then I highly recommend you to use the scipy.integrate.solve_ivp function and its t_eval argument. This function wraps up all of the scipy.integrate ode solvers in one function, thus you have to choose the method by giving value to its method argument. Fortunately, the default method is the RK45, so you don't have to bother with that. What is more interesting for you is the t_eval argument, where you have to give a flat array. The function samples the solution curve at t_eval values and only returns these points. So if you want a uniform sampling by the step size then just give the t_eval argument the following: numpy.linspace(t0, tf, samplingResolution), where t0 is the start and tf is the end of the simulation. Thusly you can have uniform sampling without having to resort fix step size that causes instability for some ODEs.
I am looking for a way to set a fixed step size for solving my initial value problem by Runge-Kutta method in Python. Accordingly, how I can tell the scipy.integrate.RK45 to keep a constant update (step size) for its integration procedure? Thank you very much.
0
1
5,393
0
64,773,397
0
0
0
0
4
false
3
2019-02-02T15:59:00.000
1
6
0
How to set fixed step size with scipy.integrate?
54,494,770
0.033321
python,scipy,integrate,runge-kutta
You've said you want a fixed-time step behaviour, not just a fixed evluation time step. Therefore, you have to "hack" your way through that if you not want to reimplement the solver yourself. Just set the integration tolerances atol and rtol to 1e90, and max_step and first_step to the value dt of the time step you want to use. This way the estimated integration error will always be very small, thus tricking the solver into not shrinking the time step dynamically. However, only use this trick with EXPLICIT algortithms (RK23,RK45,DOP853) ! The implicit algorithms from "solve_ivp" (Radau, BDF, maybe LSODA as well) adjust the precision of the nonlinear Newton solver according to atol and rtol, therefore you might end up having a solution which does not make any sense...
I am looking for a way to set a fixed step size for solving my initial value problem by Runge-Kutta method in Python. Accordingly, how I can tell the scipy.integrate.RK45 to keep a constant update (step size) for its integration procedure? Thank you very much.
0
1
5,393
0
66,190,287
0
0
0
0
4
false
3
2019-02-02T15:59:00.000
1
6
0
How to set fixed step size with scipy.integrate?
54,494,770
0.033321
python,scipy,integrate,runge-kutta
I suggest to write your own rk4 fixed step program in py. There are many internet examples to help. That guarantees that you know precisely how each value is being computed. Furthermore, there will normally be no 0/0 calculations and if so they will be easy to trace and prompt another look at the ode's being solved.
I am looking for a way to set a fixed step size for solving my initial value problem by Runge-Kutta method in Python. Accordingly, how I can tell the scipy.integrate.RK45 to keep a constant update (step size) for its integration procedure? Thank you very much.
0
1
5,393
0
54,509,633
0
0
0
0
1
false
0
2019-02-04T02:26:00.000
1
1
0
pandas read csv with extra commas and quotations in column
54,509,495
0.197375
python,pandas
Are you able to regenerate the csv? If yes, change the delimit character to a pipe, I.e | . If not, you may be forced to take the long route... because there is no way for any code to figure out which characters are delimiting/quoting and which are part of the value if you have both commas and quotes lurking inside the value. A workaround could involve leveraging the column position where this problem occurs... I.e first you could isolate the columns to the left of the troubled column, isolate all columns to the right, then all characters remaining are your troubled column. Can you post a few example rows? It would be good to see a few rows that have this issue, and a few that work fine
I'm reading a basic csv file where the columns are separated by commas. However, the body column is a string which may contain commas and quotations. For example, there are some cells like "Bahamas\", The" and "Germany, West" I have tried text = pd.read_table("input.txt", encoding = 'utf-16', quotechar='"', sep = ','), text = pd.read_table("input.txt", encoding = 'utf-16', quotechar='"', delimiter = ','). But they both cannot work. Is there a way to go around this problem?
0
1
372
0
54,530,692
0
0
0
0
1
false
0
2019-02-04T13:19:00.000
0
2
0
SURF: How could we get the value of sigma from the keypoint radius
54,517,035
0
opencv,image-processing,computer-vision,surf,opencv-python
This value s = size*1.2f/9.0f is not montioned in the bay's article scale= L*0.4 or scale= L* 1.2/3 any one can explain me this part??
In the SURF technique, and more precisely within the feature description stage, the authors have stated (if I understand correctly) that the description will be performed in a area of 20 times sigma. Sigma represents the scale on which the keypoint was detected. Sigma = 0.4 x L where L = 2^Octave x level+1. If we use the OpenCV implementation, the DetectAndCompute function computes, with the value of Keypoint.size, the radius of the circle surrounding the keypoint. My question is : How could we get the value of sigma from the radius value ?
0
1
95
0
54,541,372
0
0
0
0
1
false
0
2019-02-04T18:03:00.000
1
1
0
spark-submit --master local[n] cannot create multi-threads
54,521,867
0.197375
python,apache-spark,pyspark
Just find the problem: there is another user running his own spark task on the same instance which occupying resources.
I write pyspark code to deal with some spark-sql data. Last month, it worked perfectly when I ran spark-submit --master local[25]. From top command, I could see 25 python threads. However, nothing change but today the spark-submit only create one thread. I wonder what kind of things can cause such problem. This is on a ubuntu server on AWS, which has 16 CPU cores. The Spark version is 2.2.1 and Python is 3.6
0
1
68
0
54,809,376
0
0
0
0
1
true
0
2019-02-05T12:40:00.000
0
1
0
How to check learning feasibility on a binary classification problem with Hoeffding's inequality/VC dimension with Python?
54,534,664
1.2
python,machine-learning
Well here is how I handled it : I generate multiple train/test samples, run the algorithm on them, calculate Ein as the train set error, Eout estimated by the test set error, calculate how many times their differnces exceeds the value of epsilon (for a range of epsilons). And then I plot the curve of these rates of exceeding epsilon and the curve of the right side of the Hoeffding's /VC inequality so I see if the differences curve is always under the Hoeffding/VC's Bound curve, this informs me about the learning feasiblity.
I have a simple binary classification problem, and I want to assess the learning feasibility using Hoeffding's Inequality and also if possible VC dimension. I understand the theory but, I am still stuck on how to implement it in Python. I understand that In-sample Error (Ein) is the training Error. Out of sample Error(Eout) is the error on the test subsample I guess. But how do I plot the difference between these two errors with the Hoeffdings bound?
0
1
172
0
54,540,745
0
0
0
0
1
true
1
2019-02-05T18:17:00.000
1
1
0
Python: given a plane equation draw a subset of points that belong to it
54,540,676
1.2
python,matplotlib,linear-algebra,mplot3d
For a plane a simple approach that would work is pick a coefficient that's not 0 (let's suppose is c) pick random values for the other two coordinates (x and y in this case) compute z with (d - ax - by)/c
As the title say, let's assume I have a plane equation: ax+by+cz=d (e.g. -4x + 5y + 9z = -9) I want to draw n random points (let's say 500) that belong to that plane. Can somebody help me with that? I saw that from mpl_toolkits import mplot3d has the function plot_surface(x,y,z) but (as it says) it plots the surface equation and this is not what I need. Any help is really appreciated.
0
1
446
0
57,832,051
0
0
0
0
1
false
31
2019-02-05T22:54:00.000
0
6
0
Is it possible to do multivariate multi-step forecasting using FB Prophet?
54,544,285
0
python,machine-learning,time-series,forecasting,facebook-prophet
This might be late, however if you are reading this in 2019, you can implement multivariate time series using LSTM, Keras.
I'm working on a multivariate (100+ variables) multi-step (t1 to t30) forecasting problem where the time series frequency is every 1 minute. The problem requires to forecast one of the 100+ variables as target. I'm interested to know if it's possible to do it using FB Prophet's Python API. I was able to do it in a univariate fashion using only the target variable and the datetime variable. Any help and direction is appreciated. Please let me know if any further input or clarity is needed on the question.
0
1
28,022
0
54,551,132
0
0
0
0
1
false
9
2019-02-06T08:25:00.000
15
2
0
convert Dataframe to 2d Array
54,549,284
1
python,dataframe,conv-neural-network,convolution
You just need to call .values on the DataFrame. If for example your dataframe is called df, then you can pass df.values to your convolutional neural network.
I have a data-frame of size (140000,22) dimensions. i have to create 2d array of equal dimensions to pass it into convolution neural network . Can you please guide how to transform on this dataframe
0
1
21,926
0
54,557,235
0
0
0
0
1
true
1
2019-02-06T15:27:00.000
2
3
0
Can accuracy_score and precision_score be equal?
54,557,082
1.2
python,scikit-learn,logistic-regression,sklearn-pandas
Precision = True Positive / (True Positive + False Positive) Accuracy = (True Positive + True Negative) / (True Positive + False Positive + True Negative + False Negative) Therefore, if there are no negative predictions, these two values will be equal.
I am trying to build a logistic regression model in python 3 using sklearn library. Let's stick to below short versions going forward, dv - dependent variable idv - independent variable Now I have idv1, idv2, idv3, idv4, idv5, idv6, idv7, idv8 & idv9. Out of which idv6 to idv9 are categorical variables (idv6 & idv7 has 3 categories..where as idv8 & idv9 are boolean variables..yes or no kind of variables [0 or 1]) And dv is again a boolean variable (yes or no kind of variable). Now, I have created a dummies for all idv6 to idv9 for the final model data...i.e idv6_c1, idv6_c2, idv_c3 and followed similar for the remaining..like idv8_c1, idv8_c2 for idv8 & idv9. Now, after fitting the model and finding the metrics of the predicted values... I am getting let's say accuracy_score of 76.7415479670124 % and precision_score of 76.7415479670124 % I have calculated using sklearn.metrics.accuracy_score and sklearn.metrics.precision_score libraries. I am wondering..is this correct or am I missing something...?? Can this happen ??...accuracy & precision to be equal to almost 13 decimals ???....I am sure...I am doing something wrong...can anyone please help me ??
0
1
780
0
56,294,966
0
0
0
0
1
false
0
2019-02-06T17:21:00.000
1
2
0
Python equivalent for MATLAB binofit
54,559,209
0.099668
python,python-2.7
I think the function you suggested is good enough. I ran some test comparing Matlab binofit and Python statsmodels.stats.proportion.proportion_confint. The test was empyrical like testin 100K experiments like [phat,pci] = binofit(x,n,alpha) with min_conf,max_conf = proportion_confint(x,n,alpha=alpha,method='beta'). The RMSE bewteen confidence interval limits from Matlab and Python are below 5e-6 for values values of x and n between 0 and 10000. Tested with alpha=0.05 and 0.01. I know this is not strict demonstrations but for my project I decided to consider the two estimates of confidence intervals as equivalent.
In MATLAB, binofit returns the maximum likelihood estimate of the success of binomial probability distribution and confidence intervals. statsmodels.stats.proportion.proportion_confint returns confidence intervals as well, but couldn't find a function for maximum likelihood estimate of the binomial probability distribution. Is there any function that you can suggest as a binofit function in MATLAB for python?
0
1
319
0
66,913,904
0
1
0
0
1
false
18
2019-02-06T17:41:00.000
0
6
0
How to change python version in Anaconda?
54,559,566
0
python,tensorflow,anaconda,jupyter-notebook,jupyter
You just can change the python version by creating a new environment in anaconda. It will ask for the python version when you create an environment
I am trying to get into deep learning. I installed Anaconda to use jupyter and generally not to care about installing all of those packages like matplotlib etc myself. But I cannot install tensorflow as it works only with Python 3.4, 3.5, or 3.6 but I have 3.7. After I read about it I installed python 3.6.8. I uninstalled Anaconda and installed it again, nothing changed. After that, I used this command conda install python=3.6.8 to presumably install python 3.6.8 for it (I found this solution somewhere on the web). The command worked but didn't change anything. Please help
0
1
88,747
0
54,573,011
0
0
0
0
1
false
2
2019-02-07T04:21:00.000
1
2
0
How keras model H5 works in theory
54,566,249
0.099668
python,python-3.x,keras,deep-learning,conv-neural-network
When you save your model as h5-file, you save the model structure, all its parameters and further informations like state of your optimizer and so on. It is just an efficient way to save huge amounts of information. You could use json or xml file formats to do this as well. You can't classifiy anything only using this file (it is not executable). You have to rebuild the graph as a tensorflow graph from this file. To do so you simply use the load_model() function from keras, which returns a keras.models.Model object. Then you can use this object to classifiy new data, with keras predict() function.
After training the trained model will be saved as H5 format. But I didn't know how that H5 file can be used as classifier to classifying new data. How H5 model works in theory when classifying new data?
0
1
1,209
0
54,581,374
0
0
0
0
1
true
1
2019-02-07T17:57:00.000
1
1
0
Is there a way to find the n most distant vectors in an array?
54,579,473
1.2
python,vector,cluster-analysis,doc2vec,dimensionality-reduction
Wouldn't a random sample from all vectors necessarily encounter any of the various 'regions' in the set? If there are "natural joints" and clusters to the documents, some clustering algorithm should be able to find the N clusters, then the smaller number of NxN distances between each cluster's centroid to each other cluster's centroid might identify those "furthest out" clusters. Note for any vector, you can use the Doc2Vec doc-vectors most_similar() with a topn value of 0/false-ish to get the (unsorted) similarities to all other model doc-vectors. You could then find the least-similar vectors in that set. If your dataset is small enough for it to be practical to do this for "all" (or some large sampling) of doc-vectors, then perhaps other docs that appear in the "bottom N" least-similar, for the most number of other vectors, would be the most "far out". Whether this idea of "far out" is actually shown in the data, or useful, isn't clear. (In high-dimensional spaces, everything can be quite "far" from everything else in ways that don't match our 2d/3d intuitions, and slight differences in some vectors being a little "further" might not correspond to useful distinctions.)
I have an array of thousands of doc2vec vectors with 90 dimensions. For my current purposes I would like to find a way to "sample" the different regions of this vector space, to get a sense of the diversity of the corpus. For example, I would like to partition my space into n regions, and get the most relevant word vectors for each of these regions. I've tried clustering with hdbscan (after reducing the dimensionality with UMAP) to carve the vector space at its natural joints, but it really doesn't work well. So now I'm wondering whether there is a way to sample the "far out regions" of the space (n vectors that are most distant from each other). Would that be a good strategy? How could I do this? Many thanks in advance!
0
1
244
0
54,585,712
0
1
0
0
1
true
3
2019-02-08T03:38:00.000
9
1
0
How to reset Colab after the following CUDA error 'Cuda assert fails: device-side assert triggered'?
54,585,685
1.2
python,pytorch,google-colaboratory,tensor
You need to reset the Colab notebook. To run existing Pytorch modules that used to work before, you have to do the following: Go to 'Runtime' in the tool bar Click 'Restart and Run all' This will reset your CUDA assert and flush out the module so that you can have another shot at avoiding the error!
I'm running my Jupyter Notebook using Pytorch on Google Colab. After I received the 'Cuda assert fails: device-side assert triggered' I am unable to run any other code that uses my pytorch module. Does anyone know how to reset my code so that my Pytorch functions that were working before can still run? I've already tried implementing CUDA_LAUNCH_BLOCKING=1but my code still doesn't work as the Assert is still triggered!
0
1
11,545
0
54,720,270
0
0
0
0
1
false
0
2019-02-08T04:55:00.000
0
1
0
I´m trying to filter data of colums from a Data Frame, but the index names contain white spaces
54,586,159
0
python,pandas,filter,row,spaces
Hi everyone I found the solution. The problem with the method I used was it did not work when the index had spaces in the name so there is another way to get rid of the null values using the following structure: df1 = df[df["ColumnName With Spaces"].notnull()] From here you will filter all the rows in the "df" with index "ColumnName With Spaces" thet contain null values.
I`m trying to filter the rows of a Data Frame, but since the index name of the column has white spaces, I've not been able to do it The DDTS Number is the name of the column It worked when there is no spaces data[data3.(DDTS Number) != null] I've tried different syntax but I don't if there is way to do it without to rename the column name
0
1
36
0
54,623,195
0
0
0
0
1
true
1
2019-02-08T06:28:00.000
1
1
0
Why random_state parameter is used in NMF and LDA algorithm ? What are the benefits of using random topics generated every time?
54,587,051
1.2
python,lda,topic-modeling,nmf
The algorithms for both are stochastic - meaning they use randomness as a part of estimating a good answer. It's done that way to make it tractable, and in the case of LDA, the whole model is stochastic, providing you ideally with a probabilistic distribution (called "the posterior distribution") of answers, but instead providing a single, likely answer as an estimate. So the answer is that using randomness in the algorithms makes a tremendously difficult problem much simpler and feasible to calculate in less than a hundred years. If you're going to use them, I think it would do you well to study them, learn something of how they work, why they work. Using a tool that you don't understand is risky, as you don't really know what the result the tool provides actually means. One example is the numerors words in all "topics" with very low probability. The differences in these probabilities are actually meaningless - given a different sample from the posterior, you'd get different probabilities, ranked differently between words.
For Topic Modelling , Why random_state parameter is used in NMF and LDA algorithm ? What are the benefits of using random topics generated every time ?
0
1
545
0
54,603,217
0
0
0
0
1
false
4
2019-02-09T02:31:00.000
3
1
0
Simplest way to index within a dimension
54,602,610
0.53705
python,tensorflow
Found it! tf.batch_gather and tf.batch_scatter.
I have two tensors x and y that have equal shape in the first k dimensions. The second tensor contains indices to retrieve values from the first along to the last dimension. For a rank of 3, then the output z should be such that z[i_1, i_2,...,i_k, j] = x[i_1, i_2,...,i_k, y[i_1, i_2, ...,i_k, j]]. I currently have a method that requires reshaping the x and y, appending row indices of y, using gather_nd and finally returning to the original shape. Is there is a more elegant method? Is there a way to get the tensor of indices (like np.indices), preferably that does not require knowledge of the rank or shape beyond that they satisfy the above condition?
0
1
46
0
54,608,871
0
0
0
0
1
false
0
2019-02-09T15:50:00.000
0
1
0
How to reach streaming learning in Neural network?
54,607,881
0
python,tensorflow,machine-learning
There is no some special function for it in TensorFlow. You make a single training pass over a new chunk of data. And then another training pass over another new chunk of data, etc till you reach the end of the data stream (which, hopefully, will never happen).
As title, I know there're some model supporting streaming learning like classification model. And the model has function partial_fit() Now I'm studying regression model like SVR and RF regressor...etc in scikit. But most of regression models doesn't support partial_fit . So I want to reach the same effect in neural network. If in tensorflow, how to do like that? Is there any keyword?
0
1
29
0
54,611,524
0
0
0
0
1
true
3
2019-02-09T18:33:00.000
8
1
0
Instance normalization and group normalization missing update
54,609,375
1.2
python,tensorflow
You should understand why does batch_norm need to add ops in UPDATE_OPS. tf.layers.batch_normalization function will generate four variables, namely gamma, beta, moving_mean and moving_variance, and only gamma, beta are in tf.GraphKeys.TRAINABLE_VARIABLES. When it is in the training phase, moving_mean and moving_variance also need to be updated, so that if we set training parameter as 1 for tf.layers.batch_normalization, the function will add corresponding ops into tf.GraphKeys.UPDATE_OPS for updating moving_mean and moving_variance, whereas if we set training parameter as 0 for tf.layers.batch_normalization, the function will not do anything to tf.GraphKeys.UPDATE_OPS, since it doesn't need to update moving_mean and moving_variance in the test phase. As for the group_norm and instance_norm, they only have beta and gamma variables, which have already been in the tf.GraphKeys.TRAINABLE_VARIABLES, so that there is no need to add any ops in tf.GraphKeys.UPDATE_OPS.
In tensorflow, there is well-known batch normalization which adds the weights update ops to tf.GraphKeys.UPDATE_OPS. But in the case of instance normalization there is no update op added. When using tf.contrib.layer.batch_norm, I can specify the is_training parameter which adds the update op to collection. But for tf.contrib.layer.instance_norm and tf.contrib.layer.group_norm there is no such parameter, and also no op is added to tf.GraphKeys.UPDATE_OPS. Is this correct behaviour, or bug in tensorflow? How does the update op in instance normalization work then?
0
1
918
0
54,617,927
0
1
0
0
1
false
2
2019-02-10T15:10:00.000
0
2
0
dependent variable One hot encoder
54,617,771
0
python,machine-learning
OneHotEncoder will create k number of columns if there are k classes for a single variable. For example : it will create 2 variables if gender values in that dataset are Male/Female, It will create 3 Variables if gender values are male/Female/PreferNotToSay Now, You don't want multiple variables in your predicate y, So better go with LabelEncoder(from sklearn.preprocessing) or some mechanism that keeps the dimensionality intact.
I am new to machine learning my question is: Do we need to encode dependent variable y if it contains three class segments 1,2,3 and I want to know if there is need to encode the dependent variable when it contains no
0
1
1,860
0
56,425,972
0
0
0
0
2
true
3
2019-02-11T05:44:00.000
6
2
0
Back-propagation and forward-propagation for 2 hidden layers in neural network
54,624,562
1.2
python,neural-network,deep-learning
● Let X be a matrix of samples with shape (n, d), where n denotes number of samples, and d denotes number of features. ● Let wh1 be the matrix of weights - of shape (d, h1) , and ● Let bh1 be the bias vector of shape (1, h1). You need the following steps for forward and backward propagations: ► FORWARD PROPAGATION: ⛶ Step 1: Zh1       =       [ X   •   wh1 ]     +     bh1 ↓                       ↓         ↓                   ↓ (n,h1)     (n,d)   (d,h1)     (1,h1) Here, the symbol • represents matrix multiplication, and the h1 denotes the number of hidden units in the first hidden layer. ⛶ Step 2: Let Φ() be the activation function. We get. ah1     =     Φ (Zh1)   ↓                   ↓ (n,h1)       (n,h1) ⛶ Step 3: Obtain new weights and biases: ● wh2 of shape (h1, h2), and ● bh2 of shape (1, h2). ⛶ Step 4: Zh2       =       [ ah1   •   wh2 ]     +     bh2 ↓                       ↓           ↓                   ↓ (n,h2)     (n,h1)   (h1,h2)     (1,h2) Here, h2 is the number of hidden units in the second hidden layer. ⛶ Step 5: ah2     =     Φ (Zh2)   ↓                   ↓ (n,h2)       (n,h2) ⛶ Step 6: Obtain new weights and biases: ● wout of shape (h2, t), and ● bout of shape (1, t). Here, t is the number of classes. ⛶ Step 7: Zout       =       [ ah2   •   wout ]     +     bout ↓                         ↓           ↓                   ↓ (n,t)       (n,h2)   (h2,t)     (1,t) ⛶ Step 8: aout     =     Φ (Zout)   ↓                   ↓ (n,t)       (n,t) ► BACKWARD PROPAGATION: ⛶ Step 1: Construct the one-hot encoded matrix of the unique output classes ( yone-hot ). Errorout     =     aout   -   yone-hot     ↓                     ↓               ↓ (n,t)           (n,t)       (n,t) ⛶ Step 2: Δwout     =     η ( ah2T   •   Errorout )     ↓                       ↓               ↓ (h2,t)         (h2,n)     (n,t) Δbout     =     η [ ∑ i=1n  (Errorout,i) ]     ↓                                 ↓ (1,t)                     (1,t) Here η is the learning rate. wout = wout - Δwout         (weight update.) bout = bout - Δbout         (bias update.) ⛶ Step 3: Error2     =     [Errorout   •   woutT]   ✴   Φ/ (ah2)     ↓                     ↓                   ↓                   ↓ (n,h2)         (n,t)         (t,h2)       (n,h2) Here, the symbol ✴ denotes element wise matrix multiplication. The symbol Φ/ represents derivative of sigmoid function. ⛶ Step 4: Δwh2     =     η ( ah1T   •   Error2 )     ↓                       ↓               ↓ (h1,h2)         (h1,n)     (n,h2) Δbh2     =     η [ ∑ i=1n  (Error2,i) ]     ↓                                 ↓ (1,h2)                     (1,h2) wh2 = wh2 - Δwh2         (weight update.) bh2 = bh2 - Δbh2         (bias update.) ⛶ Step 5: Error3     =     [Error2   •   wh2T]   ✴   Φ/ (ah1)     ↓                     ↓               ↓                   ↓ (n,h1)       (n,h2)     (h2,h1)       (n,h1) ⛶ Step 6: Δwh1     =     η ( XT   •   Error3 )     ↓                     ↓               ↓ (d,h1)         (d,n)     (n,h1) Δbh1     =     η [ ∑ i=1n  (Error3,i) ]     ↓                                 ↓ (1,h1)                     (1,h1) wh1 = wh1 - Δwh1         (weight update.) bh1 = bh1 - Δbh1         (bias update.)
My question is about forward and backward propagation for deep neural networks when the number of hidden units is greater than 1. I know what I have to do if I have a single hidden layer. In case of a single hidden layer, if my input data X_train has n samples, with d number of features (i.e. X_train is a (n, d) dimensional matrix, y_train is a (n,1) dimensional vector) and if I have h1 number of hidden units in my first hidden layer, then I use Z_h1 = (X_train * w_h1) + b_h1 (where w_h1 is a weight matrix with random number entries which has the shape (d, h1) and b_h1 is a bias unit with shape (h1,1). I use sigmoid activation A_h1 = sigmoid(Z_h1) and find that both A_h1 and Z_h1 have shapes (n, h1). If I have t number of output units, then I use a weight matrix w_out with dimensions (h1, t) and b_out with shape (t,1) to get the output Z_out = (A_h1 * w_h1) + b_h1. From here I can get A_out = sigmoid(Z_out) which has shape (n, t). If I have a 2nd hidden layer (with h2 number of units) after the 1st hidden layer and before the output layer, then what steps must I add to the forward propagation and which steps should I modify? I also have idea about how to tackle backpropagation in case of single hidden layer neural networks. For the single hidden layer example in the previous paragraph, I know that in the first backpropagation step (output layer -> hidden layer1), I should do Step1_BP1: Err_out = A_out - y_train_onehot (here y_train_onehot is the onehot representation of y_train. Err_out has shape (n,t). This is followed by Step2_BP1: delta_w_out = (A_h1)^T * Err_out and delta_b_out = sum(Err_out). The symbol (.)^T denotes the transpose of matrix. For the second backpropagation step (hidden layer1 -> input layer), we do the following Step1_BP2: sig_deriv_h1 = (A_h1) * (1-A_h1). Here sig_deriv_h1 has shape (n,h1). In the next step, I do Step2_BP2: Err_h1 = \Sum_i \Sum_j [ ( Err_out * w_out.T)_{i,j} * sig_deriv_h1__{i,j} )]. Here, Err_h1 has shape (n,h1). In the final step, I do Step3_BP2: delta_w_h1 = (X_train)^T * Err_h1 and delta_b_h1 = sum(Err_h1). What backpropagation steps should I add if I have a 2nd hidden layer (h2 number of units) after the 1st hidden layer and before the output layer? Should I modify the backpropagation steps for the one hidden layer case that I have described here?
0
1
1,732
0
54,625,251
0
0
0
0
2
false
3
2019-02-11T05:44:00.000
1
2
0
Back-propagation and forward-propagation for 2 hidden layers in neural network
54,624,562
0.099668
python,neural-network,deep-learning
For Forward Propagation, the dimension of the output from the first hidden layer must cope up with the dimensions of the second input layer. As mentioned above, your input has dimension (n,d). The output from hidden layer1 will have a dimension of (n,h1). So the weights and bias for the second hidden layer must be (h1,h2) and (h1,h2) respectively. So w_h2 will be of dimension (h1,h2) and b_h2 will be (h1,h2). The dimensions for the weights and bias for the output layer will be w_output will be of dimension (h2,1) and b_output will be (h2,1). The same you have to repeat in Backpropagation.
My question is about forward and backward propagation for deep neural networks when the number of hidden units is greater than 1. I know what I have to do if I have a single hidden layer. In case of a single hidden layer, if my input data X_train has n samples, with d number of features (i.e. X_train is a (n, d) dimensional matrix, y_train is a (n,1) dimensional vector) and if I have h1 number of hidden units in my first hidden layer, then I use Z_h1 = (X_train * w_h1) + b_h1 (where w_h1 is a weight matrix with random number entries which has the shape (d, h1) and b_h1 is a bias unit with shape (h1,1). I use sigmoid activation A_h1 = sigmoid(Z_h1) and find that both A_h1 and Z_h1 have shapes (n, h1). If I have t number of output units, then I use a weight matrix w_out with dimensions (h1, t) and b_out with shape (t,1) to get the output Z_out = (A_h1 * w_h1) + b_h1. From here I can get A_out = sigmoid(Z_out) which has shape (n, t). If I have a 2nd hidden layer (with h2 number of units) after the 1st hidden layer and before the output layer, then what steps must I add to the forward propagation and which steps should I modify? I also have idea about how to tackle backpropagation in case of single hidden layer neural networks. For the single hidden layer example in the previous paragraph, I know that in the first backpropagation step (output layer -> hidden layer1), I should do Step1_BP1: Err_out = A_out - y_train_onehot (here y_train_onehot is the onehot representation of y_train. Err_out has shape (n,t). This is followed by Step2_BP1: delta_w_out = (A_h1)^T * Err_out and delta_b_out = sum(Err_out). The symbol (.)^T denotes the transpose of matrix. For the second backpropagation step (hidden layer1 -> input layer), we do the following Step1_BP2: sig_deriv_h1 = (A_h1) * (1-A_h1). Here sig_deriv_h1 has shape (n,h1). In the next step, I do Step2_BP2: Err_h1 = \Sum_i \Sum_j [ ( Err_out * w_out.T)_{i,j} * sig_deriv_h1__{i,j} )]. Here, Err_h1 has shape (n,h1). In the final step, I do Step3_BP2: delta_w_h1 = (X_train)^T * Err_h1 and delta_b_h1 = sum(Err_h1). What backpropagation steps should I add if I have a 2nd hidden layer (h2 number of units) after the 1st hidden layer and before the output layer? Should I modify the backpropagation steps for the one hidden layer case that I have described here?
0
1
1,732
0
54,629,669
0
0
0
0
2
true
3
2019-02-11T11:28:00.000
3
4
0
Fastest way in numpy to sum over upper triangular elements with the least memory
54,629,601
1.2
python,arrays,performance,numpy
You can replace np.diag(A).sum() with np.trace(A); this will not create the temporary Nx1 array
I need to perform a summation of the kind i<j on symmetric matrices. This is equivalent to sum over the upper triangular elements of a matrix, diagonal excluded. Given A a symmetric N x N array, the simplest solution is np.triu(A,1).sum() however I was wondering if faster methods exist that require less memory. It seems that (A.sum() - np.diag(A).sum())/2 is faster on large array, but how to avoid creating even the N x 1 array from np.diag? A doubly nested for loop would require no additional memory, but it is clearly not the way to go in Python.
0
1
1,810
0
54,630,624
0
0
0
0
2
false
3
2019-02-11T11:28:00.000
1
4
0
Fastest way in numpy to sum over upper triangular elements with the least memory
54,629,601
0.049958
python,arrays,performance,numpy
The fastest method with the least memory, in pure numpy is going to be to sum the entire thing and subtract the diagonal. It may feel wasteful in terms of FLOPS, but note that the theoretical savings relative to that implementation are only a factor 2. If that means anything to you, you probably should not be using numpy in the first place. Also, numpy fundamentally deals with blocks of memory addressable as strided views. If you could get a single strided view onto your triangle, it might lead to an efficient numpy implementation. But you cant (proof left as exercise to the reader), so you can safely forget about any true numpy solution that isnt a call to an optimized C-routine that solves your problem for you. And none exist that I am aware. But even that 'optimized' C loop may in practice get its ass kicked by A.sum(). If A is contiguous, that sum has the potential to dispatch a maximally cache-optimized and SIMD-optimized codepath. Likely, any vanilly-C youd write yourself would get absolutely demolished by A.sum() in a benchmark.
I need to perform a summation of the kind i<j on symmetric matrices. This is equivalent to sum over the upper triangular elements of a matrix, diagonal excluded. Given A a symmetric N x N array, the simplest solution is np.triu(A,1).sum() however I was wondering if faster methods exist that require less memory. It seems that (A.sum() - np.diag(A).sum())/2 is faster on large array, but how to avoid creating even the N x 1 array from np.diag? A doubly nested for loop would require no additional memory, but it is clearly not the way to go in Python.
0
1
1,810
0
54,661,633
0
0
0
0
1
true
4
2019-02-11T17:56:00.000
0
1
0
nlp multilabel classification tf vs tfidf
54,636,433
1.2
python,nlp,tf-idf,multilabel-classification,tfidfvectorizer
Tf method can give importance to common words more than necessary rather use Tfidf method which gives importance to words that are rare and unique in the particular document in the dataset. Also before selecting Kbest rather train on the whole set of features and then use feature importance to get the best features. You can also try using Tree Classifiers or XGB ones to better model but SVC is also very good classifier. Try using Naive Bayes as the minimum standard of f1 score and try improving your results on other classifiers with the help of grid search.
I am trying to solve an NLP multilabel classification problem. I have a huge amount of documents that should be classified into 29 categories. My approach to the problem was, after cleaning up the text, stop word removal, tokenizing etc., is to do the following: To create the features matrix I looked at the frequency distribution of the terms of each document, I then created a table of these terms (where duplicate terms are removed), I then calculated the term frequency for each word in its corresponding text (tf). So, eventually I ended up with around a 1000 terms and their respected frequency in each document. I then used selectKbest to narrow them down to around 490. and after scaling them I used OneVsRestClassifier(SVC) to do the classification. I am getting an F1 score around 0.58 but it is not improving at all and I need to get 0.62. Am I handling the problem correctly? Do I need to use tfidf vectorizer instead of tf, and how? I am very new to NLP and I am not sure at all what to do next and how to improve the score. Any help in this subject is priceless. Thanks
0
1
240
0
54,640,039
0
0
0
0
1
false
2
2019-02-11T22:14:00.000
1
2
0
Run a polynomial regression without combinations of the features
54,639,963
0.099668
python,scikit-learn,regression,polynomials,non-linear-regression
Tbh, this seems like very weird idea to me. A lot of strength of poly features come out of interaction features. I'm pretty sure there's nothing built-in, but you can take a look at PolynomialFeatures pre-processor, and make your own with modification. You'll need to "revert" logic of interaction_only parameter just build your pre-processor, your case is quite simple, .fit will do smth like concat(a, a**2)
I am running a polynomial regression for order p. To make it simple, we use order p = 2 in this question. Suppose we have X with two feature x1, x2 and y. And I am trying to run a polynomial regression of y = ε + α + β1•x1 + β2•x2 + β3•x1^2 + β4•x2^2 I find that the sklearn have a sklearn.preprocessing.PolynomialFeatures. However, if I use order p = 2 and it automatically gives the combination of features. It will result in a regression of: y = ε + α + β1•x1 + β2•x2 + β3•x1^2 + β4•x2^2 + β5•x1x2 However, I do not want the combination of the features, i.e. things like x1x2. Is there any package that can do the polynomial regress as I wished? Thanks!
0
1
843
0
54,641,758
0
1
0
0
1
false
1
2019-02-12T01:46:00.000
1
1
0
How can I convert .mat files to NumPy files in Python?
54,641,709
0.197375
python-3.x
I think you have two options to read it. Reading it in python: import scipy.io mat = scipy.io.loadmat('fileName.mat') Converting it to .csv in MATLAB in order to read it in python later: FileData = load('FileName.mat'); csvwrite('FileName.csv', FileData.M);
So I have a .mat file It is a little over 1 GB but I don't know how much data or lines of code is on it. I want to convert this .mat file to a NumPy file in Python so I can look at the data and see what is in it. How do I do this conversion?
0
1
3,092
0
54,647,401
0
0
0
0
1
false
0
2019-02-12T09:55:00.000
0
1
0
How to create a word2vector model from imdb dataset and get it's featuremap using CNN
54,647,276
0
python,nltk,word2vec,sentiment-analysis
If the size of your dataset is quite large you can easily employ Deep Learning to complete your project. First, you need to create a pipeline to convert your data into well representable form, and then feed into the model. And do not worry about computational costs if you are writing in TensorFlow, the Google Cloud TPU offers free service on Google Colab.
I'm a newbie to python, i need to complete a project on IMDB Review sentiment analysis. I did not quiet understand how to train the imdb dataset aclImdb_v1.tar to a model. Please show me how to train a model from this dataset. Below is the method I need to implement for my project. Text Reviews -> Embedded Layer -> Word vector generation -> CNN -> Feature Maps -> LSTM -> Classification layer The result I expect is to find if a review taken as input is either positive or negative. Please help me out and pardon my unknowledgeable words, if any..
0
1
84
0
54,650,088
0
0
0
0
1
true
1
2019-02-12T12:10:00.000
8
2
0
Does pandas read the whole file even when usecols is used?
54,649,847
1.2
python,pandas
According to the documentation, it will read the whole file (no way to only read columns from disk), but will only parse and store the columns given in the use_cols variable (emphasize mine): usecols : list-like or callable, optional Return a subset of the columns... Using this parameter results in much faster parsing time and lower memory usage.
I'm using pandas to read a file inside a rest service. The file is huge with more than 100 columns. But I only want to read just first two columns. I know I can use usecols in read_csv but I was wondering how exactly it works? Does pandas read the whole file and filter out the required columns? Or does it only read the required columns? I'm asking because I don't want to overload the memory.
0
1
454
0
54,711,863
0
0
0
0
1
false
2
2019-02-12T15:13:00.000
0
2
0
saspy: write large SAS table to local csv
54,653,191
0
python,csv,sas,saspy
With saspy V2.4.3, you could try to_csv() to create the csv file on the SAS server, then download(), which is new in 2.4.3, to pull the csv over to your local filesystem.
The SASData object has to_csv and to_df_CSV methods, but both of these write to locations on the host machine (where the SAS session is running). Is there a way to write a large SAS data table to .CSV on my local machine from a remote connection? The option on the saspy Github page was to get the DataFrame, via to_df, and then write that to .CSV, but this won't work in my case because the SAS table is bigger than memory. Must I read and write in chunks?
0
1
1,164
0
54,665,528
0
1
0
0
3
true
66
2019-02-13T08:24:00.000
70
5
0
ImportError: No module named 'pandas.core.internals.managers'; 'pandas.core.internals' is not a package
54,665,527
1.2
python,pandas,pickle
This error comes off due to encoding of formerly saved pickle file. If you updated pandas to newly amended version, it produces this import error.
When I tried to read a pickle file that saved by a former version of pandas, it yielded an ImportError. ImportError: No module named 'pandas.core.internals.managers'; 'pandas.core.internals' is not a package There was no hit on stackoverflow so i would like to share my solution for this particular problem.
0
1
62,757
0
54,785,333
0
1
0
0
3
false
66
2019-02-13T08:24:00.000
10
5
0
ImportError: No module named 'pandas.core.internals.managers'; 'pandas.core.internals' is not a package
54,665,527
1
python,pandas,pickle
I had the same problem, but for me, it seemed to come from the pickle package / interaction with the pandas package. I had Pandas version 0.23.4. I saved some pickle files with pandas.Dataframe.to_pickle, with python 3.6.6 & Pandas version 0.23.4. Then I upgraded to python 3.7.2 (Pandas version 0.23.4), and was enabled to read thoses pickle files with pandas.Dataframe.read_pickle. Next, I upgraded pandas to pandas 0.24.1, and it worked for me. I can read those files again.
When I tried to read a pickle file that saved by a former version of pandas, it yielded an ImportError. ImportError: No module named 'pandas.core.internals.managers'; 'pandas.core.internals' is not a package There was no hit on stackoverflow so i would like to share my solution for this particular problem.
0
1
62,757
0
58,784,510
0
1
0
0
3
false
66
2019-02-13T08:24:00.000
2
5
0
ImportError: No module named 'pandas.core.internals.managers'; 'pandas.core.internals' is not a package
54,665,527
0.07983
python,pandas,pickle
conda update pandas If you use conda package manager.
When I tried to read a pickle file that saved by a former version of pandas, it yielded an ImportError. ImportError: No module named 'pandas.core.internals.managers'; 'pandas.core.internals' is not a package There was no hit on stackoverflow so i would like to share my solution for this particular problem.
0
1
62,757
0
54,708,388
0
0
0
0
3
true
71
2019-02-13T08:43:00.000
102
3
0
When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath'
54,665,842
1.2
python-3.x,numpy,tensorflow,anaconda
I also had the same issue. It got resloved once i upgraded the numpy from 1.15.4 to 1.16.1. If you're using pip: pip install numpy --upgrade Numpy that came with Anaconda3 is of version 1.15.4. so i upgraded and it worked. Side note: if you're also using scikit-image in your script, be aware that numpy 1.16.3 has a conflict with old versions of scikit-image (e.g. you may get ImportError: cannot import name '_validate_lengths'). In that case, pip install --upgrade scikit-image from terminal solved the issue for me. Hope it helps!!
I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error: ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' ImportError: numpy.core.multiarray failed to import The above exception was the direct cause of the following exception: Traceback (most recent call last): File "", line 980, in _find_and_load SystemError: returned a result with an error set ImportError: numpy.core._multiarray_umath failed to import ImportError: numpy.core.umath failed to import I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python. I am using Windows10. Thanks in advance.
0
1
76,204
0
56,179,177
0
0
0
0
3
false
71
2019-02-13T08:43:00.000
2
3
0
When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath'
54,665,842
0.132549
python-3.x,numpy,tensorflow,anaconda
You can use two options in python 3.6 Install py pip -m install numpy==1.14.5 Upgrade py pip install numpy --upgrade Note: the version most recently is 1.14.5
I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error: ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' ImportError: numpy.core.multiarray failed to import The above exception was the direct cause of the following exception: Traceback (most recent call last): File "", line 980, in _find_and_load SystemError: returned a result with an error set ImportError: numpy.core._multiarray_umath failed to import ImportError: numpy.core.umath failed to import I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python. I am using Windows10. Thanks in advance.
0
1
76,204
0
56,356,627
0
0
0
0
3
false
71
2019-02-13T08:43:00.000
2
3
0
When importing tensorflow, I get the following error: No module named 'numpy.core._multiarray_umath'
54,665,842
0.132549
python-3.x,numpy,tensorflow,anaconda
Kindly check whether you have installed the numpy package from pip. Because if you are running on conda evironment, then all packages need to be downloaded from there. Please use the below mentioned statement for this purpose conda install -c anaconda numpy Also make sure that the numpy version supports the Python version you are using.
I have installed Ancaconda3 and Tensorflow. When I try to import Tensorflow in python shell I receive the following error: ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' ImportError: numpy.core.multiarray failed to import The above exception was the direct cause of the following exception: Traceback (most recent call last): File "", line 980, in _find_and_load SystemError: returned a result with an error set ImportError: numpy.core._multiarray_umath failed to import ImportError: numpy.core.umath failed to import I am not sure what the problem is as numpy is installed on my system and can be successfully imported in python. I am using Windows10. Thanks in advance.
0
1
76,204
0
54,677,347
0
1
0
0
1
true
3
2019-02-13T17:18:00.000
2
2
0
RAM usage after importing numpy in python 3.7.2
54,675,983
1.2
python,numpy,conda,ram
You can't avoid this cost, but it's likely not as bad as it seems. The numpy libraries (a copy of C only libopenblasp, plus all the Python numpy extension modules) occupy over 60 MB on disk, and they're all going to be memory mapped into your Python process on import; adding on all the Python modules and the dynamically allocated memory involved in loading and initializing all of them, and 80 MB of increased reported RAM usage is pretty normal. That said: The C libraries and Python extension modules are memory mapped in, but that doesn't actually mean they occupy "real" RAM; if the code paths in a given page aren't exercised, the page will either never be loaded, or will be dropped under memory pressure (not even written to the page file, since it can always reload it from the original DLL). On UNIX-like systems, when you fork (multiprocessing does this by default everywhere but Windows) that memory is shared between parent and worker processes in copy-on-write mode. Since the code itself is generally not written, the only cost is the page tables themselves (a tiny fraction of the memory they reference), and both parent and child will share that RAM. Sadly, on Windows, fork isn't an option (unless you're running Ubuntu bash on Windows, in which case it's only barely Windows, effectively Linux), so you'll likely pay more of the memory costs in each process. But even there, libopenblasp, the C library backing large parts of numpy, will be remapped per process, but the OS should properly share that read-only memory across processes (and large parts, if not all, of the Python extension modules as well). Basically, until this actually causes a problem (and it's unlikely to do so), don't worry about it.
I run conda 4.6.3 with python 3.7.2 win32. In python, when I import numpy, i see the RAM usage increase by 80MB. Since I am using multiprocessing, I wonder if this is normal and if there is anyway to avoid this RAM overhead? Please see below all the versions from relevant packages (from conda list): python...........3.7.2 h8c8aaf0_2 mkl_fft...........1.0.10 py37h14836fe_0 mkl_random..1.0.2 py37h343c172_0 numpy...........1.15.4 py37h19fb1c0_0 numpy-base..1.15.4 py37hc3f5095_0 thanks!
0
1
1,002
0
54,861,503
0
0
0
0
1
false
4
2019-02-13T21:43:00.000
0
1
0
Remote interpreter and local plot in PyCharm?
54,679,917
0
python,matplotlib,ssh,pycharm,xserver
Interacting with visualisations on separate windows is slow, not just on PyCharm but any IDE that you specify visualisations to be loaded separately. This is because they are loaded on either tkinter or any of the available modules like Qt5 and if you're on a mac, you can also use the inbuilt OSX rendering. Especially if your dataset is large then interaction becomes slower. It just seems that visualisations in Python are not exactly that optimised as you witness on Tableau or even Orange/Glue. That's why I personally prefer visualising data inline through the IPython console (for that I use Spyder). You cannot interact with plots though, but the purpose suffices.
I'm using PyCharm with a remote interpreter. My code is showing a scatter figure using matplotlib. I can see the figure normally and interact with (zoom and rotate), but the interaction is too slow. I think this is because it's done through the SSH X-server. My question is how to manually make the figure interactions graphically (using mouse, like zooming, panning, rotation, ...) execute faster? I think this should be via allowing the figure interactions to happen on local machine (machine running PyCharm), not the remote server. One workaround is to save a .fig file, then copy it to my local machine, then load it. But I don't prefer this workaround.
0
1
815
0
54,683,752
0
1
0
0
1
false
2
2019-02-14T04:58:00.000
0
3
0
How can I upgrade Numpy in just one version of Python?
54,683,455
0
python,python-2.7,numpy,opencv,pip
Extending the first answer by JCutrer, after installing numpy on the specified version, you need to run the python.exe interpreter of the specified version. So, assuming you did c:\python27\Scripts\pip.exe install --upgrade numpy, the libraries have been installed for python27, now you can run python from the below path, or set this path as interpreter in your IDE. c:\python27\bin\python27.exe (or python.exe)
I am trying to get OpenCV working, but the issue with this is that my Python27 Numpp version is too old. Every time I write "install --upgrade numpy", I am told that Numpy is already up to date in C:Python37. How can I update Numpy in C:Python27 rather than 37? Any help would be much appreciated.
0
1
14,288
0
57,377,131
0
1
0
0
1
false
1
2019-02-14T21:39:00.000
1
1
0
Getting ImportError on spyder when trying to open a DataFrame after updating pandas and numpy
54,699,473
0.197375
python,pandas,spyder
I had the same problem. I solved it installing the pandas version 0.24.2 pip install pandas==0.24.2
I was trying to run some commands that needed me to update pandas, and then numpy, and so I did. Problem is now, when I try to look into a DataFrame in the variable explorer, they don't open and I get this error instead: ImportError: No module named 'pandas.core.internals.managers'; 'pandas.core.internals' is not a package Do you know what is happening?
0
1
788
0
54,706,020
0
0
0
0
1
false
0
2019-02-15T00:17:00.000
0
1
0
How to create a 2 value data table for keras
54,701,027
0
python,pandas,tensorflow,keras,neural-network
Sir even i'm new to neural network but i have some knowledge if you want to do this in exactly this manner then i'm no help but your can try doing this by genetic algo which will surely work for this
I am trying to make my first neural network in keras (python) that takes in the x and y distances to the next pipe and outputs whether or not the bird should flap. How would I go about creating an input data set from the game and then turning that into something keras can use for training? I don't have very much knowledge in this area and my high school computer science teachers don't know either, therefore I'm not quite sure where to start. I have a very, very basic understanding of Keras and NN concepts. I have tried using .csv files with pandas but I am not sure how to turn that into useable data.
0
1
117
0
54,702,197
0
0
0
0
1
true
0
2019-02-15T01:18:00.000
1
1
0
Tensorflow: why tf.nn.conv2d runs faster than tf.layers.conv2d?
54,701,429
1.2
python,tensorflow
If you try to follow the chain of function calls, you will find that tf.layers.conv2D() makes calls to tf.nn.conv2D() so no matter what you use, tf.nn.conv2d() will be called, it will be just faster if you call it yourself. You can use traceback.print_stack() method to verify that for yourself. NOTE This does not mean that they are one and the same, select the function based on your need as there are various other tasks undertaken by tf.layers.conv2D().
I am writing a simple implementation of AlexNet. I tried with using tf.nn.conv2d and tf.layers.conv2d, and the results turn out that the loss dropped faster when using tf.nn.conv2d, even the structure is exactly the same. Does anyone know any explanation for that?
0
1
92
0
54,704,727
0
0
0
0
1
true
0
2019-02-15T06:03:00.000
0
1
0
TensorFlow why we still use tf.name_scope when we already have the function tf.variable_scope
54,703,473
1.2
python,tensorflow
You can use tf.variable_scope to add a prefix on both variables created with tf.get_variable and operations: as you said, this allows also variable sharing but it also makes the first call to tf.get_variable the definition of new variable under this scope. tf.name_scope adds a prefix only at the operations: variables defined outside the tf.name_scope using tf.get_variable are not prefixed thus the tf.name_scope is ignored completely for this variable: you're not declarning a variable prefixed in any way. This can be useful when you want to create an operation block (using tf.name_scope) that uses a variable declared outside of it. This variable can be even used by multiple operation blocks at the same time.
I do not understand why we also need the function tf.name_scope when we already have tf.variable_scope. From the Tensorflow official API, I see that the tf.variable_scope is more powerful because it can have an effect on tf.get_variable. When we create layers and want to share variables, we always use tf.variable_scope and tf.name_scope. However, I try to learn something new from code released by Nvidia on GitHub. I found that it is frequent for coders to use tf.name_scope. Why do we still need this function?
0
1
53
0
54,704,764
0
0
0
0
1
false
1
2019-02-15T06:50:00.000
1
3
0
What is difference between SGD classifier and SGD regressor in python?
54,704,015
0.066568
python-3.x,machine-learning,scikit-learn
Well, it's in the name. SGD Classifier is a model that is optimized (trained) using SGD (taking the gradient of the loss of each sample at a time and the model is updated along the way) in classification problems. It can represent a variety of classification models (SVM, logistic regression...) which is defined with the loss parameter. By default, it represents linear SVM. SGD Regressor is a model that is optimized (trained) using SGD for regression tasks. It's basically a linear model that is updated along the way with a decaying learning rate.
What is difference between SGD classifier and SGD regressor in python sklearn? Also can we set batch size for faster performance in them?
0
1
1,733
0
54,735,778
0
0
0
0
1
false
0
2019-02-15T11:48:00.000
0
1
0
How to insert a sum row of groupby sums
54,708,714
0
python,pandas,sum,pandas-groupby
after the groupby use df.reset_index() to convert the df to a dataframe again
I am trying to insert a new row of totals after groupby sum. I can get the groupby sums of my table. I can also compute the sum of groupby sums with a second groupby sum. I tried and searched here to find a solution to insert/append each sum of sums as a new row (e.g. named Total) after each group, but to no avail. First groupby sum df.groupby(['Col1', 'Col2']).sum() Second groupby sum df.groupby(['Col1', 'Col2']).sum().groupby(level=[0]).sum()
0
1
93
0
54,800,843
0
1
0
0
1
false
0
2019-02-15T12:19:00.000
0
2
1
How to access data from the vision capture cards to opencv?
54,709,269
0
python,c++,opencv
It might be possible to have the DVI stream written to a file, FFMPEG/gstreamer read the file stream, and then pipe the input into OpenCV.
I am trying to get data from an a endoscope into my opencv code in python. The endoscope machine has a dvi output and I have a Datapath vision capture card which helps read it into my system. I understand that opencv can only read from usb cameras or ip webcams. I was wondering if anyone has done this kind of a read into opencv? Pointers greatly appreciated.
0
1
838
0
54,793,162
0
1
0
0
6
false
33
2019-02-15T19:21:00.000
10
11
0
Numpy is installed but still getting error
54,715,835
1
python,numpy,tensorflow
I was getting the error when I was trying to use Keras. This can be fixed by removing the numpy package continuously by running pip3 uninstall numpy. And checking the successful un-installation by opening a python terminal and importing numpy package.
I am trying to run jupyter notebook and getting following error. I am using Win 7 with anaconda python 3.7. ImportError: Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['c:\users\paperspace\anaconda3\envs\tensorflow10\lib\site-packages\numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version. I have followed the steps mentioned in the error but still not working.
0
1
64,552