Giter Site home page Giter Site logo

learngit's Introduction

fsklearn

A simple module for machine learning in Fortran using scikit-learn.

Overview

  • Currently the module can be used to do training and prediction in FORTRAN.

  • The training part uses scikit-learn library by calling Python from FORTRAN.

  • The prediction part, as it may be called frequent by a FORTRAN code, is written with FORTRAN 2003.

Supported machine learning method

Currently, the following methods are supported for regression (not classification) problem:

  • Neual Networks
  • Decision Tree
  • Random Forest

Supported FORTRAN compiler

The following compiler are tested.

  • Intel - Tested with 2019.0.2.187
  • GNU - Tested with 8.1.0

Since derived type is used in the module, it is recommended to used GNU > 5.0 or Intel > 14.0 (2013 SP1).

Required packages for Python3

build tool

Run the test

    git clone https://github.com/Yeldon/fsklearn.git
    cd fsklearn/
    cp -r tests/src ./
    cp -r tests/build ./
    make 
    ./build/fsklearn_test

Example

Assume you have set up the file path and the correct input and output interface for your data, a simple main program (sequential version) could be:

  • training
    program main
    use mod_fsklearn
    implicit none
    integer :: input_len = 3
    integer :: input_len = 3
    integer :: num_datalen = 500
    integer :: sample_data(500,6)
    
    Call fsklearn_initialization ! Initialization
    ! Assume you have defined your interface in mod_fsklearn
    Call F_Sklearn%Fen_Training(sample_data,3, 3, 500)
    Call F_Sklearn%PY_Training ! Call python to train
    
    end program main
  • prediction
    program main
    use mod_fsklearn
    implicit none
    integer :: inputs = 3
    
    Call fsklearn_initialization ! Initialization
    inputs=[-0.99,0.141067, -0.54]
    ! If you have setup the mod_fsklearn and input.namelist, this should be working
    F_Sklearn%outputs = F_Sklearn%predict(inputs,F_Sklearn%n_inputs,F_Sklearn%n_outputs)

Progress[6/8]

  • Glue FORTRAN and Python
  • Basic training and prediction interface
  • MPI version
  • First step tests
  • A more smart Python code generator
  • Parameters for training function
  • Prediction for data, vector and matrix
  • Second step tests

License

This project is licensed under the BSD3 - see the LICENSE.md file for details

learngit's People

Contributors

zhoutengye avatar

Watchers

xiazh 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.