Giter VIP home page Giter VIP logo

special-topics-final's Introduction

Special Topics in Learning Theory Final: No Free Lunch Theorem simulation

A program that demonstrates the No Free Lunch theorem for machine learning.

Example

Let the domain be the integers from 1 to 10, and let the size of the example dataset be m = 4. Define the learning algorithm as an algoritm that inputs a subset of size m of our domain and randomly outputs a binary classifier. aka: let A be a "random" algorithm, S denote a subset of size m, f_i denote a binary classifier. Note that A maps S to f_i: A(S) = f_i where f_i assigns a value of 1 or 0 to each integer x in the domain.

In code:

def random_algo(S):
  rand.seed(hash(tuple(S))):
  i = rand.randint(0, 2 ** len(DOMAIN))
  return f_from_int(i, DOMAIN)

If we run the no_free_lunch(algo, size) on this random algorithm and size = 4:

Our program would output:

  1. A distribution D in which there exists a function with zero loss on D:
  • Distribution formatting: ({x in domain}, f(x)): probability(({x in domain}, f(x)))
  • {(1, 0): 0, (1, 1): 0, (2, 0): 0, (2, 1): 0, (3, 1): 0.25, (3, 0): 0, (4, 0): 0.25, (4, 1): 0, (5, 0): 0.25, (5, 1): 0, (6, 0): 0, (6, 1): 0, (7, 0): 0, (7, 1): 0, (8, 0): 0, (8, 1): 0, (9, 1): 0.25, (9, 0): 0, (10, 0): 0, (10, 1): 0}
  1. The function that has zero loss on D:
  • Function formatting: (x in domain): f(x)
  • {1: 1, 2: 1, 3: 1, 4: 0, 5: 0, 6: 1, 7: 1, 8: 1, 9: 1, 10: 1}
  1. And expected loss of algo(S), where S is drawn from D (Should be greater than ΒΌ)
  • example expected loss: 0.7083333333333333

special-topics-final's People

Contributors

dafg05 avatar tinazs avatar

Watchers

 avatar

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.