Posts

Showing posts with the label MIT

6.00.1x - Week 2

Image
2.3.1 Simple Algorithms slice string using: start:stop:step s[::-1] reverse the string string is immutable 2 ways to write for loop: "for char in s" "for index in range(len(s))" 2.3.2 Approximate Solutions Exhaustive enumeration start with initial guess step: any small number, takes many steps 2.3.3 Bisection Search takes log time to get an answer works well with problem with "ordering" property: value increases as input increases print("Hi", end=' ') print("there") will print "Hi there" 2.3.4 Floats and Fractions This is why sometimes we get weird result because in binary you can get close to it, but not exact Should not use == to compare float, instead use abs(a-b) < epsilon 2.3.5 Newton-Raphson Algorithm Approximation algorithm to find roots of a polynomial: g -> g - p(g)/p'(g) Even better than Bisection search

6.00.1x - Week 1

1.1 Introduction: Machine are good at calculations and remember results. Some problems require better algorithm to solve faster. Some problems are fundamentally hard:turing halting or decrypt encryption which is benefical for us. 1.1 Knowledge Declarative knowledge: statement of fact Imperative knowledge: recipe, how to solve Algorithm = sequence of steps + flow of control + when/how to stop 1.2 Machines Fixed program vs. Stored program Core of machine: Memory, Arithmetic Logic Unit (ALU), and Control Unit with program counter Interpreter vs Compiler: read 1 Turing machine: infinite tape, 6 primitives: move left, move right, scan, read, write, do nothing Anything computable in one language is computable in any other programming language 1.3 Languages Expression: legal combination of primitives Syntax: combination of primitives that makes sense, legal expression Static semantics: valid syntax that has meaning Semantic: meaning associated with a syntac...

Python

Hello, Welcome to Python. I'm picking up Python because it is the most popular programming language for Machine Learning. I'm taking 2 courses at the same time: Principles of Computing with Python by Carnegie Mellon University Introduction to Computer Science and Programming Using Python by MIT This blog is to post what I learned. Thanks for reading. Good luck. Huy