Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

INSTRUCTIONS · Use of the following CLASSIFICATION Machine Learning Models · Decision Trees · Random Forest · Gradient Boosting Trees · First, given dataset “spx_tail”, the “tail events” as defined...

1 answer below »
INSTRUCTIONS
· Use of the following CLASSIFICATION Machine Learning Models
· Decision Trees
· Random Forest
· Gradient Boosting Trees
· First, given dataset “spx_tail”, the “tail events” as defined below have to be identified in order to assign them such label
· All sections needed, i.e.
· “Please Report” section
· “Remember” section:
· one-split cross validation
· k-fold cross validation (use k = 5)
· top K Feature Importance for Random Forest and Gradient Boosting Trees
· Bonus 1
· Bonus 2
· Bonus 3
ASSIGNMENT
Answered Same Day Nov 07, 2020

Solution

Ximi answered on Nov 10 2020
143 Votes
{
"cells": [
{
"cell_type": "code",
"execution_count": 110,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import pandas as pd\n",
"from sklearn.model_selection import train_test_split, cross_val_score, TimeSeriesSplit\n",
"from sklearn.tree import DecisionTreeClassifier\n",
"from sklearn.metrics import accuracy_score, classification_report\n",
"from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier, VotingClassifier\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from sklearn.linear_model import LogisticRegression\n",
"from sklearn.naive_bayes import GaussianNB\n",
"from sklearn.neighbors import KNeighborsClassifier"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"#Reading CSV file\n",
"df = pd.read_csv('spx_tail.csv')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(4319, 254)"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#Shape of the data\n",
"df.shape"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"