Re: [scikit-learn] Question RE: skLearn Logistic Regression

2020-10-31 Thread serafim loukas
These are not numpy arrays.

Try:

X = np.array([-3,-2,-1,0,1,2,3]).reshape(-1,1)

And

y = np.array([0, 0, 0, 1, 1, 1, 1]).reshape(-1,1)

Makis


On 31 Oct 2020, at 17:51, The Helmbolds via scikit-learn 
mailto:scikit-learn@python.org>> wrote:

I have a case with binary results and 1-D features, like:

X = np.array(-3,-2,-1,0,1,2,3,)

and

y = np.array(0, 0, 0, 1, 1, 1, 1)

only longer arrays (about 180 entries in each array) of this general type.

So this should be the "simplest" case.

Altho I've tried several variations of the Logistic input formats, in

   LogisticRegression.fit(X, y)

they keep being rejected with the most common error message being

   Missing argument y

I assure you I do indeed have an array "y" that is passed to "fit"

SoWhat do I have to do to get Logistic Regression to accept 1-D features?


___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn

___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


Re: [scikit-learn] Question regarding regression models

2020-06-11 Thread serafim loukas
Hi Kelden,

I answered your SO question but for the record this is what happens:

date_index is a scalar and you type date_index.columns which raises the error.

So you just need this:

def predict_price(dates,price):
date_index = np.where(date_format.columns == dates)[0][0]

x = np.zeros(len(date_format.columns))
if date_index >= 0:
x[date_index] = 1

return prediction.predict([x])[0]

predict_price('Feb 20, 2018', 1000)

Bests,
Makis


On 11 Jun 2020, at 15:12, Kelden Dorji 
mailto:keldendraduldo...@gmail.com>> wrote:



Hi scikit-learn,
I have a question related to regression models. Please find my question in the 
link below. I am still new to this and would appreciate any help. Thank you and 
have a nice day!

https://stackoverflow.com/questions/62325079/issues-with-regression-model-giving-inverse-relationship

Kelden Dradul Dorji
___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn

___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


Re: [scikit-learn] question

2019-10-20 Thread serafim loukas
I would take the magnitude.
Otherwise you will have to modify the source code to make it work with complex 
values.

Bests,
Makis

On Oct 20, 2019, at 15:55, Fernando Marcos Wittmann 
 wrote:


What about converting into two columns? One with the real projection and the 
other with the complex projection?

On Sat, Oct 19, 2019, 3:44 PM ahmad qassemi 
mailto:ahmadqass...@gmail.com>> wrote:
Dear Mr/Mrs,

 I'm a PhD student in DS. I'm trying to use your provided code on Spectral 
CoClustering and Spectral Biclustering to bi-cluster my data matrix 
(https://scikit-learn.org/stable/modules/biclustering.html). Since my data has 
complex values, i.e., matrix elements are complex, your modules don't work on 
my data. It seems that the reason is your K-means' code doesn't work with 
complex numbers. I will really appreciate it if you take some time and tell me 
how should I apply your codes on my complex data. Thanks a lot in advance.

Sincerely,
Ahmad Qassemi
___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn
___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn
___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


Re: [scikit-learn] logistic regression results are not stable between solvers

2019-10-09 Thread serafim loukas
The predictions across solver are exactly the same when I run the code.
I am using 0.21.3 version. What is yours?


In [13]: import sklearn

In [14]: sklearn.__version__
Out[14]: '0.21.3'


Serafeim



On 9 Oct 2019, at 21:44, Benoît Presles 
mailto:benoit.pres...@u-bourgogne.fr>> wrote:

(y_pred_lbfgs==y_pred_saga).all() == False

___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


[scikit-learn] Question about Kmeans implementation in sklearn

2019-08-05 Thread serafim loukas
Dear Sklearn community,


I have a simple question concerning the implementation of KMeans clustering 
algorithm.
Two of the input arguments are the “n_init” and “random_state”.

Consider a case where  “n_init=10” and “random_state=0”.

By looking at the source code 
(https://github.com/scikit-learn/scikit-learn/blob/1495f69242646d239d89a5713982946b8ffcf9d9/sklearn/cluster/k_means_.py#L187),
 we have the following:

for it in range(n_init):
# run a k-means once
labels, inertia, centers, n_iter_ = kmeans_single(
X, sample_weight, n_clusters, max_iter=max_iter, init=init,
verbose=verbose, precompute_distances=precompute_distances,
tol=tol, x_squared_norms=x_squared_norms,
random_state=random_state)


My question is: Why the results are not going to be the same for all `n_init` 
iterations since `random_state` is fixed?


Bests,
Makis
___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


Re: [scikit-learn] Error with Kfold cross vailidation

2018-10-24 Thread serafim loukas
What is your scikit learn version?

In case you have the latest  try to reinstall the module.

On 24 Oct 2018, at 15:36, bright silas Aboh 
mailto:sbrighta...@gmail.com>> wrote:

Okey. I did removed the data.shape as suggested but I am now having a new error 
that says:
Kfold object not iterable

On Wed, 24 Oct 2018 at 13:23, Gael Varoquaux 
mailto:gael.varoqu...@normalesup.org>> wrote:
>   kf = KFold(data.shape[0], n_splits=5)
> TypeError: __init__() got multiple values for argument 'n_splits'

Don't specify data.shape[0], this is no longer necessary in the recent
versions of scikit-learn.
___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn
___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn
___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


Re: [scikit-learn] Error with Kfold cross vailidation

2018-10-24 Thread serafim loukas
Hello,


Do you import KFold from sklearn.model_selection ?



On 24 Oct 2018, at 13:29, bright silas Aboh 
mailto:sbrighta...@gmail.com>> wrote:

Hi Everyone,

I am Bright and am trying to build a machine learning model with sklearn
I get the following error however, can someone please help me?

  kf = KFold(data.shape[0], n_splits=5)
TypeError: __init__() got multiple values for argument 'n_splits'

Thank you



___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn

___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


Re: [scikit-learn] Plot Cross-validated ROCs for multi-class classification problem

2018-07-21 Thread serafim loukas
Hello J.B,


I could simply create some ROC curves as shown in the scikit-learn 
documentation by selecting only 2 classes and then repeating by selecting other 
pair of classes (in total I have 3 classes so this would result in 3 different 
ROC figures).

An alternative would be I would like to plot the mean and confidence intervals 
of the 3-class Cohen Kappa metric as estimated by KFolds (k=5) cross-validation.

Any tips about this ?


Cheers,
Makis



On 21 Jul 2018, at 16:02, Brown J.B. via scikit-learn 
mailto:scikit-learn@python.org>> wrote:

Hello Makis,

2018-07-20 23:44 GMT+09:00 Andreas Mueller 
mailto:t3k...@gmail.com>>:
There is no single roc curve for a 3 class problem. So what do you want to plot?

On 07/20/2018 10:40 AM, serafim loukas wrote:
What I want to do is to plot the average(mean) ROC across Folds for a 3-class 
case.

The prototypical ROC curve uses True Positive Rate and False Positive Rate for 
its axes, so it is for 2-class problems, and not for 3+-class problems, as Andy 
mentioned.
Perhaps you are wanting the mean and confidence intervals of the n-class Cohen 
Kappa metric as estimated by either many folds of cross validation, or you want 
to evaluate your classifier by repeated subsampling experiments and Kappa value 
distribution/histogram?

Hope this helps,
J.B.
___
scikit-learn mailing list
scikit-learn@python.org<mailto:scikit-learn@python.org>
https://mail.python.org/mailman/listinfo/scikit-learn

___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn


[scikit-learn] Plot Cross-validated ROCs for multi-class classification problem

2018-07-20 Thread serafim loukas
Dear Scikit-learn community,


I have a 3 class classification problem and I would like to plot the average 
ROC across Folds.
There is an example in scikit-learn website but only for binary classification 
problems 
(http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc_crossval.html).

I want to do the same but in the case of 3 classes. I have tried to use `clf = 
OneVsRestClassifier(LinearDiscriminantAnalysis())`but I am having a hard time 
to make it work.


Any help would be appreciated,
Makis
___
scikit-learn mailing list
scikit-learn@python.org
https://mail.python.org/mailman/listinfo/scikit-learn