maml icon indicating copy to clipboard operation
maml copied to clipboard

Create tests file to highlight usage

Open davidshumway opened this issue 2 years ago • 0 comments

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!

davidshumway avatar Jan 11 '23 01:01 davidshumway