what is the difference between offline and online learning considering that the program will be made with matlab .. and please check the following matlab code , does it fall into one of those two categories?

function y = Perceptron_online(inputs,dest,iterations,Bias)
w = rand(1,size(inputs,2));
while (i<iterations)
    output = sum(w.*inputs)+ Bias;
    if sign(output)~=sign(dest)
        diffW = dest.*inputs;
        w = w + diffW;
        diffBias = dest;
        Bias = Bias + diffBias;

1 Answer 1

  • in Online machine learning data becomes available in a sequential order and is used to update the predictor (its parameters) for future data at each step
  • (as instead) in Offline machine learning we generate the best predictor by learning on the entire training data set at once

Such code looks like a Perceptron, which can be used in online classification but you should specify what input and output are.
If input is the data matrix and output is the known labels vector, you can work in an online fashion by removing the iterations and simply scanning the data matrix, that is (for every jth example):

  1. evaluate output
  2. update weights

However if you want to work in an offline fashion you can repeat such steps until a maximum number of iterations has been reached or until the iteration error is less then a specific, a priori known, threshold.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.