for friday read chapter 18, section 7 program 3 due

42
For Friday Read chapter 18, section 7 Program 3 due

Upload: jasmin-haynes

Post on 30-Dec-2015

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: For Friday Read chapter 18, section 7 Program 3 due

For Friday• Read chapter 18, section 7• Program 3 due

Page 2: For Friday Read chapter 18, section 7 Program 3 due

Program 3

• Any questions?

Page 3: For Friday Read chapter 18, section 7 Program 3 due

Learning Theory• Theorems that characterize classes of learning problems or

specific algorithms in terms of computational complexity or sample complexity, i.e. the number of training examples necessary or sufficient to learn hypotheses of a given accuracy.

• Complexity of a learning problem depends on:– Size or expressiveness of the hypothesis space.– Accuracy to which target concept must be approximated.– Probability with which the learner must produce a successful

hypothesis.– Manner in which training examples are presented, e.g. randomly

or by query to an oracle.

Page 4: For Friday Read chapter 18, section 7 Program 3 due

Types of Results• Learning in the limit: Is the learner guaranteed to

converge to the correct hypothesis in the limit as the number of training examples increases indefinitely?

• Sample Complexity: How many training examples are needed for a learner to construct (with high probability) a highly accurate concept?

• Computational Complexity: How much computational resources (time and space) are needed for a learner to construct (with high probability) a highly accurate concept?– High sample complexity implies high computational complexity,

since learner at least needs to read the input data.• Mistake Bound: Learning incrementally, how many

training examples will the learner misclassify before constructing a highly accurate concept.

Page 5: For Friday Read chapter 18, section 7 Program 3 due

Learning in the Limit• Given a continuous stream of examples where the learner

predicts whether each one is a member of the concept or not and is then is told the correct answer, does the learner eventually converge to a correct concept and never make a mistake again?

• No limit on the number of examples required or computational demands, but must eventually learn the concept exactly.

• By simple enumeration, concepts from any known finite hypothesis space are learnable in the limit, although typically requires an exponential (or doubly exponential) number of examples and time.

• Class of total recursive (Turing computable) functions is not learnable in the limit.

Page 6: For Friday Read chapter 18, section 7 Program 3 due

Learning in the Limit vs.PAC Model

• Learning in the limit model is too strong.– Requires learning correct exact concept

• Learning in the limit model is too weak– Allows unlimited data and computational resources.

• PAC Model– Only requires learning a Probably Approximately

Correct Concept: Learn a decent approximation most of the time.

– Requires polynomial sample complexity and computational complexity.

Page 7: For Friday Read chapter 18, section 7 Program 3 due

Cannot Learn Exact Conceptsfrom Limited Data, Only Approximations

Negative

Learner Classifier

Positive

Negative

Positive

Page 8: For Friday Read chapter 18, section 7 Program 3 due

Cannot Learn Even Approximate Conceptsfrom Pathological Training Sets

Learner ClassifierNegative

Positive

NegativePositive

Page 9: For Friday Read chapter 18, section 7 Program 3 due

PAC Learning

• The only reasonable expectation of a learner is that with high probability it learns a close approximation to the target concept.

• In the PAC model, we specify two small parameters, ε and δ, and require that with probability at least (1 δ) a system learn a concept with error at most ε.

Page 10: For Friday Read chapter 18, section 7 Program 3 due

Formal Definition of PAC-Learnable• Consider a concept class C defined over an instance space X

containing instances of length n, and a learner, L, using a hypothesis space, H.

• C is said to be PAC-learnable by L using H iff for all cC, distributions D over X, 0<ε<0.5, 0<δ<0.5; learner L by sampling random examples from distribution D, will with probability at least 1 δ output a hypothesis hH such that errorD(h) ε, in time polynomial in 1/ε, 1/δ, n and size(c).

• Example:– X: instances described by n binary features– C: conjunctive descriptions over these features– H: conjunctive descriptions over these features– L: most-specific conjunctive generalization algorithm (Find-S)– size(c): the number of literals in c (i.e. length of the conjunction).

Page 11: For Friday Read chapter 18, section 7 Program 3 due

Issues of PAC Learnability• The computational limitation also imposes a

polynomial constraint on the training set size, since a learner can process at most polynomial data in polynomial time.

