-
Notifications
You must be signed in to change notification settings - Fork 205
Open
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
The README screenshot showcases a LinearRegression implementation - Python on the left, C# on the right.
This is what NumSharp was built for: enabling near-identical code translation from Python to C#.
What This Demonstrates
The screenshot proves NumSharp's core promise: you can take NumPy code and translate it to C# with minimal changes:
| Python/NumPy | C#/NumSharp |
|---|---|
np.hstack(...) |
np.hstack(...) |
np.mean(X, 0) |
np.mean(X, 0) |
np.std(X, 0) |
np.std(X, 0) |
np.expand_dims(y, -1) |
np.expand_dims(y, -1) |
np.zeros(...) |
np.zeros(...) |
X @ self.params |
np.matmul(X, @params) |
(y - y_pred)**2 |
np.power(y - y_pred, 2) |
The entire LinearRegression class - constructor, fit(), score(), and predict() methods - translates almost 1-to-1.
Achievement Unlocked 🏆
This example should be preserved, tested, and maintained as a canonical demonstration of NumSharp's capabilities.
Tasks
- Add
LinearRegressionexample to test suite to ensure it never breaks - Verify all APIs used still work correctly with NumPy 2.x behavior
- Consider adding to documentation as a "getting started" example
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
