Giter Club home page Giter Club logo

mldlnl's Introduction

Documentation

1. What's the MLDLNL?

  MLDLNL is a tensorflow based high level API. It facilitates creating machine learning models(for now).

2.Installation

a.Requirements

-Python
     -Numpy
     -Tensorflow 1.x.x

b.Installation Steps

You can run the module including into working directory. You can also install it into python3. After the installation, you can run the module without including into working directory.

Follow this steps for install the module(optional)

·Installation Steps for Linux

  1. Open the terminal. After that
  2. git clone https://github.com/alihakimtaskiran/mldlnl.git
  3. cd "mldlnl"
  4. sudo cp mldlnl.py /usr/lib/python[version]
  5. If you haven't installed numpy, install the numpy with pip3 install numpy
  6. If you haven't installed tensorflow 1.x, install the tensorflow 1.x with pip3 install tensorflow==1.15.0

Finally, you can use the module in python3 just one lines of code:import mldlnl

3.Tree of Module

mldlnl---|
         |
         |---LinReg()--|
         |             |--fit(x,y,lr=0.1,iter_no=80000,loss_fun="L2",lang="en")
         |             |--get_variables()
         |             |--calc(x)
         |             |--save(file_name)
         |             |--restore(file_name)
         |             |--restore_manually(weight,bias)
         |
         |
         |---MultiLinReg(n_of_params)--|
         |                             |--fit(x,y,lr=0.05,iter_no=70000,loss_fun="L2",lang="en")
         |                             |--get_variables()
         |                             |--calc(x)
         |                             |--save(file_name)
         |                             |--restore(file_name)                                   
         |
         |
         |---Perceptron(neurons=[1,1,1],activation_fun="tanh")--|
         |                                                      |--fit(x,y,epochs=5,batch_size=200,lr=0.01,keep_prob=1.)
         |                                                      |--calc(x,argmax=False)
         |                                                      |--save(file)
         |                                                      |--restore(file)
         |                                                      |--test(x,y)
         |                                                      |--properties()
         |
         |
         |---tools--|
         |          |--split_batch(x,batch_size)
         |
         |
         |---ExpReg()--|
         |             |--fit(x,y,lr=0.01,iter_no=50000)
         |             |--calc(x)
         |             |--get_variables()
         |             |--save(n_of_file)
         |             |--restore(n_of_file)
         |
         |---CExpReg()--|
                        |--fit(x,y,lr=0.01,iter_no=50000)
                        |--calc(x)
                        |--get_variables()
                        |--save(n_of_file)
                        |--restore(n_of_file)

  • LinReg:

    type:objectLinear Regression object. Use this object to create linear regression models.
      fit(x,y,lr=0.1,iter_no=80000,loss_fun="L2",lang="en")

      type:method fit() optimizes model with specic loss function. It uses tf.train.AdamOptimizer to find optimum weight and bias.x is input,y is output. lr islearning rate, it's default 0.1.iter_no is number of train step.loss_fun is a string represents loss function.It's default L2, you can also use L1 with "L1".

      get_variables() 

      type:method The function exports variables and returns a tupleweight,bias)

      calc(x) 
      type:method

      Computes the output value with spesific input.

      save(file_n) 
      type:method

      Exports and saves parametrs into a file.file_n is a string takes name of file. Don't add directory into the string.

      restore(file_n) 
      type:method

      Imports and restores parameters from file.file_n is a string takes name of file. Don't add directory into the string.

      restore_manually(W,B) 
      type:method

      This function utilizes restore parameters manually. You can initialize variables by this function.




  • MultiLinReg(n_of_params)

    Multi Linear Regression object. Use this object to create multi linear regression models.
  • type:object

    n_of_params is number of parameters.

      fit(x,y,lr=0.1,iter_no=80000,loss_fun="L2",lang="en")

      type:method fit() optimizes model with specific loss function. It uses tf.train.AdamOptimizer to find optimum weight and bias.x is input,y is output. lr is learning rate, it's default 0.1.iter_no is number of train step.loss_fun is a string represents loss function.It's default L2, you can also use L1 with "L1".

      get_variables() 

      type:method The function exports variables and returns a tupleweight,bias)

      calc(x) 
      type:method

      Computes the output value with spesific input.

      save(file_n) 
      type:method

      Exports and saves parametrs into a file.file_n is a string takes name of file. Don't add directory into the string.

      restore(file_n) 
      type:method

      Imports and restores parameters from file.file_n is a string takes name of file. Don't add directory into the string.




  • Perceptron(neurons=[1,1,1],activation_fun="tanh")

    Perceptron object utilizes creating multi layer perceptrons with specific activation function
  • type:object

    neurons is a list(like [784,256,128,10]) to represent number of neuron per layer. The list should have at least 3 elements.activation_fun is specific activation function for perceptron.tanh,ReLU and sigmoid are supported activation functions. Activation function of last layer is softmax independed from specific activation function.

  • fit(x,y,epochs=5,batch_size=200,lr=0.01,keep_prob=1.) 
  • type:method fit() utilizes train perceptron. It uses AdamOptimizer to optimize model.x is input data and y is output data to train perceptron. You don't need to split into batchs the data. Percepton object has internal batch splitting system.epochs is training epochs.batch_size is default set into 200.lr is default set into 0.01.keep_prob is probibilty of retained neurons after dropout

  • calc(x,argmax=False) 
  • type: method This function feed forwards an input value. You can compute the output of perceptron.x is input. argmax is a boolean. If it's True, the function returns index of maximum value of percpetron's output. If it's False, function returns output of perceptron.

  • save(file) 
  • type:method It exports parameters of perceptrons into a filefile is name of the file.

  • restore(file) 
  • type:method It imports parameters of perceptron from file. file is name of the file.

  • test(x,y) 
  • type:method Computes cross entropy loss and accuracy of spesific data. x is input and y is true output. Function returns loss,accuracy

  • properties() 
  • type:method Shows number of neurons in each layer and activation function. Function returns a tuple (neurons, activation function)





    • tools()

      This class contains usefull tools for data science.
    • type:class
    • split_batch(x,batch_size) 
    • type:method This function facilates spliting dataset into batchs.x is input data, batch_size is size of batch, it's an integer.


    ExpReg()

    ExpReg object utilizes creating exponential regression model. It's ideal for pandemic analysis. Number of infected poeple growth exponentially.


    • type:class
    • fit(x,y,lr=0.01,iter_no=50000)
      type:method
      It optimizes the model with dataset. x is dataset's x values and y is y values of dataset.lr is learning rate set as 0.01. iter_no is training steps for optimizer.
    • calc(x) 
      type:method

      Computes the output value with spesific input.

    • get_variables() 
    • type:method The function exports variables and returns a tupleweight,bias)

    • save(n_of_file) 
    • type:method

      Exports and saves parametrs into a file.n_of_file is a string takes name of file. Don't add directory into the string.

    • restore(n_of_file) 
    • type:method

      Imports and restores parameters from file.n_of_file is a string takes name of file. Don't add directory into the string.




    CExpReg()

    CExpReg object utilizes creating exponential regression model. It's a bit complex than exponential regression. It has more variables than ExpReg. It's ideal for pandemic analysis more than ExpReg.


    • type:class
    • fit(x,y,lr=0.01,iter_no=50000)
      type:method
      It optimizes the model with dataset. x is dataset's x values and y is y values of dataset.lr is learning rate set as 0.01. iter_no is training steps for optimizer.
    • calc(x) 
      type:method

      Computes the output value with spesific input.

    • get_variables() 
    • type:method The function exports variables and returns a tupleweight,bias)

    • save(n_of_file) 
    • type:method

      Exports and saves parametrs into a file.n_of_file is a string takes name of file. Don't add directory into the string.

    • restore(n_of_file) 
    • type:method

      Imports and restores parameters from file.n_of_file is a string takes name of file. Don't add directory into the string.

mldlnl's People

Contributors

alihakimtaskiran avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

onuratakan

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.