• How to prove PAC learnability:– First, prove sample complexity of learning C using H is

polynomial.– Second, prove that the learner can train on a

polynomial-sized data set in polynomial time.• To be PAC-learnable, there must be a hypothesis

in H with arbitrarily small error for every concept in C, generally CH.

Page 12: For Friday Read chapter 18, section 7 Program 3 due

Version Space

• Bounds on generalizations of a set of examples

Page 13: For Friday Read chapter 18, section 7 Program 3 due

Consistent Learners• A learner L using a hypothesis H and training data

D is said to be a consistent learner if it always outputs a hypothesis with zero error on D whenever H contains such a hypothesis.

• By definition, a consistent learner must produce a hypothesis in the version space for H given D.

• Therefore, to bound the number of examples needed by a consistent learner, we just need to bound the number of examples needed to ensure that the version-space contains no hypotheses with unacceptably high error.

Page 14: For Friday Read chapter 18, section 7 Program 3 due

ε-Exhausted Version Space• The version space, VSH,D, is said to be ε-exhausted iff every

hypothesis in it has true error less than or equal to ε.• In other words, there are enough training examples to

guarantee than any consistent hypothesis has error at most ε.• One can never be sure that the version-space is ε-exhausted,

but one can bound the probability that it is not.• Theorem 7.1 (Haussler, 1988): If the hypothesis space H is

finite, and D is a sequence of m1 independent random examples for some target concept c, then for any 0 ε 1, the probability that the version space VSH,D is not ε-exhausted is less than or equal to:

|H|e–εm

Page 15: For Friday Read chapter 18, section 7 Program 3 due

Sample Complexity Analysis• Let δ be an upper bound on the probability of not

exhausting the version space. So:

/ln1

ln

