Last active
September 18, 2017 03:12
-
-
Save parvathysarat/e04f518acd7ca6bc7b57a85eb38bd336 to your computer and use it in GitHub Desktop.
Spot checking Decision Tree Classifier for firewall logs. Original data (18 columns) trimmed to 10.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CART Classification | |
import pandas as pd | |
from sklearn import model_selection | |
from sklearn.tree import DecisionTreeClassifier | |
dataframe = pd.read_csv("data.csv", names=['ID', 'No.', 'Smth', 'Number', 'Count', 'Count2', 'UDP/TCP', 'RandomNo', | |
'IP', 'AUDIT/ALLOW/BLOCK']) | |
array = dataframe.values | |
X = array[:,0:9] | |
Y = array[:,9] | |
seed = 7 | |
kfold = model_selection.KFold(n_splits=10, random_state=seed) | |
model = DecisionTreeClassifier() | |
results = model_selection.cross_val_score(model, X, Y, cv=kfold) | |
print(results.mean()) | |
#0.731300116075 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment