{ "data_id": "44776", "name": "sf-police-incidents_seed_3_nrows_2000_nclasses_10_ncols_100_stratify_True", "exact_name": "sf-police-incidents_seed_3_nrows_2000_nclasses_10_ncols_100_stratify_True", "version": 1, "version_label": "9937c60f-d42d-4daf-9592-07b0dc27fa0f", "description": "Subsampling of the dataset sf-police-incidents (42732) with\n\nseed=3\nargs.nrows=2000\nargs.ncols=100\nargs.nclasses=10\nargs.no_stratify=True\nGenerated with the following source code:\n\n\n```python\n def subsample(\n self,\n seed: int,\n nrows_max: int = 2_000,\n ncols_max: int = 100,\n nclasses_max: int = 10,\n stratified: bool = True,\n ) -> Dataset:\n rng = np.random.default_rng(seed)\n\n x = self.x\n y = self.y\n\n # Uniformly sample\n classes = y.unique()\n if len(classes) > nclasses_max:\n vcs = y.value_counts()\n selected_classes = rng.choice(\n classes,\n size=nclasses_max,\n replace=False,\n p=vcs \/ sum(vcs),\n )\n\n # Select the indices where one of these classes is present\n idxs = y.index[y.isin(classes)]\n x = x.iloc[idxs]\n y = y.iloc[idxs]\n\n # Uniformly sample columns if required\n if len(x.columns) > ncols_max:\n columns_idxs = rng.choice(\n list(range(len(x.columns))), size=ncols_max, replace=False\n )\n sorted_column_idxs = sorted(columns_idxs)\n selected_columns = list(x.columns[sorted_column_idxs])\n x = x[selected_columns]\n else:\n sorted_column_idxs = list(range(len(x.columns)))\n\n if len(x) > nrows_max:\n # Stratify accordingly\n target_name = y.name\n data = pd.concat((x, y), axis=\"columns\")\n _, subset = train_test_split(\n data,\n test_size=nrows_max,\n stratify=data[target_name],\n shuffle=True,\n random_state=seed,\n )\n x = subset.drop(target_name, axis=\"columns\")\n y = subset[target_name]\n\n # We need to convert categorical columns to string for openml\n categorical_mask = [self.categorical_mask[i] for i in sorted_column_idxs]\n columns = list(x.columns)\n\n return Dataset(\n # Technically this is not the same but it's where it was derived from\n dataset=self.dataset,\n x=x,\n y=y,\n categorical_mask=categorical_mask,\n columns=columns,\n )\n```", "format": "arff", "uploader": "Eddie Bergman", "uploader_id": 32840, "visibility": "public", "creator": "\"Eddie Bergman\"", "contributor": null, "date": "2022-11-17 18:50:36", "update_comment": null, "last_update": "2022-11-17 18:50:36", "licence": "CC0", "status": "active", "error_message": null, "url": "https:\/\/api.openml.org\/data\/download\/22111538\/dataset", "default_target_attribute": "ViolentCrime", "row_id_attribute": null, "ignore_attribute": null, "runs": 0, "suggest": { "input": [ "sf-police-incidents_seed_3_nrows_2000_nclasses_10_ncols_100_stratify_True", "Subsampling of the dataset sf-police-incidents (42732) with seed=3 args.nrows=2000 args.ncols=100 args.nclasses=10 args.no_stratify=True Generated with the following source code: ```python def subsample( self, seed: int, nrows_max: int = 2_000, ncols_max: int = 100, nclasses_max: int = 10, stratified: bool = True, ) -> Dataset: rng = np.random.default_rng(seed) x = self.x y = self.y # Uniformly sample classes = y.unique() if len(classes) > nclasses_max: vcs = y.value_counts() selected_classes = " ], "weight": 5 }, "qualities": { "NumberOfInstances": 2000, "NumberOfFeatures": 9, "NumberOfClasses": 2, "NumberOfMissingValues": 0, "NumberOfInstancesWithMissingValues": 0, "NumberOfNumericFeatures": 3, "NumberOfSymbolicFeatures": 6, "PercentageOfBinaryFeatures": 11.11111111111111, "PercentageOfInstancesWithMissingValues": 0, "AutoCorrelation": 0.7883941970985493, "PercentageOfMissingValues": 0, "Dimensionality": 0.0045, "PercentageOfNumericFeatures": 33.33333333333333, "MajorityClassPercentage": 87.85, "PercentageOfSymbolicFeatures": 66.66666666666666, "MajorityClassSize": 1757, "MinorityClassPercentage": 12.15, "MinorityClassSize": 243, "NumberOfBinaryFeatures": 1 }, "tags": [ { "uploader": "38960", "tag": "Images" }, { "uploader": "38960", "tag": "Machine Learning" } ], "features": [ { "name": "ViolentCrime", "index": "8", "type": "nominal", "distinct": "2", "missing": "0", "target": "1", "distr": [ [ "Yes", "No" ], [ [ "243", "0" ], [ "0", "1757" ] ] ] }, { "name": "Hour", "index": "0", "type": "numeric", "distinct": "24", "missing": "0", "min": "0", "max": "23", "mean": "13", "stdev": "7" }, { "name": "DayOfWeek", "index": "1", "type": "nominal", "distinct": "7", "missing": "0", "distr": [ [ "1", "2", "3", "4", "5", "6", "7" ], [ [ "39", "218" ], [ "33", "235" ], [ "33", "227" ], [ "32", "288" ], [ "32", "246" ], [ "37", "271" ], [ "37", "272" ] ] ] }, { "name": "Month", "index": "2", "type": "nominal", "distinct": "12", "missing": "0", "distr": [ [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], [ [ "19", "139" ], [ "21", "149" ], [ "23", "156" ], [ "28", "163" ], [ "19", "154" ], [ "19", "127" ], [ "7", "144" ], [ "23", "156" ], [ "26", "147" ], [ "17", "171" ], [ "11", "131" ], [ "30", "120" ] ] ] }, { "name": "Year", "index": "3", "type": "nominal", "distinct": "16", "missing": "0", "distr": [ [ "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018" ], [ [ "22", "132" ], [ "16", "134" ], [ "14", "98" ], [ "10", "102" ], [ "20", "102" ], [ "18", "138" ], [ "15", "113" ], [ "7", "97" ], [ "21", "115" ], [ "14", "116" ], [ "20", "98" ], [ "16", "139" ], [ "19", "131" ], [ "16", "103" ], [ "13", "106" ], [ "2", "33" ] ] ] }, { "name": "PdDistrict", "index": "4", "type": "nominal", "distinct": "10", "missing": "0", "distr": [ [ "BAYVIEW", "CENTRAL", "INGLESIDE", "MISSION", "NORTHERN", "PARK", "RICHMOND", "SOUTHERN", "TARAVAL", "TENDERLOIN" ], [ [ "21", "165" ], [ "26", "164" ], [ "27", "168" ], [ "37", "254" ], [ "27", "205" ], [ "16", "106" ], [ "10", "91" ], [ "37", "317" ], [ "14", "136" ], [ "28", "151" ] ] ] }, { "name": "Address", "index": "5", "type": "nominal", "distinct": "1527", "missing": "0", "distr": [] }, { "name": "X", "index": "6", "type": "numeric", "distinct": "1593", "missing": "0", "min": "-123", "max": "0", "mean": "-122", "stdev": "0" }, { "name": "Y", "index": "7", "type": "numeric", "distinct": "1593", "missing": "0", "min": "38", "max": "38", "mean": "38", "stdev": "0" } ], "nr_of_issues": 0, "nr_of_downvotes": 0, "nr_of_likes": 0, "nr_of_downloads": 0, "total_downloads": 0, "reach": 0, "reuse": 0, "impact_of_reuse": 0, "reach_of_reuse": 0, "impact": 0 }