Exemple #1
0
from clusterers.expectation_maximization import ExpectationMaximization
from clusterers.k_means import Kmeans
from clusterers.Optic_Clustering import optics
from sklearn.metrics import calinski_harabasz_score, davies_bouldin_score, silhouette_score
from utils import clear, load_dataset, factorize
from gap import optimalK
from sklearn.cluster import KMeans


argument_parser = ArgumentParser()

setup = {
    "dataset": argument_parser.get_dataset_path(),
    "dataset_name": argument_parser.get_dataset_name(),
    "simple_name": argument_parser.get_simple_dataset_name(),
    "algorithm": argument_parser.get_algorithm(),
    "clusters": argument_parser.get_number_of_clusters(),
    "class_args": argument_parser.get_classifier_arguments()
}

if argument_parser.is_n_clusters_fixed() is True:
    setup['clusters'] = argument_parser.get_fixed_n_clusters()

data = load_dataset(setup['dataset'])
data = data.apply(factorize)

if argument_parser.is_elbow_method_run() is False:
    algorithm = None
    if setup['algorithm'] == 1:
        algorithm = ExpectationMaximization(data, setup['clusters'], setup['class_args'])
    elif setup['algorithm'] == 2:
Exemple #2
0
from classifiers.bayes import Bayes
from classifiers.neural_network import NeuralNetwork
from classifiers.knn import KNN
from classifiers.svm import SVM
from util import *

argument_parser = ArgumentParser()
filename = argument_parser.get_filename()
adwin_delta = argument_parser.get_delta()
training_set_ratio = argument_parser.get_training_set_ratio()
neighbors_number = argument_parser.get_neighbors_number()
kernel = argument_parser.get_kernel()
regulation = argument_parser.get_regulation()
max_iters = argument_parser.get_iterations()
n_of_hidden = argument_parser.get_n_of_hidden_layers()
algorithm = argument_parser.get_algorithm()
printing = argument_parser.is_printing()

data, labels = load_data(filename)

classifiers = {
    'bayes': Bayes(data, labels, training_set_ratio),
    'knn': KNN(data, labels, training_set_ratio, neighbors_number),
    'nn': NeuralNetwork(data, labels, training_set_ratio, n_of_hidden,
                        max_iters),
    'svm': SVM(data, labels, training_set_ratio, kernel, regulation)
}

classifier = classifiers[algorithm]

classifier.train()
Exemple #3
0
Fichier : main.py Projet : shreq/OE
import numpy
from matplotlib import pyplot
from platypus import ZDT1, ZDT2, ZDT3, ZDT4, ZDT5, ZDT6
from platypus.algorithms import NSGAII, IBEA, SPEA2, GDE3
from platypus.operators import UniformMutation
from platypus.core import nondominated
from pymoo.factory import get_problem, get_performance_indicator
from scipy.interpolate import interp1d
from sklearn.metrics import mean_squared_error

from utils import clear
from argument_parser import ArgumentParser

args = ArgumentParser()

algorithm_name = args.get_algorithm()
population_size = args.get_population()
problem_name = args.get_problem()

clear()

variator = UniformMutation(probability=args.get_probability(),
                           perturbation=0.5)

problem = {
    'zdt1': ZDT1(),
    'zdt2': ZDT2(),
    'zdt3': ZDT3(),
    'zdt4': ZDT4(),
}[problem_name]