![]() #define a likelihood function for the boundary lineĬfm = confusion_matrix(labels,classifications)Ĭm = cfm.astype('float') / cfm.sum(axis=1) Plt.scatter(folded_xy_train,folded_z_train,c=rounded_labels_train,s=1.0) ![]() Model = (m_true*folded_xy_train) + b_true Rounded_labels_train = np.ones(len(folded_z_train)) #define the true gradient and offset for the boundary line ![]() import emceeįrom trics import confusion_matrixįolded_xy_train = np.random.uniform(0,1,10000) #test x dataįolded_z_train = np.random.uniform(0,1,10000) #test y data The following code should run out-of-the-box. I'm unsure as to why the MCMC chains don't converge nicely to an appropriate value here so any help would be greatly appreciated. I have put an example code below which generates some nicely divided populations and then MCMCs around the initial guesses of the parameter values. This way you can imagine a TP and TN rate of 1 respectively will give a likelihood value of 1 while TP and TN rates of 0 will return a likelihood value of 0.īut when I attempt to sample the parameter space for m and b, the gradient and offset (or bias), for the boundary line, I get some wildly big and/or small values for the walks. The likelihood function calculates the true positive and true negative classifications, given some linear boundary line, and is used to minimise the difference between the two values whilst maximising their sum. I'm trying to implement emcee MCMC sampling in Python with a predefined likelihood function to find the best boundary between two populations of data.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |