Lesson2-split_vals function


(aomine) #1


i’m new to machine learning ,i cant able to understand the splitting mechanism by calling the function and using the split_vals function
can anyone please help me out


(Fredrik Fyring) #2

split_vals is a quite typical python function so I guess it’s the array “slicing” functionality that you don’t understand?

split_vals simply takes an array “a” and a number “n” and split the array into two parts. One from element 0 to element n-1 (a[:n]) and one from element n to the last element (a[n:]). It returns copies of the slices so modifying them will not affect the input array.


(aomine) #3

Thank you so much