2019-04-29 05:10:20 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import numpy as np
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
import sys
|
|
|
|
import load_datasets
|
|
|
|
import NeuralNet # importer la classe du Réseau de Neurones
|
|
|
|
import DecisionTree # importer la classe de l'Arbre de Décision
|
|
|
|
# importer d'autres fichiers et classes si vous en avez développés
|
|
|
|
# importer d'autres bibliothèques au besoin, sauf celles qui font du machine learning
|
|
|
|
|
2019-04-30 01:35:45 +00:00
|
|
|
train1, train_labels1, test1, test_labels1 = ld.load_iris_dataset(train_ratio = 0.7)
|
|
|
|
train2, train_labels2, test2, test_labels2 = ld.load_monks_dataset(1)
|
|
|
|
train3, train_labels3, test3, test_labels3 = ld.load_monks_dataset(2)
|
|
|
|
train4, train_labels4, test4, test_labels4 = ld.load_monks_dataset(3)
|
|
|
|
train5, train_labels5, test5, test_labels5 = ld.load_congressional_dataset(train_ratio = 0.7)
|
2019-04-29 05:10:20 +00:00
|
|
|
|
|
|
|
|
2019-04-30 01:35:45 +00:00
|
|
|
dt1 = DecisionTree.DecisionTree(attribute_type="continuous")
|
|
|
|
dt1.train(train1, train_labels1)
|
|
|
|
dt1.predict(test1[0],test_labels1[0])
|
|
|
|
dt1.test(test1, test_labels1)
|
2019-04-30 00:20:05 +00:00
|
|
|
|
2019-04-30 01:35:45 +00:00
|
|
|
|
|
|
|
dt5 = DecisionTree.DecisionTree(attribute_type="discrete")
|
|
|
|
dt5.train(train5, train_labels5)
|
|
|
|
dt5.predict(test5[0],test_labels5[0])
|
|
|
|
dt5.test(test5, test_labels5)
|