Code Monkey home page Code Monkey logo

xgp-python's Introduction

XGP Python package

PyPI version Travis build status Coverage Status

This repository contains Python bindings to the XGP library. It is a simple wrapper that calls the XGP dynamic shared library and exposes a scikit-learn interface.

Documentation

Please refer to the Python section of the XGP website.

Installation

Installation instructions are available here.

Quick start

>>> from sklearn import datasets
>>> from sklearn import metrics
>>> from sklearn import model_selection
>>> import xgp

>>> X, y = datasets.load_boston(return_X_y=True)
>>> X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, random_state=42)

>>> model = xgp.XGPRegressor(
...    flavor='boosting',
...    loss_metric='mse',
...    funcs='add,sub,mul,div',
...    n_individuals=50,
...    n_generations=20,
...    parsimony_coefficient=0.01,
...    n_rounds=8,
...    random_state=42,
... )

>>> model = model.fit(X_train, y_train, eval_set=(X_test, y_test), verbose=True)

>>> metrics.mean_squared_error(y_train, model.predict(X_train))  # doctest: +ELLIPSIS
17.794685...

>>> metrics.mean_squared_error(y_test, model.predict(X_test))  # doctest: +ELLIPSIS
17.337693...

This will also produce the following output in the shell:

00:00:00 -- train mse: 42.06567 -- val mse: 33.80606 -- round 1
00:00:00 -- train mse: 24.20662 -- val mse: 22.73832 -- round 2
00:00:00 -- train mse: 22.06328 -- val mse: 18.90887 -- round 3
00:00:00 -- train mse: 20.25549 -- val mse: 18.45531 -- round 4
00:00:00 -- train mse: 18.86693 -- val mse: 18.22908 -- round 5
00:00:00 -- train mse: 17.79469 -- val mse: 17.33769 -- round 6
00:00:01 -- train mse: 17.62692 -- val mse: 22.67012 -- round 7
00:00:01 -- train mse: 17.24799 -- val mse: 22.77802 -- round 8

xgp-python's People

Contributors

amueller avatar arokem avatar bryandeng avatar fabianp avatar kjacks21 avatar maxhalford avatar mechcoder avatar tomdlt avatar vighneshbirodkar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.