Programming for Business Analytics BEMM458 Session 1 PDF
Document Details
Uploaded by Deleted User
Tags
Related
- Programming in Python for Business Analytics (BMAN73701) Lecture Notes PDF
- Programming in Python for Business Analytics Lecture Notes PDF
- Programming in Business Analytics Lecture 5 Notes PDF
- Programming in Business Analytics (BMAN73701) Lecture 1
- Python Programming for Business Analytics Lecture 6 PDF
- BMAN73701 Programming in Python for Business Analytics - Week 5: Lecture 1 Intro to Machine Learning PDF
Summary
These slides cover introductory concepts in programming for business analytics, focusing on Python and its applications. They outline the course structure for BEMM458, and explain how to use Python for various tasks, including data analysis and visualization. The document demonstrates some simple examples of Python programming.
Full Transcript
Programming for Business Analytics Introduction BEMM458 Or... From this... >_ To this... In : import numpy as np; import pandas as pd; import seaborn as sns sns.set_theme() # Generate...
Programming for Business Analytics Introduction BEMM458 Or... From this... >_ To this... In : import numpy as np; import pandas as pd; import seaborn as sns sns.set_theme() # Generate an example radial dataset r = np.linspace(0, 10, num=100) df = pd.DataFrame({'r': r, 'slow': r, 'medium': 2 * r, 'fast': 4 * r}) # Convert the dataframe to long-form or "tidy" format df = pd.melt(df, id_vars=['r'], var_name='speed', value_name='theta') # Set up a grid of axes with a polar projection & draw scatteplot g = sns.FacetGrid(df, col="speed", hue="speed",subplot_kws=dict(projection='polar'), height=4.5, sharex=False, sharey=False, despine=False).map(sns.scatterplot, "theta", "r") Today's Lecture... Course structure How to pass / fail this module Introduction - Basic Concepts How to use Python Setting up a computing environment Course Structure Lectures Basic ideas and material Tutorials / Labs Implementation Assesment Mid Term Test (Nov 17th) Final assignment How to do well in this module.... Learn by DOING... spend time atempting the tutorial questions Try it. Scream. Look it up in notes / web / chat to colleauges / use forum Make Coffee. Figure it out. Repeat. How to fail this module... Make coffee Sit back and watch me complete the tutorial / lab questions Assume you can magically reproduce this under exam conditions Be lucky Basic Concepts... Computer Languages Natural languages (Welsh, French...) Formal languages (Algebra, Chemistry, Computer Languages) General computer languages (Python, C++, BASIC) Special purpose languages (R, SQL, Stan) Historically, computer languages can be 'Interpreted' or 'Compiled' Today, boundaries are a little blurred Python is mostly / usually interpreted Formal languages have precise syntax... Tokens - basic language elements, words and symbols Structure - rules for combining tokens In : Hey Siri, print 'hello world!' File "/var/folders/ln/y6d0454x7w7bshmk9krycbc40000gn/ T/ipykernel_5527/4263165544.py", line 1 Hey Siri, print 'hello world!' ^ SyntaxError: invalid syntax Natural and Formal Language Ambiguity Redundancy Idiom and Metaphor Aside... Theory of Complete Programming Languages For interest only: Anything that can be computed can be constructed from a minimal set of commands Known as the Turing Thesis, after famous Mathematician Alan Turing. Discussion and details: 'Introduction to the Theory of Computation' - Michael Sipser Using Python An analogy Writing a recipie for a friend Use MS Word. Type out idea / instructions. Go to kitchen. Make dish. Eat(Test). Return to MS Word. Edit instructions. Save as a PDF. Email to a friend. Friend goes to kitchen and follows instructions (or video self and post to TikTok / Boastagram etc. etc. etc.) Writing code for colleauge Use an IDE. Type out commands. Run the code using python interpreter. Assess results (Test) Use an IDE to edit commands. Deliver to client. Colleauge sets up environment and runs code Components we need... An IDE Integrated Development Environment (we will use VS Code) Analogous to a Word Processor for text A set of Python commands Saved in a file 'mycode.py' Can be written in to a notebook 'mycode.ipynb' Or run interactively line by line Python Enviromnet / Interpreter We will use the 'Anaconda' Python distribution Takes commands and executes them A python version plus supporting code libraries Also... GitHub Classroom For exercises / tutorials Expanding Python - Code Libraries Python is general programming language We can adopt it to particular applications using code libraries There are litterally hundreds of these The 'Anaconda' distribution comes with most key packages Many more can be downloaded using installers such as 'pip' and 'conda' In R, 'packages' are used similarly Common Libraries We will use (mostly): Pandas - Dataframe library, perfect for manipulation of tabular data Numpy - An extensive numerical computation library Matplotlib - A general purpose grpahics package Seaborn - A front end to Matplotlib, great for smart presentational graphics Statsmodels - Statistics algorithums (regression, time series etc) Scikit Learn - Basic Machine Learning Setting Up... Setting up your computing environment Python can be downloaded, and installed from the web Code can be written in any text editing application... And run from the command line... But... There is a better / easier way! We will use an 'IDE' - an Integrated Development Environment' - a seperate application Purpose built code editor, with lots of facilities which help us design and manage the coding process We will (or at least, I will) use the following tools: The 'Anaconda' Python distribution for data science The VS Code IDE GitHub Classroom for Tutorial Exercises Links to all of the above on ELE You will use VS Code in other modules But other options are available, these are not obligatory Please try to get these set up yourselves before next week Wrap Up Today we have covered... What a computer language / code is Various tools we will use / need How to succceed / fail this module! Tutorial Please attempt the following before Wednesday / Thursday's tutorials, and bring your PC to the sessions. 1. Download and install Anaconda on your PC 2. Download and Install VS Code on your PC Links are on the VLE. Use online help and link provided / work together!