/ln

)inequality (flip /ln

)ln(

)),(consist(

Hm

Hm

Hm

Hm

He

eHDHP

m

mbad

Page 16: For Friday Read chapter 18, section 7 Program 3 due

Sample Complexity Result• Therefore, any consistent learner, given at least:

examples will produce a result that is PAC.• Just need to determine the size of a hypothesis space to

instantiate this result for learning specific classes of concepts.

• This gives a sufficient number of examples for PAC learning, but not a necessary number. Several approximations like that used to bound the probability of a disjunction make this a gross over-estimate in practice.

/ln1

ln

H

Page 17: For Friday Read chapter 18, section 7 Program 3 due

Sample Complexity of Conjunction Learning• Consider conjunctions over n boolean features. There are 3n of these

since each feature can appear positively, appear negatively, or not appear in a given conjunction. Therefore |H|= 3n, so a sufficient number of examples to learn a PAC concept is:

• Concrete examples:– δ=ε=0.05, n=10 gives 280 examples– δ=0.01, ε=0.05, n=10 gives 312 examples– δ=ε=0.01, n=10 gives 1,560 examples– δ=ε=0.01, n=50 gives 5,954 examples

• Result holds for any consistent learner.

/3ln1

ln/3ln1

ln

nn

Page 18: For Friday Read chapter 18, section 7 Program 3 due

Sample Complexity of LearningArbitrary Boolean Functions

• Consider any boolean function over n boolean features such as the hypothesis space of DNF or decision trees. There are 22^n of these, so a sufficient number of examples to learn a PAC concept is:

• Concrete examples:– δ=ε=0.05, n=10 gives 14,256 examples– δ=ε=0.05, n=20 gives 14,536,410 examples– δ=ε=0.05, n=50 gives 1.561x1016 examples

/2ln21

ln/2ln1

ln 2

nn

Page 19: For Friday Read chapter 18, section 7 Program 3 due

COLT Conclusions

• The PAC framework provides a theoretical framework for analyzing the effectiveness of learning algorithms.

• The sample complexity for any consistent learner using some hypothesis space, H, can be determined from a measure of its expressiveness |H| or VC(H), quantifying bias and relating it to generalization.

• If sample complexity is tractable, then the computational complexity of finding a consistent hypothesis in H governs its PAC learnability.

• Constant factors are more important in sample complexity than in computational complexity, since our ability to gather data is generally not growing exponentially.

• Experimental results suggest that theoretical sample complexity bounds over-estimate the number of training instances needed in practice since they are worst-case upper bounds.

Page 20: For Friday Read chapter 18, section 7 Program 3 due

COLT Conclusions (cont)• Additional results produced for analyzing:

– Learning with queries– Learning with noisy data– Average case sample complexity given assumptions about the data

distribution.– Learning finite automata– Learning neural networks

• Analyzing practical algorithms that use a preference bias is difficult.

• Some effective practical algorithms motivated by theoretical results:– Winnow– Boosting– Support Vector Machines (SVM)

Page 21: For Friday Read chapter 18, section 7 Program 3 due

Why Neural Networks?

Page 22: For Friday Read chapter 18, section 7 Program 3 due

Why Neural Networks?• Analogy to biological systems, the best examples we

have of robust learning systems. • Models of biological systems allowing us to

understand how they learn and adapt. • Massive parallelism that allows for computational

efficiency. • Graceful degradation due to distributed represent-

ations that spread knowledge representation over large numbers of computational units.

• Intelligent behavior is an emergent property from large numbers of simple units rather than resulting from explicit symbolically encoded rules.

Page 23: For Friday Read chapter 18, section 7 Program 3 due

Neural Speed Constraints

• Neuron “switching time” is on the order of milliseconds compared to nanoseconds for current transistors.

• A factor of a million difference in speed. • However, biological systems can perform

significant cognitive tasks (vision, language understanding) in seconds or tenths of seconds.

Page 24: For Friday Read chapter 18, section 7 Program 3 due

What That Means• Therefore, there is only time for about a

hundred serial steps needed to perform such tasks.

• Even with limited abilties, current AI systems require orders of magnitude more serial steps.

• Human brain has approximately 1011 neurons each connected on average to 104 others, therefore must exploit massive parallelism.

Page 25: For Friday Read chapter 18, section 7 Program 3 due

Real Neurons• Cells forming the basis of neural tissue

– Cell body – Dendrites – Axon – Syntaptic terminals

• The electrical potential across the cell membrane exhibits spikes called action potentials.

• Originating in the cell body, this spike travels down the axon and causes chemical neuro-transmitters to be released at syntaptic terminals.

• This chemical difuses across the synapse into dendrites of neighboring cells.

Page 26: For Friday Read chapter 18, section 7 Program 3 due

Real Neurons (cont)

• Synapses can be excitory or inhibitory. • Size of synaptic terminal influences

strength of connection. • Cells “add up” the incoming chemical

messages from all neighboring cells and if the net positive influence exceeds a threshold, they “fire” and emit an action potential.

Page 27: For Friday Read chapter 18, section 7 Program 3 due

Model Neuron(Linear Threshold Unit)

• Neuron modelled by a unit (j) connected by weights, wji, to other units (i):

• Net input to a unit is defined as:

netj = S wji * oi

• Output of a unit is a threshold function on the net input:– 1 if netj > Tj

– 0 otherwise

Page 28: For Friday Read chapter 18, section 7 Program 3 due

Neural Computation

• McCollough and Pitts (1943) show how linear threshold units can be used to compute logical functions.

• Can build basic logic gates – AND: Let all wji be (Tj /n)+e where n = number

of inputs – OR: Let all wji be Tj+e

– NOT: Let one input be a constant 1 with weight Tj+e and the input to be inverted have weight Tj

Page 29: For Friday Read chapter 18, section 7 Program 3 due

Neural Computation (cont)

• Can build arbitrary logic circuits, finite state machines, and computers given these basis gates.

• Given negated inputs, two layers of linear threshold units can specify any boolean function using a two layer AND OR network.

Page 30: For Friday Read chapter 18, section 7 Program 3 due

Learning

• Hebb (1949) suggested if two units are both active (firing) then the weight between them should increase:

wji = wji + ojoi

– h is a constant called the learning rate – Supported by physiological evidence

Page 31: For Friday Read chapter 18, section 7 Program 3 due

Alternate Learning Rule

• Rosenblatt (1959) suggested that if a target output value is provided for a single neuron with fixed inputs, can incrementally change weights to learn to produce these outputs using the perceptron learning rule. – Assumes binary valued input/outputs – Assumes a single linear threshold unit. – Assumes input features are detected by fixed

networks.

Page 32: For Friday Read chapter 18, section 7 Program 3 due

Perceptron Learning Rule

• If the target output for output unitj is tj

wji = wji + h(tj - oj)oi

• Equivalent to the intuitive rules: – If output is correct, don't change the weights – If output is low (oj = 0, tj =1), increment weights for all inputs

which are 1. – If output is high (oj = 1, tj =0), decrement weights for all inputs

which are 1.

• Must also adjust threshold:

Tj = Tj + h(tj - oj)

• or equivalently assume there is a weight wj0 = -Tj for an extra input unit 0 that has constant output o0 =1 and that

the threshold is always 0.

Page 33: For Friday Read chapter 18, section 7 Program 3 due

Perceptron Learning Algorithm

• Repeatedly iterate through examples adjusting weights according to the perceptron learning rule until all outputs are correct

Initialize the weights to all zero (or randomly)

Until outputs for all training examples are correct

For each training example, e, do

Compute the current output oj

Compare it to the target tj and update the weights

according to the perceptron learning rule.

Page 34: For Friday Read chapter 18, section 7 Program 3 due

Algorithm Notes

• Each execution of the outer loop is called an epoch.

• If the output is considered as concept membership and inputs as binary input features, then easily applied to concept learning problems.

• For multiple category problems, learn a separate perceptron for each category and assign to the class whose perceptron most exceeds its threshold.

• When will this algorithm terminate (converge) ??

Page 35: For Friday Read chapter 18, section 7 Program 3 due

Representational Limitations

• Perceptrons can only represent linear threshold functions and can therefore only learn data which is linearly separable (positive and negative examples are separable by a hyperplane in n dimensional space)

• Cannot represent exclusive or (xor)

Page 36: For Friday Read chapter 18, section 7 Program 3 due

Perceptron Learnability

• System obviously cannot learn what it cannot represent. • Minsky and Papert(1969) demonstrated that many

functions like parity (n input generalization of xor) could not be represented.

• In visual pattern recognition, assumed that input features are local and extract feature within a fixed radius. In which case no input features support learning – Symmetry – Connectivity

• These limitations discouraged subsequent research on

neural networks.

Page 37: For Friday Read chapter 18, section 7 Program 3 due

Perceptron Convergence and Cycling Theorems

• Perceptron Convergence Theorem: If there are a set of weights that are consistent with the training data (i.e. the data is linearly separable), the perceptron learning algorithm will converge (Minsky & Papert, 1969).

• Perceptron Cycling Theorem: If the training data is not linearly separable, the Perceptron learning algorithm will eventually repeat the same set of weights and threshold at the end of some epoch and therefore enter an infinite loop.

Page 38: For Friday Read chapter 18, section 7 Program 3 due

Perceptron Learning as Hill Climbing

• The search space for Perceptron learning is the space of possible values for the weights (and threshold).

• The evaluation metric is the error these weights produce when used to classify the training examples.

• The perceptron learning algorithm performs a form of hill climbing (gradient descent), at each point altering the weights slightly in a direction to help minimize this error.

• Perceptron convergence theorem guarantees that for the linearly separable case there is only one local minimum and the space is well behaved.

Page 39: For Friday Read chapter 18, section 7 Program 3 due

Perceptron Performance

• Can represent and learn conjunctive concepts and M of N concepts (true if any M of a set of N selected binary features are true).

• Although simple and restrictive, this high bias algorithm performs quite well on many realistic problems.

• However, the representational restriction is limiting in many applications.

Page 40: For Friday Read chapter 18, section 7 Program 3 due

Beyond a Single Learner

• Ensembles of learners work better than individual learning algorithms

• Several possible ensemble approaches:– Ensembles created by using different learning

methods and voting– Bagging– Boosting

Page 41: For Friday Read chapter 18, section 7 Program 3 due

Bagging

• Random selections of examples to learn the various members of the ensemble.

• Seems to work fairly well, but no real guarantees.

Page 42: For Friday Read chapter 18, section 7 Program 3 due

Boosting

• Most used ensemble method• Based on the concept of a weighted training set.• Works especially well with weak learners.• Start with all weights at 1.• Learn a hypothesis from the weights.• Increase the weights of all misclassified examples

and decrease the weights of all correctly classified examples.

• Learn a new hypothesis.• Repeat