ICS 235 Machine Learning Methods Department of Information and Computer Sciences University of Hawai i at M noa Kyungim Baek Announcements Attendance record has been added to the Gradebook in Laulima You can view the number of missed classes and their corresponding dates 2 1 Homework assignment 1 Will be released over the weekend Due 11 55 PM on Wednesday September 18 Lecture 3 Python introduction part 2 NumPy Matplotlib Pandas 3 4 2 Brief introduction to Python with Jupyter notebook Part 2 NumPy Matplotlib Pandas NumPy Broadcasting rules Suppose we have NumPy arrays x and y How will they broadcast Write down the shape of each array as a tuple of integers For example x 10 y 20 10 If they have different numbers of dimensions prepend with ones until they have the same number of dimensions For example x 10 y 20 10 x 1 10 y 20 10 Compare each dimension There are 3 cases a Dimension match Everything is good b Dimensions don t match but one is 1 Duplicate the smaller array along that axis to match a Dimensions don t match neither are 1 Error Slide credit Justin Johnson David Fouhey 5 6 3 NumPy Broadcasting examples x np ones 10 20 y np ones 20 z x y print z shape 10 20 x np ones 10 20 y np ones 10 1 z x y print z shape 10 20 x np ones 10 20 y np ones 10 z x y print z shape ERROR x np ones 1 20 y np ones 10 1 z x y print z shape 10 20 Slide credit Justin Johnson David Fouhey Using numpy newaxis for broadcasting What will be the output of the following code 7 8 4 Next class Introduction to supervised learning with nearest neighbors Binary classification metrics Model evaluation and selection Train test split 9 5
View Full Document