dcekit 2.14.2__tar.gz → 2.15.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dcekit-2.14.2/dcekit.egg-info → dcekit-2.15.1}/PKG-INFO +3 -2
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/generative_model/vbgmr.py +105 -2
- {dcekit-2.14.2 → dcekit-2.15.1/dcekit.egg-info}/PKG-INFO +3 -2
- {dcekit-2.14.2 → dcekit-2.15.1}/setup.py +1 -1
- {dcekit-2.14.2 → dcekit-2.15.1}/LICENSE +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/LICENSE.txt +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/MANIFEST.in +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/README.md +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/__init__.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/design_of_exmeriments/__init__.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/design_of_exmeriments/bayesian_optimization.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/generative_model/__init__.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/generative_model/gmr.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/generative_model/gtm.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/just_in_time/__init__.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/just_in_time/jitpls.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/just_in_time/lwpls.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/learning/__init__.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/learning/ensemble_learning.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/learning/semi_supervised_learning.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/learning/transfer_learning.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/optimization/__init__.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/optimization/fast_opt_svr_hyperparams.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/optimization/iot.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/optimization/opt_dnn_hyperparams.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/optimization/opt_dnn_hyperparams_class.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/sampling/__init__.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/sampling/kennard_stone.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/validation/__init__.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/validation/applicability_domain.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/validation/metrics.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/validation/validation.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/variable_selection/__init__.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/variable_selection/basic_variable_selection.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/variable_selection/local_interpretation.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit/variable_selection/variable_importance.py +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit.egg-info/SOURCES.txt +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit.egg-info/dependency_links.txt +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit.egg-info/requires.txt +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/dcekit.egg-info/top_level.txt +0 -0
- {dcekit-2.14.2 → dcekit-2.15.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dcekit
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.15.1
|
|
4
4
|
Summary: Data Chemical Engineering toolkit
|
|
5
5
|
Home-page: https://github.com/hkaneko1985/dcekit/
|
|
6
6
|
Author: Hiromasa Kaneko
|
|
@@ -38,6 +38,7 @@ Dynamic: author-email
|
|
|
38
38
|
Dynamic: description
|
|
39
39
|
Dynamic: home-page
|
|
40
40
|
Dynamic: license
|
|
41
|
+
Dynamic: license-file
|
|
41
42
|
Dynamic: requires-dist
|
|
42
43
|
Dynamic: summary
|
|
43
44
|
|
|
@@ -25,11 +25,11 @@ class VBGMR(BayesianGaussianMixture):
|
|
|
25
25
|
def __init__(self, n_components=30, covariance_type='full',
|
|
26
26
|
weight_concentration_prior_type='dirichlet_process',
|
|
27
27
|
weight_concentration_prior=0.01, rep='mean', max_iter=100,
|
|
28
|
-
random_state=None, display_flag=False):
|
|
28
|
+
init_params='kmeans', random_state=None, display_flag=False):
|
|
29
29
|
super(self.__class__, self).__init__(n_components=n_components, covariance_type=covariance_type,
|
|
30
30
|
weight_concentration_prior_type=weight_concentration_prior_type,
|
|
31
31
|
weight_concentration_prior=weight_concentration_prior,
|
|
32
|
-
max_iter=max_iter, random_state=random_state)
|
|
32
|
+
init_params=init_params, max_iter=max_iter, random_state=random_state)
|
|
33
33
|
|
|
34
34
|
self.rep = rep
|
|
35
35
|
self.display_flag = display_flag
|
|
@@ -327,6 +327,109 @@ class VBGMR(BayesianGaussianMixture):
|
|
|
327
327
|
|
|
328
328
|
return estimated_means, estimated_covariances, weights
|
|
329
329
|
|
|
330
|
+
def predict_mog_pdf(self, dataset, numbers_of_input_variables, numbers_of_output_variables):
|
|
331
|
+
"""
|
|
332
|
+
Variational Bayesian Gaussian Mixture Regression (VBGMR) based on Variational Bayesian Gaussian Mixture Model (VBGMM)
|
|
333
|
+
|
|
334
|
+
Predict values of variables for forward analysis (regression) and inverse analysis. Predition results are given as mixture of Gaussians
|
|
335
|
+
|
|
336
|
+
Parameters
|
|
337
|
+
----------
|
|
338
|
+
gmm_model: mixture.gaussian_mixture.GaussianMixture
|
|
339
|
+
GMM model constructed using scikit-learn
|
|
340
|
+
dataset: numpy.array or pandas.DataFrame
|
|
341
|
+
(autoscaled) m x n matrix of dataset of training data or test data,
|
|
342
|
+
m is the number of sammples and
|
|
343
|
+
n is the number of input variables
|
|
344
|
+
When this is X-variables, it is forward analysis (regression) and
|
|
345
|
+
when this is Y-variables, it is inverse analysis
|
|
346
|
+
numbers_of_input_variables: list
|
|
347
|
+
vector of numbers of input variables
|
|
348
|
+
When this is numbers of X-variables, it is forward analysis (regression) and
|
|
349
|
+
when this is numbers of Y-variables, it is inverse analysis
|
|
350
|
+
numbers_of_output_variables: list
|
|
351
|
+
vector of numbers of output variables
|
|
352
|
+
When this is numbers of Y-variables, it is forward analysis (regression) and
|
|
353
|
+
when this is numbers of X-variables, it is inverse analysis
|
|
354
|
+
|
|
355
|
+
Returns
|
|
356
|
+
-------
|
|
357
|
+
estimated_means : numpy.array
|
|
358
|
+
(autoscaled) l x m x k matrix of output variables estimated for all components,
|
|
359
|
+
k is the number of output variables
|
|
360
|
+
estimated_covariances : numpy.array
|
|
361
|
+
(autoscaled) l x k x k variance-covariance matrix of output variables estimated for all components,
|
|
362
|
+
weights : numpy.array
|
|
363
|
+
l x m matrix of weights,
|
|
364
|
+
"""
|
|
365
|
+
|
|
366
|
+
dataset = np.array(dataset)
|
|
367
|
+
if dataset.ndim == 0:
|
|
368
|
+
dataset = np.reshape(dataset, (1, 1))
|
|
369
|
+
elif dataset.ndim == 1:
|
|
370
|
+
dataset = np.reshape(dataset, (1, dataset.shape[0]))
|
|
371
|
+
|
|
372
|
+
input_means = self.means_[:, numbers_of_input_variables]
|
|
373
|
+
output_means = self.means_[:, numbers_of_output_variables]
|
|
374
|
+
|
|
375
|
+
if self.covariance_type == 'full':
|
|
376
|
+
all_covariances = self.covariances_
|
|
377
|
+
elif self.covariance_type == 'diag':
|
|
378
|
+
all_covariances = np.empty(
|
|
379
|
+
[self.n_components, self.covariances_.shape[1], self.covariances_.shape[1]])
|
|
380
|
+
for component_number in range(self.n_components):
|
|
381
|
+
all_covariances[component_number, :, :] = np.diag(self.covariances_[component_number, :])
|
|
382
|
+
elif self.covariance_type == 'tied':
|
|
383
|
+
all_covariances = np.tile(self.covariances_, (self.n_components, 1, 1))
|
|
384
|
+
elif self.covariance_type == 'spherical':
|
|
385
|
+
all_covariances = np.empty([self.n_components, self.means_.shape[1], self.means_.shape[1]])
|
|
386
|
+
for component_number in range(self.n_components):
|
|
387
|
+
all_covariances[component_number, :, :] = np.diag(
|
|
388
|
+
self.covariances_[component_number] * np.ones(self.means_.shape[1]))
|
|
389
|
+
|
|
390
|
+
estimated_means = np.zeros([self.n_components, dataset.shape[0], len(numbers_of_output_variables)])
|
|
391
|
+
estimated_covariances = np.zeros([self.n_components, len(numbers_of_output_variables), len(numbers_of_output_variables)])
|
|
392
|
+
weights = np.zeros([self.n_components, dataset.shape[0]])
|
|
393
|
+
pdfs = np.zeros([self.n_components, dataset.shape[0]])
|
|
394
|
+
logpdfs = np.zeros([self.n_components, dataset.shape[0]])
|
|
395
|
+
# print(all_covariances.shape[2], len(numbers_of_input_variables), len(numbers_of_output_variables))
|
|
396
|
+
if all_covariances.shape[2] == len(numbers_of_input_variables) + len(numbers_of_output_variables):
|
|
397
|
+
input_output_covariances = all_covariances[:, numbers_of_input_variables, :]
|
|
398
|
+
input_covariances = input_output_covariances[:, :, numbers_of_input_variables]
|
|
399
|
+
input_output_covariances = input_output_covariances[:, :, numbers_of_output_variables]
|
|
400
|
+
output_input_covariances = all_covariances[:, numbers_of_output_variables, :]
|
|
401
|
+
output_covariances = output_input_covariances[:, :, numbers_of_output_variables]
|
|
402
|
+
output_input_covariances = output_input_covariances[:, :, numbers_of_input_variables]
|
|
403
|
+
|
|
404
|
+
# estimated means and weights for all components
|
|
405
|
+
for component_number in range(self.n_components):
|
|
406
|
+
estimated_means[component_number, :, :] = output_means[component_number, :] + (
|
|
407
|
+
dataset - input_means[component_number, :]).dot(
|
|
408
|
+
np.linalg.inv(input_covariances[component_number, :, :])).dot(
|
|
409
|
+
input_output_covariances[component_number, :, :])
|
|
410
|
+
estimated_covariances[component_number, :, :] = output_covariances[component_number, :, :] - output_input_covariances[component_number, :, :].dot(
|
|
411
|
+
np.linalg.inv(input_covariances[component_number, :, :])).dot(input_output_covariances[component_number, :, :])
|
|
412
|
+
try:
|
|
413
|
+
weights[component_number, :] = self.weights_[component_number] * \
|
|
414
|
+
multivariate_normal.pdf(dataset,
|
|
415
|
+
input_means[component_number, :],
|
|
416
|
+
input_covariances[component_number, :, :])
|
|
417
|
+
pdfs[component_number, :] = multivariate_normal.pdf(dataset, input_means[component_number, :], input_covariances[component_number, :, :])
|
|
418
|
+
logpdfs[component_number, :] = multivariate_normal.logpdf(dataset, input_means[component_number, :], input_covariances[component_number, :, :])
|
|
419
|
+
except:
|
|
420
|
+
print('assignment of weights is failed, and zero is assigned')
|
|
421
|
+
|
|
422
|
+
if len(np.where(weights.sum(axis=0)==0)[0]) > 0:
|
|
423
|
+
weights = np.ones(weights.shape)
|
|
424
|
+
if np.isnan(weights.sum(axis=0)).any():
|
|
425
|
+
weights = np.ones(weights.shape)
|
|
426
|
+
if np.isinf(weights.sum(axis=0)).any():
|
|
427
|
+
weights = np.ones(weights.shape)
|
|
428
|
+
weights = weights / weights.sum(axis=0)
|
|
429
|
+
ioe = -logsumexp(logpdfs, axis=0, b=weights)
|
|
430
|
+
|
|
431
|
+
return estimated_means, estimated_covariances, weights, pdfs, logpdfs, ioe
|
|
432
|
+
|
|
330
433
|
def cv_opt(self, dataset, numbers_of_input_variables, numbers_of_output_variables, covariance_types,
|
|
331
434
|
numbers_of_components, weight_concentration_prior_types, weight_concentration_priors, fold_number):
|
|
332
435
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: dcekit
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.15.1
|
|
4
4
|
Summary: Data Chemical Engineering toolkit
|
|
5
5
|
Home-page: https://github.com/hkaneko1985/dcekit/
|
|
6
6
|
Author: Hiromasa Kaneko
|
|
@@ -38,6 +38,7 @@ Dynamic: author-email
|
|
|
38
38
|
Dynamic: description
|
|
39
39
|
Dynamic: home-page
|
|
40
40
|
Dynamic: license
|
|
41
|
+
Dynamic: license-file
|
|
41
42
|
Dynamic: requires-dist
|
|
42
43
|
Dynamic: summary
|
|
43
44
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|