Exemplo n.º 1
0
import utils
import numpy as np

from utils import save_obj, load_obj

import plots
from sklearn import preprocessing

x, y = utils.load_excel_data("4clstrain1200.xlsx")
y = y - np.ones(shape=(np.shape(y)))
y = y.astype(int)

class_num = 4
print(y[0])
print(min(y))
print(max(y))
print(x[0])
dim = np.shape(x)[1]
number_of_circles = 7

plots.plot_classification_data(x, y, [0, 1, 2, 3])

x = preprocessing.scale(x)
x, y = utils.unison_shuffled_copies(x, y)

x, x_validation, x_test, y, y_validation, y_test = utils.split_data(x, y, 1, 0)

plots.plot_classification_data(x, y, [0, 1, 2, 3])

import ES
import RBF
Exemplo n.º 2
0
import RBF
import utils
from utils import save_obj, load_obj
import plots

x, y = utils.load_excel_data("regdata1500.xlsx")

from sklearn import preprocessing

ind = load_obj("IND_REG")
W = load_obj("W_REG")

x = preprocessing.scale(x)
y = preprocessing.scale(y)

print(RBF.evaluator(RBF.regression_loss, x_train=None, y_train=None, x_test=x, y_test=y, W=W, individual=ind))
y_out = RBF.get_y_regression(individual=ind, x_train=None, y_train=None, x_test=x, W=W)

plots.plot_regression_result(y_correct=y, y_model=y_out)
Exemplo n.º 3
0
import RBF
import utils
from utils import save_obj, load_obj
import plots
import matplotlib.pyplot as plt
import numpy as np
from sklearn import preprocessing

x_train, y_train = utils.load_excel_data("2clstrain1200.xlsx")

x, y = utils.load_excel_data("2clstest4000.xlsx")

plots.plot_classification_data(x, y, [-1, 1])

number_of_circles = 7
dim = len(x[0])
print("dim", len(x[0]))

ind = load_obj("IND_2CLS")
W = RBF.get_W(x_train, y_train, ind, number_of_circles)
W = load_obj("W_2CLS")
print(ind)
x = preprocessing.scale(x)
x_train = preprocessing.scale(x_train)
# preprocessing.scale(y)

print(
    RBF.evaluator(RBF.binary_classification_loss,
                  x_train=x_train,
                  y_train=y_train,
                  x_test=x,
Exemplo n.º 4
0
import utils
import numpy as np
from utils import save_obj, load_obj

# x, y = utils.regression_data2(1000, dim)
x_train, y_train = utils.load_excel_data("regdata1500.xlsx")

dim = np.shape(x_train)[1]
number_of_circles = 20

import plots
from sklearn import preprocessing

# min_max_scaler = preprocessing.MinMaxScaler()
# x = min_max_scaler.fit_transform(x)

x_train = preprocessing.scale(x_train)
y_train = preprocessing.scale(y_train)

print(np.shape(x_train))
print(np.shape(y_train))

x_train, y_train = utils.unison_shuffled_copies(x_train, y_train)
x_train, x_validation, x_test, y_train, y_validation, y_test = utils.split_data(
    x_train, y_train, 0.6, 0)
# plots.scatter_plot(x[:, 0], x[:, 1], y)

import ES
import RBF

best = ES.find_circle_coordinates(MU=10,