Skip to content

Lightweight Symbolic Regression using the Interaction-Transformation representation, implemented in JavaScript to run on websites (executed on client-side).

License

Notifications You must be signed in to change notification settings

gAldeia/laboratory-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Laboratory Assistant: Lightweight Symbolic Regression

This project was developed to show the possibility of applying the SymTree algorithm as a lightweight alternative to common Symbolic Regression algorithms. This tool can be used as an assistent to physics and engineering experimental labs to verify equations and functions seen in theory classes.

The algorithm was entirely developed in JavaScript.


Getting Started

The project is hosted at http://gAldeia.github.io, where you can use the SymTree algorithm online without any further requirements.

Also, the project page contains a brief tutorial on how to use the tool, some pre made examples to try out the algorithm and a theorical fundamentation of the project (in portuguese);


Installation and Usage

In case you only want the algorithm source code, you'll need to download and include in your HTML two files:

LoadFile.js SymbolicRegression.js
The LoadFile.js deals with the user input, reading it from a html <input type=text> tag or from a html <input type=file>, and converting it to an array of DataPoints (an object created to make notation more meanfull) The SymbolicRegression.js contains three algorithms, all based on the new data structure recently introduced by Fabrício Olivetti de França (GitHub) called IT - iteraction transformation.

Pre requisites

The project depends on the math.js library to handle matrix operations, ploty.js for plotting the results, Mathajax for displaying LaTeX equations, Bootstrap for the structure of the site, jQuery for the interactiveness, and Font Awesome for the icons on the menus.

It is important to notice that is possible to use those libraries without installing it (via CDN).

Running

  1. Read the user input using one of the methods:
  performUpload('my-manualinput', 'manual');
  performUpload('my-csvinput', 'csv');
  1. Use one of the regression algorithms and store the result in a variable:
  performRegression('SymTree');
  performRegression('ITLS');
  performRegression('ITES');
  1. The performRegression method will search for some tags to set the parameters of the models:
 if (algorithm==="SymTree"){
        let iteractions = parseInt($('#symtree-iteractions').val());
        let minI        = parseInt($('#symtree-inv').val());
        let minT        = parseInt($('#symtree-transf').val());
        let threshold   = parseFloat($('#symtree-threshold').val());
        let stopscore   = parseFloat($('#symtree-stopscore').val());

        configuration = {
            iteractions       : iteractions,
            threshold         : threshold,
            minInverse        : minI,
            minTransformation : minT,
            stopscore         : stopscore
        }
        
        //(Xs, ts, iterations, threshold, minI, minT, stopScore)
        expression = SYMTREE(Xtemp, ytemp, iteractions, threshold, minI, minT, stopscore);
    }

    if (algorithm==="ITLS"){
        let popsize     = Number($('#itls-popsize').val());
        let startsize   = Number($('#itls-startsize').val());
        let endsize     = Number($('#itls-endsize').val());
        let expolim     = Number($('#itls-expolim').val());
        let iteractions = Number($('#itls-iteractions').val());
        let stopscore   = Number($('#itls-stopscore').val());

        configuration = {
            popsize     : popsize,
            startsize   : startsize,
            endsize     : endsize,
            expolim     : expolim,
            iteractions : iteractions,
            stopscore   : stopscore   
        }

        //(Xs, ys, popSize, minSize, maxSize, expolim, iterations, stopScore)
        expression = ITLS(Xtemp, ytemp, popsize, startsize, startsize+endsize, expolim, iteractions, stopscore);
    }
        
    if (algorithm==="ITES"){
        let popsize    = Number($('#ites-popsize').val());
        let startsize  = Number($('#ites-startsize').val());
        let endsize    = Number($('#ites-endsize').val());
        let selecsize  = Number($('#ites-selecsize').val());
        let expolim    = Number($('#ites-expolim').val());
        let gens       = Number($('#ites-gens').val());
        let stopscore  = Number($('#ites-stopscore').val());
        
        configuration = {
            popsize    : popsize,
            startsize  : startsize,
            endsize    : endsize,
            selecsize  : selecsize,
            expolim    : expolim,
            gens       : gens,
            stopscore  : stopscore
        }

        //(Xs, ys, popSize, selectedSize, minSize, maxSize, expolim, generations, stopScore)
        expression = ITES(Xtemp, ytemp, popsize, selecsize, startsize, startsize+endsize, expolim, gens, stopscore);
    }
  1. Now to retrieve informations from the returned expression:
  let exp_str   = printIT_html(expression);
  let exp_latex = printIT_latex(expression);

License

See the LICENSE.md file for details.

About

Lightweight Symbolic Regression using the Interaction-Transformation representation, implemented in JavaScript to run on websites (executed on client-side).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published