|
|
@ -180,13 +180,20 @@ class WarmStartComponent(Component):
|
|
|
|
self.predictors[category] = deepcopy(self.predictor_prototype)
|
|
|
|
self.predictors[category] = deepcopy(self.predictor_prototype)
|
|
|
|
self.predictors[category].fit(x_train, y_train)
|
|
|
|
self.predictors[category].fit(x_train, y_train)
|
|
|
|
|
|
|
|
|
|
|
|
def merge(self, other):
|
|
|
|
def merge(self, other_components):
|
|
|
|
for c in other.x_train.keys():
|
|
|
|
keys = set(self.x_train.keys())
|
|
|
|
if c not in self.x_train:
|
|
|
|
for comp in other_components:
|
|
|
|
self.x_train[c] = other.x_train[c]
|
|
|
|
keys = keys.union(set(comp.x_train.keys()))
|
|
|
|
self.y_train[c] = other.y_train[c]
|
|
|
|
|
|
|
|
else:
|
|
|
|
for key in keys:
|
|
|
|
self.x_train[c] = np.vstack([self.x_train[c], other.x_train[c]])
|
|
|
|
x_train_submatrices = [comp.x_train[key]
|
|
|
|
self.y_train[c] = np.vstack([self.y_train[c], other.y_train[c]])
|
|
|
|
for comp in other_components
|
|
|
|
if (c in other.predictors.keys()) and (c not in self.predictors.keys()):
|
|
|
|
if key in comp.x_train.keys()]
|
|
|
|
self.predictors[c] = other.predictors[c]
|
|
|
|
y_train_submatrices = [comp.y_train[key]
|
|
|
|
|
|
|
|
for comp in other_components
|
|
|
|
|
|
|
|
if key in comp.y_train.keys()]
|
|
|
|
|
|
|
|
if key in self.x_train.keys():
|
|
|
|
|
|
|
|
x_train_submatrices += [self.x_train[key]]
|
|
|
|
|
|
|
|
y_train_submatrices += [self.y_train[key]]
|
|
|
|
|
|
|
|
self.x_train[key] = np.vstack(x_train_submatrices)
|
|
|
|
|
|
|
|
self.y_train[key] = np.vstack(y_train_submatrices)
|
|
|
|