|
9 | 9 |
|
10 | 10 | initializers provide good starting points for EM algorithm and other optimization |
11 | 11 | methods, helping to avoid poor local optima and improving convergence. |
12 | | -
|
13 | | -**Usage Example** |
14 | | -
|
15 | | -.. code-block:: python |
16 | | -
|
17 | | - >>> from rework_pysatl_mpest.distributions.exponential import Exponential |
18 | | - >>> from sklearn.cluster import KMeans |
19 | | - >>> from rework_pysatl_mpest.initializers.clusterize_initializer import ClusterizeInitializer |
20 | | - >>> from rework_pysatl_mpest.initializers import ClusterMatchStrategy, EstimationStrategy |
21 | | - >>> from rework_pysatl_mpest.core.mixture import MixtureModel |
22 | | -
|
23 | | - >>> # Create initializer with KMeans clustering |
24 | | - >>> initializer_cluster = ClusterizeInitializer( |
25 | | - ... is_accurate=True, |
26 | | - ... is_soft=False, |
27 | | - ... clusterizer=KMeans(n_clusters=3) |
28 | | - ... ) |
29 | | -
|
30 | | - >>> # Create distribution models to initialize |
31 | | - >>> distributions = [Exponential(loc=0.0, rate=0.1), |
32 | | - >>>Exponential(loc=5.0, rate=0.05), Exponential(loc=10.0, rate=0.01)] |
33 | | -
|
34 | | - >>> # Generate sample data |
35 | | - >>> mixture = MixtureModel(distributions, [0.3, 0.4, 0.3]) |
36 | | - >>> X = mixture.generate(300) |
37 | | -
|
38 | | - >>> # Perform initialization |
39 | | - >>> mixture_model = initializer_cluster.perform( |
40 | | - ... X=X, |
41 | | - ... dists=distributions, |
42 | | - ... cluster_match_strategy=ClusterMatchStrategy.AKAIKE, |
43 | | - ... estimation_strategies=[EstimationStrategy.QFUNCTION] * len(distributions) |
44 | | - ... ) |
45 | | -
|
46 | | - >>> # The mixture model is now initialized with estimated parameters |
47 | | - >>> print(f"Number of components: {len(mixture_model.components)}") |
48 | | - >>> print(f"Weights: {mixture_model.weights}") |
49 | 12 | """ |
50 | 13 |
|
51 | 14 | __author__ = "Viktor Khanukaev" |
52 | 15 | __copyright__ = "Copyright (c) 2025 PySATL project" |
53 | 16 | __license__ = "SPDX-License-Identifier: MIT" |
54 | 17 |
|
55 | 18 | from ._estimation_strategies.q_function import q_function_strategy, q_function_strategy_exponential |
56 | | -from .cluster_match_strategy import ( |
57 | | - match_clusters_for_models_akaike, |
58 | | - match_clusters_for_models_log_likelihood, |
59 | | -) |
60 | 19 | from .clusterize_initializer import ClusterizeInitializer |
61 | 20 | from .initializer import Initializer |
62 | | -from .strategies import ClusterMatchStrategy, EstimationStrategy |
| 21 | +from .strategies import EstimationStrategy |
63 | 22 |
|
64 | 23 | __all__ = [ |
65 | | - "ClusterMatchStrategy", |
66 | 24 | "ClusterizeInitializer", |
67 | 25 | "EstimationStrategy", |
68 | 26 | "Initializer", |
69 | | - "match_clusters_for_models_akaike", |
70 | | - "match_clusters_for_models_log_likelihood", |
71 | 27 | "q_function_strategy", |
72 | 28 | "q_function_strategy_exponential", |
73 | 29 | ] |
0 commit comments