0% found this document useful (0 votes)
4 views

Introduction

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Introduction

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

INTRODUCTION

CS5800

1
WHO AM I

Leader: Dr. Anand Subramoney


[email protected]
I use the pronouns he/his/him
Please call me Anand, but Prof if you’re
uncomfortable with that
I’ll call you by your first name, but let me know if
you want me to use something different.
◦ Office hours: Monday 16-17, Thursday 10-11

2
◼︎
◼︎
◼︎
◼︎
◼︎
STRUCTURE

Most teaching in first five weeks


Two hour lecture every week
◦ Wednesday 11:00 WETTONS-A
Two hour lab every week
Quizzes!
Slows down after that

3
◼︎
◼︎
◼︎
◼︎
◼︎
ON DEMAND MATERIAL

Micro-lectures (5-20 minutes of video).


Short quizzes at end of each micro-lecture.

4
◼︎
◼︎
LABS

Document of tasks to complete.


Based on materials delivered.
Can use lab PC’s or your own laptop.
Recommend you install Spyder on your laptop.
Use office hours to talk technical issues.

5
◼︎
◼︎
◼︎
◼︎
◼︎
QUIZZES

Quizzes after micro-lectures - attempts tracked.


◦ Formative feedback
Summative quizzes - 3 tests @ 10% each
◦ Up to 60 minutes.
◦ 10 questions randomly selected from a question
bank.

6
◼︎
◼︎
TOOLS

Moodle - https://moodle.royalholloway.ac.uk/
course/view.php?id=2589
Microsoft Teams
NoMachine
Python and Spyder.

7
◼︎
◼︎
◼︎
◼︎
MOODLE

Virtual Learning Environment (VLE).


All materials, quizzes, links to items of interest go
there.
Forum to ask questions
◦ Can be asked anonymously.

8
◼︎
◼︎
◼︎
NOMACHINE

Tool that allows you to log into the CS RHUL


servers from your laptop.
You do not have to install Python etc. on your own
laptop (though it makes life easier).

9
◼︎
◼︎
PYTHON

This module teaches you Python.


◦ https://www.anaconda.com/products/individual -
for installation.
Spyder is an Integrated Development Environment
(IDE) for Python (installed by default with
anaconda)

10
◼︎
◼︎
ASSESSMENT

3 Quizzes - each 10% each


Final exam - 70%

11
◼︎
◼︎
ENGAGEMENT

You need to stay on top of this material.


Watch the videos.
Attend labs.
Attend the live events.
Take the formative quizzes.
Most students taking distance learning modules fail
because they don’t stick with it.

12
◼︎
◼︎
◼︎
◼︎
◼︎
◼︎
ENTRANCE QUIZ

If you are taking Data Science and Analytics MSc


then this is a core module.
Entrance quiz check to see if you already are good
enough at Python.
Will be open soon, and will be open until Oct. 4th
You can use it to evaluate if you know enough
Python to skip the course.
◦ Get at least 70%
BUT, you can still skip this course even if you don’t
pass. BUT THIS IS NOT RECOMMENDED.
13
◼︎
◼︎
◼︎
◼︎
◼︎
LEARNING OBJECTIVES

1. Understand standard programming concepts.

2. Apply understanding to solve programming tasks.

3. Evaluate programming solutions.

14
MORE PROSAICALLY

You learn basic Python.


You learn some basic principles of Computer
Science.
Enough to get you ready to do some Data Science.

15
◼︎
◼︎
◼︎
IN MORE DETAIL
1. Introduction
1. Languages, types, variables
2. The python console
2. Control ow
1. Basic types in Python
2. Comparison operations
3. Branching
4. while, for loops
5. Break

3. Strings, simple algos


1. String indexing and slicing
2. string mutability
3. Exhaustive search
4. Bisection search

4. Functions, tuples, lists


1. Functions, abstraction, decomposition, reuse
2. functions in Python; variable scope, functions as arguments, visibilty
3. Tuples; de ning, immutability, unpacking, operations
4. Lists; de ning, mutability, indexing, iterating, operations
5. Multi-dimensional arrays

16
fl
fi
fi
1. Dictionaries
1. keys, values
2. Operations
3. Iterating
2. Files, Pandas, Numpy
3. OOP 1
1. OOP concepts
2. Creation, destruction
3. Class attributes, methods
4. Querying types
5. Special methods

4. OOP 2
1. Why use objects?
2. getter and setter methods
3. information hiding
4. hierarchies, inheritance
5. Class variables

17
APPLICABILITY

If you have
◦ No prior experience in programming
◦ You had a little experience in programming
Then this is the module for you.

18
◼︎
◼︎
COURSE INFO: RESOURCES
MIT Course: Introduction to Computer Science and
Programming in Python
◦ https://ocw.mit.edu/courses/electrical-engineering-and-
computer-science/6-0001-introduction-to-computer-science-
and-programming-in-python-fall-2016/index.htm
edX course: https://courses.edx.org/courses/course-
v1:MITx+6.00.1x+2T2018/course/
John Guttag. Introduction to Computation and
Programming Using Python: With Application to
Understanding Data Second Edition. MIT Press, 2016. ISBN:
9780262529624
Numerous other online resources (watch Moodle space and
library reading list)

19
◼︎
◼︎
◼︎
◼︎
FAST-PACED COURSE

Position yourself for success:


◦ Start working on the project early
New to programming? PRACTICE. PRACTICE?
PRACTICE!
◦ Work hard at lab sessions
◦ Try things on your own
◦ Get into habit of using Python for your everyday
problem solving

20
◼︎
◼︎
Problem Solving

PRACTICE
Knowledge of Programming
Concepts Skills

21
WHAT DOES A COMPUTER DO?

Fundamentally:
◦ performs operations -> calculations
a billion calculations per second!
◦ remembers results
100s of gigabytes of storage!
What kinds of calculations?
◦ built-in to the language
◦ ones that you define as the programmer
Computers only know what you tell them

22
◼︎
◼︎
◼︎
THE ONE TRICK OF COMPUTER
SCIENCE

Create a set of primitive “things”.


Have a set of simple rules for those “things” to be
put together.
Build arbitrarily complex things from the primitive
things.

23
◼︎
◼︎
◼︎
TYPES OF KNOWLEDGE

Declarative knowledge is statements of facts


◦ There is a student in the 2nd row whose name is …
Imperative knowledge is a recipe or “how-to”
1. Face the students at the front of the room
2. Count up 2 rows
3. Start from the student in the leftmost chair
4. Ask the student to tell their name
5. If not … count to the right 1 chair, goto 4
6. Otherwise, report the chair where … was found
7. Terminate

24
◼︎
◼︎
NUMERICAL EXAMPLE
Square root of a number x is y such that y*y = x
Recipe for deducing square root of a number x
(16)
◦ Start with a guess, g
◦ If g*g is close enough to x, stop and say g is the
answer
◦ Otherwise make a new guess by averaging g and x/
g
◦ Using
g the new guess,
g*g repeat process
x/g until close
(g+x/g)/2
enough
3 9 16/3 4.17
4.17 17.36 3.837 4.0035
4.0035 16.0277 3.997 4.000002
25
◼︎
◼︎
WHAT IS A RECIPE?

1. Sequence of simple steps

2. Flow of control process that specifies when each


step is executed

3. A means of determining when to stop

1 + 2 + 3 = an algorithm!

26
BASIC
BASIC MACHINE
MACHINEARCHITECTURE
ARCHITECTURE
MEMORY

CONTROL ARITHMETIC
UNIT LOGIC UNIT
program counter do primitive ops

INPUT OUTPUT
6.0001 LECTURE 1 14
27
STORED PROGRAM COMPUTER

Sequence of instructions stored inside computer


◦ Built from predefined set of primitive instructions
• arithmetic and logic

• simple tests

• moving data

Special program (interpreter) executes each


instruction in order
◦ Use tests to change flow of control through sequence
◦ Stop when done

28
◼︎
◼︎
CREATING RECIPES

A programming language provides a set of


primitive operations
Expressions are complex but legal combinations
of primitives in a programming language
Expressions and computations have values and
meanings in a programming language

29
◼︎
◼︎
◼︎
ASPECTS OF LANGUAGES
ASPECTS OF LANGUAGES
primitive constructs
◦ English: words
◦ programming language: numbers, strings, simple
operators

30
ord Cloud copyright Michael Twardos, All Right Reserved. This content is excluded from our Word Cloud copyright un nown, All Rig
ASPECTS OF LANGUAGE

Syntax
◦ English: “cat dog boy” ➔ not syntactically valid
“cat hugs boy” ➔ syntactically valid
◦ programming language:
“hi”5 ➔ not syntactically valid
3.2*5 ➔ syntactically valid

31
◼︎
ASPECTS OF LANGUAGES
ASPECTS OF LANGUAGES
static semantics is which syntactically valid strings
have meaning
◦ English: "I are hungry" syntactically valid
but static semantic error
◦ programming language: 3.2*5 syntactically valid
3+"hi" static semantic error

32
ASPECTS OF LANGUAGES

Semantics is the meaning associated with a


syntactically correct string of symbols with no
static semantic errors

◦ English: can have many meanings "Flying planes


can be dangerous"

◦ programming languages: have only one meaning


but may not be what programmer intended

33
◼︎
WHERE THINGS GO WRONG

Syntactic errors
◦ common and easily caught
Static semantic errors
◦ some languages check for these before running program
◦ can cause unpredictable behaviour
No semantic errors but different meaning than what
programmer intended
◦ program crashes, stops running
◦ program runs forever
◦ program gives an answer but different than expected

34
◼︎
◼︎
◼︎
WHAT IS PYTHON

Python is a modern, general-purpose, object-


oriented, high-level programming language.

From the python website:


◦ "Python is an easy to learn, powerful programming
language. It has efficient high-level data structures
and a simple but effective approach to object-oriented
programming. Python’s elegant syntax and dynamic
typing, together with its interpreted nature, make it
an ideal language for scripting and rapid application
development in many areas on most platforms."

35
◼︎
◼︎
WHY PYTHON?

Open-source language that works everywhere (including


the Raspberry Pi!)
Extensive ecosystem of scientific libraries and
environments
Great performance due to close integration with time-
tested and highly optimised libraries written in C and
Fortran
Good support for Parallel processing, GPU computing etc.
It’s the defacto programming language for machine
learning (Tensorflow, PyTorch, JAX…)
Also very good for GUI, servers, scripting etc.

36
◼︎
◼︎
◼︎
◼︎
◼︎
◼︎

You might also like