Exemple #1
0
CTotal = [0, 0, 0]
MTotal = [0, 0, 0]

for i in range(1, DIM + 1):
    select_arr.append(i)
    bubble_arr.append(i)
    insert_arr.append(i)

myfile = open("sort_methods.txt", "w")  # Все результаты запишем в файл

print("\nУПОРЯДОЧЕННАЯ ПОСЛЕДОВАТЕЛЬНОСТЬ: Исходный массив")
print(select_arr)

count = [0, 0]
count = algorithms.select(select_arr, DIM)
print("\nУПОРЯДОЧЕННАЯ ПОСЛЕДОВАТЕЛЬНОСТЬ: Результирующий массив")
print(select_arr)
CTotal[0] = count[0]
MTotal[0] = count[1]

count = [0, 0]
count = algorithms.insert(insert_arr, DIM)
CTotal[1] = count[0]
MTotal[1] = count[1]

count = [0, 0]
count = algorithms.bubble(bubble_arr, DIM)
CTotal[2] = count[0]
MTotal[2] = count[1]
print("УПОРЯДОЧЕННАЯ ПОСЛЕДОВАТЕЛЬНОСТЬ:\n")
Exemple #2
0
        'num_constraints': 2000,
        'gamma': 20.0
    },
    'SDML': {
        'balance_param': 0.5,
        'sparsity_param': 0.1
    },
    'LSML': {},
    'NCA': {},
    'LFDA': {},
    'RCA': {}
}
# ,'LFDA':{'k':2, 'dim': 50}  'NCA':{'learning_rate':0.01}'RCA':{ 'num_chunks':150, 'chunk_size':3}

selected = ['GSEA', 'BASE', 'LMNN', 'SDML', 'LSML', 'LFDA', 'NCA']
options = algo.select(methods, selected)

Result = algo.ALGO(GeneExp, Label, **options)

Dist = Result.Dist
Dist['SiamDen'] = np.load('Dist.npy')
# Train = Result.inds_train
# Test = Result.inds_test
Train = np.load('inds_train.npy')
Test = np.load('inds_test.npy')

amin, amax = Dist['SiamDen'].min(), Dist['SiamDen'].max()
Dist['SiamDen'] = 1.0 - (Dist['SiamDen'] - amin) / (amax - amin)

perf.roc(Dist, Label, save_figure=True)
import random
import collections

import matplotlib.pyplot as plt

from algorithms import select
from branch_predictor import BranchPredictor
import plotter

history_length = 128
bp = BranchPredictor(history_length)

data = list(range(200))

for _ in range(200):
    random.shuffle(data)
    result, result_length = select(data, 0, 100, 16, bp)

bp.print_accuracies()

plotter.generate_plot(bp, "expand")