“Machine learning is a type of artificial intelligence (AI) that provides computers with the ability to learn without being explicitly programmed. Machine learning focuses on the development of computer programs that can teach themselves to grow and change when exposed to new data.”
The data determines the output.
require 'decisiontree' attributes = ['Temp'] training = [ [98.7, 'healthy'], [99.1, 'healthy'], [99.5, 'sick'], [100.5, 'sick'], [102.5, 'crazy sick'], [107.5, 'dead'], ] dec_tree = DecisionTree::ID3Tree.new(attributes, training, 'sick', :continuous) dec_tree.train test = [98.5, 'healthy'] dec_tree.predict(test)
require 'decisiontree' attributes = ['Age', 'Education', 'Income', 'Marital Status'] training = [ ['36-55', 'Masters', 'High', 'Single', 1], ['18-35', 'High School', 'Low', 'Single', 0], ['36-55', 'Masters', 'High', 'Single', 1], ['18-35', 'PhD', 'Low', 'Married', 1], ['< 18', 'High School', 'Low', 'Single', 1], ['55+', 'High School', 'High', 'Married', 0], ['55+', 'High School', 'High', 'Married', 1], ['55+', 'High School', 'High', 'Married', 1], ['55+', 'High School', 'High', 'Married', 1], ['< 18', 'Masters', 'Low', 'Single', 0], ] dec_tree = DecisionTree::ID3Tree.new(attributes, training, 1, :discrete) dec_tree.train test = ['18-35', 'PhD', 'High', 'Married'] dec_tree.predict(test)
I've been a software engineer for the past decade and have traveled the world building applications and training individuals on a wide variety of topics.