{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# ACRO Demonstration" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# uncomment this line if acro is not installed\n", "# ie you are in development mode\n", "# sys.path.insert(0, os.path.abspath(\"..\"))" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from acro import ACRO" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Instantiate ACRO" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "INFO:acro:version: 0.4.8\n", "INFO:acro:config: {'safe_threshold': 10, 'safe_dof_threshold': 10, 'safe_nk_n': 2, 'safe_nk_k': 0.9, 'safe_pratio_p': 0.1, 'check_missing_values': False, 'survival_safe_threshold': 10, 'zeros_are_disclosive': True}\n", "INFO:acro:automatic suppression: False\n" ] } ], "source": [ "acro = ACRO(suppress=False)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Load test data\n", "The dataset used in this notebook is the nursery dataset from OpenML. \n", "- In this version, the data can be read directly from the local machine after it has been downloaded. \n", "- The code below reads the data from a folder called \"data\" which we assume is at the same level as the folder where you are working.\n", "- The path might need to be changed if the data has been downloaded and stored elsewhere.\n", " - for example use: \n", " path = os.path.join(\"data\", \"nursery.arff\") \n", " if the data is in a sub-folder of your work folder" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | parents | \n", "has_nurs | \n", "form | \n", "children | \n", "housing | \n", "finance | \n", "social | \n", "health | \n", "recommend | \n", "
|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "usual | \n", "proper | \n", "complete | \n", "1 | \n", "convenient | \n", "convenient | \n", "nonprob | \n", "recommended | \n", "recommend | \n", "
| 1 | \n", "usual | \n", "proper | \n", "complete | \n", "1 | \n", "convenient | \n", "convenient | \n", "nonprob | \n", "priority | \n", "priority | \n", "
| 2 | \n", "usual | \n", "proper | \n", "complete | \n", "1 | \n", "convenient | \n", "convenient | \n", "nonprob | \n", "not_recom | \n", "not_recom | \n", "
| 3 | \n", "usual | \n", "proper | \n", "complete | \n", "1 | \n", "convenient | \n", "convenient | \n", "slightly_prob | \n", "recommended | \n", "recommend | \n", "
| 4 | \n", "usual | \n", "proper | \n", "complete | \n", "1 | \n", "convenient | \n", "convenient | \n", "slightly_prob | \n", "priority | \n", "priority | \n", "