text_plain_output_1.png
import matplotlib.pyplot as plt

import numpy as np

import random

data = np.genfromtxt('/kaggle/input/da-assignment2/wdbc.data', delimiter=',')
data = np.delete(data, [0, 1], axis=1)
file = open('/kaggle/input/wdbc-labels/wdbc_labels.csv', 'r')
lines = file.readlines()
count = 0
labels = np.zeros((data.shape[0], 1))
for line in lines:
    if line[0] == 'M':
        labels[count] = 0
    else:
        labels[count] = 1
    count = count + 1

data_comb = []
for i in range(569):
    data_comb.append((data[i], labels[i]))
random.shuffle(data_comb)
print(len(data_comb))
data = np.empty((569, 30))
for i in range(569):
    data[i] = np.array(data_comb[i][0])
    labels[i] = data_comb[i][1]
print(data[9])
print(labels[9])
border = int(data.shape[0] * 0.75)
train_x = data[0:border]
train_y = labels[0:border]
test_x = data[border + 1:data.shape[0]]
test_y = labels[border + 1:data.shape[0]]
print(train_x[9])
print(train_y[9])