In the previous two weeks, I had completed the proof of concept implementation of the Jaxns Sampler for Gaussian Processes, and in these two weeks, I mainly focussed on making the actual implimentation and putting the functions together in a PR.
My Intial Plan was to make two different Classes for the project and get_likelihood and get_prior function whihc have different functions for different combinations but I changed those implimentation based on the suggestion of my Mentor. This is the part of the project, that I like the most, I am getting to ideate and try out various interfaces, and am getting some really nice suggestions to imporve my code. This is really a first time experience of such type of project for me.
When people think of Open Source they think of Code that is available for all to see, rather than private code, but reality cannot be any more further than that!! Open Source is all about collaboration. I learned this the nice way in these two weeks.
Firstly I was some difficulty implimenting my conditioned beta priors using Tensorflow Probability distribution and was finding it difficult to find it up in the documentation. So I thought that perhaps, I might get some hints if I ask in the email channel, and guess what, the maintainers not only replied back fast, they gave me a well written explaination, and links for further reference.
Secoundly, I also had to implement some prior functions in the Jaxns prior model, so on the advice of my mentors, I wrote a issue in the library, and this started a very enjoyable interchange between me and the library author. I would ask a question at the night, and when I would wake up I would have a well written reply.
Such experiences with so many amazing people has made realise the real meaning of Open Source, and you bet I will be recipocating all this help to other programmers.
A brief about the classes of the project.
The GP class will be the class that takes a lightcurve and makes a Gaussian process model for it and will also carry out storing, calculating log-likelihood, and plotting the initial file.
Inputs: (Lc: Lightcurve, Kernel Type, Kernel Parameters , Mean Type , Meanl Parameters)
The kernel and mean type classes will be dictionaries containing information regarding the type of kernel to be built, and the parameters will have the respective parameters.
Instance Attributes:-
• self.maingp: which will be made with the given kernel and mean on the time bins of the lightcurve as X.
• self.conditionalgp: will have the GP fitted conditionally on the lightcurve values.
• Trivial ones like:- self.kernel, self.mean etc
Functions:-
• get likelihood(): returns the likelihood of the data over the parameters
• get model():- returns the kernel, mean and their parameters
• plot original gp():- Plots the gp based on the time bins of the lightcurve and the model implemented. Will have many other features
• plot conditional gp():- Plot the gp fitted on the light curve
• plot lc():- Plots the lightcurve with option of fitting it will the gp and filling the gp variance
The GPResult class will execute the sampling and hyperparameter inference for a given GP class and its matching priors. Ie. we will give a GP object, and a GP model, along with priors for the parameters and we will its sampled parameters
Inputs: (GPclass, prior type, prior parameters )
The GP class is the GP regressor we made on the light curve. The prior is the dictionary containing the information regarding types of the kernel and mean prior (mostly analogous to the kernel and mean) along with the prior parameters.
Functions:-
• get parameters():- samples from the posterior and saves the parameter probabilities as a histogram, and a dictionary with means and standard deviations
• get meangp() :- returns a GP with the kernel (and mean function) parameters set to the mean of the sampled posterior
• get random posterior():- returns a random sample on the posterior
• get likelihood() :- gives the likelihood of the GP
• get evidence() :- calculates and returns the evidence for the given model over the data
• Other self Explanatory functions:- get kernel(), etc Plotting:- plot kernel(), plot lightcurve(), plot residue(), plot corners(), plot frequency posterior(), plot period posterior(), plot qpo log amplitude()