REGRESSION
NuSVR
Nu Support Vector Regression.
Example of usage
Python API reference included; executable data demonstration pending review.
Usage / limitations
+Use when: Predict continuous measurements.
−Limitations: Check input requirements, mathematical assumptions and version-specific behaviour before using.
Mathematical formula
See method documentation: implementation and assumptions vary.
Sample dataShow
{
"variable": "housing_data",
"domain": "Residential property pricing",
"feature_names": [
"floor_area_m2",
"building_age_years"
],
"records": [
{
"floor_area_m2": 60.0,
"building_age_years": 25.0
},
{
"floor_area_m2": 72.0,
"building_age_years": 24.0
},
{
"floor_area_m2": 84.0,
"building_age_years": 23.0
},
{
"floor_area_m2": 96.0,
"building_age_years": 22.0
},
{
"floor_area_m2": 108.0,
"building_age_years": 21.0
},
{
"floor_area_m2": 120.0,
"building_age_years": 20.0
},
{
"floor_area_m2": 132.0,
"building_age_years": 19.0
},
{
"floor_area_m2": 144.0,
"building_age_years": 18.0
},
{
"floor_area_m2": 156.0,
"building_age_years": 17.0
},
{
"floor_area_m2": 168.0,
"building_age_years": 16.0
},
{
"floor_area_m2": 180.0,
"building_age_years": 15.0
},
{
"floor_area_m2": 192.0,
"building_age_years": 14.0
},
{
"floor_area_m2": 204.0,
"building_age_years": 13.0
},
{
"floor_area_m2": 216.0,
"building_age_years": 12.0
},
{
"floor_area_m2": 228.0,
"building_age_years": 11.0
},
{
"floor_area_m2": 240.0,
"building_age_years": 10.0
},
{
"floor_area_m2": 252.0,
"building_age_years": 9.0
},
{
"floor_area_m2": 264.0,
"building_age_years": 8.0
},
{
"floor_area_m2": 276.0,
"building_age_years": 7.0
},
{
"floor_area_m2": 288.0,
"building_age_years": 6.0
},
{
"floor_area_m2": 300.0,
"building_age_years": 5.0
},
{
"floor_area_m2": 312.0,
"building_age_years": 4.0
},
{
"floor_area_m2": 324.0,
"building_age_years": 3.0
},
{
"floor_area_m2": 336.0,
"building_age_years": 2.0
}
],
"sale_price_thousands_gbp": [
220.5,
252.8,
285.1,
311.4,
343.7,
376.0,
402.3,
434.6,
466.9,
493.2,
525.5,
557.8,
584.1,
616.4,
648.7,
675.0,
707.3,
739.6,
765.9,
798.2,
830.5,
856.8,
889.1,
921.4
],
"retained_customer": [
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0,
1,
0
]
}
Code example (Python)
housing_data = {'variable': 'housing_data', 'domain': 'Residential property pricing', 'feature_names': ['floor_area_m2', 'building_age_years'], 'records': [{'floor_area_m2': 60.0, 'building_age_years': 25.0}, {'floor_area_m2': 72.0, 'building_age_years': 24.0}, {'floor_area_m2': 84.0, 'building_age_years': 23.0}, {'floor_area_m2': 96.0, 'building_age_years': 22.0}, {'floor_area_m2': 108.0, 'building_age_years': 21.0}, {'floor_area_m2': 120.0, 'building_age_years': 20.0}, {'floor_area_m2': 132.0, 'building_age_years': 19.0}, {'floor_area_m2': 144.0, 'building_age_years': 18.0}, {'floor_area_m2': 156.0, 'building_age_years': 17.0}, {'floor_area_m2': 168.0, 'building_age_years': 16.0}, {'floor_area_m2': 180.0, 'building_age_years': 15.0}, {'floor_area_m2': 192.0, 'building_age_years': 14.0}, {'floor_area_m2': 204.0, 'building_age_years': 13.0}, {'floor_area_m2': 216.0, 'building_age_years': 12.0}, {'floor_area_m2': 228.0, 'building_age_years': 11.0}, {'floor_area_m2': 240.0, 'building_age_years': 10.0}, {'floor_area_m2': 252.0, 'building_age_years': 9.0}, {'floor_area_m2': 264.0, 'building_age_years': 8.0}, {'floor_area_m2': 276.0, 'building_age_years': 7.0}, {'floor_area_m2': 288.0, 'building_age_years': 6.0}, {'floor_area_m2': 300.0, 'building_age_years': 5.0}, {'floor_area_m2': 312.0, 'building_age_years': 4.0}, {'floor_area_m2': 324.0, 'building_age_years': 3.0}, {'floor_area_m2': 336.0, 'building_age_years': 2.0}], 'sale_price_thousands_gbp': [220.5, 252.8, 285.1, 311.4, 343.7, 376.0, 402.3, 434.6, 466.9, 493.2, 525.5, 557.8, 584.1, 616.4, 648.7, 675.0, 707.3, 739.6, 765.9, 798.2, 830.5, 856.8, 889.1, 921.4], 'retained_customer': [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]}
# DataLens.ai example — NuSVR
# Domain: residential property pricing, with named predictor fields.
# Copy input + code + test includes the sample housing_data assignment.
import numpy as np
from sklearn import linear_model, tree, neighbors, gaussian_process, kernel_ridge, svm, neural_network, naive_bayes
# Read floor area and building age as the numeric feature matrix.
X = np.array([[row[field] for field in housing_data['feature_names']] for row in housing_data['records']], dtype=float)
# Read historic transaction prices, in thousands of pounds.
y = np.array(housing_data['sale_price_thousands_gbp'], dtype=float)
# Constrain the support-vector fraction with a nu-SVR kernel model.
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
model=make_pipeline(StandardScaler(),svm.NuSVR(nu=0.5,C=100.0)).fit(X,y)
assert np.isfinite(model.predict(X)).all() and model.predict(X).shape==y.shape
# Confirm the model-specific assertion without relying on printed numbers.
print("Expected output verified")
# DataLens.ai example — NuSVR
# Domain: residential property pricing, with named predictor fields.
# Copy input + code + test includes the sample housing_data assignment.
import numpy as np
from sklearn import linear_model, tree, neighbors, gaussian_process, kernel_ridge, svm, neural_network, naive_bayes
# Read floor area and building age as the numeric feature matrix.
X = np.array([[row[field] for field in housing_data['feature_names']] for row in housing_data['records']], dtype=float)
# Read historic transaction prices, in thousands of pounds.
y = np.array(housing_data['sale_price_thousands_gbp'], dtype=float)
# Constrain the support-vector fraction with a nu-SVR kernel model.
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
model=make_pipeline(StandardScaler(),svm.NuSVR(nu=0.5,C=100.0)).fit(X,y)
assert np.isfinite(model.predict(X)).all() and model.predict(X).shape==y.shape
# Confirm the model-specific assertion without relying on printed numbers.
print("Expected output verified")