Sha256: 9ad19ad3ecdd1267dda988c712c7ac094bc43d4b66bde5da89b55bc8b22cf522

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

# Author::    Sergio Fierens
# License::   MPL 1.1
# Project::   ai4r
# Url::       http://ai4r.rubyforge.org/
#
# You can redistribute it and/or modify it under the terms of 
# the Mozilla Public License version 1.1  as published by the 
# Mozilla Foundation at http://www.mozilla.org/MPL/MPL-1.1.txt
 
module Ai4r
  module Classifiers
    
    # The only purpose of this class is to define a common API for classifiers.
    # All methods in this class must be implemented in subclasses.
    class Classifier

      # Build a new classifier, using data examples found in data_set.
      def build(data_set)
        raise NotImplementedError
      end
      
      # You can evaluate new data, predicting its class.
      # e.g.
      #   classifier.eval(['New York',  '<30', 'F'])  # => 'Y'
      def eval(data)
        raise NotImplementedError
      end
      
      # This method returns the generated rules in ruby code.
      # e.g.
      #   
      #   classifier.get_rules
      #     # =>  marketing_target='Y'
      #
      # It is a nice way to inspect induction results, and also to execute them:  
      #     marketing_target = nil
      #     eval classifier.get_rules   
      #     puts marketing_target
      #       # =>  'Y'
      def get_rules
        raise NotImplementedError
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ai4r-1.3 lib/ai4r/classifiers/classifier.rb