Skip to content

Commit

Permalink
Update __init__.py
Browse files Browse the repository at this point in the history
  • Loading branch information
koaning committed May 14, 2024
1 parent b0e1c65 commit 5ef97f5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drawdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def data_as_polars(self):
def data_as_X_y(self, kind='classification'):
import numpy as np

colors = [_['label'] for _ in self.data]
colors = [_['color'] for _ in self.data]
X = np.array([[_['x']] for _ in self.data])

# Assume that we're dealing with regression in this case
if np.unique(colors).shape[0] == 1:
X = np.array([[_['x']] for _ in self.data])
y = np.array([_['y'] for _ in self.data])
return X, y
X = np.array([[_['x'], _['y']] for _ in self.data])
y = np.array([_['label'] for _ in self.data])
return X, y
return X, colors

0 comments on commit 5ef97f5

Please sign in to comment.