Skip to content

Instantly share code, notes, and snippets.

@AniekanInyang
Created August 22, 2020 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AniekanInyang/3c963cdbbe8b52cf0c38e881c1564a51 to your computer and use it in GitHub Desktop.
Save AniekanInyang/3c963cdbbe8b52cf0c38e881c1564a51 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Accuracy of the GBM on training set: 0.640\n",
"Accuracy of the GBM on test set: 0.666\n"
]
}
],
"source": [
"from sklearn.ensemble import GradientBoostingClassifier\n",
"\n",
"gbc = GradientBoostingClassifier(n_estimators=5, learning_rate=1.0, max_depth=1, random_state=0)\n",
"gbc.fit(features_train, y_train)\n",
"\n",
"print('Accuracy of the GBM on training set: {:.3f}'.format(gbc.score(features_train, y_train)))\n",
"print('Accuracy of the GBM on test set: {0:.3f}'.format(gbc.score(features_test, y_test)))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.7.6 64-bit",
"language": "python",
"name": "python37664bitf2b8979454eb492e8e911544bb13ab4b"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment