21
Course Introduction BBM 101 - Introduction to Programming I Hacettepe University Fall 2016 Fuat Akal, Aykut Erdem, Erkut Erdem 1 Slides based on material prepared by Ruth Anderson, Michael Ernst and Bill Howe in the course CSE 140 University of Washington

Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

CourseIntroduction

BBM101- IntroductiontoProgrammingI

Hacettepe UniversityFall2016

FuatAkal,AykutErdem,Erkut Erdem

1SlidesbasedonmaterialpreparedbyRuthAnderson,MichaelErnstandBillHoweinthecourseCSE140UniversityofWashington

Page 2: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

WelcometoBBM101• Thiscourse teaches coreprogramming conceptswithanemphasis ondatamanipulation tasksfromscience, engineering, andbusiness

• Goal bytheendofthesemester: Givenadatasource andaproblemdescription, youcanindependently writeacomplete,usefulprogramtosolvetheproblem

2

Page 3: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

CourseStaff

• Lecturers:– Asst.Prof.Dr.Fuat Akal– Asst.Prof.Dr.Aykut Erdem– Asst.Prof.Dr.Erkut Erdem

3

Page 4: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

CourseStaff

• TAs(TeachingAssistants):– Necva Bölücü– SelmaDilek– Burcu Yalçıner– Selim Yılmaz

DonothesitatetoaskTAsforhelp!

4

Page 5: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

LearningObjectives• Computationalproblem-solving– Writingaprogramwillbecomeyour“go-to”solutionfordataanalysistasks.

• BasicPythonproficiency– Includingexperiencewithrelevantlibraries fordatamanipulation, scientific computing,andvisualization.

• Experienceworkingwithrealdatasets– astronomy,biology, linguistics,oceanography, opengovernment, socialnetworks,andmore.

– Youwillseethattheseareeasytoprocesswithaprogram,andthatdoingsoyieldsinsight.

5

Page 6: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

WhatThisCourseisnot• A“skillscourse”inPython

– …thoughyouwillbecomeproficientinthebasicsofthePythonprogramminglanguage

– …andyouwillgainexperiencewithsomeimportantPythonlibraries

• Adataanalysis/“datascience”/datavisualizationcourse– Therewillbeverylittlestatisticsknowledgeassumedortaught

• A“project”course– theassignmentsare“real,”butareintendedtoteachspecific

programmingconcepts

• A“softwareengineering” course– Programmingisthestartingpointofcomputerscienceandsoftware

engineering

6

Page 7: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

“It’sagreattimetobeadatageek.”-- RogerBarga,MicrosoftResearch

7

“Thegreatestmindsofmygenerationaretryingtofigureouthowtomakepeopleclickonads”

-- JeffHammerbacher,co-founder,Cloudera

Page 8: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

8

AllofScienceisReducingtoComputationalDataManipulation

Oldmodel:“Querytheworld” (Dataacquisitioncoupledtoaspecifichypothesis)Newmodel:“Downloadtheworld” (Dataacquisitionsupportsmanyhypotheses)– Astronomy:High-resolution,high-frequencyskysurveys(SDSS,LSST,PanSTARRS)– Biology:labautomation,high-throughputsequencing,– Oceanography:high-resolutionmodels,cheapsensors,satellites

40TB/2nights

~1TB/day100sofdevices

Page 9: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

Example:AssessingTreatmentEfficacy

Zipcodeofclinic

Zipcodeofpatient

numberoffollowupswithin16weeksaftertreatmentenrollment.

Question:Doesthedistancebetweenthepatient’shomeandclinicinfluencethenumberoffollowups,andthereforetreatmentefficacy?

9

Page 10: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

PythonProgramtoAssessTreatmentEfficacy#ThisprogramreadsanExcelspreadsheetwhosepenultimate#andantepenultimatecolumnsarezipcodes.#Itaddsanewlastcolumnforthedistancebetweenthosezip# codes,andoutputsinCSV(comma-separatedvalues)format.#Calltheprogramwithtwonumericvalues:thefirstandlast# rowtoinclude.#Theoutputcontainsthecolumnheadersandthoserows.

#Librariestouseimport randomimport sysimport xlrd #libraryforworkingwithExcelspreadsheetsimport timefrom gdapi import GoogleDirections

#Nokeyneedediffewqueriesgd =GoogleDirections('dummy-Google-key')

wb =xlrd.open_workbook('mhip_zip_eScience_121611a.xls')sheet=wb.sheet_by_index(0)

