online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
import numpy as np # For numerical operations import matplotlib.pyplot as plt # For plotting from sklearn.datasets import make_regression # For generating synthetic data from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsRegressor from sklearn.metrics import mean_squared_error, r2_score # Generate synthetic dataset X, y = make_regression( n_samples=200, n_features=1, noise=0.1, random_state=42 ) # Split the dataset into training and testing sets X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.2, random_state=42 ) # Create and train the KNN regressor knn_regressor = KNeighborsRegressor(n_neighbors=5) knn_regressor.fit(X_train, y_train) # Make predictions on the test data y_pred = knn_regressor.predict(X_test) # Evaluate the model mse = mean_squared_error(y_test, y_pred) r2 = r2_score(y_test, y_pred) print(f'Mean Squared Error: {mse}') print(f'R-squared: {r2}') # Visualize the results plt.scatter(X_test, y_test, color='blue', label='Actual') plt.scatter(X_test, y_pred, color='red', label='Predicted') plt.title('KNN Regression') plt.xlabel('Feature') plt.ylabel('Target') plt.legend() plt.show()

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue