sklearn-tasks-v1 / train.jsonl
eltociear's picture
add 25 verified scikit-learn tasks
789ebde verified
Raw
History Blame Contribute Delete
25 kB
{"task_id": "sk-000", "category": "preprocessing", "prompt": "Fit a StandardScaler on X_clf and return its per-feature mean_, rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.058753, -0.037808, -0.053043, -0.0129, -0.249795, 0.018859, -0.362284, 0.018563], \"dtype\": \"float64\", \"shape\": [8]}"}
{"task_id": "sk-001", "category": "preprocessing", "prompt": "Fit a StandardScaler on X_clf, transform it, and return a 2-element array [mean of the transformed matrix, std of the transformed matrix], each rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [-0.0, 1.0], \"dtype\": \"float64\", \"shape\": [2]}"}
{"task_id": "sk-002", "category": "preprocessing", "prompt": "Fit a MinMaxScaler on X_clf, transform it, and return a 2-element array [min of the result, max of the result], rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.0, 1.0], \"dtype\": \"float64\", \"shape\": [2]}"}
{"task_id": "sk-003", "category": "preprocessing", "prompt": "Fit PCA(n_components=3, random_state=20260806) on X_clf and return its explained_variance_ratio_, rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.588764, 0.132395, 0.096792], \"dtype\": \"float64\", \"shape\": [3]}"}
{"task_id": "sk-004", "category": "preprocessing", "prompt": "Apply SelectKBest(f_classif, k=4) to (X_clf, y_clf) and return the 0-based indices of the selected features as a sorted int array.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [2, 3, 4, 6], \"dtype\": \"int64\", \"shape\": [4]}"}
{"task_id": "sk-005", "category": "preprocessing", "prompt": "Split (X_clf, y_clf) with train_test_split(test_size=0.25, random_state=20260806, stratify=y_clf) and return a 4-element int array [n_train_rows, n_test_rows, positives in train, positives in test].", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [225, 75, 113, 37], \"dtype\": \"int64\", \"shape\": [4]}"}
{"task_id": "sk-006", "category": "classification", "prompt": "Split (X_clf, y_clf) with train_test_split(test_size=0.25, random_state=20260806, stratify=y_clf). Fit LogisticRegression(max_iter=1000, random_state=20260806) on the train split and return a 1-element array with the test accuracy rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.693333], \"dtype\": \"float64\", \"shape\": [1]}"}
{"task_id": "sk-007", "category": "classification", "prompt": "Same split as above. Fit RandomForestClassifier(n_estimators=50, random_state=20260806, n_jobs=1) and return a 1-element array with the test accuracy rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.813333], \"dtype\": \"float64\", \"shape\": [1]}"}
{"task_id": "sk-008", "category": "classification", "prompt": "Same split as above. Fit DecisionTreeClassifier(max_depth=4, random_state=20260806) and return its feature_importances_ rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.107393, 0.051301, 0.082084, 0.0, 0.0, 0.372747, 0.364173, 0.022301], \"dtype\": \"float64\", \"shape\": [8]}"}
{"task_id": "sk-009", "category": "classification", "prompt": "Same split as above. Fit a Pipeline of StandardScaler then SVC(kernel='rbf', random_state=20260806) and return a 1-element array with the test accuracy rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.813333], \"dtype\": \"float64\", \"shape\": [1]}"}
{"task_id": "sk-010", "category": "classification", "prompt": "Same split as above. Fit GradientBoostingClassifier(n_estimators=40, random_state=20260806) and return a 1-element array with the test accuracy rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.826667], \"dtype\": \"float64\", \"shape\": [1]}"}
{"task_id": "sk-011", "category": "classification", "prompt": "Same split as above. Fit LogisticRegression(max_iter=1000, random_state=20260806) and return the first 10 predicted TEST labels as an int array, in test-set order.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0, 1, 1, 0, 1, 0, 0, 0, 0, 0], \"dtype\": \"int64\", \"shape\": [10]}"}
{"task_id": "sk-012", "category": "metrics", "prompt": "Split (X_imb, y_imb) with train_test_split(test_size=0.25, random_state=20260806, stratify=y_imb). Fit LogisticRegression(max_iter=1000, random_state=20260806) and return a 4-element array [accuracy, precision, recall, f1] on the test split, each rounded to 6 decimals. Use zero_division=0 for precision.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.97, 1.0, 0.7, 0.823529], \"dtype\": \"float64\", \"shape\": [4]}"}
{"task_id": "sk-013", "category": "metrics", "prompt": "Same imbalanced split. Fit LogisticRegression(max_iter=1000, random_state=20260806) and return a 1-element array with the test ROC AUC computed from predict_proba, rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.987778], \"dtype\": \"float64\", \"shape\": [1]}"}
{"task_id": "sk-014", "category": "metrics", "prompt": "Same imbalanced split. Return a 4-element int array with the confusion-matrix counts [tn, fp, fn, tp] for LogisticRegression(max_iter=1000, random_state=20260806) on the test split.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [90, 0, 3, 7], \"dtype\": \"int64\", \"shape\": [4]}"}
{"task_id": "sk-015", "category": "metrics", "prompt": "Return a 2-element array [number of class-0 samples, number of class-1 samples] in y_imb, as int64.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [358, 42], \"dtype\": \"int64\", \"shape\": [2]}"}
{"task_id": "sk-016", "category": "regression", "prompt": "Split (X_reg, y_reg) with train_test_split(test_size=0.25, random_state=20260806). Fit LinearRegression and return a 3-element array [R2, MAE, RMSE] on the test split, each rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.981652, 6.978677, 8.68575], \"dtype\": \"float64\", \"shape\": [3]}"}
{"task_id": "sk-017", "category": "regression", "prompt": "Same regression split. Fit LinearRegression and return its coef_ rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [1.00929, 0.305271, 26.87147, 60.479451, 15.443362], \"dtype\": \"float64\", \"shape\": [5]}"}
{"task_id": "sk-018", "category": "regression", "prompt": "Same regression split. Fit Ridge(alpha=10.0, random_state=20260806) and return a 1-element array with the test R2 rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.975896], \"dtype\": \"float64\", \"shape\": [1]}"}
{"task_id": "sk-019", "category": "regression", "prompt": "Same regression split. Fit a Pipeline of StandardScaler then Ridge(alpha=1.0, random_state=20260806) and return the first 5 test predictions rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [47.800108, 6.009665, 75.209202, 41.860588, 15.131067], \"dtype\": \"float64\", \"shape\": [5]}"}
{"task_id": "sk-020", "category": "validation", "prompt": "Run cross_val_score on the FULL (X_clf, y_clf) with LogisticRegression(max_iter=1000, random_state=20260806), cv=KFold(n_splits=5, shuffle=True, random_state=20260806), scoring 'accuracy', and return the 5 fold scores rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.666667, 0.65, 0.7, 0.683333, 0.6], \"dtype\": \"float64\", \"shape\": [5]}"}
{"task_id": "sk-021", "category": "validation", "prompt": "Same cross-validation setup, but score a Pipeline of StandardScaler then LogisticRegression(max_iter=1000, random_state=20260806) — so the scaler is fitted INSIDE each fold. Return the 5 fold scores rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.666667, 0.666667, 0.7, 0.683333, 0.616667], \"dtype\": \"float64\", \"shape\": [5]}"}
{"task_id": "sk-022", "category": "validation", "prompt": "Same cross-validation setup with RandomForestClassifier(n_estimators=40, random_state=20260806, n_jobs=1). Return a 2-element array [mean score, std of scores], rounded to 6 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [0.83, 0.032318], \"dtype\": \"float64\", \"shape\": [2]}"}
{"task_id": "sk-023", "category": "validation", "prompt": "Fit KMeans(n_clusters=3, n_init=10, random_state=20260806) on X_clf and return a 1-element array with its inertia_ rounded to 4 decimals.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [3216.3212], \"dtype\": \"float64\", \"shape\": [1]}"}
{"task_id": "sk-024", "category": "validation", "prompt": "Fit KMeans(n_clusters=3, n_init=10, random_state=20260806) on X_clf and return the size of each cluster as an int array, ordered by cluster label.", "datasets": "Three datasets are preloaded, each generated with a fixed seed:\n\n X_clf, y_clf : make_classification(n_samples=300, n_features=8, n_informative=5,\n n_redundant=1, n_classes=2, random_state=20260806)\n X_imb, y_imb : make_classification(n_samples=400, n_features=6, n_informative=4,\n n_redundant=0, n_classes=2, weights=[0.9, 0.1],\n random_state=20260806)\n X_reg, y_reg : make_regression(n_samples=200, n_features=5, n_informative=3,\n noise=8.0, random_state=20260806)\n", "seed": 20260806, "expected_output": "{\"data\": [117, 124, 59], \"dtype\": \"int64\", \"shape\": [3]}"}