Skip to content

Instantly share code, notes, and snippets.

@pronojitsaha
Created October 18, 2015 10:27
Show Gist options
  • Save pronojitsaha/fe279bf82d4f6924852a to your computer and use it in GitHub Desktop.
Save pronojitsaha/fe279bf82d4f6924852a to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"test = pd.read_csv(\"data/test_yIjzS7t.csv\", usecols = [\"REF_NO\"])\n",
"preds = pd.read_csv(\"data/subXGB1.csv\")\n",
"preds['REF_NO'] = test['REF_NO']\n",
"preds2 = pd.read_csv(\"data/subXGB2.csv\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We give equal weightage to both the XGB models"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"preds['Account.Status'] = 0.5 * (preds['Account.Status'] + preds2['Account.Status'])"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"preds['Account.Status'] = ['Gold' if pred > 0.20 else 'Silver' for pred in preds['Account.Status']]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"preds.to_csv('data/final.csv', columns=['REF_NO','Account.Status'], index=False)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment