Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create tests file to highlight usage #88

Open
davidshumway opened this issue Jan 11, 2023 · 0 comments
Open

Create tests file to highlight usage #88

davidshumway opened this issue Jan 11, 2023 · 0 comments

Comments

@davidshumway
Copy link

Is it possible to create a tests file to highlight basic usage scenarios? For example, in sklearn, a simple regression task looks like...

import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression

Xtrain = [[0,1],[0,2]]
ytrain = [1, 20]
Xtest = [[0,1],[0,2]]
ytest = [2, 30]
print(Xtrain, ytrain)
print(Xtest, ytest)

regr = LinearRegression()
regr.fit(Xtrain, ytrain)
print(regr.score(Xtest, ytest))
ypred = regr.predict(Xtest)

plt.scatter(range(len(ytest)), ytest, label='Observed')
plt.scatter(range(len(ytest)), ypred, label='Predicted')
plt.legend()

>> [[0, 1], [0, 2]] [1, 20]
>> [[0, 1], [0, 2]] [2, 30]
>> 0.7423469387755101

image

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant