LABS: CODING IN ACTION (MODULE II)

LABS: CODING IN ACTION (MODULE II)

Stefano Guarino

Instructional goals

This course builds upon the work done during the first module of the Coding in action Labs. It covers more advanced topics of programming such as object-oriented programming, computational cost and efficiency of a program, and so-called Pythonic programming. The course also introduces the main tools for data processing, analysis and visualization that are available in Python, which is one of the reference programming languages in the "data science" world.

Intended learning outcomes

Knowledge and understanding: By the end of this course, the students will learn what object-oriented programming is and how this programming paradigm is implemented in Python. They will understand that a good program solve the given task making use of the least possible amount of resources. They will learn specific Python syntax and best practices needed to make programming faster and increase performance. Further, the students will learn how to use, at an introductory level, the most known Python packages for data analysis and visualization: NumPy, Pandas, Scikit-learn and Matplotlib. Applying knowledge and understanding: To test their understanding of the concepts seen in class, the students will be assigned projects that require to deal with real data. They will be asked to: • Rapidly manipulate and process large data sets through dataframes and arrays • Plot data and functions • Operate basic descriptive analysis and modeling (statistics, histograms, interpolation, clustering, fitting) The course will prepare the students for more advanced data analysis courses and make them ready to complete projects in other courses that require a computational approach to data. Making judgements: Upon completing the study program, students will be able to: • Design algorithms in terms of objects that interact with one another • Understand that an object can be considered an instance of a more general concept – a class – that defines the common features of all objects of that type • Compare simple algorithms that solve the same task in terms of their computational cost • Address simple data analysis project Communications Skills: Being introduced to the concepts of computational and memory efficiency and to their formalization, the students will understand that the “cost” of solving a problem can be precisely quantified and expressed. Through examples, case studies and projects, the students will learn how to communicate the results of a data analysis task and how to justify the choice of specific algorithms, methods and techniques. Learning skills: The students will be introduced to a set of advanced/professional libraries for data analysis. At the end of the course, they will be able to autonomously browse the Python standard library as well as the web to find the right libraries and tools to perform a given task.

Course Contents

The course will cover the following aspects of computer programming: • Classes and objects: classes, types, objects and instances; instances as return values; attributes and methods; objects mutability; instantiation and the __init__ method; operator overloading and special methods; static methods and class methods; inheritance. • Pythonic programming: conditional expressions; EAFP (Easier to Ask for Forgiveness than Permission); list comprehension; generator expressions; any and all; sets. • Scientific programming: Numpy, arrays and broadcasting; Pandas, dataframes and series; Scikit-learn and basic machine learning with Python; Matplotlib and plotting in Python

Reference Books

Allen B. Downey, “Think Python: How to Think Like a Computer Scientist (2nd Edition)”, O’Reilly, ISBN-13: 978-1491939369

Teaching Methods

Traditional face-to-face teaching will be the main teaching method, but a few case studies will be considered that the students will have to address by themselves, alone or in groups, in line with a “learning by doing” paradigm. Students’ participation during lectures is strongly encouraged.

Assessment Method

Grading for this course will be based on a combination of programming assignments (70%) and a final exam (30%). The final exam will consist in a multiple answer quiz. All programming assignments will be scored as follows: • If the code produces the correct answer using the requested approach: 100% • If it generally uses the right approach, but the answer is incorrect due to some minor mistakes: 70-90% • If it correctly uses the core concepts and makes some progress in the attempt to solve the problem: 40-60% • If the answer demonstrates a lack of understanding of some or all of the core concepts: 0-40% At the teacher’s discretion, the students may be asked to provide a thorough description of their code.

Thesis assignment criteria

No thesis will be assigned

Does the syllabus cover sustainability topics?

No

Week 1 Contenuto sessioni on line e on campus

Classes and objects: classes, types, objects and instances

Week 2 Contenuto sessioni on line e on campus

instances as return values; attributes and methods; objects mutability

Week 3 Contenuto sessioni on line e on campus

instantiation and the __init__ method; operator overloading and special methods;

Week 4 Contenuto sessioni on line e on campus

static methods and class methods; inheritance.

Week 5 Contenuto sessioni on line e on campus

conditional expressions; EAFP (Easier to Ask for Forgiveness than Permission)

Week 6 Contenuto sessioni on line e on campus

list comprehension; generator expressions; any and all; sets.

Week 7 Contenuto sessioni on line e on campus

Numpy, arrays and broadcasting

Week 8 Contenuto sessioni on line e on campus

Pandas, dataframes and series

Week 9 Contenuto sessioni on line e on campus

Scikit-learn and basic machine learning with Python (1/2)

Week 10 Contenuto sessioni on line e on campus

Scikit-learn and basic machine learning with Python (2/2)

Week 11 Contenuto sessioni on line e on campus

Matplotlib and plotting in Python

Week 12 Contenuto sessioni on line e on campus

Final review ed exercises