Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Python Application Case

Python Application Case

Python Workshop @ Kongkow IT 2018

Vicky Vernando Dasta

January 27, 2018
Tweet

More Decks by Vicky Vernando Dasta

Other Decks in Programming

Transcript

  1. PYTHON WORKSHOP HAFIZHAN: WEB APPLICATION WITH PYTHON FLASK VICKY: PYTHON

    101 AND APPLICATION IN SECURITY & MACHINE LEARNING
  2. About • Student @ physics dept. UR • Research assistant

    at photonic lab @ UR • Research interest: photonic, applied machine learning on raspberry pi system • Python user 2014-now
  3. Python at a glance • Multipurpose • OOP (everything is

    object) • Dynamic typing • Batteries included • Case sensitive
  4. Things we can build computer vision search engine security tools

    embedded system web services web application machine learning apps
  5. Data Structure • Integer • Float • List • String

    • Boolean • Dictionary • Tupple
  6. Data Structure: list • Create an empty list • Add

    an item into it • Access item • Remove some item fr = [] fr.append(“guava”) fr[0] fr.remove(“guava”)
  7. Data Structure: tupple • Immutable array • Data are read-only

    • Items in tupple can’t be deleted • Can’t add more data once it’s created fixed_data = (1, 2) fixed_data[0] # 1 fixed_data[0] = 1
  8. Data Structure: dict • Named-list • Key-value user = {“name”

    “vicky”, “age”: 21} user[“name”] user.keys() user.values() user = {name=“vicky”, age=21}
  9. Control Flow In Python, there are: • if • elif

    • else • for • while • continue • break
  10. Control Flow: if-elif-else if 1 > 2: print “hola” elif

    1 > 3: print “holu” else: print “holi”
  11. Loop: for • for loop is for iterating over iterable

    object • range function creates list which is iterable • in above case, the i is 0, 1, 2, ..., 99 on each iteration for i in range(100): print(i)
  12. Looping: while • while Requires a condition in order to

    start or terminate the loop (while-break) while True: print “hello!” N = 0 while N < 10: N += 1
  13. Function: def • def is the keyword for creating function

    def gravity_force(M, m, r): return 6.62e+12*(M*m)/r**2 Function keyword Returned value(s) arguments function name
  14. Coding style in Python • Python uses indentation • 3

    spaces or 1 tab for each scope • No brackets or semicolons!
  15. ML: Linear Regression • Linear model out = mx+b •

    Scikit learn search for the m • so the predicted value can be close to y
  16. ML: Datasets X (M2) Y ($ USD) 200 2000 250

    3500 300 5000 378 5400 456 6500 680 8700 800 10000