Skip to content

Latest commit

 

History

History
92 lines (54 loc) · 3.55 KB

README.md

File metadata and controls

92 lines (54 loc) · 3.55 KB

CANCER CLASSIFICATION PROJECT

SVM

  • can be used for both classifications & regression

Attributes

['mean radius' 'mean texture' 'mean perimeter' 'mean area' 'mean smoothness' 'mean compactness' 'mean concavity' 'mean concave points' 'mean symmetry' 'mean fractal dimension' 'radius error' 'texture error' 'perimeter error' 'area error' 'smoothness error' 'compactness error' 'concavity error' 'concave points error' 'symmetry error' 'fractal dimension error' 'worst radius' 'worst texture' 'worst perimeter' 'worst area' 'worst smoothness' 'worst compactness' 'worst concavity' 'worst concave points' 'worst symmetry' 'worst fractal dimension']

Label / The prediction

  • classes = ['malignant', 'benign']

Requirements

  1. sklearn

    import sklearn 
    from sklearn import datasets
    from sklearn import svm

HOW SUPPORT VECTOR MACHINES works!!!

  • SVM create a hyperplane, that divides your data

CASE 1:

Web capture_20-6-2023_10430_www youtube com

  • The hyperplane is the same distance from the two closest data points from both classes (red & green) in this case.

a. Web capture_20-6-2023_104740_www youtube com

NOTE: Meaning we could generate multiple hyperplanes eg;

b. Web capture_20-6-2023_10505_www youtube com

c. Web capture_20-6-2023_105148_www youtube com

  • The best hyperplane to use is the one where the distance between our classes is the greatest. In our case The best to use is a..

CASE 2:

  • if we get this type of data what happens? kernel trick

Web capture_20-6-2023_11116_www youtube com

  • In this case we use kernel trick

  • Kernel, simply take the x1 's and x2 of each data point and comes up with an x3. For 3D

Web capture_20-6-2023_111853_www youtube com

Web capture_20-6-2023_112012_www youtube com

  • This shows how a 2D is converted to a 3D.

Web capture_20-6-2023_112246_www youtube com

CASE 3:

  • Using a soft margin

    model = svm.SVC(kernel="linear", C=1)

Web capture_20-6-2023_112813_www youtube com

  • If this occurs like in our case where by a RED DATA POINT has strayed. We ignore it to get a better result.

  • a few points maybe ignored

Web capture_20-6-2023_11318_www youtube com

NOTE: In a hard margin this is not allowed.