Codecademy code to assist Support Vector Machine project

Machine learning -support vector machines

image

hi please can someone provide the code for ‘draw_boundary’ function as listed within step 12 of project for support vector machine… thanks…

1 Like

Hello!
the draw boundary function is imported at the beginning of the code for this project. The instructions for this step of the project describe the inputs and outputs of the function, so we don’t need to know its contents.

In this case, the function colours the graph you are plotting so that it is easier to visualize the “strike zone” of a player. You call the function by providing the plot axes and trained SVM as follows:

draw_boundary(ax, classifier)
2 Likes

the point is i would like to see the code that i am using… the outcome of this example project is dependent on utilising that piece of code which is not transparent to me… how can i take learning of this project into the real world… my knowledge and skills will remain incomplete…

1 Like

I understand that it’s frustrating not to be able to see the contents of the function that you’re using. Think of this function the same way you would any other package that you’re importing (ie. pandas, sci-kit learn, matplotlib.pyplot, etc.). You don’t know the details of the code contained in these packages, but you know what they do and how to use them.

If you’re interested in delving into how a function like this could work, you could try re-engineering it using matplotlib with code similar to this.

1 Like

If you click on the file icon in the top left corner of the code editor image
you can then click on the svm_visualization.py file, and see the code. :slight_smile:

image

3 Likes