Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Use for data science questions related to the programming language Python. Not intended for general coding questions (which should be asked on Stack Overflow).
1
vote
1
answer
459
views
Histogram of some values only
I have a pandas dataframe df, and I want to show the histogram.
df.hist(bins=100, label="myhist")
Now, for some reason I have lots of zeros in this df, so I only want to show the values between 1 a …
1
vote
Accepted
Histogram of some values only
Ok, after some digging around I found that I can pass a range = (1,100) and that does the trick.
0
votes
1
answer
76
views
Super basic logistic regression example
I am new to ML and I created a super basic logistic regression example with 4 points on the $x$ line that belong to two classes:
points = [[1, 1]]
points = points + [[2, 0]]
points = points + [[1.5, …
19
votes
2
answers
86k
views
How does SelectKBest work?
I am looking at this tutorial: https://www.dataquest.io/mission/75/improving-your-submission
At section 8, finding the best features, it shows the following code.
import numpy as np
from sklearn.f …
3
votes
1
answer
738
views
Theano logistic regression example
I am trying to understand some simple neural net case using theano.
The deeplearning.net site gives the following simple code for implementing a logistic regression application to a simple case:
impo …
0
votes
Logistic regression program does not give statistically correct result
Found the issue, a simple bug in my code. I wrote:
for index in result:
if result[index] != 0:
error += 1
while it should have been something like:
for index in range(N):
if result …
1
vote
3
answers
3k
views
What should I use if I have millions of possible values for a feature in a sklearn predictiv...
I am trying to create a large model. One of the features is categorical, and it has almost 100 million entries.
I have looked at sklearn LabelEncoder, but I am concerned that it will still create an …
1
vote
1
answer
671
views
Choosing your own initialisation points for kmeans
Kmeans clustering will randomly select the initialisation points and then run the algorithm until convergence is reached. Is there a way I can choose my own initialisation points and pass them into th …
0
votes
2
answers
86
views
Logistic regression program does not give statistically correct result [closed]
I wrote a very simple and compact logistic regression program using theano. I am initialising my data randomly, and I have restricted the number of training steps to 1, so since the weights are also r …
0
votes
1
answer
7k
views
Max depth for a decision tree in sklearn
I know there is a partial answer here but my question is slightly different.
I have implemented a decision tree in sklearn. Say I have $2^n$ different values for a feature, with just one feature. I wa …
2
votes
1
answer
1k
views
Giving more weight to a particular feature in scikit-learn decision trees
Can I set up sklearn in python to do this? How? …
46
votes
5
answers
51k
views
How to force weights to be non-negative in Linear regression
I am using a standard linear regression using scikit-learn in python.
However, I would like to force the weights to be all non-negative for every feature. is there any way I can accomplish that? …
5
votes
2
answers
2k
views
Which variables matter most for prediction of another variable?
I have a dataset and need to predict, out of 9 variables, which ones matter most to predict number 10.
I first tried using the selectKBestmethod from sklearn.feature_selection and it looks like 4,5,6 …
0
votes
2
answers
677
views
Contrasting logistic regression vs decision tree performance in specific example
I have a set of 10,000 integers, and another set of 100.
The integers in the first set are mapped to integers in the second set according to some rules (not mathematical rules, think of these values a …
4
votes
2
answers
1k
views
Performance difference between decision trees and logistic regression when one of the featur...
I have a set of features, one of which is a string. I convert the string to an integer by treating the string as a base 36 number (I only use the first 13 characters). Then I can use DecisionTrees sin …