예제 #1
0
from pipe import Pipe
from wrapper import knn
from pipetools import predict, dump, load_y, copy, evaluate, echo
from utils import load_x, load_y
from multipipetools import average
from splitter import cross

file = './datasets/iris/iris.data'

a = Pipe() \
    .x(load_x(file)) \
    .y(load_y(file))\
    .split(5, cross()) \
        .pipe(knn(1)) \
        .pipe(copy('x_test', 'x')) \
        .pipe(copy('y_test', 'y')) \
        .pipe(predict()) \
        .pipe(evaluate()) \
    .merge('evaluation', average('evaluation'))\
    .pipe(dump('evaluation'))


from pipe import Pipe
from wrapper import agglomerative
from pipetools import dump, evaluate
from utils import load_x

file = './datasets/iris/iris.data'

Pipe()\
    .x(load_x(file, delimiter=','))\
    .pipe(agglomerative(n_clusters=3))\
    .pipe(dump('prediction'))
예제 #3
0
from pipe import Pipe
from wrapper import kernel_density_estimation
from pipetools import dump, evaluate, start_timer, stop_timer
from utils import load_x

# file = './datasets/pendigits/pendigits.tra'
file = './datasets/iris/iris.data'

Pipe() \
    .x(load_x(file, delimiter=',')) \
    .connect(start_timer()) \
    .pipe(kernel_density_estimation(bandwidth=0.5)) \
    .connect(stop_timer())\
    .pipe(dump('pdf'))