Package: bingo-nasa
master:develop:DescriptionBingo is an open source package for performing symbolic regression, though it
can be used as a general purpose evolutionary optimization package.Key FeaturesIntegrated local optimization strategiesParallel island evolution strategy implemented with mpi4pyCoevolution of fitness predictorsQuick StartDocumentationFull Documentation HereInstallationTo install Bingo, simply use pip.  Unfortunately the pip install is currently not working.  Please use source install for the time being.pipinstallbingo-nasaUsage ExampleA no-fuss way of using Bingo is by using the scikit-learn wrapper:SymbolicRegressor. Let's setup a test case to show how it works.Setting Up the RegressorThere are many options that can be set inSymbolicRegressor. Here we set some basic ones includingpopulation_size(the number of equations in a population),stack_size(the max number of nodes per equation), anduse_simplification(whether to use simplification to speed up equation evaluation and for easier reading). You can see all ofSymbolicRegressor's
optionshere.frombingo.symbolic_regression.symbolic_regressorimportSymbolicRegressorregressor=SymbolicRegressor(population_size=100,stack_size=16,use_simplification=True)/home/gbomarit/Projects/Genetic_Programming/bingo/bingo/symbolic_regression/__init__.py:31: UserWarning: Could not load C++ modules No module named 'bingocpp.build.bingocpp'
  warnings.warn(f"Could not load C++ modules {import_err}")Training DataHere we're just creating some dummy training data from the equation $5.0 X_0^2 + 3.5 X_0$. More on training data can be found
in thedata formatting guide.importnumpyasnpX_0=np.linspace(-10,10,num=30).reshape((-1,1))X=np.array(X_0)y=5.0*X_0**2+3.5*X_0importmatplotlib.pyplotaspltplt.scatter(X,y)plt.xlabel("X_0")plt.ylabel("y")plt.title("Training Data")plt.show()Fitting the RegressorFitting is as simple as calling the.fit()method.regressor.fit(X,y)using 1 processes
 Generating a diverse population took 274 iterations.
archipelago: <class 'bingo.evolutionary_optimizers.island.Island'>
done with opt, best_ind: X_0 + (5.0)((0.49999999999999967)(X_0) + (X_0)(X_0)), fitness: 5.4391466376923e-28
reran CLO, best_ind: X_0 + (5.0)((0.4999999999999999)(X_0) + (X_0)(X_0)), fitness: 5.352980018399097e-28Getting the Best Individualbest_individual=regressor.get_best_individual()print("best individual is:",best_individual)best individual is: X_0 + (5.0)((0.4999999999999999)(X_0) + (X_0)(X_0))Predicting Data with the Best IndividualYou can use the regressor's.predict(X)or
the best_individual's.evaluate_equation_at(X)to get
its predictions forX.pred_y=regressor.predict(X)pred_y=best_individual.evaluate_equation_at(X)plt.scatter(X,y)plt.plot(X,pred_y,'r')plt.xlabel("X_0")plt.ylabel("y")plt.legend(["Actual","Predicted"])plt.show()SourceInstallation from SourceFor those looking to develop their own features in Bingo.First clone the repo and move into the directory:gitclone--recurse-submoduleshttps://github.com/nasa/bingo.gitcdbingoThen make sure you have the requirements necessary to use Bingo:pipinstall-rrequirements.txtorcondainstall--channelconda-forge--filerequirements.txt(Optional) Then build the c++ performance library BingoCpp:./.build_bingocpp.shNow you should be good to go! You can run Bingo's test suite to make sure that
the installation process worked properly:pytesttestsAdd Bingo to your Python path to begin using it from other directories.exportPYTHONPATH="$PYTHONPATH:/path/to/bingo/"and test it with:python-c'import bingo; import bingocpp'ContributingFork it (https://github.com/nasa/bingo/fork)Create your feature branch (git checkout -b feature/fooBar)Commit your changes (git commit -am 'Add some fooBar')Push to the branch (git push origin feature/fooBar)Create a new Pull RequestVersioningWe useSemVerfor versioning. For the versions available,
see thetags on this repository.AuthorsGeoffrey BomaritoTyler TownsendJacob HochhalterDavid RandallEthan AdamsKathryn EshamDiana VeraLicenseCopyright 2018 United States Government as represented by the Administrator of
the National Aeronautics and Space Administration. No copyright is claimed in
the United States under Title 17, U.S. Code. All Other Rights Reserved.The Bingo Mini-app framework is licensed under the Apache License, Version 2.0
(the "License"); you may not use this application except in compliance with the
License. You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0.Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.