#Example script to launch fit 1 dimensional mixture model. #Add the toolbox to path import os import sys toolbox_path = "../code" sys.path.append(os.path.join(os.path.abspath(toolbox_path))) #Add the toolbox to path #Generate some data generate_new_data=1 if generate_new_data==1: from generate_data_vector2 import generate_data_vector data_vector=generate_data_vector(N_comps=3, N_samples=5000 ,means=[ 0., 5. ,-5.], variances= [1.,2.,2.], mixing=[0.9, 0.09, 0.01]) else: import scipy.io as sio sio.loadmat('data_vector.mat') #Generate some data #Define options for the mixture model fit Inference ='Variational Bayes'#'Method of moments'#'Variational Bayes' #'Method of moments' OR 'Maximum Likelihood' OR 'Variational Bayes' ML NOT INCLUDED YET Number_of_Components=3 Components_Model=['Gauss','Gamma','-Gamma'] #Each component can be Gauss, Gamma, InvGamma, -Gamma, -InvGamma init_params=[0.,1.,6.,1.,-6.,1.] init_pi=np.ones(3); init_pi=np.divide(init_pi,3) maxits=300 tol=0.00000001
#Example script to launch fit 1 dimensional mixture model. #Add the toolbox to path import os import sys toolbox_path = "../code" sys.path.append(os.path.join(os.path.abspath(toolbox_path))) #Add the toolbox to path #Generate some data generate_new_data = 1 if generate_new_data == 1: from generate_data_vector2 import generate_data_vector data_vector = generate_data_vector(3, 50000, [0, 5, -5], [1, 1, 1], [0.8, 0.1, 0.1]) else: import scipy.io as sio sio.loadmat('data_vector.mat') #Generate some data #Define options for the mixture model fit Inference = 'Variational Bayes' #'Method of moments'#'Variational Bayes' #'Method of moments' OR 'Maximum Likelihood' OR 'Variational Bayes' ML NOT INCLUDED YET Number_of_Components = 3 Components_Model = [ 'Gauss', 'InvGamma', '-InvGamma' ] #Each component can be Gauss, Gamma, InvGamma, -Gamma, -InvGamma init_params = [0, 1, 5, 2, -5, 2] maxits = 300 tol = 0.00000001 opts = {
#Add the toolbox to path import time import os import sys import numpy as np toolbox_path = "../code" sys.path.append(os.path.join(os.path.abspath(toolbox_path))) #Add the toolbox to path #Generate some data generate_new_data = 1 if generate_new_data == 1: from generate_data_vector2 import generate_data_vector data_vector = generate_data_vector(3, 50000, [0, 3, -3], [1, 1, 1], [0.9, 0.05, 0.05]) else: import scipy.io as sio sio.loadmat('data_vector.mat') #Generate some data #Define options for the mixture model fit Inferences_possibilities = [ 'Method of moments', 'Maximum Likelihood', 'Variational Bayes' ] Number_of_Components = 3 #Each component can be Gauss, Gamma, InvGamma, -Gamma, -InvGamma init_params = [0, 1, 5, 2, -5, 2] init_pi = np.ones(3) init_pi = np.divide(init_pi, 3) maxits = 300