node cache tests added
Created by: YanaPolonskaya
13 predictors, response = load_breast_cancer(return_X_y=True) 14 np.random.seed(1) 15 np.random.shuffle(predictors) 16 np.random.shuffle(response) 17 response = response[:100] 18 predictors = predictors[:100] 19 train_data_x, test_data_x = split_train_test(predictors) 20 train_data_y, test_data_y = split_train_test(response) 21 train_data = InputData(features=train_data_x, target=train_data_y, 22 idx=np.arange(0, len(train_data_y))) 23 test_data = InputData(features=test_data_x, target=test_data_y, 24 idx=np.arange(0, len(test_data_y))) 25 return train_data, test_data 26 27 28 def chain_first(): - Last updated by Elizaveta Lutsenko
100 chain.fit(input_data=train) 101 other_chain.fit(input_data=train) 102 chain.replace_node(chain.root_node.nodes_from[0].nodes_from[0], other_chain.root_node.nodes_from[0]) 103 root = chain.root_node 104 root_parent_first = root.nodes_from[0] 105 root_parent_second = root.nodes_from[1] 106 root_parent_first_parent_first = root_parent_first.nodes_from[0] 107 root_parent_first_parent_second = root_parent_first.nodes_from[1] 108 primary_node_first = root_parent_first_parent_first.nodes_from[0] 109 primary_node_second = root_parent_first_parent_first.nodes_from[0] 110 111 assert not all([root._is_cache_actual(), root_parent_first._is_cache_actual()]) 112 assert all([root_parent_second._is_cache_actual(), root_parent_first_parent_first._is_cache_actual(), 113 root_parent_first_parent_second._is_cache_actual()]) 114 assert all([primary_node_first._is_cache_actual(), primary_node_second._is_cache_actual()]) 115 1 import numpy as np 2 import pytest 3 from core.models.data import InputData, split_train_test 4 from core.composer.chain import Chain 5 from core.composer.node import NodeGenerator 6 from core.repository.model_types_repository import ModelTypesIdsEnum 7 from core.repository.quality_metrics_repository import MetricsRepository, ClassificationMetricsEnum 8 from sklearn.datasets import load_breast_cancer 9 10 11 @pytest.fixture() 12 def data_setup():
Please register or sign in to reply