background preloader

Unite 2

Facebook Twitter

Unit 2 begins with hash functions, which are useful for mapping large data sets. We will continue with a broad introduction to object-oriented programming languages (Python is an example), covering objects, classes, subclasses, abstract data types, exceptions, and inheritance.

Other algorithmic concepts covered are "Big O notation," divide and conquer, merge sort, orders of growth, and amortized analysis.

The next several lectures introduce effective problem-solving methods which rely on probability, statistical thinking, and simulations to solve both random and non-random problems. A background in probability is not assumed, and we will briefly cover basic concepts such as probability distributions, standard deviation, coefficient of variation, confidence intervals, linear regression, standard error, and plotting techniques. This will include an introduction to curve fitting, and we introduce the Python libraries numpy and pylab to add tools to create simulations, graphs, and predictive models.

We will spend some time on random walks and Monte Carlo simulations, a very powerful class of algorithms which invoke random sampling to model and compute mathematical or physical systems. The Monty Hall problem is used as an example of how to use simulations, and the knapsack problem introduces our discussion of optimization. Finally, we will begin looking at supervised and unsupervised machine learning, and then turn to data clustering.

At the end of Unit 2 there will be an exam covering all material (lectures, recitations, and problem sets) from the beginning of the course through More Optimization and Clustering.

Hashing and Classes | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science. Chapter 12: Classes and objects. Warning: the HTML version of this document is generated from Latex and may contain translation errors. In particular, some mathematical expressions are not translated correctly. 12.1 User-defined compound types Having used some of Python's built-in types, we are ready to create a user-defined type: the Point. Consider the concept of a mathematical point.

In two dimensions, a point is two numbers (coordinates) that are treated collectively as a single object. In mathematical notation, points are often written in parentheses with a comma separating the coordinates. A natural way to represent a point in Python is with two floating-point values. An alternative is to define a new user-defined compound type, also called a class. A class definition looks like this: class Point: pass Class definitions can appear anywhere in a program, but they are usually near the beginning (after the import statements). This definition creates a new class called Point. Blank = Point() 12.2 Attributes 12.4 Sameness. Lecture Notes sur haching I, II et III. OOP and Inheritance | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science.

Introduction to Simulation and Random Walks | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science. Some Basic Probability and Plotting Data | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science. Sampling and Monte Carlo Simulation | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science. Monte Carlo method. Monte Carlo methods (or Monte Carlo experiments) are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results; typically one runs simulations many times over in order to obtain the distribution of an unknown probabilistic entity. They are often used in physical and mathematical problems and are most useful when it is difficult or impossible to obtain a closed-form expression, or infeasible to apply a deterministic algorithm.

Monte Carlo methods are mainly used in three distinct problem classes: optimization, numerical integration and generation of draws from a probability distribution. The modern version of the Monte Carlo method was invented in the late 1940s by Stanislaw Ulam, while he was working on nuclear weapons projects at the Los Alamos National Laboratory. Immediately after Ulam's breakthrough, John von Neumann understood its importance and programmed the ENIAC computer to carry out Monte Carlo calculations. Introduction[edit] Statistical Thinking | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science.

Using Randomness to Solve Non-random Problems | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science. Matplotlib: python plotting — Matplotlib 1.2.1 documentation. Monte Carlo method. Curve Fitting | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science.

Optimization Problems and Algorithms | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science. More Optimization and Clustering | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science. Quiz 2 | Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science. Unit 2 | Introduction to Computer Science and Programming | Electrical Engineering and Computer Science.