Skip to content

Instantly share code, notes, and snippets.

@KaleabTessera
Created December 11, 2018 18:17
Show Gist options
  • Save KaleabTessera/c343402742df35d9cd4b926a75b5e1f7 to your computer and use it in GitHub Desktop.
Save KaleabTessera/c343402742df35d9cd4b926a75b5e1f7 to your computer and use it in GitHub Desktop.
# Function which will be called to make a prediction
def makePrediction(model,example_to_predict):
# One-hot encode the example to match the data it was trained on.
encoded_x = encodeSingleElement(x,example_to_predict)
y_pred = model.predict(encoded_x.reshape(1, -1))
return y_pred
# Load model with best rMse and make prediction
fileName = "results/" + "bestRegressionModel_" + str(LineaReggressionMetrics.ROOT_MEAN_SQUARED_ERROR.name) + ".sav"
bestRegression = joblib.load(fileName)
#Example ICO
#Format - price_usd,price_btc,total_supply,market_cap_usd,available_supply,usd_raised,eth_price_launch,btc_price_launch,ico_duration,month,day,country
example_x = np.array([1.71456,0.00019931,1000000000,905793616,528295082,24000000,297.63,3420.4,7,8,9,182])
y_pred = makePrediction(bestRegression,example_x)
print("Predicted value of example ICO after six months: ",y_pred )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment