diff --git a/mainproject/SFAnalytics/DataBase/Analysis/7zFM.exe b/mainproject/SFAnalytics/DataBase/Analysis/7zFM.exe new file mode 100644 index 0000000..a2f8e7a Binary files /dev/null and b/mainproject/SFAnalytics/DataBase/Analysis/7zFM.exe differ diff --git a/mainproject/SFAnalytics/generatedgrah.gv b/mainproject/SFAnalytics/generatedgrah.gv new file mode 100644 index 0000000..8997223 --- /dev/null +++ b/mainproject/SFAnalytics/generatedgrah.gv @@ -0,0 +1,37 @@ +digraph Tree { +node [shape=box, style="filled, rounded", color="black", fontname=helvetica] ; +edge [fontname=helvetica] ; +0 [label=gini = 0.6667
samples = 150
value = [50, 50, 50]
class = setosa>, fillcolor="#e5813900"] ; +1 [label=samples = 50
value = [50, 0, 0]
class = setosa>, fillcolor="#e58139ff"] ; +0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ; +2 [label=gini = 0.5
samples = 100
value = [0, 50, 50]
class = versicolor>, fillcolor="#39e58100"] ; +0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ; +3 [label=gini = 0.168
samples = 54
value = [0, 49, 5]
class = versicolor>, fillcolor="#39e581e5"] ; +2 -> 3 ; +4 [label=gini = 0.0408
samples = 48
value = [0, 47, 1]
class = versicolor>, fillcolor="#39e581fa"] ; +3 -> 4 ; +5 [label=samples = 47
value = [0, 47, 0]
class = versicolor>, fillcolor="#39e581ff"] ; +4 -> 5 ; +6 [label=samples = 1
value = [0, 0, 1]
class = virginica>, fillcolor="#8139e5ff"] ; +4 -> 6 ; +7 [label=gini = 0.4444
samples = 6
value = [0, 2, 4]
class = virginica>, fillcolor="#8139e57f"] ; +3 -> 7 ; +8 [label=samples = 3
value = [0, 0, 3]
class = virginica>, fillcolor="#8139e5ff"] ; +7 -> 8 ; +9 [label=gini = 0.4444
samples = 3
value = [0, 2, 1]
class = versicolor>, fillcolor="#39e5817f"] ; +7 -> 9 ; +10 [label=samples = 2
value = [0, 2, 0]
class = versicolor>, fillcolor="#39e581ff"] ; +9 -> 10 ; +11 [label=samples = 1
value = [0, 0, 1]
class = virginica>, fillcolor="#8139e5ff"] ; +9 -> 11 ; +12 [label=gini = 0.0425
samples = 46
value = [0, 1, 45]
class = virginica>, fillcolor="#8139e5f9"] ; +2 -> 12 ; +13 [label=gini = 0.4444
samples = 3
value = [0, 1, 2]
class = virginica>, fillcolor="#8139e57f"] ; +12 -> 13 ; +14 [label=samples = 1
value = [0, 1, 0]
class = versicolor>, fillcolor="#39e581ff"] ; +13 -> 14 ; +15 [label=samples = 2
value = [0, 0, 2]
class = virginica>, fillcolor="#8139e5ff"] ; +13 -> 15 ; +16 [label=samples = 43
value = [0, 0, 43]
class = virginica>, fillcolor="#8139e5ff"] ; +12 -> 16 ; +} diff --git a/mainproject/SFAnalytics/migrations/0007_auto_20170829_1215.py b/mainproject/SFAnalytics/migrations/0007_auto_20170829_1215.py new file mode 100644 index 0000000..959fe08 --- /dev/null +++ b/mainproject/SFAnalytics/migrations/0007_auto_20170829_1215.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11 on 2017-08-29 15:15 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('SFAnalytics', '0006_auto_20170613_1934'), + ] + + operations = [ + migrations.CreateModel( + name='DllToEntry', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id_dll', models.IntegerField(default=0)), + ('id_entry', models.IntegerField(default=0)), + ], + ), + migrations.CreateModel( + name='OpcodeToEntry', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id_opcode', models.IntegerField(default=0)), + ('id_entry', models.IntegerField(default=0)), + ], + ), + migrations.CreateModel( + name='StringToEntry', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id_string', models.IntegerField(default=0)), + ('id_entry', models.IntegerField(default=0)), + ], + ), + migrations.AlterField( + model_name='entryfile', + name='id', + field=models.IntegerField(primary_key=True, serialize=False), + ), + ] diff --git a/mainproject/SFAnalytics/test_mining.py b/mainproject/SFAnalytics/test_mining.py new file mode 100644 index 0000000..89c6f9f --- /dev/null +++ b/mainproject/SFAnalytics/test_mining.py @@ -0,0 +1,26 @@ +from tools import * +from sklearn.datasets import load_iris +from sklearn import tree +import sys +import numpy as np +import graphviz + +def main(): + #The secound arg is the outputfile + if len(sys.argv) == 2: + iris = load_iris() + decisionTree = tree.DecisionTreeClassifier() + decisionTree = decisionTree.fit(iris.data, iris.target) + sample = np.reshape(iris.data[50], (1, -1)) + dot_data = tree.export_graphviz(decisionTree, out_file=None, feature_names=iris.feature_names, class_names=iris.target_names, filled=True, rounded=True, special_characters=True) + graph = graphviz.Source(dot_data) + graph.format = 'png' + graph.render(sys.argv[1]) + print('\nGraph generated.\n') + a = np.array([[2, 3, 4],[5, 6, 7],[8, 9, 10]]) + b = np.array([[11, 12, 13]]) + #stacking arrays + np.vstack((a, b)) + +if __name__ == '__main__': + main()