1
$\begingroup$

I am trying to cross-validate my scikit-learn script by mean of Orange3, thus obtaining a nice visual representation.

Doing step by step, to keep it simple I just tried to cross-validate a simple linear regression.

enter image description here

Following is the simple script for linear regression in python/scikit-learn

lr=LinearRegression(fit_intercept=True,normalize=False,copy_X=True,n_jobs=1)
lm=lr.fit(X_train, y_train)
lmscore_train=lm.score(X_train,y_train)  ## R2 = 0.6264021467338086
lmscore_test=lm.score(X_test,y_test)     ## R2 = -12.344747578839215

Whilst I was expecting to get the same result, this is not the case.

In Orange, I get R2=-10.792 whilst in Python, I get R2=-12.344747578839215.

Train and test split are the same in both cases.

Do you have a clue why that is?

$\endgroup$
1
$\begingroup$

Orange and Scikit treat outliers in different ways. If you have outliers in your data, remove them and check. The answers then are similar.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.