Skip to content

Create tests file to highlight usage #88

Open
@davidshumway

Description

@davidshumway

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions