# Dataset Quality Scorer (`fiery_dream/dataset-quality-scorer`) Actor

Score ML datasets for quality (completeness, consistency, duplicates, balance). Detect data drift, outliers, and recommend improvements.

- **URL**: https://apify.com/fiery_dream/dataset-quality-scorer.md
- **Developed by:** [Cody Churchwell](https://apify.com/fiery_dream) (community)
- **Categories:** Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Dataset Quality Scorer for ML

Score ML datasets for quality (completeness, consistency, duplicates, balance). Detect data drift, outliers, and recommend improvements.

### Features

- **Quality Scoring**: Comprehensive scoring across multiple dimensions
- **Data Drift Detection**: Compare datasets to detect distribution changes
- **Outlier Detection**: Multiple methods (Z-score, IQR, Isolation Forest)
- **Schema Validation**: Validate data against expected schema
- **Full Reports**: Generate comprehensive quality reports

### Operations

#### 1. Score Dataset Quality

Analyze dataset quality across:

- **Completeness**: Missing values detection
- **Consistency**: Type consistency across columns
- **Duplicates**: Duplicate row detection
- **Balance**: Class distribution for ML tasks

#### 2. Detect Data Drift

Compare current dataset against baseline to detect:

- Distribution changes in numerical features
- Category changes in categorical features
- Drift severity assessment

#### 3. Find Outliers

Detect anomalous values using:

- Z-score method
- Interquartile Range (IQR)
- Isolation Forest

#### 4. Validate Schema

Validate dataset structure:

- Column presence/absence
- Data type conformity
- Required field checks

#### 5. Generate Full Report

Comprehensive analysis combining all checks

### Input Parameters

- **operation**: Operation to perform (required)
- **datasetUrl**: URL to CSV/JSON dataset or Apify dataset ID
- **datasetData**: Inline dataset as JSON array
- **schemaDefinition**: Expected schema for validation
- **baselineDataset**: Baseline for drift detection
- **outlierMethod**: Method for outlier detection (zscore, iqr, isolation_forest)
- **outlierThreshold**: Threshold value (default: 3)
- **checkDuplicates**: Enable duplicate checking (default: true)
- **checkBalance**: Enable class balance checking (default: true)
- **targetColumn**: Target column for balance analysis

### Use Cases

1. **Data Quality Assurance**: Ensure data meets quality standards before training
2. **Data Drift Monitoring**: Monitor production data for distribution shifts
3. **Outlier Detection**: Identify anomalies that could harm model performance
4. **Schema Validation**: Verify data structure before processing
5. **ML Pipeline Integration**: Automated quality gates in ML workflows

### Example

```json
{
  "operation": "generateReport",
  "datasetUrl": "https://example.com/data.csv",
  "schemaDefinition": {
    "columns": {
      "id": "number",
      "feature1": "number",
      "label": "string"
    },
    "required": ["id", "label"]
  },
  "checkDuplicates": true,
  "checkBalance": true,
  "targetColumn": "label",
  "outlierMethod": "zscore",
  "outlierThreshold": 3
}
```

### Output

Returns quality scores, detected issues, and actionable recommendations for improving dataset quality.

### Market Gap

First free comprehensive dataset quality tool. Alternatives like Great Expectations require complex setup. This actor provides instant quality scoring with zero configuration.

**Target MAU**: 800

# Actor input Schema

## `operation` (type: `string`):

Action to perform

## `datasetUrl` (type: `string`):

URL to CSV/JSON dataset or Apify dataset ID

## `datasetData` (type: `array`):

Inline dataset as JSON array (if no URL provided)

## `schemaDefinition` (type: `object`):

Expected schema with column names and types

## `baselineDataset` (type: `string`):

URL or dataset ID to compare against for drift detection

## `outlierMethod` (type: `string`):

Method for outlier detection

## `outlierThreshold` (type: `number`):

Threshold for outlier detection (e.g., 3 for Z-score)

## `checkDuplicates` (type: `boolean`):

Check for duplicate rows

## `checkBalance` (type: `boolean`):

Check if classes are balanced (for classification tasks)

## `targetColumn` (type: `string`):

Column name for class balance analysis

## Actor input object example

```json
{
  "operation": "scoreDataset",
  "schemaDefinition": {
    "columns": {
      "id": "number",
      "name": "string",
      "age": "number",
      "category": "string"
    },
    "required": [
      "id",
      "name"
    ]
  },
  "outlierMethod": "zscore",
  "outlierThreshold": 3,
  "checkDuplicates": true,
  "checkBalance": true
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "operation": "scoreDataset",
    "outlierMethod": "zscore",
    "outlierThreshold": 3,
    "checkDuplicates": true,
    "checkBalance": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("fiery_dream/dataset-quality-scorer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "operation": "scoreDataset",
    "outlierMethod": "zscore",
    "outlierThreshold": 3,
    "checkDuplicates": True,
    "checkBalance": True,
}

# Run the Actor and wait for it to finish
run = client.actor("fiery_dream/dataset-quality-scorer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "operation": "scoreDataset",
  "outlierMethod": "zscore",
  "outlierThreshold": 3,
  "checkDuplicates": true,
  "checkBalance": true
}' |
apify call fiery_dream/dataset-quality-scorer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fiery_dream/dataset-quality-scorer"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/dfj5QOGUTZISGzjha/builds/qzIopgJ8G78Iv655J/openapi.json