#Userinput:firstrowtoprocess,firstrownottoprocessfirst_row=max(int(sys.argv[1]),2)row_limit =min(int(sys.argv[2]+1),sheet.nrows)

def comma_separated(lst):return ",".join([str(s)for sin lst])

headers=sheet.row_values(0)+["distance"]print comma_separated(headers)

for rownum in range(first_row,row_limit):row=sheet.row_values(rownum)(zip1,zip2)=row[-3:-1]if zip1and zip2:#Cleanthedatazip1=str(int(zip1))zip2=str(int(zip2))row[-3:-1]=[zip1,zip2]#ComputethedistanceviaGoogleMapstry:distance=gd.query(zip1,zip2).distance

except:print >>sys.stderr,"Errorcomputingdistance:",zip1,

zip2distance=""

#Printtherowwiththedistanceprint comma_separated(row+[distance])#AvoidtoomanyGooglequeriesinrapidsuccessiontime.sleep(random.random()+0.5)

23linesofexecutablecode!10

Page 11: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

Source:Brookings

ThevalueofacomputerscienceeducationSomestatistics(fromU.S.)

Slidecredit:code.org

Page 12: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

Computingjobsarethe#1sourceofnewwagesintheUnitedStates

500,000currentopenings:These jobsareinevery industryandevery state,andthey’reprojectedtogrowattwicetherate

ofallotherjobs.

Somestatistics(fromU.S.)

Slidecredit:code.org

Page 13: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

TheSTEM*problemisincomputerscience:

Sources:BureauofLaborStatistics,NationalCenterforEducationStatistics

71%ofall newjobsin

STEMareincomputing

8%ofSTEMgraduates

areincomputerscience

*STEM=Science,Technology,Engineering,andMath

Somestatistics(fromU.S.)

Slidecredit:code.org

Page 14: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

CourseLogistics

• Website:http://web.cs.hacettepe.edu.tr/~bbm101/

• Seethewebsiteforalladministrativedetails

• Readthehandoutsandrequiredtexts,before thelecture

• Takenotes!

• FollowthecourseinPiazzahttps://piazza.com/hacettepe.edu.tr/fall2016/bbm101

14

Page 15: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

AcademicIntegrity

• Honestworkisrequiredofascientistorengineer.

• Collaborationpolicyonthecourseweb.Readit!– Discussionispermitted.– Carryingmaterials fromdiscussion isnotpermitted.– Everythingyouturninmustbeyourownwork.

• Citeyoursources,explainanyunconventionalaction.– Youmaynotviewothers’work.– Ifyouhaveaquestion,ask.

• Wetrustyoucompletely.

• Butwehavenosympathyfortrustviolations– norshouldyou!

15

Page 16: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

HowtoSucceed• Noprerequisites

• Non-predictorsforsuccess:– Pastprogrammingexperience– Enthusiasmforgamesorcomputers

• Programminganddataanalysisarechallenging

• Everyoneofyoucansucceed– Thereisnosuchthingasa“bornprogrammer”– Workhard– Followdirections– Bemethodical– Think beforeyouact– Tryonyourown,thenaskforhelp– Startearly

16

Page 17: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

IntegratedDevelopmentEnvironment(IDE)

• Therearemany!

17

Page 18: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

OurRecommendation:PyCharm

18

Page 19: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

PythonVersion• WhateverIDEyouchoosetoworkwith,alwayssticktoPythonversion3.5.2

• Always usethisversiontocodeyourassignments.

19

Page 20: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

Books• Therearemany!

20

Page 21: Course Introductionbbm101/fall16/lectures/w01-introduction.pdf8 All of Science is Reducing to Computational Data Manipulation Old model: “Query the world”(Data acquisition coupled

OurRecommendationforBooks• ThePythonTutorial,availablefromthePythonwebsite.

– ThisisgoodforexplainingthenutsandboltsofhowPythonworks.

• IntroductiontoComputationandProgrammingUsingPython,SecondEdition,JohnV.Guttag,MITPress,August2016

• ThinkPython,2ndedition– Freelyavailableonlinein HTML and PDF.– Alsoavailableforpurchaseasaprintedbook,butdon'tbuythefirst

edition.– Thisbookintroducesmoreconceptualmaterial,motivating

computationalthinking.

• Thereisan interactiveversionof“HowtoThinkLikeaComputerScientist” (thefirsteditionof“ThinkPython”),whichletsyoutypeandrunPythoncodedirectlywhilereadingthebook.

21