def main(): PC = Computer_case(comp_id=1, manufacturer="BeQuiet!", price=299) plyta1 = Motherboard(comp_id=2, manufacturer="Gigabyte", price=399) procesor1 = Processor(comp_id=3, manufacturer="intel", model="i5-8600", price=999) procesor2 = Processor(comp_id=4, manufacturer="AMD", model="Ryzen 5 1600", price=999) ram1 = Memory(comp_id=5, manufacturer="Corsair", price=390, memory_type="DDR4", capacity=16) ram2 = Memory(comp_id=6, manufacturer="GoodRam", price=300, memory_type="DDR4", capacity=16) powersupply1 = Powersupply(comp_id=7, manufacturer="BeQuiet!", price=290, ps_size=600) plyta1.add_component(procesor1) plyta1.add_component(ram1) plyta1.add_component(ram2) PC.add_component(powersupply1) PC.add_component(plyta1) PC.do_operation(plyta1.mb_components_price())
def test_create_combined_data(): data = '0.123,-0.123,5;0.456,-0.789,0.111;-0.212,0.001,1;' parser = Parser(data) processor = Processor(parser.parsed_data) assert processor.dot_product_data == [0.0, 0.0, 0.0005219529804999682] assert processor.filtered_data == [0, 0, 4.753597533351234e-05]
def test_create_separated_data(): data = '0.028,-0.072,5|0.129,-0.945,-5;0,-0.07,0.06|0.123,-0.947,5;0.2,-1,2|0.1,-0.9,3;' parser = Parser(data) processor = Processor(parser.parsed_data) assert processor.dot_product_data == [-24.928348, 0.36629, 6.92] assert processor.filtered_data == [0, 0, -1.7004231121083724]
def test_create_non_zero_data(): user = User('female', 167, 70) trial = Trial('walk 1', 100, 18) parser = Parser(open('test/data/female-167-70_walk2-100-10.txt').read()) processor = Processor(parser.parsed_data) analyzer = Analyzer(processor.filtered_data, user, trial) assert analyzer.steps == 10 assert analyzer.delta == -8 assert analyzer.distance == 700 assert analyzer.time == 1037 / 100
from models.processor import Processor from models.leap import LEAPModel from exp.coverage import config_mimic as config from utils.data import dump config = config.get_config() print(config.saved_model_file.split('/')[-1]) p = Processor(config) model = LEAPModel(p, config) # model.do_train() model.load_params( 'build/mimic_sort_seq2seq_len_50_seed13_100d_lr0.001_h256.model') # model.do_reinforce(scorer) model.do_eval(training=False, filename='mimic_unsort_seq2seq.h256.txt', max_batch=5000) # model.load_params('../models/resume_seed13_100d_lr0.001_h256.model') # ret = model.do_generate(data) # # from utils.eval import Evaluator # eva = Evaluator() # cnt = 0 # truth = [] # sum_jaccard = 0 # for line in open("seq2seq.h256.txt"): # if cnt % 3 == 1: # truth = set(line.strip().split("T: ")[1].split(" "))
def feed(self): self.parser = Parser(self.data) self.processor = Processor(self.parser.parsed_data) self.analyzer = Analyzer(self.processor.filtered_data, self.user, self.trial)