├── doc ├── .gitkeep.txt └── my-project │ ├── .gitignore │ ├── docs │ ├── references.md │ ├── home.md │ └── methods.md │ └── mkdocs.yml ├── reina ├── __init__.py ├── utilities │ ├── .gitkeep.txt │ ├── __init__.py │ └── baseModel.py ├── iv │ ├── __init__.py │ └── tsls.py └── MetaLearners │ ├── __init__.py │ ├── SLearner.py │ ├── TLearner.py │ └── XLearner.py ├── .gitignore ├── pyproject.toml ├── CONTRIBUTING.md ├── setup.py ├── LICENSE.txt ├── examples ├── README.md ├── notebooks │ ├── tsls │ │ ├── tsls_toy.ipynb │ │ └── .ipynb_checkpoints │ │ │ └── tsls_toy-checkpoint.ipynb │ └── metalearner │ │ ├── .ipynb_checkpoints │ │ ├── metalearner_toy-checkpoint.ipynb │ │ └── metalearner_churn-checkpoint.ipynb │ │ ├── metalearner_toy.ipynb │ │ └── metalearner_churn.ipynb ├── heart.csv ├── student-mat.csv └── kidney_disease.csv └── README.md /doc/.gitkeep.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /reina/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | -------------------------------------------------------------------------------- /reina/utilities/.gitkeep.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/my-project/.gitignore: -------------------------------------------------------------------------------- 1 | site/ 2 | -------------------------------------------------------------------------------- /doc/my-project/docs/references.md: -------------------------------------------------------------------------------- 1 | # References 2 | -------------------------------------------------------------------------------- /reina/iv/__init__.py: -------------------------------------------------------------------------------- 1 | from .2sls import SieveTSLS 2 | -------------------------------------------------------------------------------- /reina/utilities/__init__.py: -------------------------------------------------------------------------------- 1 | from .baseModel import baseModel 2 | -------------------------------------------------------------------------------- /reina/MetaLearners/__init__.py: -------------------------------------------------------------------------------- 1 | from .SLearner import SLearner 2 | from .TLearner import TLearner 3 | from .XLearner import XLearner 4 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = [ 3 | "setuptools>=42", 4 | "wheel" 5 | ] 6 | build-backend = "setuptools.build_meta" 7 | -------------------------------------------------------------------------------- /doc/my-project/mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: Reina 2 | site_url: https://example.com/ 3 | nav: 4 | - Home: home.md 5 | - Methods: methods.md 6 | - References: references.md 7 | theme: readthedocs 8 | -------------------------------------------------------------------------------- /doc/my-project/docs/home.md: -------------------------------------------------------------------------------- 1 | # Welcome to ReInA (Reasoning In AI) 2 | 3 | 4 | For github page visit [Reina](https://github.com/Qyu-ai/Reina). 5 | 6 | ## About 7 | ReInA (Reasoning In AI) is a causal inference platform aimed at estimating heterogeneous treatment effects in observational data. There are various open-source projects that provide convenient causal inference methods, but the current out-of-box packages are limited to local memory for computation. Hence, this project integrates Apache Spark with various machine learning (ML) powered causal inference frameworks, enabling causal analysis on big-data. 8 | 9 | ## Installation 10 | 11 | pip install reina 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Issues 4 | 5 | A good issue includes a [short, self contained, correct example](http://sscce.org/) of the problem. 6 | 7 | It is even better if you provide details regarding recreating the issue. 8 | **Warning:** you may want to remove some private information (authentication information is removed, but there may be private stuff in the messages) 9 | 10 | If for any reason you are not able to do that, open your issue anyway and a maintainer will see what is needed to solve your problem. 11 | 12 | ## Pull Requests 13 | 14 | Pull Requests should clearly describe two things: 15 | 16 | 1. The problem they attempt to solve 17 | 2. How the author went about solving the problem 18 | 19 | Ideally, changes should be made in logical commits and tests added to expand and improve Reina's Causal Infernce for Big Data capibilities. 20 | 21 | ## Coding style 22 | 23 | Reina adopts the black coding style. 24 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | with open("README.md", "r", encoding="utf-8") as fh: 4 | long_description = fh.read() 5 | 6 | setup( 7 | name="reina", 8 | version="0.0.5", 9 | author="Qyu.ai Inc.", 10 | author_email="soumil@qyu.ai", 11 | description="A Causal Inference library for Big Data.", 12 | long_description=long_description, 13 | long_description_content_type="text/markdown", 14 | url="https://github.com/Qyu-ai/Reina/", 15 | project_urls={ 16 | "Bug Tracker": "https://github.com/Qyu-ai/Reina/issues", 17 | }, 18 | classifiers=[ 19 | "Programming Language :: Python :: 3", 20 | "License :: OSI Approved :: MIT License", 21 | "Operating System :: OS Independent", 22 | ], 23 | packages=find_packages(), 24 | python_requires=">=3.6", 25 | install_requires=['py4j>=0.10.9', 'numpy>=1.7', 'pandas>=0.23.2', 'pyarrow>=1.0.0', 'pyspark'] 26 | ) 27 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Qyu.ai Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | ## About Example Notebooks 2 | 3 | The notebooks assume a test_data.csv generated by the following code snippet (Python): 4 | 5 | import pandas as pd 6 | df = pd.DataFrame(np.random.rand(1000, 7)) # Sample size is arbitrary. Could increase size if you'd like to try toy big-data. 7 | df.columns = ['var1', 'var2', 'var3', 'var4', 'var5', 'treatment', 'outcome'] 8 | df.treatment = np.random.randint(2, size=df.shape[0]) 9 | df.to_csv("test_data.csv") 10 | 11 | The purpose of these notebooks is just to demonstrate how to get started with our package. For simplicity, the data is small (1000 samples) and is randomly generated. Hence, the treatment effects produced in the scripts have no meaning. If you'd like to try out big-data processing, please increase the sample size to 50M+. 12 | 13 | Demo with actual datasets and meaningful effects will come soon. 14 | 15 | ## Running on AWS 16 | 17 | You could setup a Spark cluster easily through the AWS EMR (Elastic Map Reduce) and AWS S3 services. 18 | 19 | Once you setup a Spark cluster using EMR, ssh into the master node. Copy your scripts from S3 using 20 | 21 | aws s3 cp s3://your-bucket/your-file . 22 | 23 | Use *sudo* if you run into authorization issues. Once you have the scripts, change the line which reads in the data to point to the location of your data on S3. 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Reina 2 | 3 | ## About Reina 4 | ReInA (Reasoning In AI) is a causal inference platform aimed at estimating heterogeneous treatment effects in observational data. There are various open-source projects that provide convenient causal inference methods, but the current out-of-box packages are limited to local memory for computation. Hence, this project integrates Apache Spark with various machine learning (ML) powered causal inference frameworks, enabling causal analysis on big-data. 5 | 6 | ## Installation 7 | $ pip install reina 8 | 9 | ## Quick Start 10 | import reina 11 | from pyspark.sql import SparkSession 12 | 13 | # Initialize spark session 14 | spark = SparkSession \ 15 | .builder \ 16 | .appName('Meta-Learner-Spark') \ 17 | .getOrCreate() 18 | 19 | # Read data locally (without cluster) or from a distributed storage (e.g., Hadoop HDFS, AWS S3) 20 | data = spark.read \ 21 | .format("csv") \ 22 | .load("your_data.csv") \ 23 | 24 | # Set up necessary parameters (parameters will vary depending on the method used) 25 | treatment = ['name_of_treatment'] 26 | outcome = 'name_of_outcome' 27 | 28 | # Setup and fit model 29 | causal_model = reina.iv.TwoStageLeastSquares(data=data, treatment=treatment, outcome=outcome) 30 | causal_model.fit(data=data, treatments=treatment, outcome=outcome,...) 31 | 32 | # Get heterogeneous treatment effect 33 | cate, ate = causal_model.effect() 34 | print(cate) 35 | print(ate) 36 | 37 | Please refer to example notebooks and [full documentation](https://qyu-ai.github.io/Reina/) for more detailed toy demonstrations. 38 | 39 | ## Contribution Guidelines 40 | If you wish to contribute, please refer to our [contribution guidelines](./CONTRIBUTING.md). 41 | 42 | Any contributions are greatly welcomed and appreciated. 43 | 44 | ## References 45 | -------------------------------------------------------------------------------- /reina/utilities/baseModel.py: -------------------------------------------------------------------------------- 1 | """ 2 | Returns ML models from the MLLib library. 3 | """ 4 | import pyspark 5 | from pyspark.ml.regression import LinearRegression 6 | from pyspark.ml.regression import DecisionTreeRegressor 7 | from pyspark.ml.regression import RandomForestRegressor 8 | from pyspark.ml.regression import GBTRegressor 9 | from pyspark.ml.classification import LogisticRegression 10 | from pyspark.ml.classification import DecisionTreeClassifier 11 | from pyspark.ml.classification import RandomForestClassifier 12 | from pyspark.ml.classification import GBTClassifier 13 | from pyspark.ml.classification import MultilayerPerceptronClassifier 14 | from pyspark.ml.classification import LinearSVC 15 | 16 | def baseModel(model="LinearRegression", labelCol="label", model_options={}): 17 | 18 | if model == "LinearRegression": 19 | return LinearRegression(featuresCol="features", labelCol=labelCol, **model_options) 20 | elif model == "DecisionTreeRegressor": 21 | return DecisionTreeRegressor(featuresCol="features", labelCol=labelCol, **model_options) 22 | elif model == "RandomForestRegressor": 23 | return RandomForstRegressor(featuresCol="features", labelCol=labelCol, **model_options) 24 | elif model == "GradientBoostedTreeRegressor": 25 | return GBTRegressor(featuresCol="features", labelCol=labelCol, **model_options) 26 | elif model == "LogisticRegression": 27 | return LogisticRegression(featuresCol="features", labelCol=labelCol, **model_options) 28 | elif model == "DecisionTreeClassifier": 29 | return DecisionTreeClassifier(featuresCol="features", labelCol=labelCol, **model_options) 30 | elif model == "RandomForestClassifier": 31 | return RandomForestClassifier(featuresCol="features", labelCol=labelCol, **model_options) 32 | elif model == "GradientBoostedTreeClassifier": 33 | return GBTClassifier(featuresCol="features", labelCol=labelCol, **model_options) 34 | elif model == "MultilayerPerceptronClassifier": 35 | return MultilayerPerceptronClassifier(featuresCol="features", labelCol=labelCol, **model_options) 36 | elif model == "LinearSVM": 37 | return LinearSVC(featuresCol="features", labelCol=labelCol, **model_options) 38 | 39 | -------------------------------------------------------------------------------- /examples/notebooks/tsls/tsls_toy.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "id": "K9SvSdnga5Vl" 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "from reina.iv import TwoStageLeastSquares\n", 12 | "from pyspark.sql import SparkSession\n", 13 | "\n", 14 | "# Initialize spark session\n", 15 | "spark = SparkSession \\\n", 16 | " .builder \\\n", 17 | " .appName('Meta-Learner-Spark') \\\n", 18 | " .getOrCreate()" 19 | ] 20 | }, 21 | { 22 | "cell_type": "markdown", 23 | "metadata": { 24 | "id": "tmJ284pVbCll" 25 | }, 26 | "source": [ 27 | "#### Read toy data. Replace .load() with the test_data.csv location -- this location could be a local one (no cluster) or it could be on a distributed storage system (e.g., HDFS)\n", 28 | "\n", 29 | "*Note: Code below assumes data generated by our script (for specifics, please refer to our toy data generation in the README). You could also modify the code accordingly to use your own data.*" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": null, 35 | "metadata": { 36 | "id": "nS8iORFRa66J" 37 | }, 38 | "outputs": [], 39 | "source": [ 40 | "df = spark.read \\\n", 41 | " .format(\"csv\") \\\n", 42 | " .option('header', 'true') \\\n", 43 | " .load(\"test_data.csv\") # replace with the location of test_data.csv\n", 44 | "\n", 45 | "# Case variables to appropriate types\n", 46 | "df = df.withColumn(\"var1\", df.var1.cast(\"float\"))\n", 47 | "df = df.withColumn(\"var2\", df.var2.cast(\"float\"))\n", 48 | "df = df.withColumn(\"var3\", df.var3.cast(\"float\"))\n", 49 | "df = df.withColumn(\"var4\", df.var4.cast(\"float\"))\n", 50 | "df = df.withColumn(\"var5\", df.var5.cast(\"float\"))\n", 51 | "df = df.withColumn(\"treatment\", df.treatment.cast(\"float\"))\n", 52 | "df = df.withColumn(\"outcome\", df.outcome.cast(\"float\"))\n", 53 | "\n", 54 | "# Drop garbage column\n", 55 | "df = df.drop(\"_c0\")\n", 56 | "\n", 57 | "# Print out dataframe schema\n", 58 | "print(df.schema)" 59 | ] 60 | }, 61 | { 62 | "cell_type": "markdown", 63 | "metadata": { 64 | "id": "4FBJmTkvbbH-" 65 | }, 66 | "source": [ 67 | "#### Two-stage Least Squares" 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": null, 73 | "metadata": { 74 | "id": "mFP8fQkkbAgx" 75 | }, 76 | "outputs": [], 77 | "source": [ 78 | "# Set up necessary parameters\n", 79 | "treatments = ['treatment']\n", 80 | "outcome = 'outcome'\n", 81 | "iv = 'var1'\n", 82 | "\n", 83 | "# Fit TSLS\n", 84 | "spark_tsls = SieveTSLS()\n", 85 | "spark_tsls.fit(data=df, treatments=treatments, outcome=outcome, iv=iv)\n", 86 | "\n", 87 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 88 | "cate, ate = spark_tsls.effect()\n", 89 | "print(cate) \n", 90 | "print(ate)" 91 | ] 92 | } 93 | ], 94 | "metadata": { 95 | "colab": { 96 | "name": "Untitled2.ipynb", 97 | "provenance": [] 98 | }, 99 | "kernelspec": { 100 | "display_name": "Python 3", 101 | "language": "python", 102 | "name": "python3" 103 | }, 104 | "language_info": { 105 | "codemirror_mode": { 106 | "name": "ipython", 107 | "version": 3 108 | }, 109 | "file_extension": ".py", 110 | "mimetype": "text/x-python", 111 | "name": "python", 112 | "nbconvert_exporter": "python", 113 | "pygments_lexer": "ipython3", 114 | "version": "3.7.4" 115 | } 116 | }, 117 | "nbformat": 4, 118 | "nbformat_minor": 2 119 | } 120 | -------------------------------------------------------------------------------- /examples/notebooks/tsls/.ipynb_checkpoints/tsls_toy-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": null, 6 | "metadata": { 7 | "id": "K9SvSdnga5Vl" 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "from reina.iv import TwoStageLeastSquares\n", 12 | "from pyspark.sql import SparkSession\n", 13 | "\n", 14 | "# Initialize spark session\n", 15 | "spark = SparkSession \\\n", 16 | " .builder \\\n", 17 | " .appName('Meta-Learner-Spark') \\\n", 18 | " .getOrCreate()" 19 | ] 20 | }, 21 | { 22 | "cell_type": "markdown", 23 | "metadata": { 24 | "id": "tmJ284pVbCll" 25 | }, 26 | "source": [ 27 | "#### Read toy data. Replace .load() with the test_data.csv location -- this location could be a local one (no cluster) or it could be on a distributed storage system (e.g., HDFS)\n", 28 | "\n", 29 | "*Note: Code below assumes data generated by our script (for specifics, please refer to our toy data generation in the README). You could also modify the code accordingly to use your own data.*" 30 | ] 31 | }, 32 | { 33 | "cell_type": "code", 34 | "execution_count": null, 35 | "metadata": { 36 | "id": "nS8iORFRa66J" 37 | }, 38 | "outputs": [], 39 | "source": [ 40 | "df = spark.read \\\n", 41 | " .format(\"csv\") \\\n", 42 | " .option('header', 'true') \\\n", 43 | " .load(\"test_data.csv\") # replace with the location of test_data.csv\n", 44 | "\n", 45 | "# Case variables to appropriate types\n", 46 | "df = df.withColumn(\"var1\", df.var1.cast(\"float\"))\n", 47 | "df = df.withColumn(\"var2\", df.var2.cast(\"float\"))\n", 48 | "df = df.withColumn(\"var3\", df.var3.cast(\"float\"))\n", 49 | "df = df.withColumn(\"var4\", df.var4.cast(\"float\"))\n", 50 | "df = df.withColumn(\"var5\", df.var5.cast(\"float\"))\n", 51 | "df = df.withColumn(\"treatment\", df.treatment.cast(\"float\"))\n", 52 | "df = df.withColumn(\"outcome\", df.outcome.cast(\"float\"))\n", 53 | "\n", 54 | "# Drop garbage column\n", 55 | "df = df.drop(\"_c0\")\n", 56 | "\n", 57 | "# Print out dataframe schema\n", 58 | "print(df.schema)" 59 | ] 60 | }, 61 | { 62 | "cell_type": "markdown", 63 | "metadata": { 64 | "id": "4FBJmTkvbbH-" 65 | }, 66 | "source": [ 67 | "#### Two-stage Least Squares" 68 | ] 69 | }, 70 | { 71 | "cell_type": "code", 72 | "execution_count": null, 73 | "metadata": { 74 | "id": "mFP8fQkkbAgx" 75 | }, 76 | "outputs": [], 77 | "source": [ 78 | "# Set up necessary parameters\n", 79 | "treatments = ['treatment']\n", 80 | "outcome = 'outcome'\n", 81 | "iv = 'var1'\n", 82 | "\n", 83 | "# Fit TSLS\n", 84 | "spark_tsls = SieveTSLS()\n", 85 | "spark_tsls.fit(data=df, treatments=treatments, outcome=outcome, iv=iv)\n", 86 | "\n", 87 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 88 | "cate, ate = spark_tsls.effect()\n", 89 | "print(cate) \n", 90 | "print(ate)" 91 | ] 92 | } 93 | ], 94 | "metadata": { 95 | "colab": { 96 | "name": "Untitled2.ipynb", 97 | "provenance": [] 98 | }, 99 | "kernelspec": { 100 | "display_name": "Python 3", 101 | "language": "python", 102 | "name": "python3" 103 | }, 104 | "language_info": { 105 | "codemirror_mode": { 106 | "name": "ipython", 107 | "version": 3 108 | }, 109 | "file_extension": ".py", 110 | "mimetype": "text/x-python", 111 | "name": "python", 112 | "nbconvert_exporter": "python", 113 | "pygments_lexer": "ipython3", 114 | "version": "3.7.4" 115 | } 116 | }, 117 | "nbformat": 4, 118 | "nbformat_minor": 2 119 | } 120 | -------------------------------------------------------------------------------- /reina/MetaLearners/SLearner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # In[2]: 5 | 6 | 7 | """ 8 | Provides a spark-based S-learner heterogeneous treatment effect estimator. 9 | """ 10 | import pyspark 11 | from pyspark.sql.functions import monotonically_increasing_id 12 | from pyspark.ml.feature import VectorAssembler 13 | from pyspark.sql.functions import avg 14 | from pyspark.sql.functions import lit 15 | from pyspark.sql.functions import col 16 | from pyspark.sql.functions import when 17 | from pyspark.sql import SparkSession 18 | from pyspark.sql.functions import udf 19 | from pyspark.sql.types import FloatType 20 | 21 | class SLearner: 22 | """ 23 | Spark-based S-learner heterogeneous treatment effect estimator. 24 | 25 | This class currently only supports numeric outcomes. 26 | 27 | Assumptions 28 | --------------- 29 | This class assumes that the data is already stored in a distributed storage system (e.g., HDFS). 30 | This class also assumes that the treatment variable only contains 1s and 0s. 31 | """ 32 | 33 | def __init__(self): 34 | self.treatments = [] # Multiple treatment effects can be estimated 35 | self.covariates = [] 36 | self.outcome = "" 37 | self.estimator = None 38 | 39 | def fit(self, data, treatments, outcome, estimator): 40 | """ 41 | Wrapper function to fit an ML-based counterfacual model. 42 | When multiple treatments are inputted, each treatment effect is estiamted individually. 43 | 44 | Parameters 45 | ---------- 46 | data (2-D Spark dataframe): Base dataset containing features, treatment, iv, and outcome variables 47 | treatments (List): Names of the treatment variables 48 | outcome (Str): Name of the outcome variable 49 | estimator (sklearn model obj): Arbitrary ML estimator of choice 50 | 51 | Returns 52 | ------ 53 | self 54 | """ 55 | 56 | self.treatments = treatments 57 | self.outcome = outcome 58 | self.covariates = [var for var in data.columns if var not in treatments and var != outcome] 59 | self.estimator = estimator 60 | self.__fit(data) 61 | 62 | def effects(self, X, treatment): 63 | """ 64 | Function to get the estimated heterogeneous treatment effect from the fitted counterfactual model. 65 | 66 | The treatment effect is calculated by taking the difference between the predicted counterfactual outcomes. 67 | 68 | Parameters 69 | ---------- 70 | X (2-D Spark dataframe): Feature data to estimate treatment effect of 71 | treatment (Str): Name of the treatment variable 72 | 73 | returns 74 | ------- 75 | cate: conditional average treatment effect 76 | ate: average treatment effect 77 | """ 78 | 79 | # Input treatment has to be fitted 80 | assert treatment in self.treatments 81 | 82 | # Get predictions for treatment and control group 83 | counterfactual_treatment = X.withColumn(treatment, lit(1)) 84 | counterfactual_control = X.withColumn(treatment, lit(0)) 85 | assembler = VectorAssembler(inputCols=self.covariates+[treatment], outputCol='features') 86 | counterfactual_treatment_assembled = assembler.transform(counterfactual_treatment).select("features") 87 | counterfactual_control_assembled = assembler.transform(counterfactual_control).select("features") 88 | prediction_1 = self.estimator.transform(counterfactual_treatment_assembled).withColumnRenamed("prediction", "prediction_1").select("prediction_1") 89 | prediction_0 = self.estimator.transform(counterfactual_control_assembled).withColumnRenamed("prediction", "prediction_0").select("prediction_0") 90 | 91 | # Get cate 92 | X_w_pred = self.__mergeDfCol(X, prediction_1) 93 | X_w_pred = self.__mergeDfCol(X_w_pred, prediction_0) 94 | cate = X_w_pred.select(X_w_pred.prediction_1 - X_w_pred.prediction_0).withColumnRenamed("(prediction_1 - prediction_0)", "cate") 95 | ate = float(cate.groupby().avg().head()[0]) 96 | 97 | return cate, ate 98 | 99 | def __fit(self, data): 100 | for treatment in self.treatments: 101 | 102 | # Single estimator 103 | assembler = VectorAssembler(inputCols=self.covariates+[treatment], outputCol='features') 104 | data_assembled = assembler.transform(data) 105 | data_assembled = data_assembled.select(['features', self.outcome]) 106 | self.estimator = self.estimator.fit(data_assembled) 107 | 108 | def __mergeDfCol(self, df_1, df_2): 109 | """ 110 | Function to merge two spark dataframes. 111 | 112 | Parameters 113 | ---------- 114 | df_1 (2-D Spark dataframe): Spark dataframe to merge 115 | df_2 (2-D Spark dataframe): Spark dataframe to merge 116 | 117 | Returns 118 | ------ 119 | df_3 (2-D Spark dataframe): Spark dataframe merged by df1 and df2 120 | """ 121 | 122 | df_1 = df_1.withColumn("COL_MERGE_ID", monotonically_increasing_id()) 123 | df_2 = df_2.withColumn("COL_MERGE_ID", monotonically_increasing_id()) 124 | df_3 = df_2.join(df_1, "COL_MERGE_ID").drop("COL_MERGE_ID") 125 | return df_3 126 | -------------------------------------------------------------------------------- /reina/MetaLearners/TLearner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # In[ ]: 5 | 6 | 7 | """ 8 | Provides a spark-based T-learner heterogeneous treatment effect estimator. 9 | """ 10 | import pyspark 11 | from pyspark.sql.functions import monotonically_increasing_id 12 | from pyspark.ml.feature import VectorAssembler 13 | from pyspark.sql.functions import avg 14 | from pyspark.sql.functions import lit 15 | from pyspark.sql.functions import col 16 | from pyspark.sql.functions import when 17 | from pyspark.sql import SparkSession 18 | from pyspark.sql.functions import udf 19 | from pyspark.sql.types import FloatType 20 | 21 | class TLearner: 22 | """ 23 | Spark-based T-learner heterogeneous treatment effect estimator. 24 | Assumptions 25 | --------------- 26 | This class assumes that the data is already stored in a distributed storage system (e.g., HDFS). 27 | This class also assumes that the treatment variable only contains 1s and 0s. 28 | """ 29 | 30 | def __init__(self, learner="T"): 31 | self.treatments = [] # Multiple treatment effects can be estimated 32 | self.outcome = None 33 | self.covariates = [] 34 | self.estimator_0 = None 35 | self.estimator_1 = None 36 | 37 | def fit(self, data, treatments, outcome, estimator_0, estimator_1): 38 | """ 39 | Wrapper function to fit an ML-based counterfacual model. 40 | When multiple treatments are inputted, each treatment effect is estiamted individually. 41 | 42 | Parameters 43 | ---------- 44 | data (2-D Spark dataframe): Base dataset containing features, treatment, iv, and outcome variables 45 | treatments (List): Names of the treatment variables 46 | outcome (Str): Name of the outcome variable 47 | estimator_0 (mllib model obj): Arbitrary ML model of choice 48 | estimator_1 (mllib model obj): Arbitrary ML model of choice 49 | 50 | Returns 51 | ------ 52 | self 53 | """ 54 | 55 | self.treatments = treatments 56 | self.outcome = outcome 57 | self.covariates = [var for var in data.columns if var not in treatments and var != outcome] 58 | self.estimator_0 = estimator_0 59 | self.estimator_1 = estimator_1 60 | self.__fit(data, estimator_0, estimator_1) 61 | 62 | def effects(self, X, treatment): 63 | """ 64 | Function to get the estimated heterogeneous treatment effect from the fitted counterfactual model. 65 | 66 | The treatment effect is calculated by taking the difference between the predicted counterfactual outcomes. 67 | 68 | Parameters 69 | ---------- 70 | X (2-D Spark dataframe): Feature data to estimate treatment effect of 71 | treatment (Str): Name of the treatment variable 72 | 73 | returns 74 | ------- 75 | cate: conditional average treatment effect 76 | ate: average treatment effect 77 | """ 78 | 79 | # Input treatment has to be fitted 80 | assert treatment in self.treatments 81 | 82 | # Ger predictions for treatment and control group 83 | assembler = VectorAssembler(inputCols=self.covariates+[treatment], outputCol='features') 84 | X_assembled = assembler.transform(X) 85 | prediction_1 = self. estimator_1.transform(X_assembled.select('features')).withColumnRenamed("prediction", "prediction_1").select("prediction_1") 86 | prediction_0 = self.estimator_0.transform(X_assembled.select('features')).withColumnRenamed("prediction", "prediction_0").select("prediction_0") 87 | 88 | # Get Cate 89 | X_w_pred = self.__mergeDfCol(X, prediction_1) 90 | X_w_pred = self.__mergeDfCol(X_w_pred, prediction_0) 91 | cate = X_w_pred.select(X_w_pred.prediction_1 - X_w_pred.prediction_0).withColumnRenamed("(prediction_1 - prediction_0)", "cate") 92 | ate = float(cate.groupby().avg().head()[0]) 93 | return cate, ate 94 | 95 | def __fit(self, data, estimator_0, estimator_1): 96 | for treatment in self.treatments: 97 | 98 | # Set up assembler 99 | assembler = VectorAssembler(inputCols=self.covariates+[treatment], outputCol='features') 100 | 101 | # First estimator (treatment group) 102 | treatment_group = data.filter(treatment+" == 1") 103 | treatment_group_assembled = assembler.transform(treatment_group) 104 | treatment_group_assembled = treatment_group_assembled.select(['features', self.outcome]) 105 | self.estimator_1 = self.estimator_1.fit(treatment_group_assembled) 106 | 107 | # Second estimator (control group) 108 | control_group = data.filter(treatment+" == 0") 109 | control_group_assembled = assembler.transform(control_group) 110 | control_group_assembled = control_group_assembled.select(['features', self.outcome]) 111 | self.estimator_0 = self.estimator_0.fit(control_group_assembled) 112 | 113 | def __mergeDfCol(self, df_1, df_2): 114 | """ 115 | Function to merge two spark dataframes. 116 | 117 | Parameters 118 | ---------- 119 | df_1 (2-D Spark dataframe): Spark dataframe to merge 120 | df_2 (2-D Spark dataframe): Spark dataframe to merge 121 | 122 | Returns 123 | ------ 124 | df_3 (2-D Spark dataframe): Spark dataframe merged by df1 and df2 125 | """ 126 | 127 | df_1 = df_1.withColumn("COL_MERGE_ID", monotonically_increasing_id()) 128 | df_2 = df_2.withColumn("COL_MERGE_ID", monotonically_increasing_id()) 129 | df_3 = df_2.join(df_1, "COL_MERGE_ID").drop("COL_MERGE_ID") 130 | return df_3 131 | 132 | -------------------------------------------------------------------------------- /doc/my-project/docs/methods.md: -------------------------------------------------------------------------------- 1 | # Methods 2 | 3 | ## Metalearners 4 | 5 | ### S-Learner 6 | class reina.metalearners.SLearner 7 | 8 | #### Methods 9 | 10 | | Function Name | Description | 11 | | ----------- | ----------- | 12 | | [__init__](dummy.com) | Initialize object. | 13 | | [effects](dummy.com) | Calculates and returns the treatment effects from this class. | 14 | | [fit](dummy.com) | Train the causal model. | 15 | 16 | `effects(self, X, treatment)` 17 | 18 | Calculates and returns the treatment effects from this class. 19 | 20 | **Parameters** 21 | 22 | > 23 | - X (*2D Spark Dataframe*): Feature data to estimate treatment effect of 24 | - treatment (*Str*): Name of the treatment variable 25 | 26 | **Returns** 27 | 28 | > 29 | - cate (*2D Spark DataFrame*): conditional average treatment effect 30 | - ate (*float*): average treatment effect 31 | 32 | 33 | `fit(self, data, treatments, outcome, estimator)` 34 | 35 | Trains the ML-based causal model for this class. 36 | 37 | **Parameters** 38 | 39 | > 40 | - data (*2-D Spark dataframe*): Base dataset containing features, treatment, iv, and outcome variables 41 | - treatments (*List*): Names of the treatment variables 42 | - outcome (*Str*): Name of the outcome variable 43 | - estimator (*sklearn model obj*): Arbitrary ML estimator of choice 44 | 45 | **Returns** 46 | 47 | > 48 | - None (*self*) 49 | 50 | **Example** 51 | 52 | Example S-learner usage can be found [here](https://github.com/Qyu-ai/Reina/blob/main/examples/notebooks/metalearner/metalearner_toy.ipynb). 53 | 54 | 55 | ### T-Learner 56 | class reina.metalearners.TLearner 57 | 58 | **Methods** 59 | 60 | | Function Name | Description | 61 | | ----------- | ----------- | 62 | | [__init__](dummy.com) | Initialize object. | 63 | | [effects](dummy.com) | Calculates and returns the treatment effects from this class. | 64 | | [fit](dummy.com) | Trains the causal model | 65 | 66 | `effects(self, X, treatment)` 67 | 68 | Calculates and returns the treatment effects from this class. 69 | 70 | **Parameters** 71 | 72 | > 73 | - X (*2D Spark Dataframe*): Feature data to estimate treatment effect of 74 | - treatment (*Str*): Name of the treatment variable 75 | 76 | **Returns** 77 | 78 | > 79 | - cate (*2D Spark DataFrame*): conditional average treatment effect 80 | - ate (*float*): average treatment effect 81 | 82 | 83 | `fit(self, data, treatments, outcome, estimator_0, estimator_1)` 84 | 85 | Trains the ML-based causal model for this class. 86 | 87 | **Parameters** 88 | 89 | > 90 | - data (*2-D Spark dataframe*): Base dataset containing features, treatment, iv, and outcome variables 91 | - treatments (*List*): Names of the treatment variables 92 | - outcome (*Str*): Name of the outcome variable 93 | - estimator_0 (*mllib model obj*): Arbitrary ML model of choice 94 | - estimator_1 (*mllib model obj*): Arbitrary ML model of choice 95 | 96 | **Returns** 97 | 98 | > 99 | - None (*self*) 100 | 101 | **Example** 102 | 103 | Example T-learner usage can be found [here](https://github.com/Qyu-ai/Reina/blob/main/examples/notebooks/metalearner/metalearner_toy.ipynb). 104 | 105 | ### X-Learner 106 | class reina.metalearners.XLearner 107 | 108 | **Methods** 109 | 110 | | Function Name | Description | 111 | | ----------- | ----------- | 112 | | [__init__](dummy.com) | Initialize object. | 113 | | [effects](dummy.com) | Calculates and returns the treatment effects from this class. | 114 | | [fit](dummy.com) | Trains the causal model. | 115 | 116 | `effects(self, X, treatment)` 117 | 118 | Calculates and returns the treatment effects from this class. 119 | 120 | **Parameters** 121 | 122 | > 123 | - X (*2D Spark Dataframe*): Feature data to estimate treatment effect of 124 | - treatment (*Str*): Name of the treatment variable 125 | 126 | **Returns** 127 | 128 | > 129 | - cate (*2D Spark DataFrame*): conditional average treatment effect 130 | - ate (*float*): average treatment effect 131 | 132 | 133 | `fit(self, data, treatments, outcome, estimator_0, estimator_1)` 134 | 135 | Trains the ML-based causal model for this class. 136 | 137 | **Parameters** 138 | 139 | > 140 | - data (*2-D Spark dataframe*): Base dataset containing features, treatment, iv, and outcome variables 141 | - treatments (*List*): Names of the treatment variables 142 | - outcome (*Str*): Name of the outcome variable 143 | - estimator_10 (*mllib model obj*): Arbitrary ML model of choice 144 | - estimator_11 (*mllib model obj*): Arbitrary ML model of choice 145 | - estimator_20 (*mllib model obj*): Arbitrary ML model of choice 146 | - estimator_21 (*mllib model obj*): Arbitrary ML model of choice 147 | - propensity_estimator (*mllib model obj*): Arbitrary ML model for propensity function 148 | 149 | **Returns** 150 | 151 | > 152 | - None (*self*) 153 | 154 | **Example** 155 | 156 | Example X-learner usage can be found [here](https://github.com/Qyu-ai/Reina/blob/main/examples/notebooks/metalearner/metalearner_toy.ipynb). 157 | 158 | ## IV-based Methods 159 | 160 | ### Two-Stage Least Squares 161 | class reina.iv.TwoStageLeastSquares 162 | 163 | **Methods** 164 | 165 | | Function Name | Description | 166 | | ----------- | ----------- | 167 | | [__init__](dummy.com) | Initialize object. | 168 | | [effects](dummy.com) | Calculates and returns the treatment effects from this class. | 169 | | [fit](dummy.com) | Trains the causal model. | 170 | 171 | `effects(self, X, treatment)` 172 | 173 | Calculates and returns the treatment effects from this class. 174 | 175 | **Parameters** 176 | 177 | > 178 | - X (*2D Spark Dataframe*): Feature data to estimate treatment effect of 179 | - treatment (*Str*): Name of the treatment variable 180 | 181 | **Returns** 182 | 183 | > 184 | - cate (*2D Spark DataFrame*): conditional average treatment effect 185 | - ate (*float*): average treatment effect 186 | 187 | 188 | `fit(self, data, data, treatments, outcome, iv)` 189 | 190 | Trains the ML-based causal model for this class. 191 | 192 | **Parameters** 193 | 194 | > 195 | - data (*2-D Spark dataframe*): Base dataset containing features, treatment, iv, and outcome variables 196 | - treatments (*List*): Names of the treatment variables 197 | - outcome (*Str*): Name of the outcome variable 198 | - iv (*Str*): Name of the instrument variable 199 | 200 | **Returns** 201 | 202 | > 203 | - None (*self*) 204 | 205 | **Example** 206 | 207 | Example TwoStageLeastSquares usage can be found [here](https://github.com/Qyu-ai/Reina/blob/main/examples/notebooks/tsls/tsls_toy.ipynb). 208 | 209 | -------------------------------------------------------------------------------- /reina/iv/tsls.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # In[1]: 5 | 6 | 7 | """ 8 | Provides a spark-based two-stage least squares treatment effect estimator. 9 | """ 10 | import pyspark 11 | from pyspark.sql.functions import monotonically_increasing_id 12 | from pyspark.ml.feature import VectorAssembler 13 | from pyspark.sql.functions import avg 14 | from pyspark.sql.functions import lit 15 | from pyspark.sql.functions import when 16 | from pyspark.sql import SparkSession 17 | from pyspark.ml.regression import LinearRegression 18 | 19 | class TwoStageLeastSquares: 20 | """ 21 | Spark-based two-stage least squared heterogeneous treatment effect estimator. 22 | 23 | Assumptions 24 | --------------- 25 | This class assumes that the data is already stored in a distributed storage system (e.g., HDFS). 26 | This class also assumes that the treatment variable only contains 1s and 0s. 27 | """ 28 | 29 | def __init__(self): 30 | self.treatments = [] # Multiple treatment effects can be estimated 31 | self.covariates = [] 32 | self.outcome = "" 33 | self.iv = "" 34 | self.ols_1 = LinearRegression(featuresCol = 'features', labelCol=treatment) 35 | self.ols_2 = LinearRegression(featuresCol = 'features', labelCol=self.outcome) 36 | 37 | def fit(self, data, treatments, outcome, iv): 38 | """ 39 | Wrapper function to fit first and second stage linear model to get adjusted treatment and a counterfacual model. 40 | When multiple treatments are inputted, each treatment effect is estiamted individually. 41 | 42 | Parameters 43 | ---------- 44 | data (2-D Spark dataframe): Base dataset containing features, treatment, iv, and outcome variables 45 | treatments (List): Names of the treatment variables 46 | outcome (Str): Name of the outcome variable 47 | iv (Str): Name of the instrument variable 48 | 49 | Returns 50 | ------ 51 | self 52 | """ 53 | 54 | self.treatments = treatments 55 | self.outcome = outcome 56 | self.iv = iv 57 | self.covariates = [var for var in data.columns if var not in treatments and var != iv and var != outcome] 58 | self.__fit(data) 59 | 60 | def effects(self, X, treatment): 61 | """ 62 | Function to get the estimated heterogeneous treatment effect from the fitted counterfactual model. 63 | 64 | The treatment effect is calculated by taking the difference between the predicted counterfactual outcomes. 65 | 66 | Parameters 67 | ---------- 68 | X (2-D Spark dataframe): Feature data to estimate treatment effect of 69 | treatment (Str): Name of the treatment variable 70 | 71 | returns 72 | ------- 73 | cate: conditional average treatment effect 74 | ate: average treatment effect 75 | """ 76 | 77 | # Input treatment has to be fitted 78 | assert treatment in self.treatments 79 | 80 | # Predict adjusted treatment 81 | temp_1 = self.__mergeDfCol(X.select(treatment), X.select(self.iv)) 82 | assembler = VectorAssembler(inputCols=[self.iv], outputCol='features') 83 | temp_1_assembled = assembler.transform(temp_1) 84 | temp_1_assembled = temp_1_assembled.select(['features', treatment]) 85 | adjustedTreatment = self.ols_1 .transform(temp_1_assembled.select('features')).select("prediction") 86 | 87 | # Get predicted counterfactual for Y1 and Y0 88 | X_adjusted = self.__mergeDfCol(X, adjustedTreatment) 89 | counterfactual_treatment = X_adjusted.withColumn("prediction", lit(1)) 90 | counterfactual_control = X_adjusted.withColumn("prediction", lit(0)) 91 | counterfactual_treatment_assembled = assembler.transform(counterfactual_treatment).select("features") 92 | counterfactual_control_assembled = assembler.transform(counterfactual_control).select("features") 93 | prediction_1 = self.ols_2.transform(counterfactual_treatment_assembled).withColumnRenamed("prediction", "prediction_1").select("prediction_1") 94 | prediction_0 = self.ols_2.transform(counterfactual_control_assembled).withColumnRenamed("prediction", "prediction_0").select("prediction_0") 95 | 96 | # Get cate and ate 97 | data_w_pred = self.__mergeDfCol(data, prediction_1) 98 | data_w_pred = self.__mergeDfCol(data_w_pred, prediction_0) 99 | cate = data_w_pred.select(data_w_pred.prediction_1 - data_w_pred.prediction_0).withColumnRenamed("(prediction_1 - prediction_0)", "cate") 100 | ate = float(cate.groupby().avg().head()[0]) # simply the average of cate 101 | return cate, ate 102 | 103 | def __fit(self, data): 104 | for treatment in self.treatments: 105 | 106 | # Fit first stage OLS 107 | trainSet_1 = self.__mergeDfCol(data.select(treatment), data.select(self.iv)) 108 | assembler = VectorAssembler(inputCols=[self.iv], outputCol='features') 109 | trainSet_1_assembled = assembler.transform(trainSet_1) 110 | trainSet_1_assembled = trainSet_1_assembled.select(['features', treatment]) 111 | self.ols_1 = self.ols_1.fit(trainSet_1_assembled) 112 | adjustedTreatment = self.ols_1 .transform(trainSet_1_assembled.select('features')).select("prediction") 113 | 114 | # Fit second stage OLS 115 | trainSet_2 = self.__mergeDfCol(data, adjustedTreatment) 116 | assembler = VectorAssembler(inputCols=self.covariates+["prediction"], outputCol='features') 117 | trainSet_2_assembled = assembler.transform(trainSet_2) 118 | trainSet_2_assembled = trainSet_2_assembled.select(['features', self.outcome]) 119 | self.ols_2 = self.ols_2.fit(trainSet_2_assembled) 120 | 121 | 122 | def __mergeDfCol(self, df_1, df_2): 123 | """ 124 | Function to merge two spark dataframes. 125 | 126 | Parameters 127 | ---------- 128 | df_1 (2-D Spark dataframe): Spark dataframe to merge 129 | df_2 (2-D Spark dataframe): Spark dataframe to merge 130 | 131 | Returns 132 | ------ 133 | df_3 (2-D Spark dataframe): Spark dataframe merged by df1 and df2 134 | """ 135 | 136 | df_1 = df_1.withColumn("COL_MERGE_ID", monotonically_increasing_id()) 137 | df_2 = df_2.withColumn("COL_MERGE_ID", monotonically_increasing_id()) 138 | df_3 = df_2.join(df1, "COL_MERGE_ID").drop("COL_MERGE_ID") 139 | return df_3 140 | 141 | -------------------------------------------------------------------------------- /examples/notebooks/metalearner/.ipynb_checkpoints/metalearner_toy-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "aIvb0JodYx9d" 7 | }, 8 | "source": [ 9 | "#### Import reina and other necessary libraries. Initialize a spark session." 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 17, 15 | "metadata": { 16 | "id": "9mGaEKdeU89A" 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "from reina.metalearners import SLearner\n", 21 | "from reina.metalearners import TLearner\n", 22 | "from reina.metalearners import XLearner\n", 23 | "from pyspark.ml.regression import RandomForestRegressor\n", 24 | "from pyspark.ml.classification import RandomForestClassifier\n", 25 | "from pyspark.sql import SparkSession\n", 26 | "\n", 27 | "# Initialize spark session\n", 28 | "spark = SparkSession \\\n", 29 | " .builder \\\n", 30 | " .appName('Meta-Learner-Spark') \\\n", 31 | " .getOrCreate()" 32 | ] 33 | }, 34 | { 35 | "cell_type": "markdown", 36 | "metadata": { 37 | "id": "xNHXEHMOY9PY" 38 | }, 39 | "source": [ 40 | "#### Read toy data. Replace .load() with the test_data.csv location -- this location could be a local one (no cluster) or it could be on a distributed storage system (e.g., HDFS)\n", 41 | "\n", 42 | "*Note: Code below assumes data generated by our script (for specifics, please refer to our toy data generation in the README). You could also modify the code accordingly to use your own data.*" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": { 49 | "id": "DZyUrMTBVJAf" 50 | }, 51 | "outputs": [], 52 | "source": [ 53 | "df = spark.read \\\n", 54 | " .format(\"csv\") \\\n", 55 | " .option('header', 'true') \\\n", 56 | " .load(\"test_data.csv\") # replace with the location of test_data.csv\n", 57 | "\n", 58 | "# Case variables to appropriate types\n", 59 | "df = df.withColumn(\"var1\", df.var1.cast(\"float\"))\n", 60 | "df = df.withColumn(\"var2\", df.var2.cast(\"float\"))\n", 61 | "df = df.withColumn(\"var3\", df.var3.cast(\"float\"))\n", 62 | "df = df.withColumn(\"var4\", df.var4.cast(\"float\"))\n", 63 | "df = df.withColumn(\"var5\", df.var5.cast(\"float\"))\n", 64 | "df = df.withColumn(\"treatment\", df.treatment.cast(\"float\"))\n", 65 | "df = df.withColumn(\"outcome\", df.outcome.cast(\"float\"))\n", 66 | "\n", 67 | "# Drop garbage column\n", 68 | "df = df.drop(\"_c0\")\n", 69 | "\n", 70 | "# Print out dataframe schema\n", 71 | "print(df.schema)" 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": { 77 | "id": "1Xa3QohmXg2Y" 78 | }, 79 | "source": [ 80 | "## S-leaner" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": null, 86 | "metadata": { 87 | "id": "BkMiSReQW2DE" 88 | }, 89 | "outputs": [], 90 | "source": [ 91 | "# Set up necessary parameters\n", 92 | "treatments = ['treatment']\n", 93 | "outcome = 'outcome'\n", 94 | "\n", 95 | "# Arbitrary estimator. Can replace with other ML algo.\n", 96 | "estimator = RandomForestRegressor()\n", 97 | "\n", 98 | "# Fit S-learner\n", 99 | "spark_slearner = SLearner()\n", 100 | "spark_slearner.fit(data=df, treatments=treatments, outcome=outcome, estimator=estimator)\n", 101 | "\n", 102 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 103 | "cate, ate = spark_slearner.effects()\n", 104 | "print(cate)\n", 105 | "print(ate)" 106 | ] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": { 111 | "id": "Q1fcO5LOXjH_" 112 | }, 113 | "source": [ 114 | "## T-leaner" 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": null, 120 | "metadata": { 121 | "id": "kn1QYEJPXWvM" 122 | }, 123 | "outputs": [], 124 | "source": [ 125 | "# Set up necessary parameters\n", 126 | "treatments = ['treatment']\n", 127 | "outcome = 'outcome'\n", 128 | "\n", 129 | "# Arbitrary estimators. Can replace with other ML algo.\n", 130 | "estimator_1 = RandomForestRegressor()\n", 131 | "estimator_0 = RandomForestRegressor()\n", 132 | "\n", 133 | "# Fit T-learner\n", 134 | "spark_tlearner = TLearner()\n", 135 | "spark_tlearner.fit(data=df, treatments=treatments, outcome=outcome,\n", 136 | " estimator_0=estimator_0, estimator_1=estimator_1)\n", 137 | "\n", 138 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 139 | "cate, ate = spark_tlearner.effects()\n", 140 | "print(cate)\n", 141 | "print(ate)" 142 | ] 143 | }, 144 | { 145 | "cell_type": "markdown", 146 | "metadata": { 147 | "id": "bxZQdw1fXoPa" 148 | }, 149 | "source": [ 150 | "## X-leaner" 151 | ] 152 | }, 153 | { 154 | "cell_type": "code", 155 | "execution_count": null, 156 | "metadata": { 157 | "id": "Qj1owlx-XYKo" 158 | }, 159 | "outputs": [], 160 | "source": [ 161 | "# Set up necessary parameters\n", 162 | "treatments = ['treatment']\n", 163 | "outcome = 'outcome'\n", 164 | "\n", 165 | "# Arbitrary estimators. Can replace with other ML algo.\n", 166 | "estimator_11 = RandomForestRegressor()\n", 167 | "estimator_10 = RandomForestRegressor()\n", 168 | "estimator_21 = RandomForestRegressor()\n", 169 | "estimator_20 = RandomForestRegressor()\n", 170 | "propensity_estimator = RandomForestClassifier()\n", 171 | "\n", 172 | "# Fit X-learner\n", 173 | "spark_xlearner = XLearner()\n", 174 | "spark_xlearner.fit(data=df, treatments=treatments, outcome=outcome, \n", 175 | " estimator_10=estimator_10, estimator_11=estimator_11, \n", 176 | " estimator_20=estimator_20, estimator_21=estimator_21,\n", 177 | " propensity_estimator=propensity_estimator)\n", 178 | "\n", 179 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 180 | "cate, ate = spark_xlearner.effects()\n", 181 | "print(cate)\n", 182 | "print(ate)" 183 | ] 184 | } 185 | ], 186 | "metadata": { 187 | "colab": { 188 | "name": "Untitled1.ipynb", 189 | "provenance": [] 190 | }, 191 | "kernelspec": { 192 | "display_name": "Python 3", 193 | "language": "python", 194 | "name": "python3" 195 | }, 196 | "language_info": { 197 | "codemirror_mode": { 198 | "name": "ipython", 199 | "version": 3 200 | }, 201 | "file_extension": ".py", 202 | "mimetype": "text/x-python", 203 | "name": "python", 204 | "nbconvert_exporter": "python", 205 | "pygments_lexer": "ipython3", 206 | "version": "3.7.4" 207 | } 208 | }, 209 | "nbformat": 4, 210 | "nbformat_minor": 2 211 | } 212 | -------------------------------------------------------------------------------- /examples/notebooks/metalearner/.ipynb_checkpoints/metalearner_churn-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "aIvb0JodYx9d" 7 | }, 8 | "source": [ 9 | "#### Import reina and other necessary libraries. Initialize a spark session." 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 17, 15 | "metadata": { 16 | "id": "9mGaEKdeU89A" 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "from reina.metalearners import SLearner\n", 21 | "from reina.metalearners import TLearner\n", 22 | "from reina.metalearners import XLearner\n", 23 | "from pyspark.ml.regression import RandomForestRegressor\n", 24 | "from pyspark.ml.classification import RandomForestClassifier\n", 25 | "from pyspark.sql import SparkSession\n", 26 | "\n", 27 | "# Initialize spark session\n", 28 | "spark = SparkSession \\\n", 29 | " .builder \\\n", 30 | " .appName('Meta-Learner-Spark') \\\n", 31 | " .getOrCreate()" 32 | ] 33 | }, 34 | { 35 | "cell_type": "markdown", 36 | "metadata": { 37 | "id": "xNHXEHMOY9PY" 38 | }, 39 | "source": [ 40 | "#### Read toy data. Replace .load() with the test_data.csv location -- this location could be a local one (no cluster) or it could be on a distributed storage system (e.g., HDFS)\n", 41 | "\n", 42 | "*Note: Code below assumes data generated by our script (for specifics, please refer to our toy data generation in the README). You could also modify the code accordingly to use your own data.*" 43 | ] 44 | }, 45 | { 46 | "cell_type": "code", 47 | "execution_count": null, 48 | "metadata": { 49 | "id": "DZyUrMTBVJAf" 50 | }, 51 | "outputs": [], 52 | "source": [ 53 | "df = spark.read \\\n", 54 | " .format(\"csv\") \\\n", 55 | " .option('header', 'true') \\\n", 56 | " .load(\"test_data.csv\") # replace with the location of test_data.csv\n", 57 | "\n", 58 | "# Case variables to appropriate types\n", 59 | "df = df.withColumn(\"var1\", df.var1.cast(\"float\"))\n", 60 | "df = df.withColumn(\"var2\", df.var2.cast(\"float\"))\n", 61 | "df = df.withColumn(\"var3\", df.var3.cast(\"float\"))\n", 62 | "df = df.withColumn(\"var4\", df.var4.cast(\"float\"))\n", 63 | "df = df.withColumn(\"var5\", df.var5.cast(\"float\"))\n", 64 | "df = df.withColumn(\"treatment\", df.treatment.cast(\"float\"))\n", 65 | "df = df.withColumn(\"outcome\", df.outcome.cast(\"float\"))\n", 66 | "\n", 67 | "# Drop garbage column\n", 68 | "df = df.drop(\"_c0\")\n", 69 | "\n", 70 | "# Print out dataframe schema\n", 71 | "print(df.schema)" 72 | ] 73 | }, 74 | { 75 | "cell_type": "markdown", 76 | "metadata": { 77 | "id": "1Xa3QohmXg2Y" 78 | }, 79 | "source": [ 80 | "## S-leaner" 81 | ] 82 | }, 83 | { 84 | "cell_type": "code", 85 | "execution_count": null, 86 | "metadata": { 87 | "id": "BkMiSReQW2DE" 88 | }, 89 | "outputs": [], 90 | "source": [ 91 | "# Set up necessary parameters\n", 92 | "treatments = ['treatment']\n", 93 | "outcome = 'outcome'\n", 94 | "\n", 95 | "# Arbitrary estimator. Can replace with other ML algo.\n", 96 | "estimator = RandomForestRegressor()\n", 97 | "\n", 98 | "# Fit S-learner\n", 99 | "spark_slearner = SLearner()\n", 100 | "spark_slearner.fit(data=df, treatments=treatments, outcome=outcome, estimator=estimator)\n", 101 | "\n", 102 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 103 | "cate, ate = spark_slearner.effects()\n", 104 | "print(cate)\n", 105 | "print(ate)" 106 | ] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": { 111 | "id": "Q1fcO5LOXjH_" 112 | }, 113 | "source": [ 114 | "## T-leaner" 115 | ] 116 | }, 117 | { 118 | "cell_type": "code", 119 | "execution_count": null, 120 | "metadata": { 121 | "id": "kn1QYEJPXWvM" 122 | }, 123 | "outputs": [], 124 | "source": [ 125 | "# Set up necessary parameters\n", 126 | "treatments = ['treatment']\n", 127 | "outcome = 'outcome'\n", 128 | "\n", 129 | "# Arbitrary estimators. Can replace with other ML algo.\n", 130 | "estimator_1 = RandomForestRegressor()\n", 131 | "estimator_0 = RandomForestRegressor()\n", 132 | "\n", 133 | "# Fit T-learner\n", 134 | "spark_tlearner = TLearner()\n", 135 | "spark_tlearner.fit(data=df, treatments=treatments, outcome=outcome,\n", 136 | " estimator_0=estimator_0, estimator_1=estimator_1)\n", 137 | "\n", 138 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 139 | "cate, ate = spark_tlearner.effects()\n", 140 | "print(cate)\n", 141 | "print(ate)" 142 | ] 143 | }, 144 | { 145 | "cell_type": "markdown", 146 | "metadata": { 147 | "id": "bxZQdw1fXoPa" 148 | }, 149 | "source": [ 150 | "## X-leaner" 151 | ] 152 | }, 153 | { 154 | "cell_type": "code", 155 | "execution_count": null, 156 | "metadata": { 157 | "id": "Qj1owlx-XYKo" 158 | }, 159 | "outputs": [], 160 | "source": [ 161 | "# Set up necessary parameters\n", 162 | "treatments = ['treatment']\n", 163 | "outcome = 'outcome'\n", 164 | "\n", 165 | "# Arbitrary estimators. Can replace with other ML algo.\n", 166 | "estimator_11 = RandomForestRegressor()\n", 167 | "estimator_10 = RandomForestRegressor()\n", 168 | "estimator_21 = RandomForestRegressor()\n", 169 | "estimator_20 = RandomForestRegressor()\n", 170 | "propensity_estimator = RandomForestClassifier()\n", 171 | "\n", 172 | "# Fit X-learner\n", 173 | "spark_xlearner = XLearner()\n", 174 | "spark_xlearner.fit(data=df, treatments=treatments, outcome=outcome, \n", 175 | " estimator_10=estimator_10, estimator_11=estimator_11, \n", 176 | " estimator_20=estimator_20, estimator_21=estimator_21,\n", 177 | " propensity_estimator=propensity_estimator)\n", 178 | "\n", 179 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 180 | "cate, ate = spark_xlearner.effects()\n", 181 | "print(cate)\n", 182 | "print(ate)" 183 | ] 184 | } 185 | ], 186 | "metadata": { 187 | "colab": { 188 | "name": "Untitled1.ipynb", 189 | "provenance": [] 190 | }, 191 | "kernelspec": { 192 | "display_name": "Python 3", 193 | "language": "python", 194 | "name": "python3" 195 | }, 196 | "language_info": { 197 | "codemirror_mode": { 198 | "name": "ipython", 199 | "version": 3 200 | }, 201 | "file_extension": ".py", 202 | "mimetype": "text/x-python", 203 | "name": "python", 204 | "nbconvert_exporter": "python", 205 | "pygments_lexer": "ipython3", 206 | "version": "3.7.4" 207 | } 208 | }, 209 | "nbformat": 4, 210 | "nbformat_minor": 2 211 | } 212 | -------------------------------------------------------------------------------- /examples/notebooks/metalearner/metalearner_toy.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "aIvb0JodYx9d" 7 | }, 8 | "source": [ 9 | "#### Import reina and other necessary libraries. Initialize a spark session." 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 2, 15 | "metadata": {}, 16 | "outputs": [ 17 | { 18 | "name": "stdout", 19 | "output_type": "stream", 20 | "text": [ 21 | "^C\n" 22 | ] 23 | } 24 | ], 25 | "source": [ 26 | "!pip install reina" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 1, 32 | "metadata": { 33 | "id": "9mGaEKdeU89A" 34 | }, 35 | "outputs": [ 36 | { 37 | "ename": "ModuleNotFoundError", 38 | "evalue": "No module named 'reina'", 39 | "output_type": "error", 40 | "traceback": [ 41 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 42 | "\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", 43 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[1;32mfrom\u001b[0m \u001b[0mreina\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmetalearners\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mSLearner\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 2\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mreina\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmetalearners\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mTLearner\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 3\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mreina\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmetalearners\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mXLearner\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mpyspark\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mregression\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mRandomForestRegressor\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mfrom\u001b[0m \u001b[0mpyspark\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mml\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclassification\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mRandomForestClassifier\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 44 | "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'reina'" 45 | ] 46 | } 47 | ], 48 | "source": [ 49 | "from reina.metalearners import SLearner\n", 50 | "from reina.metalearners import TLearner\n", 51 | "from reina.metalearners import XLearner\n", 52 | "from pyspark.ml.regression import RandomForestRegressor\n", 53 | "from pyspark.ml.classification import RandomForestClassifier\n", 54 | "from pyspark.sql import SparkSession\n", 55 | "\n", 56 | "# Initialize spark session\n", 57 | "spark = SparkSession \\\n", 58 | " .builder \\\n", 59 | " .appName('Meta-Learner-Spark') \\\n", 60 | " .getOrCreate()" 61 | ] 62 | }, 63 | { 64 | "cell_type": "markdown", 65 | "metadata": { 66 | "id": "xNHXEHMOY9PY" 67 | }, 68 | "source": [ 69 | "#### Read toy data. Replace .load() with the test_data.csv location -- this location could be a local one (no cluster) or it could be on a distributed storage system (e.g., HDFS)\n", 70 | "\n", 71 | "*Note: Code below assumes data generated by our script (for specifics, please refer to our toy data generation in the README). You could also modify the code accordingly to use your own data.*" 72 | ] 73 | }, 74 | { 75 | "cell_type": "code", 76 | "execution_count": null, 77 | "metadata": { 78 | "id": "DZyUrMTBVJAf" 79 | }, 80 | "outputs": [], 81 | "source": [ 82 | "df = spark.read \\\n", 83 | " .format(\"csv\") \\\n", 84 | " .option('header', 'true') \\\n", 85 | " .load(\"test_data.csv\") # replace with the location of test_data.csv\n", 86 | "\n", 87 | "# Case variables to appropriate types\n", 88 | "df = df.withColumn(\"var1\", df.var1.cast(\"float\"))\n", 89 | "df = df.withColumn(\"var2\", df.var2.cast(\"float\"))\n", 90 | "df = df.withColumn(\"var3\", df.var3.cast(\"float\"))\n", 91 | "df = df.withColumn(\"var4\", df.var4.cast(\"float\"))\n", 92 | "df = df.withColumn(\"var5\", df.var5.cast(\"float\"))\n", 93 | "df = df.withColumn(\"treatment\", df.treatment.cast(\"float\"))\n", 94 | "df = df.withColumn(\"outcome\", df.outcome.cast(\"float\"))\n", 95 | "\n", 96 | "# Drop garbage column\n", 97 | "df = df.drop(\"_c0\")\n", 98 | "\n", 99 | "# Print out dataframe schema\n", 100 | "print(df.schema)" 101 | ] 102 | }, 103 | { 104 | "cell_type": "markdown", 105 | "metadata": { 106 | "id": "1Xa3QohmXg2Y" 107 | }, 108 | "source": [ 109 | "## S-leaner" 110 | ] 111 | }, 112 | { 113 | "cell_type": "code", 114 | "execution_count": null, 115 | "metadata": { 116 | "id": "BkMiSReQW2DE" 117 | }, 118 | "outputs": [], 119 | "source": [ 120 | "# Set up necessary parameters\n", 121 | "treatments = ['treatment']\n", 122 | "outcome = 'outcome'\n", 123 | "\n", 124 | "# Arbitrary estimator. Can replace with other ML algo.\n", 125 | "estimator = RandomForestRegressor()\n", 126 | "\n", 127 | "# Fit S-learner\n", 128 | "spark_slearner = SLearner()\n", 129 | "spark_slearner.fit(data=df, treatments=treatments, outcome=outcome, estimator=estimator)\n", 130 | "\n", 131 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 132 | "cate, ate = spark_slearner.effects()\n", 133 | "print(cate)\n", 134 | "print(ate)" 135 | ] 136 | }, 137 | { 138 | "cell_type": "markdown", 139 | "metadata": { 140 | "id": "Q1fcO5LOXjH_" 141 | }, 142 | "source": [ 143 | "## T-leaner" 144 | ] 145 | }, 146 | { 147 | "cell_type": "code", 148 | "execution_count": null, 149 | "metadata": { 150 | "id": "kn1QYEJPXWvM" 151 | }, 152 | "outputs": [], 153 | "source": [ 154 | "# Set up necessary parameters\n", 155 | "treatments = ['treatment']\n", 156 | "outcome = 'outcome'\n", 157 | "\n", 158 | "# Arbitrary estimators. Can replace with other ML algo.\n", 159 | "estimator_1 = RandomForestRegressor()\n", 160 | "estimator_0 = RandomForestRegressor()\n", 161 | "\n", 162 | "# Fit T-learner\n", 163 | "spark_tlearner = TLearner()\n", 164 | "spark_tlearner.fit(data=df, treatments=treatments, outcome=outcome,\n", 165 | " estimator_0=estimator_0, estimator_1=estimator_1)\n", 166 | "\n", 167 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 168 | "cate, ate = spark_tlearner.effects()\n", 169 | "print(cate)\n", 170 | "print(ate)" 171 | ] 172 | }, 173 | { 174 | "cell_type": "markdown", 175 | "metadata": { 176 | "id": "bxZQdw1fXoPa" 177 | }, 178 | "source": [ 179 | "## X-leaner" 180 | ] 181 | }, 182 | { 183 | "cell_type": "code", 184 | "execution_count": null, 185 | "metadata": { 186 | "id": "Qj1owlx-XYKo" 187 | }, 188 | "outputs": [], 189 | "source": [ 190 | "# Set up necessary parameters\n", 191 | "treatments = ['treatment']\n", 192 | "outcome = 'outcome'\n", 193 | "\n", 194 | "# Arbitrary estimators. Can replace with other ML algo.\n", 195 | "estimator_11 = RandomForestRegressor()\n", 196 | "estimator_10 = RandomForestRegressor()\n", 197 | "estimator_21 = RandomForestRegressor()\n", 198 | "estimator_20 = RandomForestRegressor()\n", 199 | "propensity_estimator = RandomForestClassifier()\n", 200 | "\n", 201 | "# Fit X-learner\n", 202 | "spark_xlearner = XLearner()\n", 203 | "spark_xlearner.fit(data=df, treatments=treatments, outcome=outcome, \n", 204 | " estimator_10=estimator_10, estimator_11=estimator_11, \n", 205 | " estimator_20=estimator_20, estimator_21=estimator_21,\n", 206 | " propensity_estimator=propensity_estimator)\n", 207 | "\n", 208 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 209 | "cate, ate = spark_xlearner.effects()\n", 210 | "print(cate)\n", 211 | "print(ate)" 212 | ] 213 | } 214 | ], 215 | "metadata": { 216 | "colab": { 217 | "name": "Untitled1.ipynb", 218 | "provenance": [] 219 | }, 220 | "kernelspec": { 221 | "display_name": "Python 3", 222 | "language": "python", 223 | "name": "python3" 224 | }, 225 | "language_info": { 226 | "codemirror_mode": { 227 | "name": "ipython", 228 | "version": 3 229 | }, 230 | "file_extension": ".py", 231 | "mimetype": "text/x-python", 232 | "name": "python", 233 | "nbconvert_exporter": "python", 234 | "pygments_lexer": "ipython3", 235 | "version": "3.7.4" 236 | } 237 | }, 238 | "nbformat": 4, 239 | "nbformat_minor": 2 240 | } 241 | -------------------------------------------------------------------------------- /reina/MetaLearners/XLearner.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | 4 | # In[ ]: 5 | 6 | 7 | """ 8 | Provides a spark-based X-learner heterogeneous treatment effect estimator. 9 | """ 10 | import pyspark 11 | from pyspark.sql.functions import monotonically_increasing_id 12 | from pyspark.ml.feature import VectorAssembler 13 | from pyspark.sql.functions import avg 14 | from pyspark.sql.functions import lit 15 | from pyspark.sql.functions import col 16 | from pyspark.sql.functions import when 17 | from pyspark.sql import SparkSession 18 | from pyspark.sql.functions import udf 19 | from pyspark.sql.types import FloatType 20 | 21 | class XLearner: 22 | """ 23 | Spark-based X-learner heterogeneous treatment effect estimator. 24 | Assumptions 25 | --------------- 26 | This class assumes that the data is already stored in a distributed storage system (e.g., HDFS). 27 | This class also assumes that the treatment variable only contains 1s and 0s. 28 | """ 29 | 30 | def __init__(self, learner="T"): 31 | self.treatments = [] # Multiple treatment effects can be estimated 32 | self.covariates = [] 33 | self.outcome = None 34 | self.estimator_10 = None 35 | self.estimator_11 = None 36 | self.estimator_20 = None 37 | self.estimator_21 = None 38 | self.propensity_estimator = None 39 | 40 | def fit(self, data, treatments, outcome, estimator_10, estimator_11, estimator_20, estimator_21, propensity_estimator): 41 | """ 42 | Wrapper function to fit an ML-based counterfacual model. 43 | When multiple treatments are inputted, each treatment effect is estiamted individually. 44 | 45 | Parameters 46 | ---------- 47 | data (2-D Spark dataframe): Base dataset containing features, treatment, iv, and outcome variables 48 | treatments (List): Names of the treatment variables 49 | outcome (Str): Name of the outcome variable 50 | estimator_10 (mllib model obj): Arbitrary ML model of choice 51 | estimator_11 (mllib model obj): Arbitrary ML model of choice 52 | estimator_20 (mllib model obj): Arbitrary ML model of choice 53 | estimator_21 (mllib model obj): Arbitrary ML model of choice 54 | propensity_estimator (mllib model obj): Arbitrary ML model for propensity function 55 | 56 | Returns 57 | ------ 58 | self 59 | """ 60 | 61 | self.treatments = treatments 62 | self.outcome = outcome 63 | self.covariates = [var for var in data.columns if var not in treatments and var != outcome] 64 | self.estimator_10 = estimator_10 65 | self.estimator_11 = estimator_11 66 | self.estimator_20 = estimator_20 67 | self.estimator_21 = estimator_21 68 | self.propensity_estimator = propensity_estimator 69 | self.__fit(data) 70 | 71 | def effects(self, X, treatment): 72 | """ 73 | Function to get the estimated heterogeneous treatment effect from the fitted counterfactual model. 74 | 75 | The treatment effect is calculated by taking the difference between the predicted counterfactual outcomes. 76 | 77 | Parameters 78 | ---------- 79 | X (2-D Spark dataframe): Feature data to estimate treatment effect of 80 | treatment (Str): Name of the treatment variable 81 | 82 | returns 83 | ------- 84 | cate: conditional average treatment effect 85 | ate: average treatment effect 86 | """ 87 | 88 | assert treatment in self.treatments 89 | 90 | # Final prediction 91 | assembler = VectorAssembler(inputCols=self.covariates+[treatment], outputCol='features') 92 | X_assembled = assembler.transform(X) 93 | prediction_21 = self.estimator_21.transform(X_assembled.select('features')).withColumnRenamed("prediction", "prediction_21").select("prediction_21") 94 | prediction_20 = self.estimator_20.transform(X_assembled.select('features')).withColumnRenamed("prediction", "prediction_20").select("prediction_20") 95 | 96 | # Propensity function 97 | propensity_assembler = VectorAssembler(inputCols=self.covariates, outputCol='features') 98 | treatment_group_prop = propensity_assembler.transform(X) 99 | treatment_group_prop = treatment_group_prop.select(['features', treatment]) 100 | treatment_prob = self.propensity_estimator.transform(treatment_group_prop).select("probability") 101 | firstelement = udf(lambda v:float(v[1]),FloatType()) 102 | treatment_prob = treatment_prob.select(firstelement('probability')).withColumnRenamed("(probability)", "probability") 103 | 104 | # Get cate 105 | X_w_pred = self.__mergeDfCol(X, prediction_21) 106 | X_w_pred = self.__mergeDfCol(X_w_pred, prediction_20) 107 | X_w_pred = self.__mergeDfCol(X_w_pred, treatment_prob) 108 | X_w_pred = X_w_pred.withColumn("probability", X_w_pred.probability.cast("float")) 109 | 110 | # should be + but - seems to produce the correct results... 111 | cate = X_w_pred.select((X_w_pred.probability * X_w_pred.prediction_21) - ((lit(1) - X_w_pred.probability) * X_w_pred.prediction_20)).withColumnRenamed("((probability * prediction_21) + ((1 - probability) * prediction_20))", "cate") 112 | ate = float(cate.groupby().avg().head()[0]) 113 | 114 | return cate, ate 115 | 116 | 117 | def __fit(self, data): 118 | 119 | # TODO: result of X-learner is a little weird...prediction20 and prediction21 are very close. Maybe need to check implementation again 120 | 121 | for treatment in self.treatments: 122 | 123 | # Set up assembler 124 | assembler = VectorAssembler(inputCols=self.covariates+[treatment], outputCol='features') 125 | 126 | # First Stage 127 | # First estimator (treatment group) 128 | treatment_group = data.filter(treatment+" == 1") 129 | treatment_group_assembled = assembler.transform(treatment_group) 130 | treatment_group_assembled = treatment_group_assembled.select(['features', self.outcome]) 131 | self.estimator_11 = self.estimator_11.fit(treatment_group_assembled) 132 | 133 | # Second estimator (control group) 134 | control_group = data.filter(treatment+" == 0") 135 | control_group_assembled = assembler.transform(control_group) 136 | control_group_assembled = control_group_assembled.select(['features', self.outcome]) 137 | self.estimator_10 = self.estimator_10.fit(control_group_assembled) 138 | 139 | # Second stage 140 | # Get imputed counterfactuals 141 | counterfactual_control = self.estimator_11.transform(control_group_assembled.select('features')).withColumnRenamed("prediction", "prediction_10").select("prediction_10") 142 | counterfactual_treatment = self.estimator_10.transform(treatment_group_assembled.select('features')).withColumnRenamed("prediction", "prediction_11").select("prediction_11") 143 | 144 | # Get imputed treatment effect 145 | # TODO: df.select(self.outcome) doesn't seem to work here for some reason...let's fix the label column as "label" for now when inputting 146 | treatment_group_assembled_cf = self.__mergeDfCol(treatment_group_assembled, counterfactual_treatment) 147 | treatment_group_assembled_cate = treatment_group_assembled_cf.select(treatment_group_assembled_cf.outcome - treatment_group_assembled_cf.prediction_11).withColumnRenamed("(outcome - prediction_11)", "imputed_treatment") 148 | control_group_assembled_cf = self.__mergeDfCol(control_group_assembled, counterfactual_control) 149 | control_group_assembled_cate = control_group_assembled_cf.select(control_group_assembled_cf.outcome - control_group_assembled_cf.prediction_10).withColumnRenamed("(outcome - prediction_10)", "imputed_treatment") 150 | 151 | # Third stage 152 | treatment_group_third = self.__mergeDfCol(treatment_group_assembled, treatment_group_assembled_cate) 153 | control_group_third = self.__mergeDfCol(control_group_assembled, control_group_assembled_cate) 154 | self.estimator_21 = self.estimator_21.fit(treatment_group_third) 155 | self.estimator_20 = self.estimator_20.fit(control_group_third) 156 | 157 | # Fit propensity estimator 158 | assembler_propensity = VectorAssembler(inputCols=self.covariates, outputCol='features') 159 | treatment_group_prop = assembler_propensity.transform(data) 160 | treatment_group_prop = treatment_group_prop.select(['features', treatment]) 161 | self.propensity_estimator = self.propensity_estimator.fit(treatment_group_prop) 162 | treatment_prob = self.propensity_estimator.transform(treatment_group_prop).select("probability") 163 | firstelement=udf(lambda v:float(v[1]),FloatType()) 164 | treatment_prob = treatment_prob.select(firstelement('probability')).withColumnRenamed("(probability)", "probability") 165 | 166 | 167 | def __mergeDfCol(self, df_1, df_2): 168 | """ 169 | Function to merge two spark dataframes. 170 | 171 | Parameters 172 | ---------- 173 | df_1 (2-D Spark dataframe): Spark dataframe to merge 174 | df_2 (2-D Spark dataframe): Spark dataframe to merge 175 | 176 | Returns 177 | ------ 178 | df_3 (2-D Spark dataframe): Spark dataframe merged by df1 and df2 179 | """ 180 | 181 | df_1 = df_1.withColumn("COL_MERGE_ID", monotonically_increasing_id()) 182 | df_2 = df_2.withColumn("COL_MERGE_ID", monotonically_increasing_id()) 183 | df_3 = df_2.join(df_1, "COL_MERGE_ID").drop("COL_MERGE_ID") 184 | return df_3 185 | 186 | -------------------------------------------------------------------------------- /examples/heart.csv: -------------------------------------------------------------------------------- 1 | age,sex,cp,trestbps,chol,fbs,restecg,thalach,exang,oldpeak,slope,ca,thal,target 2 | 63,1,3,145,233,1,0,150,0,2.3,0,0,1,1 3 | 37,1,2,130,250,0,1,187,0,3.5,0,0,2,1 4 | 41,0,1,130,204,0,0,172,0,1.4,2,0,2,1 5 | 56,1,1,120,236,0,1,178,0,0.8,2,0,2,1 6 | 57,0,0,120,354,0,1,163,1,0.6,2,0,2,1 7 | 57,1,0,140,192,0,1,148,0,0.4,1,0,1,1 8 | 56,0,1,140,294,0,0,153,0,1.3,1,0,2,1 9 | 44,1,1,120,263,0,1,173,0,0,2,0,3,1 10 | 52,1,2,172,199,1,1,162,0,0.5,2,0,3,1 11 | 57,1,2,150,168,0,1,174,0,1.6,2,0,2,1 12 | 54,1,0,140,239,0,1,160,0,1.2,2,0,2,1 13 | 48,0,2,130,275,0,1,139,0,0.2,2,0,2,1 14 | 49,1,1,130,266,0,1,171,0,0.6,2,0,2,1 15 | 64,1,3,110,211,0,0,144,1,1.8,1,0,2,1 16 | 58,0,3,150,283,1,0,162,0,1,2,0,2,1 17 | 50,0,2,120,219,0,1,158,0,1.6,1,0,2,1 18 | 58,0,2,120,340,0,1,172,0,0,2,0,2,1 19 | 66,0,3,150,226,0,1,114,0,2.6,0,0,2,1 20 | 43,1,0,150,247,0,1,171,0,1.5,2,0,2,1 21 | 69,0,3,140,239,0,1,151,0,1.8,2,2,2,1 22 | 59,1,0,135,234,0,1,161,0,0.5,1,0,3,1 23 | 44,1,2,130,233,0,1,179,1,0.4,2,0,2,1 24 | 42,1,0,140,226,0,1,178,0,0,2,0,2,1 25 | 61,1,2,150,243,1,1,137,1,1,1,0,2,1 26 | 40,1,3,140,199,0,1,178,1,1.4,2,0,3,1 27 | 71,0,1,160,302,0,1,162,0,0.4,2,2,2,1 28 | 59,1,2,150,212,1,1,157,0,1.6,2,0,2,1 29 | 51,1,2,110,175,0,1,123,0,0.6,2,0,2,1 30 | 65,0,2,140,417,1,0,157,0,0.8,2,1,2,1 31 | 53,1,2,130,197,1,0,152,0,1.2,0,0,2,1 32 | 41,0,1,105,198,0,1,168,0,0,2,1,2,1 33 | 65,1,0,120,177,0,1,140,0,0.4,2,0,3,1 34 | 44,1,1,130,219,0,0,188,0,0,2,0,2,1 35 | 54,1,2,125,273,0,0,152,0,0.5,0,1,2,1 36 | 51,1,3,125,213,0,0,125,1,1.4,2,1,2,1 37 | 46,0,2,142,177,0,0,160,1,1.4,0,0,2,1 38 | 54,0,2,135,304,1,1,170,0,0,2,0,2,1 39 | 54,1,2,150,232,0,0,165,0,1.6,2,0,3,1 40 | 65,0,2,155,269,0,1,148,0,0.8,2,0,2,1 41 | 65,0,2,160,360,0,0,151,0,0.8,2,0,2,1 42 | 51,0,2,140,308,0,0,142,0,1.5,2,1,2,1 43 | 48,1,1,130,245,0,0,180,0,0.2,1,0,2,1 44 | 45,1,0,104,208,0,0,148,1,3,1,0,2,1 45 | 53,0,0,130,264,0,0,143,0,0.4,1,0,2,1 46 | 39,1,2,140,321,0,0,182,0,0,2,0,2,1 47 | 52,1,1,120,325,0,1,172,0,0.2,2,0,2,1 48 | 44,1,2,140,235,0,0,180,0,0,2,0,2,1 49 | 47,1,2,138,257,0,0,156,0,0,2,0,2,1 50 | 53,0,2,128,216,0,0,115,0,0,2,0,0,1 51 | 53,0,0,138,234,0,0,160,0,0,2,0,2,1 52 | 51,0,2,130,256,0,0,149,0,0.5,2,0,2,1 53 | 66,1,0,120,302,0,0,151,0,0.4,1,0,2,1 54 | 62,1,2,130,231,0,1,146,0,1.8,1,3,3,1 55 | 44,0,2,108,141,0,1,175,0,0.6,1,0,2,1 56 | 63,0,2,135,252,0,0,172,0,0,2,0,2,1 57 | 52,1,1,134,201,0,1,158,0,0.8,2,1,2,1 58 | 48,1,0,122,222,0,0,186,0,0,2,0,2,1 59 | 45,1,0,115,260,0,0,185,0,0,2,0,2,1 60 | 34,1,3,118,182,0,0,174,0,0,2,0,2,1 61 | 57,0,0,128,303,0,0,159,0,0,2,1,2,1 62 | 71,0,2,110,265,1,0,130,0,0,2,1,2,1 63 | 54,1,1,108,309,0,1,156,0,0,2,0,3,1 64 | 52,1,3,118,186,0,0,190,0,0,1,0,1,1 65 | 41,1,1,135,203,0,1,132,0,0,1,0,1,1 66 | 58,1,2,140,211,1,0,165,0,0,2,0,2,1 67 | 35,0,0,138,183,0,1,182,0,1.4,2,0,2,1 68 | 51,1,2,100,222,0,1,143,1,1.2,1,0,2,1 69 | 45,0,1,130,234,0,0,175,0,0.6,1,0,2,1 70 | 44,1,1,120,220,0,1,170,0,0,2,0,2,1 71 | 62,0,0,124,209,0,1,163,0,0,2,0,2,1 72 | 54,1,2,120,258,0,0,147,0,0.4,1,0,3,1 73 | 51,1,2,94,227,0,1,154,1,0,2,1,3,1 74 | 29,1,1,130,204,0,0,202,0,0,2,0,2,1 75 | 51,1,0,140,261,0,0,186,1,0,2,0,2,1 76 | 43,0,2,122,213,0,1,165,0,0.2,1,0,2,1 77 | 55,0,1,135,250,0,0,161,0,1.4,1,0,2,1 78 | 51,1,2,125,245,1,0,166,0,2.4,1,0,2,1 79 | 59,1,1,140,221,0,1,164,1,0,2,0,2,1 80 | 52,1,1,128,205,1,1,184,0,0,2,0,2,1 81 | 58,1,2,105,240,0,0,154,1,0.6,1,0,3,1 82 | 41,1,2,112,250,0,1,179,0,0,2,0,2,1 83 | 45,1,1,128,308,0,0,170,0,0,2,0,2,1 84 | 60,0,2,102,318,0,1,160,0,0,2,1,2,1 85 | 52,1,3,152,298,1,1,178,0,1.2,1,0,3,1 86 | 42,0,0,102,265,0,0,122,0,0.6,1,0,2,1 87 | 67,0,2,115,564,0,0,160,0,1.6,1,0,3,1 88 | 68,1,2,118,277,0,1,151,0,1,2,1,3,1 89 | 46,1,1,101,197,1,1,156,0,0,2,0,3,1 90 | 54,0,2,110,214,0,1,158,0,1.6,1,0,2,1 91 | 58,0,0,100,248,0,0,122,0,1,1,0,2,1 92 | 48,1,2,124,255,1,1,175,0,0,2,2,2,1 93 | 57,1,0,132,207,0,1,168,1,0,2,0,3,1 94 | 52,1,2,138,223,0,1,169,0,0,2,4,2,1 95 | 54,0,1,132,288,1,0,159,1,0,2,1,2,1 96 | 45,0,1,112,160,0,1,138,0,0,1,0,2,1 97 | 53,1,0,142,226,0,0,111,1,0,2,0,3,1 98 | 62,0,0,140,394,0,0,157,0,1.2,1,0,2,1 99 | 52,1,0,108,233,1,1,147,0,0.1,2,3,3,1 100 | 43,1,2,130,315,0,1,162,0,1.9,2,1,2,1 101 | 53,1,2,130,246,1,0,173,0,0,2,3,2,1 102 | 42,1,3,148,244,0,0,178,0,0.8,2,2,2,1 103 | 59,1,3,178,270,0,0,145,0,4.2,0,0,3,1 104 | 63,0,1,140,195,0,1,179,0,0,2,2,2,1 105 | 42,1,2,120,240,1,1,194,0,0.8,0,0,3,1 106 | 50,1,2,129,196,0,1,163,0,0,2,0,2,1 107 | 68,0,2,120,211,0,0,115,0,1.5,1,0,2,1 108 | 69,1,3,160,234,1,0,131,0,0.1,1,1,2,1 109 | 45,0,0,138,236,0,0,152,1,0.2,1,0,2,1 110 | 50,0,1,120,244,0,1,162,0,1.1,2,0,2,1 111 | 50,0,0,110,254,0,0,159,0,0,2,0,2,1 112 | 64,0,0,180,325,0,1,154,1,0,2,0,2,1 113 | 57,1,2,150,126,1,1,173,0,0.2,2,1,3,1 114 | 64,0,2,140,313,0,1,133,0,0.2,2,0,3,1 115 | 43,1,0,110,211,0,1,161,0,0,2,0,3,1 116 | 55,1,1,130,262,0,1,155,0,0,2,0,2,1 117 | 37,0,2,120,215,0,1,170,0,0,2,0,2,1 118 | 41,1,2,130,214,0,0,168,0,2,1,0,2,1 119 | 56,1,3,120,193,0,0,162,0,1.9,1,0,3,1 120 | 46,0,1,105,204,0,1,172,0,0,2,0,2,1 121 | 46,0,0,138,243,0,0,152,1,0,1,0,2,1 122 | 64,0,0,130,303,0,1,122,0,2,1,2,2,1 123 | 59,1,0,138,271,0,0,182,0,0,2,0,2,1 124 | 41,0,2,112,268,0,0,172,1,0,2,0,2,1 125 | 54,0,2,108,267,0,0,167,0,0,2,0,2,1 126 | 39,0,2,94,199,0,1,179,0,0,2,0,2,1 127 | 34,0,1,118,210,0,1,192,0,0.7,2,0,2,1 128 | 47,1,0,112,204,0,1,143,0,0.1,2,0,2,1 129 | 67,0,2,152,277,0,1,172,0,0,2,1,2,1 130 | 52,0,2,136,196,0,0,169,0,0.1,1,0,2,1 131 | 74,0,1,120,269,0,0,121,1,0.2,2,1,2,1 132 | 54,0,2,160,201,0,1,163,0,0,2,1,2,1 133 | 49,0,1,134,271,0,1,162,0,0,1,0,2,1 134 | 42,1,1,120,295,0,1,162,0,0,2,0,2,1 135 | 41,1,1,110,235,0,1,153,0,0,2,0,2,1 136 | 41,0,1,126,306,0,1,163,0,0,2,0,2,1 137 | 49,0,0,130,269,0,1,163,0,0,2,0,2,1 138 | 60,0,2,120,178,1,1,96,0,0,2,0,2,1 139 | 62,1,1,128,208,1,0,140,0,0,2,0,2,1 140 | 57,1,0,110,201,0,1,126,1,1.5,1,0,1,1 141 | 64,1,0,128,263,0,1,105,1,0.2,1,1,3,1 142 | 51,0,2,120,295,0,0,157,0,0.6,2,0,2,1 143 | 43,1,0,115,303,0,1,181,0,1.2,1,0,2,1 144 | 42,0,2,120,209,0,1,173,0,0,1,0,2,1 145 | 67,0,0,106,223,0,1,142,0,0.3,2,2,2,1 146 | 76,0,2,140,197,0,2,116,0,1.1,1,0,2,1 147 | 70,1,1,156,245,0,0,143,0,0,2,0,2,1 148 | 44,0,2,118,242,0,1,149,0,0.3,1,1,2,1 149 | 60,0,3,150,240,0,1,171,0,0.9,2,0,2,1 150 | 44,1,2,120,226,0,1,169,0,0,2,0,2,1 151 | 42,1,2,130,180,0,1,150,0,0,2,0,2,1 152 | 66,1,0,160,228,0,0,138,0,2.3,2,0,1,1 153 | 71,0,0,112,149,0,1,125,0,1.6,1,0,2,1 154 | 64,1,3,170,227,0,0,155,0,0.6,1,0,3,1 155 | 66,0,2,146,278,0,0,152,0,0,1,1,2,1 156 | 39,0,2,138,220,0,1,152,0,0,1,0,2,1 157 | 58,0,0,130,197,0,1,131,0,0.6,1,0,2,1 158 | 47,1,2,130,253,0,1,179,0,0,2,0,2,1 159 | 35,1,1,122,192,0,1,174,0,0,2,0,2,1 160 | 58,1,1,125,220,0,1,144,0,0.4,1,4,3,1 161 | 56,1,1,130,221,0,0,163,0,0,2,0,3,1 162 | 56,1,1,120,240,0,1,169,0,0,0,0,2,1 163 | 55,0,1,132,342,0,1,166,0,1.2,2,0,2,1 164 | 41,1,1,120,157,0,1,182,0,0,2,0,2,1 165 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1 166 | 38,1,2,138,175,0,1,173,0,0,2,4,2,1 167 | 67,1,0,160,286,0,0,108,1,1.5,1,3,2,0 168 | 67,1,0,120,229,0,0,129,1,2.6,1,2,3,0 169 | 62,0,0,140,268,0,0,160,0,3.6,0,2,2,0 170 | 63,1,0,130,254,0,0,147,0,1.4,1,1,3,0 171 | 53,1,0,140,203,1,0,155,1,3.1,0,0,3,0 172 | 56,1,2,130,256,1,0,142,1,0.6,1,1,1,0 173 | 48,1,1,110,229,0,1,168,0,1,0,0,3,0 174 | 58,1,1,120,284,0,0,160,0,1.8,1,0,2,0 175 | 58,1,2,132,224,0,0,173,0,3.2,2,2,3,0 176 | 60,1,0,130,206,0,0,132,1,2.4,1,2,3,0 177 | 40,1,0,110,167,0,0,114,1,2,1,0,3,0 178 | 60,1,0,117,230,1,1,160,1,1.4,2,2,3,0 179 | 64,1,2,140,335,0,1,158,0,0,2,0,2,0 180 | 43,1,0,120,177,0,0,120,1,2.5,1,0,3,0 181 | 57,1,0,150,276,0,0,112,1,0.6,1,1,1,0 182 | 55,1,0,132,353,0,1,132,1,1.2,1,1,3,0 183 | 65,0,0,150,225,0,0,114,0,1,1,3,3,0 184 | 61,0,0,130,330,0,0,169,0,0,2,0,2,0 185 | 58,1,2,112,230,0,0,165,0,2.5,1,1,3,0 186 | 50,1,0,150,243,0,0,128,0,2.6,1,0,3,0 187 | 44,1,0,112,290,0,0,153,0,0,2,1,2,0 188 | 60,1,0,130,253,0,1,144,1,1.4,2,1,3,0 189 | 54,1,0,124,266,0,0,109,1,2.2,1,1,3,0 190 | 50,1,2,140,233,0,1,163,0,0.6,1,1,3,0 191 | 41,1,0,110,172,0,0,158,0,0,2,0,3,0 192 | 51,0,0,130,305,0,1,142,1,1.2,1,0,3,0 193 | 58,1,0,128,216,0,0,131,1,2.2,1,3,3,0 194 | 54,1,0,120,188,0,1,113,0,1.4,1,1,3,0 195 | 60,1,0,145,282,0,0,142,1,2.8,1,2,3,0 196 | 60,1,2,140,185,0,0,155,0,3,1,0,2,0 197 | 59,1,0,170,326,0,0,140,1,3.4,0,0,3,0 198 | 46,1,2,150,231,0,1,147,0,3.6,1,0,2,0 199 | 67,1,0,125,254,1,1,163,0,0.2,1,2,3,0 200 | 62,1,0,120,267,0,1,99,1,1.8,1,2,3,0 201 | 65,1,0,110,248,0,0,158,0,0.6,2,2,1,0 202 | 44,1,0,110,197,0,0,177,0,0,2,1,2,0 203 | 60,1,0,125,258,0,0,141,1,2.8,1,1,3,0 204 | 58,1,0,150,270,0,0,111,1,0.8,2,0,3,0 205 | 68,1,2,180,274,1,0,150,1,1.6,1,0,3,0 206 | 62,0,0,160,164,0,0,145,0,6.2,0,3,3,0 207 | 52,1,0,128,255,0,1,161,1,0,2,1,3,0 208 | 59,1,0,110,239,0,0,142,1,1.2,1,1,3,0 209 | 60,0,0,150,258,0,0,157,0,2.6,1,2,3,0 210 | 49,1,2,120,188,0,1,139,0,2,1,3,3,0 211 | 59,1,0,140,177,0,1,162,1,0,2,1,3,0 212 | 57,1,2,128,229,0,0,150,0,0.4,1,1,3,0 213 | 61,1,0,120,260,0,1,140,1,3.6,1,1,3,0 214 | 39,1,0,118,219,0,1,140,0,1.2,1,0,3,0 215 | 61,0,0,145,307,0,0,146,1,1,1,0,3,0 216 | 56,1,0,125,249,1,0,144,1,1.2,1,1,2,0 217 | 43,0,0,132,341,1,0,136,1,3,1,0,3,0 218 | 62,0,2,130,263,0,1,97,0,1.2,1,1,3,0 219 | 63,1,0,130,330,1,0,132,1,1.8,2,3,3,0 220 | 65,1,0,135,254,0,0,127,0,2.8,1,1,3,0 221 | 48,1,0,130,256,1,0,150,1,0,2,2,3,0 222 | 63,0,0,150,407,0,0,154,0,4,1,3,3,0 223 | 55,1,0,140,217,0,1,111,1,5.6,0,0,3,0 224 | 65,1,3,138,282,1,0,174,0,1.4,1,1,2,0 225 | 56,0,0,200,288,1,0,133,1,4,0,2,3,0 226 | 54,1,0,110,239,0,1,126,1,2.8,1,1,3,0 227 | 70,1,0,145,174,0,1,125,1,2.6,0,0,3,0 228 | 62,1,1,120,281,0,0,103,0,1.4,1,1,3,0 229 | 35,1,0,120,198,0,1,130,1,1.6,1,0,3,0 230 | 59,1,3,170,288,0,0,159,0,0.2,1,0,3,0 231 | 64,1,2,125,309,0,1,131,1,1.8,1,0,3,0 232 | 47,1,2,108,243,0,1,152,0,0,2,0,2,0 233 | 57,1,0,165,289,1,0,124,0,1,1,3,3,0 234 | 55,1,0,160,289,0,0,145,1,0.8,1,1,3,0 235 | 64,1,0,120,246,0,0,96,1,2.2,0,1,2,0 236 | 70,1,0,130,322,0,0,109,0,2.4,1,3,2,0 237 | 51,1,0,140,299,0,1,173,1,1.6,2,0,3,0 238 | 58,1,0,125,300,0,0,171,0,0,2,2,3,0 239 | 60,1,0,140,293,0,0,170,0,1.2,1,2,3,0 240 | 77,1,0,125,304,0,0,162,1,0,2,3,2,0 241 | 35,1,0,126,282,0,0,156,1,0,2,0,3,0 242 | 70,1,2,160,269,0,1,112,1,2.9,1,1,3,0 243 | 59,0,0,174,249,0,1,143,1,0,1,0,2,0 244 | 64,1,0,145,212,0,0,132,0,2,1,2,1,0 245 | 57,1,0,152,274,0,1,88,1,1.2,1,1,3,0 246 | 56,1,0,132,184,0,0,105,1,2.1,1,1,1,0 247 | 48,1,0,124,274,0,0,166,0,0.5,1,0,3,0 248 | 56,0,0,134,409,0,0,150,1,1.9,1,2,3,0 249 | 66,1,1,160,246,0,1,120,1,0,1,3,1,0 250 | 54,1,1,192,283,0,0,195,0,0,2,1,3,0 251 | 69,1,2,140,254,0,0,146,0,2,1,3,3,0 252 | 51,1,0,140,298,0,1,122,1,4.2,1,3,3,0 253 | 43,1,0,132,247,1,0,143,1,0.1,1,4,3,0 254 | 62,0,0,138,294,1,1,106,0,1.9,1,3,2,0 255 | 67,1,0,100,299,0,0,125,1,0.9,1,2,2,0 256 | 59,1,3,160,273,0,0,125,0,0,2,0,2,0 257 | 45,1,0,142,309,0,0,147,1,0,1,3,3,0 258 | 58,1,0,128,259,0,0,130,1,3,1,2,3,0 259 | 50,1,0,144,200,0,0,126,1,0.9,1,0,3,0 260 | 62,0,0,150,244,0,1,154,1,1.4,1,0,2,0 261 | 38,1,3,120,231,0,1,182,1,3.8,1,0,3,0 262 | 66,0,0,178,228,1,1,165,1,1,1,2,3,0 263 | 52,1,0,112,230,0,1,160,0,0,2,1,2,0 264 | 53,1,0,123,282,0,1,95,1,2,1,2,3,0 265 | 63,0,0,108,269,0,1,169,1,1.8,1,2,2,0 266 | 54,1,0,110,206,0,0,108,1,0,1,1,2,0 267 | 66,1,0,112,212,0,0,132,1,0.1,2,1,2,0 268 | 55,0,0,180,327,0,2,117,1,3.4,1,0,2,0 269 | 49,1,2,118,149,0,0,126,0,0.8,2,3,2,0 270 | 54,1,0,122,286,0,0,116,1,3.2,1,2,2,0 271 | 56,1,0,130,283,1,0,103,1,1.6,0,0,3,0 272 | 46,1,0,120,249,0,0,144,0,0.8,2,0,3,0 273 | 61,1,3,134,234,0,1,145,0,2.6,1,2,2,0 274 | 67,1,0,120,237,0,1,71,0,1,1,0,2,0 275 | 58,1,0,100,234,0,1,156,0,0.1,2,1,3,0 276 | 47,1,0,110,275,0,0,118,1,1,1,1,2,0 277 | 52,1,0,125,212,0,1,168,0,1,2,2,3,0 278 | 58,1,0,146,218,0,1,105,0,2,1,1,3,0 279 | 57,1,1,124,261,0,1,141,0,0.3,2,0,3,0 280 | 58,0,1,136,319,1,0,152,0,0,2,2,2,0 281 | 61,1,0,138,166,0,0,125,1,3.6,1,1,2,0 282 | 42,1,0,136,315,0,1,125,1,1.8,1,0,1,0 283 | 52,1,0,128,204,1,1,156,1,1,1,0,0,0 284 | 59,1,2,126,218,1,1,134,0,2.2,1,1,1,0 285 | 40,1,0,152,223,0,1,181,0,0,2,0,3,0 286 | 61,1,0,140,207,0,0,138,1,1.9,2,1,3,0 287 | 46,1,0,140,311,0,1,120,1,1.8,1,2,3,0 288 | 59,1,3,134,204,0,1,162,0,0.8,2,2,2,0 289 | 57,1,1,154,232,0,0,164,0,0,2,1,2,0 290 | 57,1,0,110,335,0,1,143,1,3,1,1,3,0 291 | 55,0,0,128,205,0,2,130,1,2,1,1,3,0 292 | 61,1,0,148,203,0,1,161,0,0,2,1,3,0 293 | 58,1,0,114,318,0,2,140,0,4.4,0,3,1,0 294 | 58,0,0,170,225,1,0,146,1,2.8,1,2,1,0 295 | 67,1,2,152,212,0,0,150,0,0.8,1,0,3,0 296 | 44,1,0,120,169,0,1,144,1,2.8,0,0,1,0 297 | 63,1,0,140,187,0,0,144,1,4,2,2,3,0 298 | 63,0,0,124,197,0,1,136,1,0,1,0,2,0 299 | 59,1,0,164,176,1,0,90,0,1,1,2,1,0 300 | 57,0,0,140,241,0,1,123,1,0.2,1,0,3,0 301 | 45,1,3,110,264,0,1,132,0,1.2,1,0,3,0 302 | 68,1,0,144,193,1,1,141,0,3.4,1,2,3,0 303 | 57,1,0,130,131,0,1,115,1,1.2,1,1,3,0 304 | 57,0,1,130,236,0,0,174,0,0,1,1,2,0 305 | -------------------------------------------------------------------------------- /examples/notebooks/metalearner/metalearner_churn.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": { 6 | "id": "aIvb0JodYx9d" 7 | }, 8 | "source": [ 9 | "## Import reina and other necessary libraries. Initialize a spark session." 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 1, 15 | "metadata": { 16 | "id": "9mGaEKdeU89A" 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "from reina.MetaLearners import SLearner\n", 21 | "from reina.MetaLearners import TLearner\n", 22 | "from reina.MetaLearners import XLearner\n", 23 | "from pyspark.ml.regression import RandomForestRegressor\n", 24 | "from pyspark.ml.classification import RandomForestClassifier\n", 25 | "from pyspark.sql import SparkSession\n", 26 | "\n", 27 | "\n", 28 | "# Initialize spark session\n", 29 | "spark = SparkSession \\\n", 30 | " .builder \\\n", 31 | " .appName('Meta-Learner-Spark') \\\n", 32 | " .getOrCreate()" 33 | ] 34 | }, 35 | { 36 | "cell_type": "markdown", 37 | "metadata": { 38 | "id": "xNHXEHMOY9PY" 39 | }, 40 | "source": [ 41 | "## Read toy data. Replace .load() with the test_data.csv location -- this location could be a local one (no cluster) or it could be on a distributed storage system (e.g., HDFS)\n", 42 | "\n", 43 | "*Note: Code below assumes data generated by our script (for specifics, please refer to our toy data generation in the README). You could also modify the code accordingly to use your own data.*" 44 | ] 45 | }, 46 | { 47 | "cell_type": "code", 48 | "execution_count": 33, 49 | "metadata": { 50 | "id": "DZyUrMTBVJAf" 51 | }, 52 | "outputs": [ 53 | { 54 | "name": "stdout", 55 | "output_type": "stream", 56 | "text": [ 57 | "StructType(List(StructField(SeniorCitizen,IntegerType,true),StructField(Dependents,StringType,true),StructField(tenure,IntegerType,true),StructField(PhoneService,StringType,true),StructField(MultipleLines,StringType,true),StructField(InternetService,StringType,true),StructField(OnlineSecurity,StringType,true),StructField(OnlineBackup,StringType,true),StructField(DeviceProtection,StringType,true),StructField(TechSupport,StringType,true),StructField(StreamingTV,StringType,true),StructField(StreamingMovies,StringType,true),StructField(Contract,StringType,true),StructField(PaperlessBilling,StringType,true),StructField(MonthlyCharges,DoubleType,true),StructField(TotalCharges,StringType,true),StructField(Churn,StringType,true)))\n", 58 | "+-------------+----------+------+------------+----------------+---------------+--------------+------------+----------------+-----------+-----------+---------------+--------------+----------------+--------------+------------+-----+\n", 59 | "|SeniorCitizen|Dependents|tenure|PhoneService| MultipleLines|InternetService|OnlineSecurity|OnlineBackup|DeviceProtection|TechSupport|StreamingTV|StreamingMovies| Contract|PaperlessBilling|MonthlyCharges|TotalCharges|Churn|\n", 60 | "+-------------+----------+------+------------+----------------+---------------+--------------+------------+----------------+-----------+-----------+---------------+--------------+----------------+--------------+------------+-----+\n", 61 | "| 0| No| 1| No|No phone service| DSL| No| Yes| No| No| No| No|Month-to-month| Yes| 29.85| 29.85| No|\n", 62 | "| 0| No| 34| Yes| No| DSL| Yes| No| Yes| No| No| No| One year| No| 56.95| 1889.5| No|\n", 63 | "| 0| No| 2| Yes| No| DSL| Yes| Yes| No| No| No| No|Month-to-month| Yes| 53.85| 108.15| Yes|\n", 64 | "| 0| No| 45| No|No phone service| DSL| Yes| No| Yes| Yes| No| No| One year| No| 42.3| 1840.75| No|\n", 65 | "| 0| No| 2| Yes| No| Fiber optic| No| No| No| No| No| No|Month-to-month| Yes| 70.7| 151.65| Yes|\n", 66 | "+-------------+----------+------+------------+----------------+---------------+--------------+------------+----------------+-----------+-----------+---------------+--------------+----------------+--------------+------------+-----+\n", 67 | "only showing top 5 rows\n", 68 | "\n", 69 | "None\n" 70 | ] 71 | } 72 | ], 73 | "source": [ 74 | "df = spark.read \\\n", 75 | " .format(\"csv\") \\\n", 76 | " .option('header', 'true') \\\n", 77 | " .option(\"inferSchema\" , \"true\")\\\n", 78 | " .load(\"../../telco-churn.csv\") # replace with the location of test_data.csv\n", 79 | "\n", 80 | "# Drop columns not needed\n", 81 | "df = df.drop(\"customerID\")\n", 82 | "df = df.drop(\"gender\")\n", 83 | "df = df.drop(\"partner\")\n", 84 | "df = df.drop(\"PaymentMethod\")\n", 85 | "\n", 86 | "# Print out dataframe schema\n", 87 | "print(df.schema)\n", 88 | "print(df.show(5))" 89 | ] 90 | }, 91 | { 92 | "cell_type": "code", 93 | "execution_count": 34, 94 | "metadata": {}, 95 | "outputs": [], 96 | "source": [ 97 | "# Fix some data types...\n", 98 | "df = df.withColumn(\"TotalCharges\", df.TotalCharges.cast(\"float\"))" 99 | ] 100 | }, 101 | { 102 | "cell_type": "markdown", 103 | "metadata": {}, 104 | "source": [ 105 | "## Minimum pre-processing" 106 | ] 107 | }, 108 | { 109 | "cell_type": "markdown", 110 | "metadata": {}, 111 | "source": [ 112 | "Transform categorical data using string index and dummy variables" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "execution_count": 35, 118 | "metadata": {}, 119 | "outputs": [], 120 | "source": [ 121 | "from pyspark.ml.feature import StringIndexer\n", 122 | "\n", 123 | "categorical_feats = [\"Dependents\", \"PhoneService\", \"MultipleLines\", \"InternetService\", \"OnlineSecurity\", \"OnlineBackup\", \"DeviceProtection\", \"TechSupport\", \"StreamingTV\", \"StreamingMovies\", \"Contract\", \"PaperlessBilling\", \"Churn\"]\n", 124 | "\n", 125 | "for feature in categorical_feats:\n", 126 | " indexer = StringIndexer(inputCol=feature, outputCol=feature+\"_index\")\n", 127 | " df = indexer.fit(df).transform(df)\n", 128 | " df = df.drop(feature)" 129 | ] 130 | }, 131 | { 132 | "cell_type": "code", 133 | "execution_count": 36, 134 | "metadata": {}, 135 | "outputs": [], 136 | "source": [ 137 | "from pyspark.ml.feature import OneHotEncoder\n", 138 | "\n", 139 | "one_hot_features = [\"MultipleLines_index\", \"InternetService_index\", \"Contract_index\"]\n", 140 | "\n", 141 | "\n", 142 | "for feature in one_hot_features:\n", 143 | " encoder = OneHotEncoder(inputCol=feature, outputCol=feature+\"_ohe\")\n", 144 | " df = encoder.fit(df).transform(df)\n", 145 | " df.drop(feature)" 146 | ] 147 | }, 148 | { 149 | "cell_type": "markdown", 150 | "metadata": { 151 | "id": "1Xa3QohmXg2Y" 152 | }, 153 | "source": [ 154 | "## S-leaner" 155 | ] 156 | }, 157 | { 158 | "cell_type": "code", 159 | "execution_count": 47, 160 | "metadata": {}, 161 | "outputs": [ 162 | { 163 | "name": "stdout", 164 | "output_type": "stream", 165 | "text": [ 166 | "(7043, 20)\n" 167 | ] 168 | } 169 | ], 170 | "source": [ 171 | "print((df.count(), len(df.columns)))" 172 | ] 173 | }, 174 | { 175 | "cell_type": "code", 176 | "execution_count": 49, 177 | "metadata": {}, 178 | "outputs": [ 179 | { 180 | "name": "stdout", 181 | "output_type": "stream", 182 | "text": [ 183 | "(7032, 20)\n" 184 | ] 185 | } 186 | ], 187 | "source": [ 188 | "from pyspark.sql.functions import col\n", 189 | "\n", 190 | "\n", 191 | "df = df.dropna()\n", 192 | "print((df.count(), len(df.columns)))" 193 | ] 194 | }, 195 | { 196 | "cell_type": "code", 197 | "execution_count": 51, 198 | "metadata": { 199 | "id": "BkMiSReQW2DE" 200 | }, 201 | "outputs": [ 202 | { 203 | "ename": "NameError", 204 | "evalue": "name 'df1' is not defined", 205 | "output_type": "error", 206 | "traceback": [ 207 | "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", 208 | "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", 209 | "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[1;31m# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 13\u001b[1;33m \u001b[0mcate\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mate\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mspark_slearner\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0meffects\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mX\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdf\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtreatment\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mtreatments\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 14\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mcate\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 15\u001b[0m \u001b[0mprint\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mate\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 210 | "\u001b[1;32m~\\Anaconda3\\lib\\site-packages\\reina\\MetaLearners\\SLearner.py\u001b[0m in \u001b[0;36meffects\u001b[1;34m(self, X, treatment)\u001b[0m\n\u001b[0;32m 90\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 91\u001b[0m \u001b[1;31m# Get cate\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 92\u001b[1;33m \u001b[0mX_w_pred\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__mergeDfCol\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mX\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mprediction_1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 93\u001b[0m \u001b[0mX_w_pred\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m__mergeDfCol\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mX_w_pred\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mprediction_0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 94\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcate\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mtreatment\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mX_w_pred\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mselect\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mX_w_pred\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mprediction_1\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0mX_w_pred\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mprediction_0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwithColumnRenamed\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"(prediction_1 - prediction_0)\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"cate\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 211 | "\u001b[1;32m~\\Anaconda3\\lib\\site-packages\\reina\\MetaLearners\\SLearner.py\u001b[0m in \u001b[0;36m__mergeDfCol\u001b[1;34m(self, df_1, df_2)\u001b[0m\n\u001b[0;32m 122\u001b[0m \u001b[0mdf_1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdf_1\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwithColumn\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"COL_MERGE_ID\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmonotonically_increasing_id\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 123\u001b[0m \u001b[0mdf_2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdf_2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwithColumn\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"COL_MERGE_ID\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mmonotonically_increasing_id\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 124\u001b[1;33m \u001b[0mdf_3\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdf_2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdf1\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"COL_MERGE_ID\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"COL_MERGE_ID\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 125\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mdf_3\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", 212 | "\u001b[1;31mNameError\u001b[0m: name 'df1' is not defined" 213 | ] 214 | } 215 | ], 216 | "source": [ 217 | "# Set up necessary parameters\n", 218 | "treatments = ['PhoneService_index']\n", 219 | "outcome = 'Churn_index'\n", 220 | "\n", 221 | "# Arbitrary estimator. Can replace with other ML algo.\n", 222 | "estimator = RandomForestRegressor(featuresCol=\"features\", labelCol=outcome)\n", 223 | "\n", 224 | "# Fit S-learner\n", 225 | "spark_slearner = SLearner()\n", 226 | "spark_slearner.fit(data=df, treatments=treatments, outcome=outcome, estimator=estimator)\n", 227 | "\n", 228 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 229 | "cate, ate = spark_slearner.effects(X=df, treatment=treatments[0])\n", 230 | "print(cate)\n", 231 | "print(ate)" 232 | ] 233 | }, 234 | { 235 | "cell_type": "markdown", 236 | "metadata": { 237 | "id": "Q1fcO5LOXjH_" 238 | }, 239 | "source": [ 240 | "## T-leaner" 241 | ] 242 | }, 243 | { 244 | "cell_type": "code", 245 | "execution_count": null, 246 | "metadata": { 247 | "id": "kn1QYEJPXWvM" 248 | }, 249 | "outputs": [], 250 | "source": [ 251 | "# Set up necessary parameters\n", 252 | "treatments = ['treatment']\n", 253 | "outcome = 'outcome'\n", 254 | "\n", 255 | "# Arbitrary estimators. Can replace with other ML algo.\n", 256 | "estimator_1 = RandomForestRegressor()\n", 257 | "estimator_0 = RandomForestRegressor()\n", 258 | "\n", 259 | "# Fit T-learner\n", 260 | "spark_tlearner = TLearner()\n", 261 | "spark_tlearner.fit(data=df, treatments=treatments, outcome=outcome,\n", 262 | " estimator_0=estimator_0, estimator_1=estimator_1)\n", 263 | "\n", 264 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 265 | "cate, ate = spark_tlearner.effects()\n", 266 | "print(cate)\n", 267 | "print(ate)" 268 | ] 269 | }, 270 | { 271 | "cell_type": "markdown", 272 | "metadata": { 273 | "id": "bxZQdw1fXoPa" 274 | }, 275 | "source": [ 276 | "## X-leaner" 277 | ] 278 | }, 279 | { 280 | "cell_type": "code", 281 | "execution_count": null, 282 | "metadata": { 283 | "id": "Qj1owlx-XYKo" 284 | }, 285 | "outputs": [], 286 | "source": [ 287 | "# Set up necessary parameters\n", 288 | "treatments = ['treatment']\n", 289 | "outcome = 'outcome'\n", 290 | "\n", 291 | "# Arbitrary estimators. Can replace with other ML algo.\n", 292 | "estimator_11 = RandomForestRegressor()\n", 293 | "estimator_10 = RandomForestRegressor()\n", 294 | "estimator_21 = RandomForestRegressor()\n", 295 | "estimator_20 = RandomForestRegressor()\n", 296 | "propensity_estimator = RandomForestClassifier()\n", 297 | "\n", 298 | "# Fit X-learner\n", 299 | "spark_xlearner = XLearner()\n", 300 | "spark_xlearner.fit(data=df, treatments=treatments, outcome=outcome, \n", 301 | " estimator_10=estimator_10, estimator_11=estimator_11, \n", 302 | " estimator_20=estimator_20, estimator_21=estimator_21,\n", 303 | " propensity_estimator=propensity_estimator)\n", 304 | "\n", 305 | "# Get heterogeneous treatment effects (cate for individual samples and ate for averaged treatment effect)\n", 306 | "cate, ate = spark_xlearner.effects()\n", 307 | "print(cate)\n", 308 | "print(ate)" 309 | ] 310 | } 311 | ], 312 | "metadata": { 313 | "colab": { 314 | "name": "Untitled1.ipynb", 315 | "provenance": [] 316 | }, 317 | "kernelspec": { 318 | "display_name": "Python 3", 319 | "language": "python", 320 | "name": "python3" 321 | }, 322 | "language_info": { 323 | "codemirror_mode": { 324 | "name": "ipython", 325 | "version": 3 326 | }, 327 | "file_extension": ".py", 328 | "mimetype": "text/x-python", 329 | "name": "python", 330 | "nbconvert_exporter": "python", 331 | "pygments_lexer": "ipython3", 332 | "version": "3.7.4" 333 | } 334 | }, 335 | "nbformat": 4, 336 | "nbformat_minor": 2 337 | } 338 | -------------------------------------------------------------------------------- /examples/student-mat.csv: -------------------------------------------------------------------------------- 1 | school,sex,age,address,famsize,Pstatus,Medu,Fedu,Mjob,Fjob,reason,guardian,traveltime,studytime,failures,schoolsup,famsup,paid,activities,nursery,higher,internet,romantic,famrel,freetime,goout,Dalc,Walc,health,absences,G1,G2,G3 2 | GP,F,18,U,GT3,A,4,4,at_home,teacher,course,mother,2,2,0,yes,no,no,no,yes,yes,no,no,4,3,4,1,1,3,6,5,6,6 3 | GP,F,17,U,GT3,T,1,1,at_home,other,course,father,1,2,0,no,yes,no,no,no,yes,yes,no,5,3,3,1,1,3,4,5,5,6 4 | GP,F,15,U,LE3,T,1,1,at_home,other,other,mother,1,2,3,yes,no,yes,no,yes,yes,yes,no,4,3,2,2,3,3,10,7,8,10 5 | GP,F,15,U,GT3,T,4,2,health,services,home,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,yes,3,2,2,1,1,5,2,15,14,15 6 | GP,F,16,U,GT3,T,3,3,other,other,home,father,1,2,0,no,yes,yes,no,yes,yes,no,no,4,3,2,1,2,5,4,6,10,10 7 | GP,M,16,U,LE3,T,4,3,services,other,reputation,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,no,5,4,2,1,2,5,10,15,15,15 8 | GP,M,16,U,LE3,T,2,2,other,other,home,mother,1,2,0,no,no,no,no,yes,yes,yes,no,4,4,4,1,1,3,0,12,12,11 9 | GP,F,17,U,GT3,A,4,4,other,teacher,home,mother,2,2,0,yes,yes,no,no,yes,yes,no,no,4,1,4,1,1,1,6,6,5,6 10 | GP,M,15,U,LE3,A,3,2,services,other,home,mother,1,2,0,no,yes,yes,no,yes,yes,yes,no,4,2,2,1,1,1,0,16,18,19 11 | GP,M,15,U,GT3,T,3,4,other,other,home,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,no,5,5,1,1,1,5,0,14,15,15 12 | GP,F,15,U,GT3,T,4,4,teacher,health,reputation,mother,1,2,0,no,yes,yes,no,yes,yes,yes,no,3,3,3,1,2,2,0,10,8,9 13 | GP,F,15,U,GT3,T,2,1,services,other,reputation,father,3,3,0,no,yes,no,yes,yes,yes,yes,no,5,2,2,1,1,4,4,10,12,12 14 | GP,M,15,U,LE3,T,4,4,health,services,course,father,1,1,0,no,yes,yes,yes,yes,yes,yes,no,4,3,3,1,3,5,2,14,14,14 15 | GP,M,15,U,GT3,T,4,3,teacher,other,course,mother,2,2,0,no,yes,yes,no,yes,yes,yes,no,5,4,3,1,2,3,2,10,10,11 16 | GP,M,15,U,GT3,A,2,2,other,other,home,other,1,3,0,no,yes,no,no,yes,yes,yes,yes,4,5,2,1,1,3,0,14,16,16 17 | GP,F,16,U,GT3,T,4,4,health,other,home,mother,1,1,0,no,yes,no,no,yes,yes,yes,no,4,4,4,1,2,2,4,14,14,14 18 | GP,F,16,U,GT3,T,4,4,services,services,reputation,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,no,3,2,3,1,2,2,6,13,14,14 19 | GP,F,16,U,GT3,T,3,3,other,other,reputation,mother,3,2,0,yes,yes,no,yes,yes,yes,no,no,5,3,2,1,1,4,4,8,10,10 20 | GP,M,17,U,GT3,T,3,2,services,services,course,mother,1,1,3,no,yes,no,yes,yes,yes,yes,no,5,5,5,2,4,5,16,6,5,5 21 | GP,M,16,U,LE3,T,4,3,health,other,home,father,1,1,0,no,no,yes,yes,yes,yes,yes,no,3,1,3,1,3,5,4,8,10,10 22 | GP,M,15,U,GT3,T,4,3,teacher,other,reputation,mother,1,2,0,no,no,no,no,yes,yes,yes,no,4,4,1,1,1,1,0,13,14,15 23 | GP,M,15,U,GT3,T,4,4,health,health,other,father,1,1,0,no,yes,yes,no,yes,yes,yes,no,5,4,2,1,1,5,0,12,15,15 24 | GP,M,16,U,LE3,T,4,2,teacher,other,course,mother,1,2,0,no,no,no,yes,yes,yes,yes,no,4,5,1,1,3,5,2,15,15,16 25 | GP,M,16,U,LE3,T,2,2,other,other,reputation,mother,2,2,0,no,yes,no,yes,yes,yes,yes,no,5,4,4,2,4,5,0,13,13,12 26 | GP,F,15,R,GT3,T,2,4,services,health,course,mother,1,3,0,yes,yes,yes,yes,yes,yes,yes,no,4,3,2,1,1,5,2,10,9,8 27 | GP,F,16,U,GT3,T,2,2,services,services,home,mother,1,1,2,no,yes,yes,no,no,yes,yes,no,1,2,2,1,3,5,14,6,9,8 28 | GP,M,15,U,GT3,T,2,2,other,other,home,mother,1,1,0,no,yes,yes,no,yes,yes,yes,no,4,2,2,1,2,5,2,12,12,11 29 | GP,M,15,U,GT3,T,4,2,health,services,other,mother,1,1,0,no,no,yes,no,yes,yes,yes,no,2,2,4,2,4,1,4,15,16,15 30 | GP,M,16,U,LE3,A,3,4,services,other,home,mother,1,2,0,yes,yes,no,yes,yes,yes,yes,no,5,3,3,1,1,5,4,11,11,11 31 | GP,M,16,U,GT3,T,4,4,teacher,teacher,home,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,yes,4,4,5,5,5,5,16,10,12,11 32 | GP,M,15,U,GT3,T,4,4,health,services,home,mother,1,2,0,no,yes,yes,no,no,yes,yes,no,5,4,2,3,4,5,0,9,11,12 33 | GP,M,15,U,GT3,T,4,4,services,services,reputation,mother,2,2,0,no,yes,no,yes,yes,yes,yes,no,4,3,1,1,1,5,0,17,16,17 34 | GP,M,15,R,GT3,T,4,3,teacher,at_home,course,mother,1,2,0,no,yes,no,yes,yes,yes,yes,yes,4,5,2,1,1,5,0,17,16,16 35 | GP,M,15,U,LE3,T,3,3,other,other,course,mother,1,2,0,no,no,no,yes,no,yes,yes,no,5,3,2,1,1,2,0,8,10,12 36 | GP,M,16,U,GT3,T,3,2,other,other,home,mother,1,1,0,no,yes,yes,no,no,yes,yes,no,5,4,3,1,1,5,0,12,14,15 37 | GP,F,15,U,GT3,T,2,3,other,other,other,father,2,1,0,no,yes,no,yes,yes,yes,no,no,3,5,1,1,1,5,0,8,7,6 38 | GP,M,15,U,LE3,T,4,3,teacher,services,home,mother,1,3,0,no,yes,no,yes,yes,yes,yes,no,5,4,3,1,1,4,2,15,16,18 39 | GP,M,16,R,GT3,A,4,4,other,teacher,reputation,mother,2,3,0,no,yes,no,yes,yes,yes,yes,yes,2,4,3,1,1,5,7,15,16,15 40 | GP,F,15,R,GT3,T,3,4,services,health,course,mother,1,3,0,yes,yes,yes,yes,yes,yes,yes,no,4,3,2,1,1,5,2,12,12,11 41 | GP,F,15,R,GT3,T,2,2,at_home,other,reputation,mother,1,1,0,yes,yes,yes,yes,yes,yes,no,no,4,3,1,1,1,2,8,14,13,13 42 | GP,F,16,U,LE3,T,2,2,other,other,home,mother,2,2,1,no,yes,no,yes,no,yes,yes,yes,3,3,3,1,2,3,25,7,10,11 43 | GP,M,15,U,LE3,T,4,4,teacher,other,home,other,1,1,0,no,yes,no,no,no,yes,yes,yes,5,4,3,2,4,5,8,12,12,12 44 | GP,M,15,U,GT3,T,4,4,services,teacher,course,father,1,2,0,no,yes,no,yes,yes,yes,yes,no,4,3,3,1,1,5,2,19,18,18 45 | GP,M,15,U,GT3,T,2,2,services,services,course,father,1,1,0,yes,yes,no,no,yes,yes,yes,no,5,4,1,1,1,1,0,8,8,11 46 | GP,F,16,U,LE3,T,2,2,other,at_home,course,father,2,2,1,yes,no,no,yes,yes,yes,yes,no,4,3,3,2,2,5,14,10,10,9 47 | GP,F,15,U,LE3,A,4,3,other,other,course,mother,1,2,0,yes,yes,yes,yes,yes,yes,yes,yes,5,2,2,1,1,5,8,8,8,6 48 | GP,F,16,U,LE3,A,3,3,other,services,home,mother,1,2,0,no,yes,no,no,yes,yes,yes,no,2,3,5,1,4,3,12,11,12,11 49 | GP,M,16,U,GT3,T,4,3,health,services,reputation,mother,1,4,0,no,no,no,yes,yes,yes,yes,no,4,2,2,1,1,2,4,19,19,20 50 | GP,M,15,U,GT3,T,4,2,teacher,other,home,mother,1,2,0,no,yes,yes,no,yes,yes,no,no,4,3,3,2,2,5,2,15,15,14 51 | GP,F,15,U,GT3,T,4,4,services,teacher,other,father,1,2,1,yes,yes,no,yes,no,yes,yes,no,4,4,4,1,1,3,2,7,7,7 52 | GP,F,16,U,LE3,T,2,2,services,services,course,mother,3,2,0,no,yes,yes,no,yes,yes,yes,no,4,3,3,2,3,4,2,12,13,13 53 | GP,F,15,U,LE3,T,4,2,health,other,other,mother,1,2,0,no,yes,yes,no,yes,yes,yes,no,4,3,3,1,1,5,2,11,13,13 54 | GP,M,15,U,LE3,A,4,2,health,health,other,father,2,1,1,no,no,no,no,yes,yes,no,no,5,5,5,3,4,5,6,11,11,10 55 | GP,F,15,U,GT3,T,4,4,services,services,course,mother,1,1,0,yes,yes,yes,no,yes,yes,yes,no,3,3,4,2,3,5,0,8,10,11 56 | GP,F,15,U,LE3,A,3,3,other,other,other,mother,1,1,0,no,no,yes,no,yes,yes,yes,no,5,3,4,4,4,1,6,10,13,13 57 | GP,F,16,U,GT3,A,2,1,other,other,other,mother,1,2,0,no,no,yes,yes,yes,yes,yes,yes,5,3,4,1,1,2,8,8,9,10 58 | GP,F,15,U,GT3,A,4,3,services,services,reputation,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,no,4,3,2,1,1,1,0,14,15,15 59 | GP,M,15,U,GT3,T,4,4,teacher,health,reputation,mother,1,2,0,no,yes,no,yes,yes,yes,no,no,3,2,2,1,1,5,4,14,15,15 60 | GP,M,15,U,LE3,T,1,2,other,at_home,home,father,1,2,0,yes,yes,no,yes,yes,yes,yes,no,4,3,2,1,1,5,2,9,10,9 61 | GP,F,16,U,GT3,T,4,2,services,other,course,mother,1,2,0,no,yes,no,no,yes,yes,yes,no,4,2,3,1,1,5,2,15,16,16 62 | GP,F,16,R,GT3,T,4,4,health,teacher,other,mother,1,2,0,no,yes,no,yes,yes,yes,no,no,2,4,4,2,3,4,6,10,11,11 63 | GP,F,16,U,GT3,T,1,1,services,services,course,father,4,1,0,yes,yes,no,yes,no,yes,yes,yes,5,5,5,5,5,5,6,10,8,11 64 | GP,F,16,U,LE3,T,1,2,other,services,reputation,father,1,2,0,yes,no,no,yes,yes,yes,yes,no,4,4,3,1,1,1,4,8,10,9 65 | GP,F,16,U,GT3,T,4,3,teacher,health,home,mother,1,3,0,yes,yes,yes,yes,yes,yes,yes,no,3,4,4,2,4,4,2,10,9,9 66 | GP,F,15,U,LE3,T,4,3,services,services,reputation,father,1,2,0,yes,no,no,yes,yes,yes,yes,yes,4,4,4,2,4,2,0,10,10,10 67 | GP,F,16,U,LE3,T,4,3,teacher,services,course,mother,3,2,0,no,yes,no,yes,yes,yes,yes,no,5,4,3,1,2,1,2,16,15,15 68 | GP,M,15,U,GT3,A,4,4,other,services,reputation,mother,1,4,0,no,yes,no,yes,no,yes,yes,yes,1,3,3,5,5,3,4,13,13,12 69 | GP,F,16,U,GT3,T,3,1,services,other,course,mother,1,4,0,yes,yes,yes,no,yes,yes,yes,no,4,3,3,1,2,5,4,7,7,6 70 | GP,F,15,R,LE3,T,2,2,health,services,reputation,mother,2,2,0,yes,yes,yes,no,yes,yes,yes,no,4,1,3,1,3,4,2,8,9,8 71 | GP,F,15,R,LE3,T,3,1,other,other,reputation,father,2,4,0,no,yes,no,no,no,yes,yes,no,4,4,2,2,3,3,12,16,16,16 72 | GP,M,16,U,GT3,T,3,1,other,other,reputation,father,2,4,0,no,yes,yes,no,yes,yes,yes,no,4,3,2,1,1,5,0,13,15,15 73 | GP,M,15,U,GT3,T,4,2,other,other,course,mother,1,4,0,no,no,no,no,yes,yes,yes,no,3,3,3,1,1,3,0,10,10,10 74 | GP,F,15,R,GT3,T,1,1,other,other,reputation,mother,1,2,2,yes,yes,no,no,no,yes,yes,yes,3,3,4,2,4,5,2,8,6,5 75 | GP,M,16,U,GT3,T,3,1,other,other,reputation,mother,1,1,0,no,no,no,yes,yes,yes,no,no,5,3,2,2,2,5,2,12,12,14 76 | GP,F,16,U,GT3,T,3,3,other,services,home,mother,1,2,0,yes,yes,yes,yes,yes,yes,yes,no,4,3,3,2,4,5,54,11,12,11 77 | GP,M,15,U,GT3,T,4,3,teacher,other,home,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,no,4,3,3,2,3,5,6,9,9,10 78 | GP,M,15,U,GT3,T,4,0,teacher,other,course,mother,2,4,0,no,no,no,yes,yes,yes,yes,no,3,4,3,1,1,1,8,11,11,10 79 | GP,F,16,U,GT3,T,2,2,other,other,reputation,mother,1,4,0,no,no,yes,no,yes,yes,yes,yes,5,2,3,1,3,3,0,11,11,11 80 | GP,M,17,U,GT3,T,2,1,other,other,home,mother,2,1,3,yes,yes,no,yes,yes,no,yes,no,4,5,1,1,1,3,2,8,8,10 81 | GP,F,16,U,GT3,T,3,4,at_home,other,course,mother,1,2,0,no,yes,no,no,yes,yes,yes,no,2,4,3,1,2,3,12,5,5,5 82 | GP,M,15,U,GT3,T,2,3,other,services,course,father,1,1,0,yes,yes,yes,yes,no,yes,yes,yes,3,2,2,1,3,3,2,10,12,12 83 | GP,M,15,U,GT3,T,2,3,other,other,home,mother,1,3,0,yes,no,yes,no,no,yes,yes,no,5,3,2,1,2,5,4,11,10,11 84 | GP,F,15,U,LE3,T,3,2,services,other,reputation,mother,1,2,0,no,yes,yes,no,yes,yes,yes,no,4,4,4,1,1,5,10,7,6,6 85 | GP,M,15,U,LE3,T,2,2,services,services,home,mother,2,2,0,no,no,yes,yes,yes,yes,yes,no,5,3,3,1,3,4,4,15,15,15 86 | GP,F,15,U,GT3,T,1,1,other,other,home,father,1,2,0,no,yes,no,yes,no,yes,yes,no,4,3,2,2,3,4,2,9,10,10 87 | GP,F,15,U,GT3,T,4,4,services,services,reputation,father,2,2,2,no,no,yes,no,yes,yes,yes,yes,4,4,4,2,3,5,6,7,9,8 88 | GP,F,16,U,LE3,T,2,2,at_home,other,course,mother,1,2,0,no,yes,no,no,yes,yes,no,no,4,3,4,1,2,2,4,8,7,6 89 | GP,F,15,U,GT3,T,4,2,other,other,reputation,mother,1,3,0,no,yes,no,yes,yes,yes,yes,no,5,3,3,1,3,1,4,13,14,14 90 | GP,M,16,U,GT3,T,2,2,services,other,reputation,father,2,2,1,no,no,yes,yes,no,yes,yes,no,4,4,2,1,1,3,12,11,10,10 91 | GP,M,16,U,LE3,A,4,4,teacher,health,reputation,mother,1,2,0,no,yes,no,no,yes,yes,no,no,4,1,3,3,5,5,18,8,6,7 92 | GP,F,16,U,GT3,T,3,3,other,other,home,mother,1,3,0,no,yes,yes,no,yes,yes,yes,yes,4,3,3,1,3,4,0,7,7,8 93 | GP,F,15,U,GT3,T,4,3,services,other,reputation,mother,1,1,0,no,no,yes,yes,yes,yes,yes,no,4,5,5,1,3,1,4,16,17,18 94 | GP,F,16,U,LE3,T,3,1,other,other,home,father,1,2,0,yes,yes,no,no,yes,yes,no,no,3,3,3,2,3,2,4,7,6,6 95 | GP,F,16,U,GT3,T,4,2,teacher,services,home,mother,2,2,0,no,yes,yes,yes,yes,yes,yes,no,5,3,3,1,1,1,0,11,10,10 96 | GP,M,15,U,LE3,T,2,2,services,health,reputation,mother,1,4,0,no,yes,no,yes,yes,yes,yes,no,4,3,4,1,1,4,6,11,13,14 97 | GP,F,15,R,GT3,T,1,1,at_home,other,home,mother,2,4,1,yes,yes,yes,yes,yes,yes,yes,no,3,1,2,1,1,1,2,7,10,10 98 | GP,M,16,R,GT3,T,4,3,services,other,reputation,mother,2,1,0,yes,yes,no,yes,no,yes,yes,no,3,3,3,1,1,4,2,11,15,15 99 | GP,F,16,U,GT3,T,2,1,other,other,course,mother,1,2,0,no,yes,yes,no,yes,yes,no,yes,4,3,5,1,1,5,2,8,9,10 100 | GP,F,16,U,GT3,T,4,4,other,other,reputation,mother,1,1,0,no,no,no,yes,no,yes,yes,no,5,3,4,1,2,1,6,11,14,14 101 | GP,F,16,U,GT3,T,4,3,other,at_home,course,mother,1,3,0,yes,yes,yes,no,yes,yes,yes,no,5,3,5,1,1,3,0,7,9,8 102 | GP,M,16,U,GT3,T,4,4,services,services,other,mother,1,1,0,yes,yes,yes,yes,yes,yes,yes,no,4,5,5,5,5,4,14,7,7,5 103 | GP,M,16,U,GT3,T,4,4,services,teacher,other,father,1,3,0,no,yes,no,yes,yes,yes,yes,yes,4,4,3,1,1,4,0,16,17,17 104 | GP,M,15,U,GT3,T,4,4,services,other,course,mother,1,1,0,no,yes,no,yes,no,yes,yes,no,5,3,3,1,1,5,4,10,13,14 105 | GP,F,15,U,GT3,T,3,2,services,other,home,mother,2,2,0,yes,yes,yes,no,yes,yes,yes,no,4,3,5,1,1,2,26,7,6,6 106 | GP,M,15,U,GT3,A,3,4,services,other,course,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,no,5,4,4,1,1,1,0,16,18,18 107 | GP,F,15,U,GT3,A,3,3,other,health,reputation,father,1,4,0,yes,no,no,no,yes,yes,no,no,4,3,3,1,1,4,10,10,11,11 108 | GP,F,15,U,GT3,T,2,2,other,other,course,mother,1,4,0,yes,yes,yes,no,yes,yes,yes,no,5,1,2,1,1,3,8,7,8,8 109 | GP,M,16,U,GT3,T,3,3,services,other,home,father,1,3,0,no,yes,no,yes,yes,yes,yes,no,5,3,3,1,1,5,2,16,18,18 110 | GP,M,15,R,GT3,T,4,4,other,other,home,father,4,4,0,no,yes,yes,yes,yes,yes,yes,yes,1,3,5,3,5,1,6,10,13,13 111 | GP,F,16,U,LE3,T,4,4,health,health,other,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,yes,5,4,5,1,1,4,4,14,15,16 112 | GP,M,15,U,LE3,A,4,4,teacher,teacher,course,mother,1,1,0,no,no,no,yes,yes,yes,yes,no,5,5,3,1,1,4,6,18,19,19 113 | GP,F,16,R,GT3,T,3,3,services,other,reputation,father,1,3,1,yes,yes,no,yes,yes,yes,yes,no,4,1,2,1,1,2,0,7,10,10 114 | GP,F,16,U,GT3,T,2,2,at_home,other,home,mother,1,2,1,yes,no,no,yes,yes,yes,yes,no,3,1,2,1,1,5,6,10,13,13 115 | GP,M,15,U,LE3,T,4,2,teacher,other,course,mother,1,1,0,no,no,no,no,yes,yes,yes,no,3,5,2,1,1,3,10,18,19,19 116 | GP,M,15,R,GT3,T,2,1,health,services,reputation,mother,1,2,0,no,no,no,yes,yes,yes,yes,yes,5,4,2,1,1,5,8,9,9,9 117 | GP,M,16,U,GT3,T,4,4,teacher,teacher,course,father,1,2,0,no,yes,no,yes,yes,yes,yes,no,5,4,4,1,2,5,2,15,15,16 118 | GP,M,15,U,GT3,T,4,4,other,teacher,reputation,father,2,2,0,no,yes,no,yes,yes,yes,no,no,4,4,3,1,1,2,2,11,13,14 119 | GP,M,16,U,GT3,T,3,3,other,services,home,father,2,1,0,no,no,no,yes,yes,yes,yes,no,5,4,2,1,1,5,0,13,14,13 120 | GP,M,17,R,GT3,T,1,3,other,other,course,father,3,2,1,no,yes,no,yes,yes,yes,yes,no,5,2,4,1,4,5,20,9,7,8 121 | GP,M,15,U,GT3,T,3,4,other,other,reputation,father,1,1,0,no,no,no,no,yes,yes,yes,no,3,4,3,1,2,4,6,14,13,13 122 | GP,F,15,U,GT3,T,1,2,at_home,services,course,mother,1,2,0,no,no,no,no,no,yes,yes,no,3,2,3,1,2,1,2,16,15,15 123 | GP,M,15,U,GT3,T,2,2,services,services,home,father,1,4,0,no,yes,yes,yes,yes,yes,yes,no,5,5,4,1,2,5,6,16,14,15 124 | GP,F,16,U,LE3,T,2,4,other,health,course,father,2,2,0,no,yes,yes,yes,yes,yes,yes,yes,4,2,2,1,2,5,2,13,13,13 125 | GP,M,16,U,GT3,T,4,4,health,other,course,mother,1,1,0,no,yes,no,yes,yes,yes,yes,no,3,4,4,1,4,5,18,14,11,13 126 | GP,F,16,U,GT3,T,2,2,other,other,home,mother,1,2,0,no,no,yes,no,yes,yes,yes,yes,5,4,4,1,1,5,0,8,7,8 127 | GP,M,15,U,GT3,T,3,4,services,services,home,father,1,1,0,yes,no,no,no,yes,yes,yes,no,5,5,5,3,2,5,0,13,13,12 128 | GP,F,15,U,LE3,A,3,4,other,other,home,mother,1,2,0,yes,no,no,yes,yes,yes,yes,yes,5,3,2,1,1,1,0,7,10,11 129 | GP,F,19,U,GT3,T,0,1,at_home,other,course,other,1,2,3,no,yes,no,no,no,no,no,no,3,4,2,1,1,5,2,7,8,9 130 | GP,M,18,R,GT3,T,2,2,services,other,reputation,mother,1,1,2,no,yes,no,yes,yes,yes,yes,no,3,3,3,1,2,4,0,7,4,0 131 | GP,M,16,R,GT3,T,4,4,teacher,teacher,course,mother,1,1,0,no,no,yes,yes,yes,yes,yes,no,3,5,5,2,5,4,8,18,18,18 132 | GP,F,15,R,GT3,T,3,4,services,teacher,course,father,2,3,2,no,yes,no,no,yes,yes,yes,yes,4,2,2,2,2,5,0,12,0,0 133 | GP,F,15,U,GT3,T,1,1,at_home,other,course,mother,3,1,0,no,yes,no,yes,no,yes,yes,yes,4,3,3,1,2,4,0,8,0,0 134 | GP,F,17,U,LE3,T,2,2,other,other,course,father,1,1,0,no,yes,no,no,yes,yes,yes,yes,3,4,4,1,3,5,12,10,13,12 135 | GP,F,16,U,GT3,A,3,4,services,other,course,father,1,1,0,no,no,no,no,yes,yes,yes,no,3,2,1,1,4,5,16,12,11,11 136 | GP,M,15,R,GT3,T,3,4,at_home,teacher,course,mother,4,2,0,no,yes,no,no,yes,yes,no,yes,5,3,3,1,1,5,0,9,0,0 137 | GP,F,15,U,GT3,T,4,4,services,at_home,course,mother,1,3,0,no,yes,no,yes,yes,yes,yes,yes,4,3,3,1,1,5,0,11,0,0 138 | GP,M,17,R,GT3,T,3,4,at_home,other,course,mother,3,2,0,no,no,no,no,yes,yes,no,no,5,4,5,2,4,5,0,10,0,0 139 | GP,F,16,U,GT3,A,3,3,other,other,course,other,2,1,2,no,yes,no,yes,no,yes,yes,yes,4,3,2,1,1,5,0,4,0,0 140 | GP,M,16,U,LE3,T,1,1,services,other,course,mother,1,2,1,no,no,no,no,yes,yes,no,yes,4,4,4,1,3,5,0,14,12,12 141 | GP,F,15,U,GT3,T,4,4,teacher,teacher,course,mother,2,1,0,no,no,no,yes,yes,yes,yes,no,4,3,2,1,1,5,0,16,16,15 142 | GP,M,15,U,GT3,T,4,3,teacher,services,course,father,2,4,0,yes,yes,no,no,yes,yes,yes,no,2,2,2,1,1,3,0,7,9,0 143 | GP,M,16,U,LE3,T,2,2,services,services,reputation,father,2,1,2,no,yes,no,yes,yes,yes,yes,no,2,3,3,2,2,2,8,9,9,9 144 | GP,F,15,U,GT3,T,4,4,teacher,services,course,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,no,4,2,2,1,1,5,2,9,11,11 145 | GP,F,16,U,LE3,T,1,1,at_home,at_home,course,mother,1,1,0,no,no,no,no,yes,yes,yes,no,3,4,4,3,3,1,2,14,14,13 146 | GP,M,17,U,GT3,T,2,1,other,other,home,mother,1,1,3,no,yes,no,no,yes,yes,yes,no,5,4,5,1,2,5,0,5,0,0 147 | GP,F,15,U,GT3,T,1,1,other,services,course,father,1,2,0,no,yes,yes,no,yes,yes,yes,no,4,4,2,1,2,5,0,8,11,11 148 | GP,F,15,U,GT3,T,3,2,health,services,home,father,1,2,3,no,yes,no,no,yes,yes,yes,no,3,3,2,1,1,3,0,6,7,0 149 | GP,F,15,U,GT3,T,1,2,at_home,other,course,mother,1,2,0,no,yes,yes,no,no,yes,yes,no,4,3,2,1,1,5,2,10,11,11 150 | GP,M,16,U,GT3,T,4,4,teacher,teacher,course,mother,1,1,0,no,yes,no,no,yes,no,yes,yes,3,3,2,2,1,5,0,7,6,0 151 | GP,M,15,U,LE3,A,2,1,services,other,course,mother,4,1,3,no,no,no,no,yes,yes,yes,no,4,5,5,2,5,5,0,8,9,10 152 | GP,M,18,U,LE3,T,1,1,other,other,course,mother,1,1,3,no,no,no,no,yes,no,yes,yes,2,3,5,2,5,4,0,6,5,0 153 | GP,M,16,U,LE3,T,2,1,at_home,other,course,mother,1,1,1,no,no,no,yes,yes,yes,no,yes,4,4,4,3,5,5,6,12,13,14 154 | GP,F,15,R,GT3,T,3,3,services,services,reputation,other,2,3,2,no,yes,yes,yes,yes,yes,yes,yes,4,2,1,2,3,3,8,10,10,10 155 | GP,M,19,U,GT3,T,3,2,services,at_home,home,mother,1,1,3,no,yes,no,no,yes,no,yes,yes,4,5,4,1,1,4,0,5,0,0 156 | GP,F,17,U,GT3,T,4,4,other,teacher,course,mother,1,1,0,yes,yes,no,no,yes,yes,no,yes,4,2,1,1,1,4,0,11,11,12 157 | GP,M,15,R,GT3,T,2,3,at_home,services,course,mother,1,2,0,yes,no,yes,yes,yes,yes,no,no,4,4,4,1,1,1,2,11,8,8 158 | GP,M,17,R,LE3,T,1,2,other,other,reputation,mother,1,1,0,no,no,no,no,yes,yes,no,no,2,2,2,3,3,5,8,16,12,13 159 | GP,F,18,R,GT3,T,1,1,at_home,other,course,mother,3,1,3,no,yes,no,yes,no,yes,no,no,5,2,5,1,5,4,6,9,8,10 160 | GP,M,16,R,GT3,T,2,2,at_home,other,course,mother,3,1,0,no,no,no,no,no,yes,no,no,4,2,2,1,2,3,2,17,15,15 161 | GP,M,16,U,GT3,T,3,3,other,services,course,father,1,2,1,no,yes,yes,no,yes,yes,yes,yes,4,5,5,4,4,5,4,10,12,12 162 | GP,M,17,R,LE3,T,2,1,at_home,other,course,mother,2,1,2,no,no,no,yes,yes,no,yes,yes,3,3,2,2,2,5,0,7,6,0 163 | GP,M,15,R,GT3,T,3,2,other,other,course,mother,2,2,2,yes,yes,no,no,yes,yes,yes,yes,4,4,4,1,4,3,6,5,9,7 164 | GP,M,16,U,LE3,T,1,2,other,other,course,mother,2,1,1,no,no,no,yes,yes,yes,no,no,4,4,4,2,4,5,0,7,0,0 165 | GP,M,17,U,GT3,T,1,3,at_home,services,course,father,1,1,0,no,no,no,no,yes,no,yes,no,5,3,3,1,4,2,2,10,10,10 166 | GP,M,17,R,LE3,T,1,1,other,services,course,mother,4,2,3,no,no,no,yes,yes,no,no,yes,5,3,5,1,5,5,0,5,8,7 167 | GP,M,16,U,GT3,T,3,2,services,services,course,mother,2,1,1,no,yes,no,yes,no,no,no,no,4,5,2,1,1,2,16,12,11,12 168 | GP,M,16,U,GT3,T,2,2,other,other,course,father,1,2,0,no,no,no,no,yes,no,yes,no,4,3,5,2,4,4,4,10,10,10 169 | GP,F,16,U,GT3,T,4,2,health,services,home,father,1,2,0,no,no,yes,no,yes,yes,yes,yes,4,2,3,1,1,3,0,14,15,16 170 | GP,F,16,U,GT3,T,2,2,other,other,home,mother,1,2,0,no,yes,yes,no,no,yes,yes,no,5,1,5,1,1,4,0,6,7,0 171 | GP,F,16,U,GT3,T,4,4,health,health,reputation,mother,1,2,0,no,yes,yes,no,yes,yes,yes,yes,4,4,2,1,1,3,0,14,14,14 172 | GP,M,16,U,GT3,T,3,4,other,other,course,father,3,1,2,no,yes,no,yes,no,yes,yes,no,3,4,5,2,4,2,0,6,5,0 173 | GP,M,16,U,GT3,T,1,0,other,other,reputation,mother,2,2,0,no,yes,yes,yes,yes,yes,yes,yes,4,3,2,1,1,3,2,13,15,16 174 | GP,M,17,U,LE3,T,4,4,teacher,other,reputation,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,no,4,4,4,1,3,5,0,13,11,10 175 | GP,F,16,U,GT3,T,1,3,at_home,services,home,mother,1,2,3,no,no,no,yes,no,yes,yes,yes,4,3,5,1,1,3,0,8,7,0 176 | GP,F,16,U,LE3,T,3,3,other,other,reputation,mother,2,2,0,no,yes,yes,yes,yes,yes,yes,no,4,4,5,1,1,4,4,10,11,9 177 | GP,M,17,U,LE3,T,4,3,teacher,other,course,mother,2,2,0,no,no,yes,yes,yes,yes,yes,no,4,4,4,4,4,4,4,10,9,9 178 | GP,F,16,U,GT3,T,2,2,services,other,reputation,mother,2,2,0,no,no,yes,yes,no,yes,yes,no,3,4,4,1,4,5,2,13,13,11 179 | GP,M,17,U,GT3,T,3,3,other,other,reputation,father,1,2,0,no,no,no,yes,no,yes,yes,no,4,3,4,1,4,4,4,6,5,6 180 | GP,M,16,R,GT3,T,4,2,teacher,services,other,mother,1,1,0,no,yes,no,yes,yes,yes,yes,yes,4,3,3,3,4,3,10,10,8,9 181 | GP,M,17,U,GT3,T,4,3,other,other,course,mother,1,2,0,no,yes,no,yes,yes,yes,yes,yes,5,2,3,1,1,2,4,10,10,11 182 | GP,M,16,U,GT3,T,4,3,teacher,other,home,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,no,3,4,3,2,3,3,10,9,8,8 183 | GP,M,16,U,GT3,T,3,3,services,other,home,mother,1,2,0,no,no,yes,yes,yes,yes,yes,yes,4,2,3,1,2,3,2,12,13,12 184 | GP,F,17,U,GT3,T,2,4,services,services,reputation,father,1,2,0,no,yes,no,yes,yes,yes,no,no,5,4,2,2,3,5,0,16,17,17 185 | GP,F,17,U,LE3,T,3,3,other,other,reputation,mother,1,2,0,no,yes,no,yes,yes,yes,yes,yes,5,3,3,2,3,1,56,9,9,8 186 | GP,F,16,U,GT3,T,3,2,other,other,reputation,mother,1,2,0,no,yes,yes,no,yes,yes,yes,no,1,2,2,1,2,1,14,12,13,12 187 | GP,M,17,U,GT3,T,3,3,services,services,other,mother,1,2,0,no,yes,no,yes,yes,yes,yes,yes,4,3,4,2,3,4,12,12,12,11 188 | GP,M,16,U,GT3,T,1,2,services,services,other,mother,1,1,0,no,yes,yes,yes,yes,yes,yes,yes,3,3,3,1,2,3,2,11,12,11 189 | GP,M,16,U,LE3,T,2,1,other,other,course,mother,1,2,0,no,no,yes,yes,yes,yes,yes,yes,4,2,3,1,2,5,0,15,15,15 190 | GP,F,17,U,GT3,A,3,3,health,other,reputation,mother,1,2,0,no,yes,no,no,no,yes,yes,yes,3,3,3,1,3,3,6,8,7,9 191 | GP,M,17,R,GT3,T,1,2,at_home,other,home,mother,1,2,0,no,no,no,no,yes,yes,no,no,3,1,3,1,5,3,4,8,9,10 192 | GP,F,16,U,GT3,T,2,3,services,services,course,mother,1,2,0,no,no,no,no,yes,yes,yes,no,4,3,3,1,1,2,10,11,12,13 193 | GP,F,17,U,GT3,T,1,1,at_home,services,course,mother,1,2,0,no,no,no,yes,yes,yes,yes,no,5,3,3,1,1,3,0,8,8,9 194 | GP,M,17,U,GT3,T,1,2,at_home,services,other,other,2,2,0,no,no,yes,yes,no,yes,yes,no,4,4,4,4,5,5,12,7,8,8 195 | GP,M,16,R,GT3,T,3,3,services,services,reputation,mother,1,1,0,no,yes,no,yes,yes,yes,yes,no,4,3,2,3,4,5,8,8,9,10 196 | GP,M,16,U,GT3,T,2,3,other,other,home,father,2,1,0,no,no,no,no,yes,yes,yes,no,5,3,3,1,1,3,0,13,14,14 197 | GP,F,17,U,LE3,T,2,4,services,services,course,father,1,2,0,no,no,no,yes,yes,yes,yes,yes,4,3,2,1,1,5,0,14,15,15 198 | GP,M,17,U,GT3,T,4,4,services,teacher,home,mother,1,1,0,no,no,no,no,yes,yes,yes,no,5,2,3,1,2,5,4,17,15,16 199 | GP,M,16,R,LE3,T,3,3,teacher,other,home,father,3,1,0,no,yes,yes,yes,yes,yes,yes,no,3,3,4,3,5,3,8,9,9,10 200 | GP,F,17,U,GT3,T,4,4,services,teacher,home,mother,2,1,1,no,yes,no,no,yes,yes,yes,no,4,2,4,2,3,2,24,18,18,18 201 | GP,F,16,U,LE3,T,4,4,teacher,teacher,reputation,mother,1,2,0,no,yes,yes,no,yes,yes,yes,no,4,5,2,1,2,3,0,9,9,10 202 | GP,F,16,U,GT3,T,4,3,health,other,home,mother,1,2,0,no,yes,no,yes,yes,yes,yes,no,4,3,5,1,5,2,2,16,16,16 203 | GP,F,16,U,GT3,T,2,3,other,other,reputation,mother,1,2,0,yes,yes,yes,yes,yes,yes,no,no,4,4,3,1,3,4,6,8,10,10 204 | GP,F,17,U,GT3,T,1,1,other,other,course,mother,1,2,0,no,yes,yes,no,no,yes,no,no,4,4,4,1,3,1,4,9,9,10 205 | GP,F,17,R,GT3,T,2,2,other,other,reputation,mother,1,1,0,no,yes,no,no,yes,yes,yes,no,5,3,2,1,2,3,18,7,6,6 206 | GP,F,16,R,GT3,T,2,2,services,services,reputation,mother,2,4,0,no,yes,yes,yes,no,yes,yes,no,5,3,5,1,1,5,6,10,10,11 207 | GP,F,17,U,GT3,T,3,4,at_home,services,home,mother,1,3,1,no,yes,yes,no,yes,yes,yes,yes,4,4,3,3,4,5,28,10,9,9 208 | GP,F,16,U,GT3,A,3,1,services,other,course,mother,1,2,3,no,yes,yes,no,yes,yes,yes,no,2,3,3,2,2,4,5,7,7,7 209 | GP,F,16,U,GT3,T,4,3,teacher,other,other,mother,1,2,0,no,no,yes,yes,yes,yes,yes,yes,1,3,2,1,1,1,10,11,12,13 210 | GP,F,16,U,GT3,T,1,1,at_home,other,home,mother,2,1,0,no,yes,yes,no,yes,yes,no,no,4,3,2,1,4,5,6,9,9,10 211 | GP,F,17,R,GT3,T,4,3,teacher,other,reputation,mother,2,3,0,no,yes,yes,yes,yes,yes,yes,yes,4,4,2,1,1,4,6,7,7,7 212 | GP,F,19,U,GT3,T,3,3,other,other,reputation,other,1,4,0,no,yes,yes,yes,yes,yes,yes,no,4,3,3,1,2,3,10,8,8,8 213 | GP,M,17,U,LE3,T,4,4,services,other,home,mother,1,2,0,no,yes,yes,no,yes,yes,yes,yes,5,3,5,4,5,3,13,12,12,13 214 | GP,F,16,U,GT3,A,2,2,other,other,reputation,mother,1,2,0,yes,yes,yes,no,yes,yes,yes,no,3,3,4,1,1,4,0,12,13,14 215 | GP,M,18,U,GT3,T,2,2,services,other,home,mother,1,2,1,no,yes,yes,yes,yes,yes,yes,no,4,4,4,2,4,5,15,6,7,8 216 | GP,F,17,R,LE3,T,4,4,services,other,other,mother,1,1,0,no,yes,yes,no,yes,yes,no,no,5,2,1,1,2,3,12,8,10,10 217 | GP,F,17,U,LE3,T,3,2,other,other,reputation,mother,2,2,0,no,no,yes,no,yes,yes,yes,no,4,4,4,1,3,1,2,14,15,15 218 | GP,F,17,U,GT3,T,4,3,other,other,reputation,mother,1,2,2,no,no,yes,no,yes,yes,yes,yes,3,4,5,2,4,1,22,6,6,4 219 | GP,M,18,U,LE3,T,3,3,services,health,home,father,1,2,1,no,yes,yes,no,yes,yes,yes,no,3,2,4,2,4,4,13,6,6,8 220 | GP,F,17,U,GT3,T,2,3,at_home,other,home,father,2,1,0,no,yes,yes,no,yes,yes,no,no,3,3,3,1,4,3,3,7,7,8 221 | GP,F,17,U,GT3,T,2,2,at_home,at_home,course,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,no,4,3,3,1,1,4,4,9,10,10 222 | GP,F,17,R,GT3,T,2,1,at_home,services,reputation,mother,2,2,0,no,yes,no,yes,yes,yes,yes,no,4,2,5,1,2,5,2,6,6,6 223 | GP,F,17,U,GT3,T,1,1,at_home,other,reputation,mother,1,3,1,no,yes,no,yes,yes,yes,no,yes,4,3,4,1,1,5,0,6,5,0 224 | GP,F,16,U,GT3,T,2,3,services,teacher,other,mother,1,2,0,yes,no,no,no,yes,yes,yes,no,2,3,1,1,1,3,2,16,16,17 225 | GP,M,18,U,GT3,T,2,2,other,other,home,mother,2,2,0,no,yes,yes,no,yes,yes,yes,no,3,3,3,5,5,4,0,12,13,13 226 | GP,F,16,U,GT3,T,4,4,teacher,services,home,mother,1,3,0,no,yes,no,yes,no,yes,yes,no,5,3,2,1,1,5,0,13,13,14 227 | GP,F,18,R,GT3,T,3,1,other,other,reputation,mother,1,2,1,no,no,no,yes,yes,yes,yes,yes,5,3,3,1,1,4,16,9,8,7 228 | GP,F,17,U,GT3,T,3,2,other,other,course,mother,1,2,0,no,no,no,yes,no,yes,yes,no,5,3,4,1,3,3,10,16,15,15 229 | GP,M,17,U,LE3,T,2,3,services,services,reputation,father,1,2,0,no,yes,yes,no,no,yes,yes,no,5,3,3,1,3,3,2,12,11,12 230 | GP,M,18,U,LE3,T,2,1,at_home,other,course,mother,4,2,0,yes,yes,yes,yes,yes,yes,yes,yes,4,3,2,4,5,3,14,10,8,9 231 | GP,F,17,U,GT3,A,2,1,other,other,course,mother,2,3,0,no,no,no,yes,yes,yes,yes,yes,3,2,3,1,2,3,10,12,10,12 232 | GP,F,17,U,LE3,T,4,3,health,other,reputation,father,1,2,0,no,no,no,yes,yes,yes,yes,yes,3,2,3,1,2,3,14,13,13,14 233 | GP,M,17,R,GT3,T,2,2,other,other,course,father,2,2,0,no,yes,yes,yes,yes,yes,yes,no,4,5,2,1,1,1,4,11,11,11 234 | GP,M,17,U,GT3,T,4,4,teacher,teacher,reputation,mother,1,2,0,yes,yes,no,yes,yes,yes,yes,yes,4,5,5,1,3,2,14,11,9,9 235 | GP,M,16,U,GT3,T,4,4,health,other,reputation,father,1,2,0,no,yes,yes,yes,yes,yes,yes,no,4,2,4,2,4,1,2,14,13,13 236 | GP,M,16,U,LE3,T,1,1,other,other,home,mother,2,2,0,no,yes,yes,no,yes,yes,yes,no,3,4,2,1,1,5,18,9,7,6 237 | GP,M,16,U,GT3,T,3,2,at_home,other,reputation,mother,2,3,0,no,no,no,yes,yes,yes,yes,yes,5,3,3,1,3,2,10,11,9,10 238 | GP,M,17,U,LE3,T,2,2,other,other,home,father,1,2,0,no,no,yes,yes,no,yes,yes,yes,4,4,2,5,5,4,4,14,13,13 239 | GP,F,16,U,GT3,T,2,1,other,other,home,mother,1,1,0,no,no,no,no,yes,yes,yes,yes,4,5,2,1,1,5,20,13,12,12 240 | GP,F,17,R,GT3,T,2,1,at_home,services,course,mother,3,2,0,no,no,no,yes,yes,yes,no,no,2,1,1,1,1,3,2,13,11,11 241 | GP,M,18,U,GT3,T,2,2,other,services,reputation,father,1,2,1,no,no,no,no,yes,no,yes,no,5,5,4,3,5,2,0,7,7,0 242 | GP,M,17,U,LE3,T,4,3,health,other,course,mother,2,2,0,no,no,no,yes,yes,yes,yes,yes,2,5,5,1,4,5,14,12,12,12 243 | GP,M,17,R,LE3,A,4,4,teacher,other,course,mother,2,2,0,no,yes,yes,no,yes,yes,yes,no,3,3,3,2,3,4,2,10,11,12 244 | GP,M,16,U,LE3,T,4,3,teacher,other,course,mother,1,1,0,no,no,no,yes,no,yes,yes,no,5,4,5,1,1,3,0,6,0,0 245 | GP,M,16,U,GT3,T,4,4,services,services,course,mother,1,1,0,no,no,no,yes,yes,yes,yes,no,5,3,2,1,2,5,0,13,12,12 246 | GP,F,18,U,GT3,T,2,1,other,other,course,other,2,3,0,no,yes,yes,no,no,yes,yes,yes,4,4,4,1,1,3,0,7,0,0 247 | GP,M,16,U,GT3,T,2,1,other,other,course,mother,3,1,0,no,no,no,no,yes,yes,yes,no,4,3,3,1,1,4,6,18,18,18 248 | GP,M,17,U,GT3,T,2,3,other,other,course,father,2,1,0,no,no,no,no,yes,yes,yes,no,5,2,2,1,1,2,4,12,12,13 249 | GP,M,22,U,GT3,T,3,1,services,services,other,mother,1,1,3,no,no,no,no,no,no,yes,yes,5,4,5,5,5,1,16,6,8,8 250 | GP,M,18,R,LE3,T,3,3,other,services,course,mother,1,2,1,no,yes,no,no,yes,yes,yes,yes,4,3,3,1,3,5,8,3,5,5 251 | GP,M,16,U,GT3,T,0,2,other,other,other,mother,1,1,0,no,no,yes,no,no,yes,yes,no,4,3,2,2,4,5,0,13,15,15 252 | GP,M,18,U,GT3,T,3,2,services,other,course,mother,2,1,1,no,no,no,no,yes,no,yes,no,4,4,5,2,4,5,0,6,8,8 253 | GP,M,16,U,GT3,T,3,3,at_home,other,reputation,other,3,2,0,yes,yes,no,no,no,yes,yes,no,5,3,3,1,3,2,6,7,10,10 254 | GP,M,18,U,GT3,T,2,1,services,services,other,mother,1,1,1,no,no,no,no,no,no,yes,no,3,2,5,2,5,5,4,6,9,8 255 | GP,M,16,R,GT3,T,2,1,other,other,course,mother,2,1,0,no,no,no,yes,no,yes,no,no,3,3,2,1,3,3,0,8,9,8 256 | GP,M,17,R,GT3,T,2,1,other,other,course,mother,1,1,0,no,no,no,no,no,yes,yes,no,4,4,2,2,4,5,0,8,12,12 257 | GP,M,17,U,LE3,T,1,1,health,other,course,mother,2,1,1,no,yes,no,yes,yes,yes,yes,no,4,4,4,1,2,5,2,7,9,8 258 | GP,F,17,U,LE3,T,4,2,teacher,services,reputation,mother,1,4,0,no,yes,yes,yes,yes,yes,yes,no,4,2,3,1,1,4,6,14,12,13 259 | GP,M,19,U,LE3,A,4,3,services,at_home,reputation,mother,1,2,0,no,yes,no,no,yes,yes,yes,no,4,3,1,1,1,1,12,11,11,11 260 | GP,M,18,U,GT3,T,2,1,other,other,home,mother,1,2,0,no,no,no,yes,yes,yes,yes,no,5,2,4,1,2,4,8,15,14,14 261 | GP,F,17,U,LE3,T,2,2,services,services,course,father,1,4,0,no,no,yes,yes,yes,yes,yes,yes,3,4,1,1,1,2,0,10,9,0 262 | GP,F,18,U,GT3,T,4,3,services,other,home,father,1,2,0,no,yes,yes,no,yes,yes,yes,yes,3,1,2,1,3,2,21,17,18,18 263 | GP,M,18,U,GT3,T,4,3,teacher,other,course,mother,1,2,0,no,yes,yes,no,no,yes,yes,no,4,3,2,1,1,3,2,8,8,8 264 | GP,M,18,R,GT3,T,3,2,other,other,course,mother,1,3,0,no,no,no,yes,no,yes,no,no,5,3,2,1,1,3,1,13,12,12 265 | GP,F,17,U,GT3,T,3,3,other,other,home,mother,1,3,0,no,no,no,yes,no,yes,no,no,3,2,3,1,1,4,4,10,9,9 266 | GP,F,18,U,GT3,T,2,2,at_home,services,home,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,yes,4,3,3,1,1,3,0,9,10,0 267 | GP,M,18,R,LE3,A,3,4,other,other,reputation,mother,2,2,0,no,yes,yes,yes,yes,yes,yes,no,4,2,5,3,4,1,13,17,17,17 268 | GP,M,17,U,GT3,T,3,1,services,other,other,mother,1,2,0,no,no,yes,yes,yes,yes,yes,yes,5,4,4,3,4,5,2,9,9,10 269 | GP,F,18,R,GT3,T,4,4,teacher,other,reputation,mother,2,2,0,no,no,yes,yes,yes,yes,yes,no,4,3,4,2,2,4,8,12,10,11 270 | GP,M,18,U,GT3,T,4,2,health,other,reputation,father,1,2,0,no,yes,yes,yes,yes,yes,yes,yes,5,4,5,1,3,5,10,10,9,10 271 | GP,F,18,R,GT3,T,2,1,other,other,reputation,mother,2,2,0,no,yes,no,no,yes,no,yes,yes,4,3,5,1,2,3,0,6,0,0 272 | GP,F,19,U,GT3,T,3,3,other,services,home,other,1,2,2,no,yes,yes,yes,yes,yes,yes,no,4,3,5,3,3,5,15,9,9,9 273 | GP,F,18,U,GT3,T,2,3,other,services,reputation,father,1,4,0,no,yes,yes,yes,yes,yes,yes,yes,4,5,5,1,3,2,4,15,14,14 274 | GP,F,18,U,LE3,T,1,1,other,other,home,mother,2,2,0,no,yes,yes,no,no,yes,no,no,4,4,3,1,1,3,2,11,11,11 275 | GP,M,17,R,GT3,T,1,2,at_home,at_home,home,mother,1,2,0,no,yes,yes,yes,no,yes,no,yes,3,5,2,2,2,1,2,15,14,14 276 | GP,F,17,U,GT3,T,2,4,at_home,health,reputation,mother,2,2,0,no,yes,yes,no,yes,yes,yes,yes,4,3,3,1,1,1,2,10,10,10 277 | GP,F,17,U,LE3,T,2,2,services,other,course,mother,2,2,0,yes,yes,yes,no,yes,yes,yes,yes,4,4,4,2,3,5,6,12,12,12 278 | GP,F,18,R,GT3,A,3,2,other,services,home,mother,2,2,0,no,no,no,no,no,no,yes,yes,4,1,1,1,1,5,75,10,9,9 279 | GP,M,18,U,GT3,T,4,4,teacher,services,home,mother,2,1,0,no,no,yes,yes,yes,yes,yes,no,3,2,4,1,4,3,22,9,9,9 280 | GP,F,18,U,GT3,T,4,4,health,health,reputation,father,1,2,1,yes,yes,no,yes,yes,yes,yes,yes,2,4,4,1,1,4,15,9,8,8 281 | GP,M,18,U,LE3,T,4,3,teacher,services,course,mother,2,1,0,no,no,yes,yes,yes,yes,yes,no,4,2,3,1,2,1,8,10,11,10 282 | GP,M,17,U,LE3,A,4,1,services,other,home,mother,2,1,0,no,no,yes,yes,yes,yes,yes,yes,4,5,4,2,4,5,30,8,8,8 283 | GP,M,17,U,LE3,A,3,2,teacher,services,home,mother,1,1,1,no,no,no,no,yes,yes,yes,no,4,4,4,3,4,3,19,11,9,10 284 | GP,F,18,R,LE3,T,1,1,at_home,other,reputation,mother,2,4,0,no,yes,yes,yes,yes,yes,no,no,5,2,2,1,1,3,1,12,12,12 285 | GP,F,18,U,GT3,T,1,1,other,other,home,mother,2,2,0,yes,no,no,yes,yes,yes,yes,no,5,4,4,1,1,4,4,8,9,10 286 | GP,F,17,U,GT3,T,2,2,other,other,course,mother,1,2,0,no,yes,no,no,no,yes,yes,no,5,4,5,1,2,5,4,10,9,11 287 | GP,M,17,U,GT3,T,1,1,other,other,reputation,father,1,2,0,no,no,yes,no,no,yes,yes,no,4,3,3,1,2,4,2,12,10,11 288 | GP,F,18,U,GT3,T,2,2,at_home,at_home,other,mother,1,3,0,no,yes,yes,no,yes,yes,yes,no,4,3,3,1,2,2,5,18,18,19 289 | GP,F,17,U,GT3,T,1,1,services,teacher,reputation,mother,1,3,0,no,yes,yes,no,yes,yes,yes,no,4,3,3,1,1,3,6,13,12,12 290 | GP,M,18,U,GT3,T,2,1,services,services,reputation,mother,1,3,0,no,no,yes,yes,yes,yes,yes,no,4,2,4,1,3,2,6,15,14,14 291 | GP,M,18,U,LE3,A,4,4,teacher,teacher,reputation,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,no,5,4,3,1,1,2,9,15,13,15 292 | GP,M,18,U,GT3,T,4,2,teacher,other,home,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,yes,4,3,2,1,4,5,11,12,11,11 293 | GP,F,17,U,GT3,T,4,3,health,services,reputation,mother,1,3,0,no,yes,yes,no,yes,yes,yes,no,4,2,2,1,2,3,0,15,15,15 294 | GP,F,18,U,LE3,T,2,1,services,at_home,reputation,mother,1,2,1,no,no,no,no,yes,yes,yes,yes,5,4,3,1,1,5,12,12,12,13 295 | GP,F,17,R,LE3,T,3,1,services,other,reputation,mother,2,4,0,no,yes,yes,no,yes,yes,no,no,3,1,2,1,1,3,6,18,18,18 296 | GP,M,18,R,LE3,T,3,2,services,other,reputation,mother,2,3,0,no,yes,yes,yes,yes,yes,yes,no,5,4,2,1,1,4,8,14,13,14 297 | GP,M,17,U,GT3,T,3,3,health,other,home,mother,1,1,0,no,yes,yes,no,yes,yes,yes,no,4,4,3,1,3,5,4,14,12,11 298 | GP,F,19,U,GT3,T,4,4,health,other,reputation,other,2,2,0,no,yes,yes,yes,yes,yes,yes,no,2,3,4,2,3,2,0,10,9,0 299 | GP,F,18,U,LE3,T,4,3,other,other,home,other,2,2,0,no,yes,yes,no,yes,yes,yes,yes,4,4,5,1,2,2,10,10,8,8 300 | GP,F,18,U,GT3,T,4,3,other,other,reputation,father,1,4,0,no,yes,yes,no,yes,yes,yes,no,4,3,3,1,1,3,0,14,13,14 301 | GP,M,18,U,LE3,T,4,4,teacher,teacher,home,mother,1,1,0,no,yes,yes,no,yes,yes,yes,yes,1,4,2,2,2,1,5,16,15,16 302 | GP,F,18,U,LE3,A,4,4,health,other,home,mother,1,2,0,no,yes,no,no,yes,yes,yes,yes,4,2,4,1,1,4,14,12,10,11 303 | GP,M,17,U,LE3,T,4,4,other,teacher,home,father,2,1,0,no,no,yes,no,yes,yes,yes,no,4,1,1,2,2,5,0,11,11,10 304 | GP,F,17,U,GT3,T,4,2,other,other,reputation,mother,2,3,0,no,yes,yes,no,yes,yes,yes,no,4,3,3,1,1,3,0,15,12,14 305 | GP,F,17,U,GT3,T,3,2,health,health,reputation,father,1,4,0,no,yes,yes,yes,no,yes,yes,no,5,2,2,1,2,5,0,17,17,18 306 | GP,M,19,U,GT3,T,3,3,other,other,home,other,1,2,1,no,yes,no,yes,yes,yes,yes,yes,4,4,4,1,1,3,20,15,14,13 307 | GP,F,18,U,GT3,T,2,4,services,at_home,reputation,other,1,2,1,no,yes,yes,yes,yes,yes,yes,no,4,4,3,1,1,3,8,14,12,12 308 | GP,M,20,U,GT3,A,3,2,services,other,course,other,1,1,0,no,no,no,yes,yes,yes,no,no,5,5,3,1,1,5,0,17,18,18 309 | GP,M,19,U,GT3,T,4,4,teacher,services,reputation,other,2,1,1,no,yes,yes,no,yes,yes,yes,yes,4,3,4,1,1,4,38,8,9,8 310 | GP,M,19,R,GT3,T,3,3,other,services,reputation,father,1,2,1,no,no,no,yes,yes,yes,no,yes,4,5,3,1,2,5,0,15,12,12 311 | GP,F,19,U,LE3,T,1,1,at_home,other,reputation,other,1,2,1,yes,yes,no,yes,no,yes,yes,no,4,4,3,1,3,3,18,12,10,10 312 | GP,F,19,U,LE3,T,1,2,services,services,home,other,1,2,1,no,no,no,yes,no,yes,no,yes,4,2,4,2,2,3,0,9,9,0 313 | GP,F,19,U,GT3,T,2,1,at_home,other,other,other,3,2,0,no,yes,no,no,yes,no,yes,yes,3,4,1,1,1,2,20,14,12,13 314 | GP,M,19,U,GT3,T,1,2,other,services,course,other,1,2,1,no,no,no,no,no,yes,yes,no,4,5,2,2,2,4,3,13,11,11 315 | GP,F,19,U,LE3,T,3,2,services,other,reputation,other,2,2,1,no,yes,yes,no,no,yes,yes,yes,4,2,2,1,2,1,22,13,10,11 316 | GP,F,19,U,GT3,T,1,1,at_home,health,home,other,1,3,2,no,no,no,no,no,yes,yes,yes,4,1,2,1,1,3,14,15,13,13 317 | GP,F,19,R,GT3,T,2,3,other,other,reputation,other,1,3,1,no,no,no,no,yes,yes,yes,yes,4,1,2,1,1,3,40,13,11,11 318 | GP,F,18,U,GT3,T,2,1,services,other,course,mother,2,2,0,no,yes,yes,yes,yes,yes,yes,no,5,3,3,1,2,1,0,8,8,0 319 | GP,F,18,U,GT3,T,4,3,other,other,course,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,yes,4,3,4,1,1,5,9,9,10,9 320 | GP,F,17,R,GT3,T,3,4,at_home,services,course,father,1,3,0,no,yes,yes,yes,no,yes,yes,no,4,3,4,2,5,5,0,11,11,10 321 | GP,F,18,U,GT3,T,4,4,teacher,other,course,mother,1,2,0,no,yes,yes,no,yes,yes,yes,no,4,4,4,3,3,5,2,11,11,11 322 | GP,F,17,U,GT3,A,4,3,services,services,course,mother,1,2,0,no,yes,yes,no,yes,yes,yes,yes,5,2,2,1,2,5,23,13,13,13 323 | GP,F,17,U,GT3,T,2,2,other,other,course,mother,1,2,0,no,yes,no,no,yes,yes,no,yes,4,2,2,1,1,3,12,11,9,9 324 | GP,F,17,R,LE3,T,2,2,services,services,course,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,no,3,3,2,2,2,3,3,11,11,11 325 | GP,F,17,U,GT3,T,3,1,services,services,course,father,1,3,0,no,yes,no,no,no,yes,yes,no,3,4,3,2,3,5,1,12,14,15 326 | GP,F,17,U,LE3,T,0,2,at_home,at_home,home,father,2,3,0,no,no,no,no,yes,yes,yes,no,3,3,3,2,3,2,0,16,15,15 327 | GP,M,18,U,GT3,T,4,4,other,other,course,mother,1,3,0,no,no,no,yes,yes,yes,yes,no,4,3,3,2,2,3,3,9,12,11 328 | GP,M,17,U,GT3,T,3,3,other,services,reputation,mother,1,1,0,no,no,no,yes,no,yes,yes,no,4,3,5,3,5,5,3,14,15,16 329 | GP,M,17,R,GT3,T,2,2,services,other,course,mother,4,1,0,no,yes,no,no,yes,yes,yes,no,4,4,5,5,5,4,8,11,10,10 330 | GP,F,17,U,GT3,T,4,4,teacher,services,course,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,no,5,4,4,1,3,4,7,10,9,9 331 | GP,F,17,U,GT3,T,4,4,teacher,teacher,course,mother,2,3,0,no,yes,yes,no,no,yes,yes,yes,4,3,3,1,2,4,4,14,14,14 332 | GP,M,18,U,LE3,T,2,2,other,other,course,mother,1,4,0,no,yes,no,yes,yes,yes,yes,no,4,5,5,2,4,5,2,9,8,8 333 | GP,F,17,R,GT3,T,2,4,at_home,other,course,father,1,3,0,no,yes,no,no,yes,yes,yes,yes,4,4,3,1,1,5,7,12,14,14 334 | GP,F,18,U,GT3,T,3,3,services,services,home,mother,1,2,0,no,no,no,yes,yes,yes,yes,no,5,3,4,1,1,4,0,7,0,0 335 | GP,F,18,U,LE3,T,2,2,other,other,home,other,1,2,0,no,no,no,yes,no,yes,yes,yes,4,3,3,1,1,2,0,8,8,0 336 | GP,F,18,R,GT3,T,2,2,at_home,other,course,mother,2,4,0,no,no,no,yes,yes,yes,no,no,4,4,4,1,1,4,0,10,9,0 337 | GP,F,17,U,GT3,T,3,4,services,other,course,mother,1,3,0,no,no,no,no,yes,yes,yes,no,4,4,5,1,3,5,16,16,15,15 338 | GP,F,19,R,GT3,A,3,1,services,at_home,home,other,1,3,1,no,no,yes,no,yes,yes,no,no,5,4,3,1,2,5,12,14,13,13 339 | GP,F,17,U,GT3,T,3,2,other,other,home,mother,1,2,0,no,yes,yes,no,yes,yes,yes,yes,4,3,2,2,3,2,0,7,8,0 340 | GP,F,18,U,LE3,T,3,3,services,services,home,mother,1,4,0,no,yes,no,no,yes,yes,yes,no,5,3,3,1,1,1,7,16,15,17 341 | GP,F,17,R,GT3,A,3,2,other,other,home,mother,1,2,0,no,yes,yes,no,yes,yes,yes,no,4,3,3,2,3,2,4,9,10,10 342 | GP,F,19,U,GT3,T,2,1,services,services,home,other,1,3,1,no,no,yes,yes,yes,yes,yes,yes,4,3,4,1,3,3,4,11,12,11 343 | GP,M,18,U,GT3,T,4,4,teacher,services,home,father,1,2,1,no,yes,no,yes,yes,yes,yes,no,4,3,3,2,2,2,0,10,10,0 344 | GP,M,18,U,LE3,T,3,4,services,other,home,mother,1,2,0,no,no,no,yes,yes,yes,yes,yes,4,3,3,1,3,5,11,16,15,15 345 | GP,F,17,U,GT3,A,2,2,at_home,at_home,home,father,1,2,1,no,yes,no,no,yes,yes,yes,yes,3,3,1,1,2,4,0,9,8,0 346 | GP,F,18,U,GT3,T,2,3,at_home,other,course,mother,1,3,0,no,yes,no,no,yes,yes,yes,no,4,3,3,1,2,3,4,11,10,10 347 | GP,F,18,U,GT3,T,3,2,other,services,other,mother,1,3,0,no,no,no,no,yes,yes,yes,yes,5,4,3,2,3,1,7,13,13,14 348 | GP,M,18,R,GT3,T,4,3,teacher,services,course,mother,1,3,0,no,no,no,no,yes,yes,yes,yes,5,3,2,1,2,4,9,16,15,16 349 | GP,M,18,U,GT3,T,4,3,teacher,other,course,mother,1,3,0,no,yes,yes,no,yes,yes,yes,yes,5,4,5,2,3,5,0,10,10,9 350 | GP,F,17,U,GT3,T,4,3,health,other,reputation,mother,1,3,0,no,yes,yes,yes,yes,yes,yes,yes,4,4,3,1,3,4,0,13,15,15 351 | MS,M,18,R,GT3,T,3,2,other,other,course,mother,2,1,1,no,yes,no,no,no,yes,yes,no,2,5,5,5,5,5,10,11,13,13 352 | MS,M,19,R,GT3,T,1,1,other,services,home,other,3,2,3,no,no,no,no,yes,yes,yes,no,5,4,4,3,3,2,8,8,7,8 353 | MS,M,17,U,GT3,T,3,3,health,other,course,mother,2,2,0,no,yes,yes,no,yes,yes,yes,no,4,5,4,2,3,3,2,13,13,13 354 | MS,M,18,U,LE3,T,1,3,at_home,services,course,mother,1,1,1,no,no,no,no,yes,no,yes,yes,4,3,3,2,3,3,7,8,7,8 355 | MS,M,19,R,GT3,T,1,1,other,other,home,other,3,1,1,no,yes,no,no,yes,yes,yes,no,4,4,4,3,3,5,4,8,8,8 356 | MS,M,17,R,GT3,T,4,3,services,other,home,mother,2,2,0,no,yes,yes,yes,no,yes,yes,yes,4,5,5,1,3,2,4,13,11,11 357 | MS,F,18,U,GT3,T,3,3,services,services,course,father,1,2,0,no,yes,no,no,yes,yes,no,yes,5,3,4,1,1,5,0,10,9,9 358 | MS,F,17,R,GT3,T,4,4,teacher,services,other,father,2,2,0,no,yes,yes,yes,yes,yes,yes,no,4,3,3,1,2,5,4,12,13,13 359 | MS,F,17,U,LE3,A,3,2,services,other,reputation,mother,2,2,0,no,no,no,no,yes,yes,no,yes,1,2,3,1,2,5,2,12,12,11 360 | MS,M,18,U,LE3,T,1,1,other,services,home,father,2,1,0,no,no,no,no,no,yes,yes,yes,3,3,2,1,2,3,4,10,10,10 361 | MS,F,18,U,LE3,T,1,1,at_home,services,course,father,2,3,0,no,no,no,no,yes,yes,yes,no,5,3,2,1,1,4,0,18,16,16 362 | MS,F,18,R,LE3,A,1,4,at_home,other,course,mother,3,2,0,no,no,no,no,yes,yes,no,yes,4,3,4,1,4,5,0,13,13,13 363 | MS,M,18,R,LE3,T,1,1,at_home,other,other,mother,2,2,1,no,no,no,yes,no,no,no,no,4,4,3,2,3,5,2,13,12,12 364 | MS,F,18,U,GT3,T,3,3,services,services,other,mother,2,2,0,no,yes,no,no,yes,yes,yes,yes,4,3,2,1,3,3,0,11,11,10 365 | MS,F,17,U,LE3,T,4,4,at_home,at_home,course,mother,1,2,0,no,yes,yes,yes,yes,yes,yes,yes,2,3,4,1,1,1,0,16,15,15 366 | MS,F,17,R,GT3,T,1,2,other,services,course,father,2,2,0,no,no,no,no,no,yes,no,no,3,2,2,1,2,3,0,12,11,12 367 | MS,M,18,R,GT3,T,1,3,at_home,other,course,mother,2,2,0,no,yes,yes,no,yes,yes,no,no,3,3,4,2,4,3,4,10,10,10 368 | MS,M,18,U,LE3,T,4,4,teacher,services,other,mother,2,3,0,no,no,yes,no,yes,yes,yes,yes,4,2,2,2,2,5,0,13,13,13 369 | MS,F,17,R,GT3,T,1,1,other,services,reputation,mother,3,1,1,no,yes,yes,no,yes,yes,yes,yes,5,2,1,1,2,1,0,7,6,0 370 | MS,F,18,U,GT3,T,2,3,at_home,services,course,father,2,1,0,no,yes,yes,no,yes,yes,yes,yes,5,2,3,1,2,4,0,11,10,10 371 | MS,F,18,R,GT3,T,4,4,other,teacher,other,father,3,2,0,no,yes,yes,no,no,yes,yes,yes,3,2,2,4,2,5,10,14,12,11 372 | MS,F,19,U,LE3,T,3,2,services,services,home,other,2,2,2,no,no,no,yes,yes,yes,no,yes,3,2,2,1,1,3,4,7,7,9 373 | MS,M,18,R,LE3,T,1,2,at_home,services,other,father,3,1,0,no,yes,yes,yes,yes,no,yes,yes,4,3,3,2,3,3,3,14,12,12 374 | MS,F,17,U,GT3,T,2,2,other,at_home,home,mother,1,3,0,no,no,no,yes,yes,yes,no,yes,3,4,3,1,1,3,8,13,11,11 375 | MS,F,17,R,GT3,T,1,2,other,other,course,mother,1,1,0,no,no,no,yes,yes,yes,yes,no,3,5,5,1,3,1,14,6,5,5 376 | MS,F,18,R,LE3,T,4,4,other,other,reputation,mother,2,3,0,no,no,no,no,yes,yes,yes,no,5,4,4,1,1,1,0,19,18,19 377 | MS,F,18,R,GT3,T,1,1,other,other,home,mother,4,3,0,no,no,no,no,yes,yes,yes,no,4,3,2,1,2,4,2,8,8,10 378 | MS,F,20,U,GT3,T,4,2,health,other,course,other,2,3,2,no,yes,yes,no,no,yes,yes,yes,5,4,3,1,1,3,4,15,14,15 379 | MS,F,18,R,LE3,T,4,4,teacher,services,course,mother,1,2,0,no,no,yes,yes,yes,yes,yes,no,5,4,3,3,4,2,4,8,9,10 380 | MS,F,18,U,GT3,T,3,3,other,other,home,mother,1,2,0,no,no,yes,no,yes,yes,yes,yes,4,1,3,1,2,1,0,15,15,15 381 | MS,F,17,R,GT3,T,3,1,at_home,other,reputation,mother,1,2,0,no,yes,yes,yes,no,yes,yes,no,4,5,4,2,3,1,17,10,10,10 382 | MS,M,18,U,GT3,T,4,4,teacher,teacher,home,father,1,2,0,no,no,yes,yes,no,yes,yes,no,3,2,4,1,4,2,4,15,14,14 383 | MS,M,18,R,GT3,T,2,1,other,other,other,mother,2,1,0,no,no,no,yes,no,yes,yes,yes,4,4,3,1,3,5,5,7,6,7 384 | MS,M,17,U,GT3,T,2,3,other,services,home,father,2,2,0,no,no,no,yes,yes,yes,yes,no,4,4,3,1,1,3,2,11,11,10 385 | MS,M,19,R,GT3,T,1,1,other,services,other,mother,2,1,1,no,no,no,no,yes,yes,no,no,4,3,2,1,3,5,0,6,5,0 386 | MS,M,18,R,GT3,T,4,2,other,other,home,father,2,1,1,no,no,yes,no,yes,yes,no,no,5,4,3,4,3,3,14,6,5,5 387 | MS,F,18,R,GT3,T,2,2,at_home,other,other,mother,2,3,0,no,no,yes,no,yes,yes,no,no,5,3,3,1,3,4,2,10,9,10 388 | MS,F,18,R,GT3,T,4,4,teacher,at_home,reputation,mother,3,1,0,no,yes,yes,yes,yes,yes,yes,yes,4,4,3,2,2,5,7,6,5,6 389 | MS,F,19,R,GT3,T,2,3,services,other,course,mother,1,3,1,no,no,no,yes,no,yes,yes,no,5,4,2,1,2,5,0,7,5,0 390 | MS,F,18,U,LE3,T,3,1,teacher,services,course,mother,1,2,0,no,yes,yes,no,yes,yes,yes,no,4,3,4,1,1,1,0,7,9,8 391 | MS,F,18,U,GT3,T,1,1,other,other,course,mother,2,2,1,no,no,no,yes,yes,yes,no,no,1,1,1,1,1,5,0,6,5,0 392 | MS,M,20,U,LE3,A,2,2,services,services,course,other,1,2,2,no,yes,yes,no,yes,yes,no,no,5,5,4,4,5,4,11,9,9,9 393 | MS,M,17,U,LE3,T,3,1,services,services,course,mother,2,1,0,no,no,no,no,no,yes,yes,no,2,4,5,3,4,2,3,14,16,16 394 | MS,M,21,R,GT3,T,1,1,other,other,course,other,1,1,3,no,no,no,no,no,yes,no,no,5,5,3,3,3,3,3,10,8,7 395 | MS,M,18,R,LE3,T,3,2,services,other,course,mother,3,1,0,no,no,no,no,no,yes,yes,no,4,4,1,3,4,5,0,11,12,10 396 | MS,M,19,U,LE3,T,1,1,other,at_home,course,father,1,1,0,no,no,no,no,yes,yes,yes,no,3,2,3,3,3,5,5,8,9,9 397 | -------------------------------------------------------------------------------- /examples/kidney_disease.csv: -------------------------------------------------------------------------------- 1 | id,age,bp,sg,al,su,rbc,pc,pcc,ba,bgr,bu,sc,sod,pot,hemo,pcv,wc,rc,htn,dm,cad,appet,pe,ane,classification 2 | 0,48.0,80.0,1.02,1.0,0.0,,normal,notpresent,notpresent,121.0,36.0,1.2,,,15.4,44,7800,5.2,yes,yes,no,good,no,no,ckd 3 | 1,7.0,50.0,1.02,4.0,0.0,,normal,notpresent,notpresent,,18.0,0.8,,,11.3,38,6000,,no,no,no,good,no,no,ckd 4 | 2,62.0,80.0,1.01,2.0,3.0,normal,normal,notpresent,notpresent,423.0,53.0,1.8,,,9.6,31,7500,,no,yes,no,poor,no,yes,ckd 5 | 3,48.0,70.0,1.005,4.0,0.0,normal,abnormal,present,notpresent,117.0,56.0,3.8,111.0,2.5,11.2,32,6700,3.9,yes,no,no,poor,yes,yes,ckd 6 | 4,51.0,80.0,1.01,2.0,0.0,normal,normal,notpresent,notpresent,106.0,26.0,1.4,,,11.6,35,7300,4.6,no,no,no,good,no,no,ckd 7 | 5,60.0,90.0,1.015,3.0,0.0,,,notpresent,notpresent,74.0,25.0,1.1,142.0,3.2,12.2,39,7800,4.4,yes,yes,no,good,yes,no,ckd 8 | 6,68.0,70.0,1.01,0.0,0.0,,normal,notpresent,notpresent,100.0,54.0,24.0,104.0,4.0,12.4,36,,,no,no,no,good,no,no,ckd 9 | 7,24.0,,1.015,2.0,4.0,normal,abnormal,notpresent,notpresent,410.0,31.0,1.1,,,12.4,44,6900,5,no,yes,no,good,yes,no,ckd 10 | 8,52.0,100.0,1.015,3.0,0.0,normal,abnormal,present,notpresent,138.0,60.0,1.9,,,10.8,33,9600,4.0,yes,yes,no,good,no,yes,ckd 11 | 9,53.0,90.0,1.02,2.0,0.0,abnormal,abnormal,present,notpresent,70.0,107.0,7.2,114.0,3.7,9.5,29,12100,3.7,yes,yes,no,poor,no,yes,ckd 12 | 10,50.0,60.0,1.01,2.0,4.0,,abnormal,present,notpresent,490.0,55.0,4.0,,,9.4,28,,,yes,yes,no,good,no,yes,ckd 13 | 11,63.0,70.0,1.01,3.0,0.0,abnormal,abnormal,present,notpresent,380.0,60.0,2.7,131.0,4.2,10.8,32,4500,3.8,yes,yes,no,poor,yes,no,ckd 14 | 12,68.0,70.0,1.015,3.0,1.0,,normal,present,notpresent,208.0,72.0,2.1,138.0,5.8,9.7,28,12200,3.4,yes,yes,yes,poor,yes,no,ckd 15 | 13,68.0,70.0,,,,,,notpresent,notpresent,98.0,86.0,4.6,135.0,3.4,9.8,,,,yes,yes,yes,poor,yes,no,ckd 16 | 14,68.0,80.0,1.01,3.0,2.0,normal,abnormal,present,present,157.0,90.0,4.1,130.0,6.4,5.6,16,11000,2.6,yes,yes,yes,poor,yes,no,ckd 17 | 15,40.0,80.0,1.015,3.0,0.0,,normal,notpresent,notpresent,76.0,162.0,9.6,141.0,4.9,7.6,24,3800,2.8,yes,no,no,good,no,yes,ckd 18 | 16,47.0,70.0,1.015,2.0,0.0,,normal,notpresent,notpresent,99.0,46.0,2.2,138.0,4.1,12.6,,,,no,no,no,good,no,no,ckd 19 | 17,47.0,80.0,,,,,,notpresent,notpresent,114.0,87.0,5.2,139.0,3.7,12.1,,,,yes,no,no,poor,no,no,ckd 20 | 18,60.0,100.0,1.025,0.0,3.0,,normal,notpresent,notpresent,263.0,27.0,1.3,135.0,4.3,12.7,37,11400,4.3,yes,yes,yes,good,no,no,ckd 21 | 19,62.0,60.0,1.015,1.0,0.0,,abnormal,present,notpresent,100.0,31.0,1.6,,,10.3,30,5300,3.7,yes,no,yes,good,no,no,ckd 22 | 20,61.0,80.0,1.015,2.0,0.0,abnormal,abnormal,notpresent,notpresent,173.0,148.0,3.9,135.0,5.2,7.7,24,9200,3.2,yes,yes,yes,poor,yes,yes,ckd 23 | 21,60.0,90.0,,,,,,notpresent,notpresent,,180.0,76.0,4.5,,10.9,32,6200,3.6,yes,yes,yes,good,no,no,ckd 24 | 22,48.0,80.0,1.025,4.0,0.0,normal,abnormal,notpresent,notpresent,95.0,163.0,7.7,136.0,3.8,9.8,32,6900,3.4,yes,no,no,good,no,yes,ckd 25 | 23,21.0,70.0,1.01,0.0,0.0,,normal,notpresent,notpresent,,,,,,,,,,no,no,no,poor,no,yes,ckd 26 | 24,42.0,100.0,1.015,4.0,0.0,normal,abnormal,notpresent,present,,50.0,1.4,129.0,4.0,11.1,39,8300,4.6,yes,no,no,poor,no,no,ckd 27 | 25,61.0,60.0,1.025,0.0,0.0,,normal,notpresent,notpresent,108.0,75.0,1.9,141.0,5.2,9.9,29,8400,3.7,yes,yes,no,good,no,yes,ckd 28 | 26,75.0,80.0,1.015,0.0,0.0,,normal,notpresent,notpresent,156.0,45.0,2.4,140.0,3.4,11.6,35,10300,4,yes,yes,no,poor,no,no,ckd 29 | 27,69.0,70.0,1.01,3.0,4.0,normal,abnormal,notpresent,notpresent,264.0,87.0,2.7,130.0,4.0,12.5,37,9600,4.1,yes,yes,yes,good,yes,no,ckd 30 | 28,75.0,70.0,,1.0,3.0,,,notpresent,notpresent,123.0,31.0,1.4,,,,,,,no,yes,no,good,no,no,ckd 31 | 29,68.0,70.0,1.005,1.0,0.0,abnormal,abnormal,present,notpresent,,28.0,1.4,,,12.9,38,,,no,no,yes,good,no,no,ckd 32 | 30,,70.0,,,,,,notpresent,notpresent,93.0,155.0,7.3,132.0,4.9,,,,,yes, yes,no,good,no,no,ckd 33 | 31,73.0,90.0,1.015,3.0,0.0,,abnormal,present,notpresent,107.0,33.0,1.5,141.0,4.6,10.1,30,7800,4,no,no,no,poor,no,no,ckd 34 | 32,61.0,90.0,1.01,1.0,1.0,,normal,notpresent,notpresent,159.0,39.0,1.5,133.0,4.9,11.3,34,9600,4.0,yes,yes,no,poor,no,no,ckd 35 | 33,60.0,100.0,1.02,2.0,0.0,abnormal,abnormal,notpresent,notpresent,140.0,55.0,2.5,,,10.1,29,,,yes,no,no,poor,no,no,ckd 36 | 34,70.0,70.0,1.01,1.0,0.0,normal,,present,present,171.0,153.0,5.2,,,,,,,no,yes,no,poor,no,no,ckd 37 | 35,65.0,90.0,1.02,2.0,1.0,abnormal,normal,notpresent,notpresent,270.0,39.0,2.0,,,12.0,36,9800,4.9,yes,yes,no,poor,no,yes,ckd 38 | 36,76.0,70.0,1.015,1.0,0.0,normal,normal,notpresent,notpresent,92.0,29.0,1.8,133.0,3.9,10.3,32,,,yes,no,no,good,no,no,ckd 39 | 37,72.0,80.0,,,,,,notpresent,notpresent,137.0,65.0,3.4,141.0,4.7,9.7,28,6900,2.5,yes,yes,no,poor,no,yes,ckd 40 | 38,69.0,80.0,1.02,3.0,0.0,abnormal,normal,notpresent,notpresent,,103.0,4.1,132.0,5.9,12.5,,,,yes,no,no,good,no,no,ckd 41 | 39,82.0,80.0,1.01,2.0,2.0,normal,,notpresent,notpresent,140.0,70.0,3.4,136.0,4.2,13.0,40,9800,4.2,yes,yes,no,good,no,no,ckd 42 | 40,46.0,90.0,1.01,2.0,0.0,normal,abnormal,notpresent,notpresent,99.0,80.0,2.1,,,11.1,32,9100,4.1,yes,no, no,good,no,no,ckd 43 | 41,45.0,70.0,1.01,0.0,0.0,,normal,notpresent,notpresent,,20.0,0.7,,,,,,,no,no,no,good,yes,no,ckd 44 | 42,47.0,100.0,1.01,0.0,0.0,,normal,notpresent,notpresent,204.0,29.0,1.0,139.0,4.2,9.7,33,9200,4.5,yes,no,no,good,no,yes,ckd 45 | 43,35.0,80.0,1.01,1.0,0.0,abnormal,,notpresent,notpresent,79.0,202.0,10.8,134.0,3.4,7.9,24,7900,3.1,no,yes,no,good,no,no,ckd 46 | 44,54.0,80.0,1.01,3.0,0.0,abnormal,abnormal,notpresent,notpresent,207.0,77.0,6.3,134.0,4.8,9.7,28,,,yes,yes,no,poor,yes,no,ckd 47 | 45,54.0,80.0,1.02,3.0,0.0,,abnormal,notpresent,notpresent,208.0,89.0,5.9,130.0,4.9,9.3,,,,yes,yes,no,poor,yes,no,ckd 48 | 46,48.0,70.0,1.015,0.0,0.0,,normal,notpresent,notpresent,124.0,24.0,1.2,142.0,4.2,12.4,37,6400,4.7,no,yes,no,good,no,no,ckd 49 | 47,11.0,80.0,1.01,3.0,0.0,,normal,notpresent,notpresent,,17.0,0.8,,,15.0,45,8600,,no,no,no,good,no,no,ckd 50 | 48,73.0,70.0,1.005,0.0,0.0,normal,normal,notpresent,notpresent,70.0,32.0,0.9,125.0,4.0,10.0,29,18900,3.5,yes,yes,no,good,yes,no,ckd 51 | 49,60.0,70.0,1.01,2.0,0.0,normal,abnormal,present,notpresent,144.0,72.0,3.0,,,9.7,29,21600,3.5,yes,yes,no,poor,no,yes,ckd 52 | 50,53.0,60.0,,,,,,notpresent,notpresent,91.0,114.0,3.25,142.0,4.3,8.6,28,11000,3.8,yes,yes,no,poor,yes,yes,ckd 53 | 51,54.0,100.0,1.015,3.0,0.0,,normal,present,notpresent,162.0,66.0,1.6,136.0,4.4,10.3,33,,,yes,yes,no,poor,yes,no,ckd 54 | 52,53.0,90.0,1.015,0.0,0.0,,normal,notpresent,notpresent,,38.0,2.2,,,10.9,34,4300,3.7,no,no,no,poor,no,yes,ckd 55 | 53,62.0,80.0,1.015,0.0,5.0,,,notpresent,notpresent,246.0,24.0,1.0,,,13.6,40,8500,4.7,yes,yes,no,good,no,no,ckd 56 | 54,63.0,80.0,1.01,2.0,2.0,normal,,notpresent,notpresent,,,3.4,136.0,4.2,13.0,40,9800,4.2,yes,no,yes,good,no,no,ckd 57 | 55,35.0,80.0,1.005,3.0,0.0,abnormal,normal,notpresent,notpresent,,,,,,9.5,28,,,no,no,no,good,yes,no,ckd 58 | 56,76.0,70.0,1.015,3.0,4.0,normal,abnormal,present,notpresent,,164.0,9.7,131.0,4.4,10.2,30,11300,3.4,yes,yes,yes,poor,yes,no,ckd 59 | 57,76.0,90.0,,,,,normal,notpresent,notpresent,93.0,155.0,7.3,132.0,4.9,,,,,yes,yes,yes,poor,no,no,ckd 60 | 58,73.0,80.0,1.02,2.0,0.0,abnormal,abnormal,notpresent,notpresent,253.0,142.0,4.6,138.0,5.8,10.5,33,7200,4.3,yes,yes,yes,good,no,no,ckd 61 | 59,59.0,100.0,,,,,,notpresent,notpresent,,96.0,6.4,,,6.6,,,,yes,yes,no,good,no,yes,ckd 62 | 60,67.0,90.0,1.02,1.0,0.0,,abnormal,present,notpresent,141.0,66.0,3.2,138.0,6.6,,,,,yes,no,no,good,no,no,ckd 63 | 61,67.0,80.0,1.01,1.0,3.0,normal,abnormal,notpresent,notpresent,182.0,391.0,32.0,163.0,39.0,,,,,no,no,no,good,yes,no,ckd 64 | 62,15.0,60.0,1.02,3.0,0.0,,normal,notpresent,notpresent,86.0,15.0,0.6,138.0,4.0,11.0,33,7700,3.8,yes,yes,no,good,no,no,ckd 65 | 63,46.0,70.0,1.015,1.0,0.0,abnormal,normal,notpresent,notpresent,150.0,111.0,6.1,131.0,3.7,7.5,27,,,no,no,no,good,no,yes,ckd 66 | 64,55.0,80.0,1.01,0.0,0.0,,normal,notpresent,notpresent,146.0,,,,,9.8,,,,no,no, no,good,no,no,ckd 67 | 65,44.0,90.0,1.01,1.0,0.0,,normal,notpresent,notpresent,,20.0,1.1,,,15.0,48,,,no, no,no,good,no,no,ckd 68 | 66,67.0,70.0,1.02,2.0,0.0,abnormal,normal,notpresent,notpresent,150.0,55.0,1.6,131.0,4.8,, ?,,,yes,yes,no,good,yes,no,ckd 69 | 67,45.0,80.0,1.02,3.0,0.0,normal,abnormal,notpresent,notpresent,425.0,,,,,,,,,no,no,no,poor,no,no,ckd 70 | 68,65.0,70.0,1.01,2.0,0.0,,normal,present,notpresent,112.0,73.0,3.3,,,10.9,37,,,no,no,no,good,no,no,ckd 71 | 69,26.0,70.0,1.015,0.0,4.0,,normal,notpresent,notpresent,250.0,20.0,1.1,,,15.6,52,6900,6.0,no,yes,no,good,no,no,ckd 72 | 70,61.0,80.0,1.015,0.0,4.0,,normal,notpresent,notpresent,360.0,19.0,0.7,137.0,4.4,15.2,44,8300,5.2,yes,yes,no,good,no,no,ckd 73 | 71,46.0,60.0,1.01,1.0,0.0,normal,normal,notpresent,notpresent,163.0,92.0,3.3,141.0,4.0,9.8,28,14600,3.2,yes,yes,no,good,no,no,ckd 74 | 72,64.0,90.0,1.01,3.0,3.0,,abnormal,present,notpresent,,35.0,1.3,,,10.3,,,,yes,yes,no,good,yes,no,ckd 75 | 73,,100.0,1.015,2.0,0.0,abnormal,abnormal,notpresent,notpresent,129.0,107.0,6.7,132.0,4.4,4.8,14,6300,,yes,no,no,good,yes,yes,ckd 76 | 74,56.0,90.0,1.015,2.0,0.0,abnormal,abnormal,notpresent,notpresent,129.0,107.0,6.7,131.0,4.8,9.1,29,6400,3.4,yes,no,no,good,no,no,ckd 77 | 75,5.0,,1.015,1.0,0.0,,normal,notpresent,notpresent,,16.0,0.7,138.0,3.2,8.1,,,,no,no,no,good,no,yes,ckd 78 | 76,48.0,80.0,1.005,4.0,0.0,abnormal,abnormal,notpresent,present,133.0,139.0,8.5,132.0,5.5,10.3,36, 6200,4,no,yes,no,good,yes,no,ckd 79 | 77,67.0,70.0,1.01,1.0,0.0,,normal,notpresent,notpresent,102.0,48.0,3.2,137.0,5.0,11.9,34,7100,3.7,yes,yes,no,good,yes,no,ckd 80 | 78,70.0,80.0,,,,,,notpresent,notpresent,158.0,85.0,3.2,141.0,3.5,10.1,30,,,yes,no,no,good,yes,no,ckd 81 | 79,56.0,80.0,1.01,1.0,0.0,,normal,notpresent,notpresent,165.0,55.0,1.8,,,13.5,40,11800,5.0,yes,yes,no,poor,yes,no,ckd 82 | 80,74.0,80.0,1.01,0.0,0.0,,normal,notpresent,notpresent,132.0,98.0,2.8,133.0,5.0,10.8,31,9400,3.8,yes,yes,no,good,no,no,ckd 83 | 81,45.0,90.0,,,,,,notpresent,notpresent,360.0,45.0,2.4,128.0,4.4,8.3,29,5500,3.7,yes,yes,no,good,no,no,ckd 84 | 82,38.0,70.0,,,,,,notpresent,notpresent,104.0,77.0,1.9,140.0,3.9,,,,,yes,no,no,poor,yes,no,ckd 85 | 83,48.0,70.0,1.015,1.0,0.0,normal,normal,notpresent,notpresent,127.0,19.0,1.0,134.0,3.6,,,,,yes,yes,no,good,no,no,ckd 86 | 84,59.0,70.0,1.01,3.0,0.0,normal,abnormal,notpresent,notpresent,76.0,186.0,15.0,135.0,7.6,7.1,22,3800,2.1,yes,no,no,poor,yes,yes,ckd 87 | 85,70.0,70.0,1.015,2.0,,,,notpresent,notpresent,,46.0,1.5,,,9.9,,,,no,yes,no,poor,yes,no,ckd 88 | 86,56.0,80.0,,,,,,notpresent,notpresent,415.0,37.0,1.9,,,,,,,no,yes,no,good,no,no,ckd 89 | 87,70.0,100.0,1.005,1.0,0.0,normal,abnormal,present,notpresent,169.0,47.0,2.9,,,11.1,32,5800,5,yes,yes,no,poor,no,no,ckd 90 | 88,58.0,110.0,1.01,4.0,0.0,,normal,notpresent,notpresent,251.0,52.0,2.2,,,,,13200,4.7,yes, yes,no,good,no,no,ckd 91 | 89,50.0,70.0,1.02,0.0,0.0,,normal,notpresent,notpresent,109.0,32.0,1.4,139.0,4.7,,,,,no,no,no,poor,no,no,ckd 92 | 90,63.0,100.0,1.01,2.0,2.0,normal,normal,notpresent,present,280.0,35.0,3.2,143.0,3.5,13.0,40,9800,4.2,yes,no,yes,good,no,no,ckd 93 | 91,56.0,70.0,1.015,4.0,1.0,abnormal,normal,notpresent,notpresent,210.0,26.0,1.7,136.0,3.8,16.1,52,12500,5.6,no,no,no,good,no,no,ckd 94 | 92,71.0,70.0,1.01,3.0,0.0,normal,abnormal,present,present,219.0,82.0,3.6,133.0,4.4,10.4,33,5600,3.6,yes,yes,yes,good,no,no,ckd 95 | 93,73.0,100.0,1.01,3.0,2.0,abnormal,abnormal,present,notpresent,295.0,90.0,5.6,140.0,2.9,9.2,30,7000,3.2,yes,yes,yes,poor,no,no,ckd 96 | 94,65.0,70.0,1.01,0.0,0.0,,normal,notpresent,notpresent,93.0,66.0,1.6,137.0,4.5,11.6,36,11900,3.9,no,yes,no,good,no,no,ckd 97 | 95,62.0,90.0,1.015,1.0,0.0,,normal,notpresent,notpresent,94.0,25.0,1.1,131.0,3.7,,,,,yes,no,no,good,yes,yes,ckd 98 | 96,60.0,80.0,1.01,1.0,1.0,,normal,notpresent,notpresent,172.0,32.0,2.7,,,11.2,36,,,no,yes,yes,poor,no,no,ckd 99 | 97,65.0,60.0,1.015,1.0,0.0,,normal,notpresent,notpresent,91.0,51.0,2.2,132.0,3.8,10.0,32,9100,4.0,yes,yes,no,poor,yes,no,ckd 100 | 98,50.0,140.0,,,,,,notpresent,notpresent,101.0,106.0,6.5,135.0,4.3,6.2,18,5800,2.3,yes,yes,no,poor,no,yes,ckd 101 | 99,56.0,180.0,,0.0,4.0,,abnormal,notpresent,notpresent,298.0,24.0,1.2,139.0,3.9,11.2,32,10400,4.2,yes,yes,no,poor,yes,no,ckd 102 | 100,34.0,70.0,1.015,4.0,0.0,abnormal,abnormal,notpresent,notpresent,153.0,22.0,0.9,133.0,3.8,,,,,no,no,no,good,yes,no,ckd 103 | 101,71.0,90.0,1.015,2.0,0.0,,abnormal,present,present,88.0,80.0,4.4,139.0,5.7,11.3,33,10700,3.9,no,no,no,good,no,no,ckd 104 | 102,17.0,60.0,1.01,0.0,0.0,,normal,notpresent,notpresent,92.0,32.0,2.1,141.0,4.2,13.9,52,7000,,no,no,no,good,no,no,ckd 105 | 103,76.0,70.0,1.015,2.0,0.0,normal,abnormal,present,notpresent,226.0,217.0,10.2,,,10.2,36,12700,4.2,yes,no,no,poor,yes,yes,ckd 106 | 104,55.0,90.0,,,,,,notpresent,notpresent,143.0,88.0,2.0,,,,,,,yes,yes,no,poor,yes,no,ckd 107 | 105,65.0,80.0,1.015,0.0,0.0,,normal,notpresent,notpresent,115.0,32.0,11.5,139.0,4.0,14.1,42,6800,5.2,no,no,no,good,no,no,ckd 108 | 106,50.0,90.0,,,,,,notpresent,notpresent,89.0,118.0,6.1,127.0,4.4,6.0,17,6500,,yes,yes,no,good,yes,yes,ckd 109 | 107,55.0,100.0,1.015,1.0,4.0,normal,,notpresent,notpresent,297.0,53.0,2.8,139.0,4.5,11.2,34,13600,4.4,yes,yes,no,good,no,no,ckd 110 | 108,45.0,80.0,1.015,0.0,0.0,,abnormal,notpresent,notpresent,107.0,15.0,1.0,141.0,4.2,11.8,37,10200,4.2,no,no,no,good,no,no,ckd 111 | 109,54.0,70.0,,,,,,notpresent,notpresent,233.0,50.1,1.9,,,11.7,,,,no,yes,no,good,no,no,ckd 112 | 110,63.0,90.0,1.015,0.0,0.0,,normal,notpresent,notpresent,123.0,19.0,2.0,142.0,3.8,11.7,34,11400,4.7,no,no,no,good,no,no,ckd 113 | 111,65.0,80.0,1.01,3.0,3.0,,normal,notpresent,notpresent,294.0,71.0,4.4,128.0,5.4,10.0,32,9000,3.9,yes,yes,yes,good,no,no,ckd 114 | 112,,60.0,1.015,3.0,0.0,abnormal,abnormal,notpresent,notpresent,,34.0,1.2,,,10.8,33,,,no,no,no,good,no,no,ckd 115 | 113,61.0,90.0,1.015,0.0,2.0,,normal,notpresent,notpresent,,,,,,,,9800,,no,yes,no,poor,no,yes,ckd 116 | 114,12.0,60.0,1.015,3.0,0.0,abnormal,abnormal,present,notpresent,,51.0,1.8,,,12.1,,10300,,no,no,no,good,no,no,ckd 117 | 115,47.0,80.0,1.01,0.0,0.0,,abnormal,notpresent,notpresent,,28.0,0.9,,,12.4,44,5600,4.3,no,no,no,good,no,yes,ckd 118 | 116,,70.0,1.015,4.0,0.0,abnormal,normal,notpresent,notpresent,104.0,16.0,0.5,,,,,,,no,no,no,good,yes,no,ckd 119 | 117,,70.0,1.02,0.0,0.0,,,notpresent,notpresent,219.0,36.0,1.3,139.0,3.7,12.5,37,9800,4.4,no,no,no,good,no,no,ckd 120 | 118,55.0,70.0,1.01,3.0,0.0,,normal,notpresent,notpresent,99.0,25.0,1.2,,,11.4,,,,no,no,no,poor,yes,no,ckd 121 | 119,60.0,70.0,1.01,0.0,0.0,,normal,notpresent,notpresent,140.0,27.0,1.2,,,,,,,no,no,no,good,no,no,ckd 122 | 120,72.0,90.0,1.025,1.0,3.0,,normal,notpresent,notpresent,323.0,40.0,2.2,137.0,5.3,12.6,,,,no,yes,yes,poor,no,no,ckd 123 | 121,54.0,60.0,,3.0,,,,notpresent,notpresent,125.0,21.0,1.3,137.0,3.4,15.0,46,,,yes,yes,no,good,yes,no,ckd 124 | 122,34.0,70.0,,,,,,notpresent,notpresent,,219.0,12.2,130.0,3.8,6.0,,,,yes,no,no,good,no,yes,ckd 125 | 123,43.0,80.0,1.015,2.0,3.0,,abnormal,present,present,,30.0,1.1,,,14.0,42,14900,,no,no,no,good,no,no,ckd 126 | 124,65.0,100.0,1.015,0.0,0.0,,normal,notpresent,notpresent,90.0,98.0,2.5,,,9.1,28,5500,3.6,yes,no,no,good,no,no,ckd 127 | 125,72.0,90.0,,,,,,notpresent,notpresent,308.0,36.0,2.5,131.0,4.3,,,,,yes,yes,no,poor,no,no,ckd 128 | 126,70.0,90.0,1.015,0.0,0.0,,normal,notpresent,notpresent,144.0,125.0,4.0,136.0,4.6,12.0,37,8200,4.5,yes,yes,no,poor,yes,no,ckd 129 | 127,71.0,60.0,1.015,4.0,0.0,normal,normal,notpresent,notpresent,118.0,125.0,5.3,136.0,4.9,11.4,35,15200,4.3,yes,yes,no,poor,yes,no,ckd 130 | 128,52.0,90.0,1.015,4.0,3.0,normal,abnormal,notpresent,notpresent,224.0,166.0,5.6,133.0,47.0,8.1,23,5000,2.9,yes,yes,no,good,no,yes,ckd 131 | 129,75.0,70.0,1.025,1.0,0.0,,normal,notpresent,notpresent,158.0,49.0,1.4,135.0,4.7,11.1,,,,yes,no,no,poor,yes,no,ckd 132 | 130,50.0,90.0,1.01,2.0,0.0,normal,abnormal,present,present,128.0,208.0,9.2,134.0,4.8,8.2,22,16300,2.7,no,no,no,poor,yes,yes,ckd 133 | 131,5.0,50.0,1.01,0.0,0.0,,normal,notpresent,notpresent,,25.0,0.6,,,11.8,36,12400,,no,no,no,good,no,no,ckd 134 | 132,50.0,,,,,normal,,notpresent,notpresent,219.0,176.0,13.8,136.0,4.5,8.6,24,13200,2.7,yes,no,no,good,yes,yes,ckd 135 | 133,70.0,100.0,1.015,4.0,0.0,normal,normal,notpresent,notpresent,118.0,125.0,5.3,136.0,4.9,12.0,37, 8400,8.0,yes,no,no,good,no,no,ckd 136 | 134,47.0,100.0,1.01,,,normal,,notpresent,notpresent,122.0,,16.9,138.0,5.2,10.8,33,10200,3.8,no,yes,no,good,no,no,ckd 137 | 135,48.0,80.0,1.015,0.0,2.0,,normal,notpresent,notpresent,214.0,24.0,1.3,140.0,4.0,13.2,39,,,no,yes,no,poor,no,no,ckd 138 | 136,46.0,90.0,1.02,,,,normal,notpresent,notpresent,213.0,68.0,2.8,146.0,6.3,9.3,,,,yes,yes,no,good,no,no,ckd 139 | 137,45.0,60.0,1.01,2.0,0.0,normal,abnormal,present,notpresent,268.0,86.0,4.0,134.0,5.1,10.0,29,9200,,yes,yes,no,good,no,no,ckd 140 | 138,73.0,,1.01,1.0,0.0,,,notpresent,notpresent,95.0,51.0,1.6,142.0,3.5,,,,,no, no,no,good,no,no,ckd 141 | 139,41.0,70.0,1.015,2.0,0.0,,abnormal,notpresent,present,,68.0,2.8,132.0,4.1,11.1,33,,,yes,no,no,good,yes,yes,ckd 142 | 140,69.0,70.0,1.01,0.0,4.0,,normal,notpresent,notpresent,256.0,40.0,1.2,142.0,5.6,,,,,no,no,no,good,no,no,ckd 143 | 141,67.0,70.0,1.01,1.0,0.0,normal,normal,notpresent,notpresent,,106.0,6.0,137.0,4.9,6.1,19,6500,,yes,no,no,good,no,yes,ckd 144 | 142,72.0,90.0,,,,,,notpresent,notpresent,84.0,145.0,7.1,135.0,5.3,,,,,no,yes,no,good,no,no,ckd 145 | 143,41.0,80.0,1.015,1.0,4.0,abnormal,normal,notpresent,notpresent,210.0,165.0,18.0,135.0,4.7,,,,,no,yes,no,good,no,no,ckd 146 | 144,60.0,90.0,1.01,2.0,0.0,abnormal,normal,notpresent,notpresent,105.0,53.0,2.3,136.0,5.2,11.1,33,10500,4.1,no,no,no,good,no,no,ckd 147 | 145,57.0,90.0,1.015,5.0,0.0,abnormal,abnormal,notpresent,present,,322.0,13.0,126.0,4.8,8.0,24,4200,3.3,yes,yes,yes,poor,yes,yes,ckd 148 | 146,53.0,100.0,1.01,1.0,3.0,abnormal,normal,notpresent,notpresent,213.0,23.0,1.0,139.0,4.0,,,,,no,yes,no,good,no,no,ckd 149 | 147,60.0,60.0,1.01,3.0,1.0,normal,abnormal,present,notpresent,288.0,36.0,1.7,130.0,3.0,7.9,25,15200,3.0,yes,no,no,poor,no,yes,ckd 150 | 148,69.0,60.0,,,,,,notpresent,notpresent,171.0,26.0,48.1,,,,,,,yes,no,no,poor,no,no,ckd 151 | 149,65.0,70.0,1.02,1.0,0.0,abnormal,abnormal,notpresent,notpresent,139.0,29.0,1.0,,,10.5,32,,,yes,no,no,good,yes,no,ckd 152 | 150,8.0,60.0,1.025,3.0,0.0,normal,normal,notpresent,notpresent,78.0,27.0,0.9,,,12.3,41,6700,,no,no,no,poor,yes,no,ckd 153 | 151,76.0,90.0,,,,,,notpresent,notpresent,172.0,46.0,1.7,141.0,5.5,9.6,30,,,yes,yes,no,good,no,yes,ckd 154 | 152,39.0,70.0,1.01,0.0,0.0,,normal,notpresent,notpresent,121.0,20.0,0.8,133.0,3.5,10.9,32,,,no,yes,no,good,no,no,ckd 155 | 153,55.0,90.0,1.01,2.0,1.0,abnormal,abnormal,notpresent,notpresent,273.0,235.0,14.2,132.0,3.4,8.3,22,14600,2.9,yes,yes,no,poor,yes,yes,ckd 156 | 154,56.0,90.0,1.005,4.0,3.0,abnormal,abnormal,notpresent,notpresent,242.0,132.0,16.4,140.0,4.2,8.4,26,,3,yes,yes,no,poor,yes,yes,ckd 157 | 155,50.0,70.0,1.02,3.0,0.0,abnormal,normal,present,present,123.0,40.0,1.8,,,11.1,36,4700,,no,no,no,good,no,no,ckd 158 | 156,66.0,90.0,1.015,2.0,0.0,,normal,notpresent,present,153.0,76.0,3.3,,,,,,,no,no,no,poor,no,no,ckd 159 | 157,62.0,70.0,1.025,3.0,0.0,normal,abnormal,notpresent,notpresent,122.0,42.0,1.7,136.0,4.7,12.6,39,7900,3.9,yes,yes,no,good,no,no,ckd 160 | 158,71.0,60.0,1.02,3.0,2.0,normal,normal,present,notpresent,424.0,48.0,1.5,132.0,4.0,10.9,31,,,yes,yes,yes,good,no,no,ckd 161 | 159,59.0,80.0,1.01,1.0,0.0,abnormal,normal,notpresent,notpresent,303.0,35.0,1.3,122.0,3.5,10.4,35,10900,4.3,no,yes,no,poor,no,no,ckd 162 | 160,81.0,60.0,,,,,,notpresent,notpresent,148.0,39.0,2.1,147.0,4.2,10.9,35,9400,2.4,yes,yes,yes,poor,yes,no,ckd 163 | 161,62.0,,1.015,3.0,0.0,abnormal,,notpresent,notpresent,,,,,,14.3,42,10200,4.8,yes,yes,no,good,no,no,ckd 164 | 162,59.0,70.0,,,,,,notpresent,notpresent,204.0,34.0,1.5,124.0,4.1,9.8,37,6000, ?,no,yes,no,good,no,no,ckd 165 | 163,46.0,80.0,1.01,0.0,0.0,,normal,notpresent,notpresent,160.0,40.0,2.0,140.0,4.1,9.0,27,8100,3.2,yes,no,no,poor,no,yes,ckd 166 | 164,14.0,,1.015,0.0,0.0,,,notpresent,notpresent,192.0,15.0,0.8,137.0,4.2,14.3,40,9500,5.4,no,yes,no,poor,yes,no,ckd 167 | 165,60.0,80.0,1.02,0.0,2.0,,,notpresent,notpresent,,,,,,,,,,no,yes,no,good,no,no,ckd 168 | 166,27.0,60.0,,,,,,notpresent,notpresent,76.0,44.0,3.9,127.0,4.3,,,,,no,no,no,poor,yes,yes,ckd 169 | 167,34.0,70.0,1.02,0.0,0.0,abnormal,normal,notpresent,notpresent,139.0,19.0,0.9,,,12.7,42,2200,,no,no,no,poor,no,no,ckd 170 | 168,65.0,70.0,1.015,4.0,4.0,,normal,present,notpresent,307.0,28.0,1.5,,,11.0,39,6700,,yes,yes,no,good,no,no,ckd 171 | 169,,70.0,1.01,0.0,2.0,,normal,notpresent,notpresent,220.0,68.0,2.8,,,8.7,27,,,yes,yes,no,good,no,yes,ckd 172 | 170,66.0,70.0,1.015,2.0,5.0,,normal,notpresent,notpresent,447.0,41.0,1.7,131.0,3.9,12.5,33,9600,4.4,yes,yes,no,good,no,no,ckd 173 | 171,83.0,70.0,1.02,3.0,0.0,normal,normal,notpresent,notpresent,102.0,60.0,2.6,115.0,5.7,8.7,26,12800,3.1,yes,no,no,poor,no,yes,ckd 174 | 172,62.0,80.0,1.01,1.0,2.0,,,notpresent,notpresent,309.0,113.0,2.9,130.0,2.5,10.6,34,12800,4.9,no,no,no,good,no,no,ckd 175 | 173,17.0,70.0,1.015,1.0,0.0,abnormal,normal,notpresent,notpresent,22.0,1.5,7.3,145.0,2.8,13.1,41,11200,,no,no,no,good,no,no,ckd 176 | 174,54.0,70.0,,,,,,notpresent,notpresent,111.0,146.0,7.5,141.0,4.7,11.0,35,8600,4.6,no,no,no,good,no,no,ckd 177 | 175,60.0,50.0,1.01,0.0,0.0,,normal,notpresent,notpresent,261.0,58.0,2.2,113.0,3.0,,,4200,3.4,yes,no,no,good,no,no,ckd 178 | 176,21.0,90.0,1.01,4.0,0.0,normal,abnormal,present,present,107.0,40.0,1.7,125.0,3.5,8.3,23,12400,3.9,no,no,no,good,no,yes,ckd 179 | 177,65.0,80.0,1.015,2.0,1.0,normal,normal,present,notpresent,215.0,133.0,2.5,,,13.2,41,,,no,yes,no,good,no,no,ckd 180 | 178,42.0,90.0,1.02,2.0,0.0,abnormal,abnormal,present,notpresent,93.0,153.0,2.7,139.0,4.3,9.8,34,9800,,no,no,no,poor,yes,yes,ckd 181 | 179,72.0,90.0,1.01,2.0,0.0,,abnormal,present,notpresent,124.0,53.0,2.3,,,11.9,39,,,no,no,no,good,no,no,ckd 182 | 180,73.0,90.0,1.01,1.0,4.0,abnormal,abnormal,present,notpresent,234.0,56.0,1.9,,,10.3,28,,,no,yes,no,good,no,no,ckd 183 | 181,45.0,70.0,1.025,2.0,0.0,normal,abnormal,present,notpresent,117.0,52.0,2.2,136.0,3.8,10.0,30,19100,3.7,no,no,no,good,no,no,ckd 184 | 182,61.0,80.0,1.02,0.0,0.0,,normal,notpresent,notpresent,131.0,23.0,0.8,140.0,4.1,11.3,35,,,no,no,no,good,no,no,ckd 185 | 183,30.0,70.0,1.015,0.0,0.0,,normal,notpresent,notpresent,101.0,106.0,6.5,135.0,4.3,,,,,no,no,no,poor,no,no,ckd 186 | 184,54.0,60.0,1.015,3.0,2.0,,abnormal,notpresent,notpresent,352.0,137.0,3.3,133.0,4.5,11.3,31,5800,3.6,yes,yes,yes,poor,yes,no,ckd 187 | 185,4.0,,1.02,1.0,0.0,,normal,notpresent,notpresent,99.0,23.0,0.6,138.0,4.4,12.0,34, ?,,no,no,no,good,no,no,ckd 188 | 186,8.0,50.0,1.02,4.0,0.0,normal,normal,notpresent,notpresent,,46.0,1.0,135.0,3.8,,,,,no,no,no,good,yes,no,ckd 189 | 187,3.0,,1.01,2.0,0.0,normal,normal,notpresent,notpresent,,22.0,0.7,,,10.7,34,12300,,no,no,no,good,no,no,ckd 190 | 188,8.0,,,,,,,notpresent,notpresent,80.0,66.0,2.5,142.0,3.6,12.2,38,,,no, no,no,good,no,no,ckd 191 | 189,64.0,60.0,1.01,4.0,1.0,abnormal,abnormal,notpresent,present,239.0,58.0,4.3,137.0,5.4,9.5,29,7500,3.4,yes,yes,no,poor,yes,no,ckd 192 | 190,6.0,60.0,1.01,4.0,0.0,abnormal,abnormal,notpresent,present,94.0,67.0,1.0,135.0,4.9,9.9,30,16700,4.8,no,no,no,poor,no,no,ckd 193 | 191,,70.0,1.01,3.0,0.0,normal,normal,notpresent,notpresent,110.0,115.0,6.0,134.0,2.7,9.1,26,9200,3.4,yes,yes,no,poor,no,no,ckd 194 | 192,46.0,110.0,1.015,0.0,0.0,,normal,notpresent,notpresent,130.0,16.0,0.9,,,,,,,no,no,no,good,no,no,ckd 195 | 193,32.0,90.0,1.025,1.0,0.0,abnormal,abnormal,notpresent,notpresent,,223.0,18.1,113.0,6.5,5.5,15,2600,2.8,yes,yes,no,poor,yes,yes,ckd 196 | 194,80.0,70.0,1.01,2.0,,,abnormal,notpresent,notpresent,,49.0,1.2,,,,,,,yes, yes,no,good,no,no,ckd 197 | 195,70.0,90.0,1.02,2.0,1.0,abnormal,abnormal,notpresent,present,184.0,98.6,3.3,138.0,3.9,5.8,,,,yes,yes,yes,poor,no,no,ckd 198 | 196,49.0,100.0,1.01,3.0,0.0,abnormal,abnormal,notpresent,notpresent,129.0,158.0,11.8,122.0,3.2,8.1,24,9600,3.5,yes,yes,no,poor,yes,yes,ckd 199 | 197,57.0,80.0,,,,,,notpresent,notpresent,,111.0,9.3,124.0,5.3,6.8,,4300,3.0,yes,yes,no,good,no,yes,ckd 200 | 198,59.0,100.0,1.02,4.0,2.0,normal,normal,notpresent,notpresent,252.0,40.0,3.2,137.0,4.7,11.2,30,26400,3.9,yes,yes,no,poor,yes,no,ckd 201 | 199,65.0,80.0,1.015,0.0,0.0,,normal,notpresent,notpresent,92.0,37.0,1.5,140.0,5.2,8.8,25,10700,3.2,yes,no,yes,good,yes,no,ckd 202 | 200,90.0,90.0,1.025,1.0,0.0,,normal,notpresent,notpresent,139.0,89.0,3.0,140.0,4.1,12.0,37,7900,3.9,yes,yes,no,good,no,no,ckd 203 | 201,64.0,70.0,,,,,,notpresent,notpresent,113.0,94.0,7.3,137.0,4.3,7.9,21,,,yes,yes,yes,good,yes,yes,ckd 204 | 202,78.0,60.0,,,,,,notpresent,notpresent,114.0,74.0,2.9,135.0,5.9,8.0,24,,,no,yes,no,good,no,yes,ckd 205 | 203,,90.0,,,,,,notpresent,notpresent,207.0,80.0,6.8,142.0,5.5,8.5,,,,yes,yes,no,good,no,yes,ckd 206 | 204,65.0,90.0,1.01,4.0,2.0,normal,normal,notpresent,notpresent,172.0,82.0,13.5,145.0,6.3,8.8,31,,,yes,yes,no,good,yes,yes,ckd 207 | 205,61.0,70.0,,,,,,notpresent,notpresent,100.0,28.0,2.1,,,12.6,43,,,yes,yes,no,good,no,no,ckd 208 | 206,60.0,70.0,1.01,1.0,0.0,,normal,notpresent,notpresent,109.0,96.0,3.9,135.0,4.0,13.8,41,,,yes,no,no,good,no,no,ckd 209 | 207,50.0,70.0,1.01,0.0,0.0,,normal,notpresent,notpresent,230.0,50.0,2.2,,,12.0,41,10400,4.6,yes,yes,no,good,no,no,ckd 210 | 208,67.0,80.0,,,,,,notpresent,notpresent,341.0,37.0,1.5,,,12.3,41,6900,4.9,yes,yes,no,good,no,yes,ckd 211 | 209,19.0,70.0,1.02,0.0,0.0,,normal,notpresent,notpresent,,,,,,11.5,,6900,,no,no,no,good,no,no,ckd 212 | 210,59.0,100.0,1.015,4.0,2.0,normal,normal,notpresent,notpresent,255.0,132.0,12.8,135.0,5.7,7.3,20,9800,3.9,yes,yes,yes,good,no,yes,ckd 213 | 211,54.0,120.0,1.015,0.0,0.0,,normal,notpresent,notpresent,103.0,18.0,1.2,,,,,,,no,no,no,good,no,no,ckd 214 | 212,40.0,70.0,1.015,3.0,4.0,normal,normal,notpresent,notpresent,253.0,150.0,11.9,132.0,5.6,10.9,31,8800,3.4,yes,yes,no,poor,yes,no,ckd 215 | 213,55.0,80.0,1.01,3.0,1.0,normal,abnormal,present,present,214.0,73.0,3.9,137.0,4.9,10.9,34,7400,3.7,yes,yes,no,good,yes,no,ckd 216 | 214,68.0,80.0,1.015,0.0,0.0,,abnormal,notpresent,notpresent,171.0,30.0,1.0,,,13.7, 43,4900,5.2,no,yes,no,good,no,no,ckd 217 | 215,2.0,,1.01,3.0,0.0,normal,abnormal,notpresent,notpresent,,,,,,,,,,no,no,no,good,yes,no,ckd 218 | 216,64.0,70.0,1.01,0.0,0.0,,normal,notpresent,notpresent,107.0,15.0,,,,12.8,38,,,no,no,no,good,no,no,ckd 219 | 217,63.0,100.0,1.01,1.0,0.0,,normal,notpresent,notpresent,78.0,61.0,1.8,141.0,4.4,12.2,36,10500,4.3,no,yes,no,good,no,no,ckd 220 | 218,33.0,90.0,1.015,0.0,0.0,,normal,notpresent,notpresent,92.0,19.0,0.8,,,11.8,34,7000,,no,no,no,good,no,no,ckd 221 | 219,68.0,90.0,1.01,0.0,0.0,,normal,notpresent,notpresent,238.0,57.0,2.5,,,9.8,28,8000,3.3,yes,yes,no,poor,no,no,ckd 222 | 220,36.0,80.0,1.01,0.0,0.0,,normal,notpresent,notpresent,103.0,,,,,11.9,36,8800,,no,no,no,good,no,no,ckd 223 | 221,66.0,70.0,1.02,1.0,0.0,normal,,notpresent,notpresent,248.0,30.0,1.7,138.0,5.3,,,,,yes,yes,no,good,no,no,ckd 224 | 222,74.0,60.0,,,,,,notpresent,notpresent,108.0,68.0,1.8,,,,,,,yes,yes,no,good,no,no,ckd 225 | 223,71.0,90.0,1.01,0.0,3.0,,normal,notpresent,notpresent,303.0,30.0,1.3,136.0,4.1,13.0,38,9200,4.6,yes,yes,no,good,no,no,ckd 226 | 224,34.0,60.0,1.02,0.0,0.0,,normal,notpresent,notpresent,117.0,28.0,2.2,138.0,3.8,,,,,no,no,no,good,yes,no,ckd 227 | 225,60.0,90.0,1.01,3.0,5.0,abnormal,normal,notpresent,present,490.0,95.0,2.7,131.0,3.8,11.5,35,12000,4.5,yes,yes,no,good,no,no,ckd 228 | 226,64.0,100.0,1.015,4.0,2.0,abnormal,abnormal,notpresent,present,163.0,54.0,7.2,140.0,4.6,7.9,26,7500,3.4,yes,yes,no,good,yes,no,ckd 229 | 227,57.0,80.0,1.015,0.0,0.0,,normal,notpresent,notpresent,120.0,48.0,1.6,,,11.3,36,7200,3.8,yes,yes,no,good,no,no,ckd 230 | 228,60.0,70.0,,,,,,notpresent,notpresent,124.0,52.0,2.5,,,,,,,yes,no,no,good,no,no,ckd 231 | 229,59.0,50.0,1.01,3.0,0.0,normal,abnormal,notpresent,notpresent,241.0,191.0,12.0,114.0,2.9,9.6,31,15700,3.8,no,yes,no,good,yes,no,ckd 232 | 230,65.0,60.0,1.01,2.0,0.0,normal,abnormal,present,notpresent,192.0,17.0,1.7,130.0,4.3,,,9500,,yes,yes,no,poor,no,no,ckd 233 | 231,60.0,90.0,,,,,,notpresent,notpresent,269.0,51.0,2.8,138.0,3.7,11.5,35,,,yes,yes,yes,good,yes,no,ckd 234 | 232,50.0,90.0,1.015,1.0,0.0,abnormal,abnormal,notpresent,notpresent,,,,,,,,,,no,no,no,good,yes,no,ckd 235 | 233,51.0,100.0,1.015,2.0,0.0,normal,normal,notpresent,present,93.0,20.0,1.6,146.0,4.5,,,,,no,no,no,poor,no,no,ckd 236 | 234,37.0,100.0,1.01,0.0,0.0,abnormal,normal,notpresent,notpresent,,19.0,1.3,,,15.0,44,4100,5.2,yes,no,no,good,no,no,ckd 237 | 235,45.0,70.0,1.01,2.0,0.0,,normal,notpresent,notpresent,113.0,93.0,2.3,,,7.9,26,5700,,no,no,yes,good,no,yes,ckd 238 | 236,65.0,80.0,,,,,,notpresent,notpresent,74.0,66.0,2.0,136.0,5.4,9.1,25,,,yes,yes,yes,good,yes,no,ckd 239 | 237,80.0,70.0,1.015,2.0,2.0,,normal,notpresent,notpresent,141.0,53.0,2.2,,,12.7,40,9600,,yes,yes,no,poor,yes,no,ckd 240 | 238,72.0,100.0,,,,,,notpresent,notpresent,201.0,241.0,13.4,127.0,4.8,9.4,28,,,yes,yes,no,good,no,yes,ckd 241 | 239,34.0,90.0,1.015,2.0,0.0,normal,normal,notpresent,notpresent,104.0,50.0,1.6,137.0,4.1,11.9,39,,,no,no,no,good,no,no,ckd 242 | 240,65.0,70.0,1.015,1.0,0.0,,normal,notpresent,notpresent,203.0,46.0,1.4,,,11.4,36,5000,4.1,yes,yes,no,poor,yes,no,ckd 243 | 241,57.0,70.0,1.015,1.0,0.0,,abnormal,notpresent,notpresent,165.0,45.0,1.5,140.0,3.3,10.4,31,4200,3.9,no,no,no,good,no,no,ckd 244 | 242,69.0,70.0,1.01,4.0,3.0,normal,abnormal,present,present,214.0,96.0,6.3,120.0,3.9,9.4,28,11500,3.3,yes,yes,yes,good,yes,yes,ckd 245 | 243,62.0,90.0,1.02,2.0,1.0,,normal,notpresent,notpresent,169.0,48.0,2.4,138.0,2.9,13.4,47,11000,6.1,yes,no,no,good,no,no,ckd 246 | 244,64.0,90.0,1.015,3.0,2.0,,abnormal,present,notpresent,463.0,64.0,2.8,135.0,4.1,12.2,40,9800,4.6,yes,yes,no,good,no,yes,ckd 247 | 245,48.0,100.0,,,,,,notpresent,notpresent,103.0,79.0,5.3,135.0,6.3,6.3,19,7200,2.6,yes,no,yes,poor,no,no,ckd 248 | 246,48.0,110.0,1.015,3.0,0.0,abnormal,normal,present,notpresent,106.0,215.0,15.2,120.0,5.7,8.6,26,5000,2.5,yes,no,yes,good,no,yes,ckd 249 | 247,54.0,90.0,1.025,1.0,0.0,normal,abnormal,notpresent,notpresent,150.0,18.0,1.2,140.0,4.2,,,,,no,no,no,poor,yes,yes,ckd 250 | 248,59.0,70.0,1.01,1.0,3.0,abnormal,abnormal,notpresent,notpresent,424.0,55.0,1.7,138.0,4.5,12.6,37,10200,4.1,yes,yes,yes,good,no,no,ckd 251 | 249,56.0,90.0,1.01,4.0,1.0,normal,abnormal,present,notpresent,176.0,309.0,13.3,124.0,6.5,3.1,9,5400,2.1,yes,yes,no,poor,yes,yes,ckd 252 | 250,40.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,140.0,10.0,1.2,135.0,5.0,15.0,48,10400,4.5,no,no,no,good,no,no,notckd 253 | 251,23.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,70.0,36.0,1.0,150.0,4.6,17.0,52,9800,5.0,no,no,no,good,no,no,notckd 254 | 252,45.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,82.0,49.0,0.6,147.0,4.4,15.9,46,9100,4.7,no,no,no,good,no,no,notckd 255 | 253,57.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,119.0,17.0,1.2,135.0,4.7,15.4,42,6200,6.2,no,no,no,good,no,no,notckd 256 | 254,51.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,99.0,38.0,0.8,135.0,3.7,13.0,49,8300,5.2,no,no,no,good,no,no,notckd 257 | 255,34.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,121.0,27.0,1.2,144.0,3.9,13.6,52,9200,6.3,no,no,no,good,no,no,notckd 258 | 256,60.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,131.0,10.0,0.5,146.0,5.0,14.5,41,10700,5.1,no,no,no,good,no,no,notckd 259 | 257,38.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,91.0,36.0,0.7,135.0,3.7,14.0,46,9100,5.8,no,no,no,good,no,no,notckd 260 | 258,42.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,98.0,20.0,0.5,140.0,3.5,13.9,44,8400,5.5,no,no,no,good,no,no,notckd 261 | 259,35.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,104.0,31.0,1.2,135.0,5.0,16.1,45,4300,5.2,no,no,no,good,no,no,notckd 262 | 260,30.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,131.0,38.0,1.0,147.0,3.8,14.1,45,9400,5.3,no,no,no,good,no,no,notckd 263 | 261,49.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,122.0,32.0,1.2,139.0,3.9,17.0,41,5600,4.9,no,no,no,good,no,no,notckd 264 | 262,55.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,118.0,18.0,0.9,135.0,3.6,15.5,43,7200,5.4,no,no,no,good,no,no,notckd 265 | 263,45.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,117.0,46.0,1.2,137.0,5.0,16.2,45,8600,5.2,no,no,no,good,no,no,notckd 266 | 264,42.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,132.0,24.0,0.7,140.0,4.1,14.4,50,5000,4.5,no,no,no,good,no,no,notckd 267 | 265,50.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,97.0,40.0,0.6,150.0,4.5,14.2,48,10500,5.0,no,no,no,good,no,no,notckd 268 | 266,55.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,133.0,17.0,1.2,135.0,4.8,13.2,41,6800,5.3,no,no,no,good,no,no,notckd 269 | 267,48.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,122.0,33.0,0.9,146.0,3.9,13.9,48,9500,4.8,no,no,no,good,no,no,notckd 270 | 268,,80.0,,,,,,notpresent,notpresent,100.0,49.0,1.0,140.0,5.0,16.3,53,8500,4.9,no,no,no,good,no,no,notckd 271 | 269,25.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,121.0,19.0,1.2,142.0,4.9,15.0,48,6900,5.3,no,no,no,good,no,no,notckd 272 | 270,23.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,111.0,34.0,1.1,145.0,4.0,14.3,41,7200,5.0,no,no,no,good,no,no,notckd 273 | 271,30.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,96.0,25.0,0.5,144.0,4.8,13.8,42,9000,4.5,no,no,no,good,no,no,notckd 274 | 272,56.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,139.0,15.0,1.2,135.0,5.0,14.8,42,5600,5.5,no,no,no,good,no,no,notckd 275 | 273,47.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,95.0,35.0,0.9,140.0,4.1,,,,,no,no,no,good,no,no,notckd 276 | 274,19.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,107.0,23.0,0.7,141.0,4.2,14.4,44,,,no,no,no,good,no,no,notckd 277 | 275,52.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,125.0,22.0,1.2,139.0,4.6,16.5,43,4700,4.6,no,no,no,good,no,no,notckd 278 | 276,20.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,,,,137.0,4.7,14.0,41,4500,5.5,no,no,no,good,no,no,notckd 279 | 277,46.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,123.0,46.0,1.0,135.0,5.0,15.7,50,6300,4.8,no,no,no,good,no,no,notckd 280 | 278,48.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,112.0,44.0,1.2,142.0,4.9,14.5,44,9400,6.4,no,no,no,good,no,no,notckd 281 | 279,24.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,140.0,23.0,0.6,140.0,4.7,16.3,48,5800,5.6,no,no,no,good,no,no,notckd 282 | 280,47.0,80.0,,,,,,notpresent,notpresent,93.0,33.0,0.9,144.0,4.5,13.3,52,8100,5.2,no,no,no,good,no,no,notckd 283 | 281,55.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,130.0,50.0,1.2,147.0,5.0,15.5,41,9100,6.0,no,no,no,good,no,no,notckd 284 | 282,20.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,123.0,44.0,1.0,135.0,3.8,14.6,44,5500,4.8,no,no,no,good,no,no,notckd 285 | 283,60.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,,,,,,16.4,43,10800,5.7,no,no,no,good,no,no,notckd 286 | 284,33.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,100.0,37.0,1.2,142.0,4.0,16.9,52,6700,6.0,no,no,no,good,no,no,notckd 287 | 285,66.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,94.0,19.0,0.7,135.0,3.9,16.0,41,5300,5.9,no,no,no,good,no,no,notckd 288 | 286,71.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,81.0,18.0,0.8,145.0,5.0,14.7,44,9800,6.0,no,no,no,good,no,no,notckd 289 | 287,39.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,124.0,22.0,0.6,137.0,3.8,13.4,43,,,no,no,no,good,no,no,notckd 290 | 288,56.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,70.0,46.0,1.2,135.0,4.9,15.9,50,11000,5.1,,,,good,no,no,notckd 291 | 289,42.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,93.0,32.0,0.9,143.0,4.7,16.6,43,7100,5.3,no,no,no,good,no,no,notckd 292 | 290,54.0,70.0,1.02,0.0,0.0,,,,,76.0,28.0,0.6,146.0,3.5,14.8,52,8400,5.9,no,no,no,good,no,no,notckd 293 | 291,47.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,124.0,44.0,1.0,140.0,4.9,14.9,41,7000,5.7,no,no,no,good,no,no,notckd 294 | 292,30.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,89.0,42.0,0.5,139.0,5.0,16.7,52,10200,5.0,no,no,no,good,no,no,notckd 295 | 293,50.0,,1.02,0.0,0.0,normal,normal,notpresent,notpresent,92.0,19.0,1.2,150.0,4.8,14.9,48,4700,5.4,no,no,no,good,no,no,notckd 296 | 294,75.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,110.0,50.0,0.7,135.0,5.0,14.3,40,8300,5.8,no,no,no,,,,notckd 297 | 295,44.0,70.0,,,,,,notpresent,notpresent,106.0,25.0,0.9,150.0,3.6,15.0,50,9600,6.5,no,no,no,good,no,no,notckd 298 | 296,41.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,125.0,38.0,0.6,140.0,5.0,16.8,41,6300,5.9,no,no,no,good,no,no,notckd 299 | 297,53.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,116.0,26.0,1.0,146.0,4.9,15.8,45,7700,5.2,,,,good,no,no,notckd 300 | 298,34.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,91.0,49.0,1.2,135.0,4.5,13.5,48,8600,4.9,no,no,no,good,no,no,notckd 301 | 299,73.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,127.0,48.0,0.5,150.0,3.5,15.1,52,11000,4.7,no,no,no,good,no,no,notckd 302 | 300,45.0,60.0,1.02,0.0,0.0,normal,normal,,,114.0,26.0,0.7,141.0,4.2,15.0,43,9200,5.8,no,no,no,good,no,no,notckd 303 | 301,44.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,96.0,33.0,0.9,147.0,4.5,16.9,41,7200,5.0,no,no,no,good,no,no,notckd 304 | 302,29.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,127.0,44.0,1.2,145.0,5.0,14.8,48,,,no,no,no,good,no,no,notckd 305 | 303,55.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,107.0,26.0,1.1,,,17.0,50,6700,6.1,no,no,no,good,no,no,notckd 306 | 304,33.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,128.0,38.0,0.6,135.0,3.9,13.1,45,6200,4.5,no,no,no,good,no,no,notckd 307 | 305,41.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,122.0,25.0,0.8,138.0,5.0,17.1,41,9100,5.2,no,no,no,good,no,no,notckd 308 | 306,52.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,128.0,30.0,1.2,140.0,4.5,15.2,52,4300,5.7,no,no,no,good,no,no,notckd 309 | 307,47.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,137.0,17.0,0.5,150.0,3.5,13.6,44,7900,4.5,no,no,no,good,no,no,notckd 310 | 308,43.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,81.0,46.0,0.6,135.0,4.9,13.9,48,6900,4.9,no,no,no,good,no,no,notckd 311 | 309,51.0,60.0,1.02,0.0,0.0,,,notpresent,notpresent,129.0,25.0,1.2,139.0,5.0,17.2,40,8100,5.9,no,no,no,good,no,no,notckd 312 | 310,46.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,102.0,27.0,0.7,142.0,4.9,13.2,44,11000,5.4,no,no,no,good,no,no,notckd 313 | 311,56.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,132.0,18.0,1.1,147.0,4.7,13.7,45,7500,5.6,no,no,no,good,no,no,notckd 314 | 312,80.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,,,,135.0,4.1,15.3,48,6300,6.1,no,no,no,good,no,no,notckd 315 | 313,55.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,104.0,28.0,0.9,142.0,4.8,17.3,52,8200,4.8,no,no,no,good,no,no,notckd 316 | 314,39.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,131.0,46.0,0.6,145.0,5.0,15.6,41,9400,4.7,no,no,no,good,no,no,notckd 317 | 315,44.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,,,,,,13.8,48,7800,4.4,no,no,no,good,no,no,notckd 318 | 316,35.0,,1.02,0.0,0.0,normal,normal,,,99.0,30.0,0.5,135.0,4.9,15.4,48,5000,5.2,no,no,no,good,no,no,notckd 319 | 317,58.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,102.0,48.0,1.2,139.0,4.3,15.0,40,8100,4.9,no,no,no,good,no,no,notckd 320 | 318,61.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,120.0,29.0,0.7,137.0,3.5,17.4,52,7000,5.3,no,no,no,good,no,no,notckd 321 | 319,30.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,138.0,15.0,1.1,135.0,4.4,,,,,no,no,no,good,no,no,notckd 322 | 320,57.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,105.0,49.0,1.2,150.0,4.7,15.7,44,10400,6.2,no,no,no,good,no,no,notckd 323 | 321,65.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,109.0,39.0,1.0,144.0,3.5,13.9,48,9600,4.8,no,no,no,good,no,no,notckd 324 | 322,70.0,60.0,,,,,,notpresent,notpresent,120.0,40.0,0.5,140.0,4.6,16.0,43,4500,4.9,no,no,no,good,no,no,notckd 325 | 323,43.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,130.0,30.0,1.1,143.0,5.0,15.9,45,7800,4.5,no,no,no,good,no,no,notckd 326 | 324,40.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,119.0,15.0,0.7,150.0,4.9,,,,,no,no,no,good,no,no,notckd 327 | 325,58.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,100.0,50.0,1.2,140.0,3.5,14.0,50,6700,6.5,no,no,no,good,no,no,notckd 328 | 326,47.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,109.0,25.0,1.1,141.0,4.7,15.8,41,8300,5.2,no,no,no,good,no,no,notckd 329 | 327,30.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,120.0,31.0,0.8,150.0,4.6,13.4,44,10700,5.8,no,no,no,good,no,no,notckd 330 | 328,28.0,70.0,1.02,0.0,0.0,normal,normal,,,131.0,29.0,0.6,145.0,4.9,,45,8600,6.5,no,no,no,good,no,no,notckd 331 | 329,33.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,80.0,25.0,0.9,146.0,3.5,14.1,48,7800,5.1,no,no,no,good,no,no,notckd 332 | 330,43.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,114.0,32.0,1.1,135.0,3.9,,42,,,no,no,no,good,no,no,notckd 333 | 331,59.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,130.0,39.0,0.7,147.0,4.7,13.5,46,6700,4.5,no,no,no,good,no,no,notckd 334 | 332,34.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,,33.0,1.0,150.0,5.0,15.3,44,10500,6.1,no,no,no,good,no,no,notckd 335 | 333,23.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,99.0,46.0,1.2,142.0,4.0,17.7,46,4300,5.5,no,no,no,good,no,no,notckd 336 | 334,24.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,125.0,,,136.0,3.5,15.4,43,5600,4.5,no,no,no,good,no,no,notckd 337 | 335,60.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,134.0,45.0,0.5,139.0,4.8,14.2,48,10700,5.6,no,no,no,good,no,no,notckd 338 | 336,25.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,119.0,27.0,0.5,,,15.2,40,9200,5.2,no,no,no,good,no,no,notckd 339 | 337,44.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,92.0,40.0,0.9,141.0,4.9,14.0,52,7500,6.2,no,no,no,good,no,no,notckd 340 | 338,62.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,132.0,34.0,0.8,147.0,3.5,17.8,44,4700,4.5,no,no,no,good,no,no,notckd 341 | 339,25.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,88.0,42.0,0.5,136.0,3.5,13.3,48,7000,4.9,no,no,no,good,no,no,notckd 342 | 340,32.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,100.0,29.0,1.1,142.0,4.5,14.3,43,6700,5.9,no,no,no,good,no,no,notckd 343 | 341,63.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,130.0,37.0,0.9,150.0,5.0,13.4,41,7300,4.7,no,no,no,good,no,no,notckd 344 | 342,44.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,95.0,46.0,0.5,138.0,4.2,15.0,50,7700,6.3,no,no,no,good,no,no,notckd 345 | 343,37.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,111.0,35.0,0.8,135.0,4.1,16.2,50,5500,5.7,no,no,no,good,no,no,notckd 346 | 344,64.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,106.0,27.0,0.7,150.0,3.3,14.4,42,8100,4.7,no,no,no,good,no,no,notckd 347 | 345,22.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,97.0,18.0,1.2,138.0,4.3,13.5,42,7900,6.4,no,no,no,good,no,no,notckd 348 | 346,33.0,60.0,,,,normal,normal,notpresent,notpresent,130.0,41.0,0.9,141.0,4.4,15.5,52,4300,5.8,no,no,no,good,no,no,notckd 349 | 347,43.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,108.0,25.0,1.0,144.0,5.0,17.8,43,7200,5.5,no,no,no,good,no,no,notckd 350 | 348,38.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,99.0,19.0,0.5,147.0,3.5,13.6,44,7300,6.4,no,no,no,good,no,no,notckd 351 | 349,35.0,70.0,1.025,0.0,0.0,,,notpresent,notpresent,82.0,36.0,1.1,150.0,3.5,14.5,52,9400,6.1,no,no,no,good,no,no,notckd 352 | 350,65.0,70.0,1.025,0.0,0.0,,,notpresent,notpresent,85.0,20.0,1.0,142.0,4.8,16.1,43,9600,4.5,no,no,no,good,no,no,notckd 353 | 351,29.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,83.0,49.0,0.9,139.0,3.3,17.5,40,9900,4.7,no,no,no,good,no,no,notckd 354 | 352,37.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,109.0,47.0,1.1,141.0,4.9,15.0,48,7000,5.2,no,no,no,good,no,no,notckd 355 | 353,39.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,86.0,37.0,0.6,150.0,5.0,13.6,51,5800,4.5,no,no,no,good,no,no,notckd 356 | 354,32.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,102.0,17.0,0.4,147.0,4.7,14.6,41,6800,5.1,no,no,no,good,no,no,notckd 357 | 355,23.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,95.0,24.0,0.8,145.0,5.0,15.0,52,6300,4.6,no,no,no,good,no,no,notckd 358 | 356,34.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,87.0,38.0,0.5,144.0,4.8,17.1,47,7400,6.1,no,no,no,good,no,no,notckd 359 | 357,66.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,107.0,16.0,1.1,140.0,3.6,13.6,42,11000,4.9,no,no,no,good,no,no,notckd 360 | 358,47.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,117.0,22.0,1.2,138.0,3.5,13.0,45,5200,5.6,no,no,no,good,no,no,notckd 361 | 359,74.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,88.0,50.0,0.6,147.0,3.7,17.2,53,6000,4.5,no,no,no,good,no,no,notckd 362 | 360,35.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,105.0,39.0,0.5,135.0,3.9,14.7,43,5800,6.2,no,no,no,good,no,no,notckd 363 | 361,29.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,70.0,16.0,0.7,138.0,3.5,13.7,54,5400,5.8,no,no,no,good,no,no,notckd 364 | 362,33.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,89.0,19.0,1.1,144.0,5.0,15.0,40,10300,4.8,no,no,no,good,no,no,notckd 365 | 363,67.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,99.0,40.0,0.5,,,17.8,44,5900,5.2,no,no,no,good,no,no,notckd 366 | 364,73.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,118.0,44.0,0.7,137.0,3.5,14.8,45,9300,4.7,no,no,no,good,no,no,notckd 367 | 365,24.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,93.0,46.0,1.0,145.0,3.5,,,10700,6.3,no,no,no,good,no,no,notckd 368 | 366,60.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,81.0,15.0,0.5,141.0,3.6,15.0,46,10500,5.3,no,no,no,good,no,no,notckd 369 | 367,68.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,125.0,41.0,1.1,139.0,3.8,17.4,50,6700,6.1,no,no,no,good,no,no,notckd 370 | 368,30.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,82.0,42.0,0.7,146.0,5.0,14.9,45,9400,5.9,no,no,no,good,no,no,notckd 371 | 369,75.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,107.0,48.0,0.8,144.0,3.5,13.6,46,10300,4.8,no,no,no,good,no,no,notckd 372 | 370,69.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,83.0,42.0,1.2,139.0,3.7,16.2,50,9300,5.4,no,no,no,good,no,no,notckd 373 | 371,28.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,79.0,50.0,0.5,145.0,5.0,17.6,51,6500,5.0,no,no,no,good,no,no,notckd 374 | 372,72.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,109.0,26.0,0.9,150.0,4.9,15.0,52,10500,5.5,no,no,no,good,no,no,notckd 375 | 373,61.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,133.0,38.0,1.0,142.0,3.6,13.7,47,9200,4.9,no,no,no,good,no,no,notckd 376 | 374,79.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,111.0,44.0,1.2,146.0,3.6,16.3,40,8000,6.4,no,no,no,good,no,no,notckd 377 | 375,70.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,74.0,41.0,0.5,143.0,4.5,15.1,48,9700,5.6,no,no,no,good,no,no,notckd 378 | 376,58.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,88.0,16.0,1.1,147.0,3.5,16.4,53,9100,5.2,no,no,no,good,no,no,notckd 379 | 377,64.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,97.0,27.0,0.7,145.0,4.8,13.8,49,6400,4.8,no,no,no,good,no,no,notckd 380 | 378,71.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,,,0.9,140.0,4.8,15.2,42,7700,5.5,no,no,no,good,no,no,notckd 381 | 379,62.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,78.0,45.0,0.6,138.0,3.5,16.1,50,5400,5.7,no,no,no,good,no,no,notckd 382 | 380,59.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,113.0,23.0,1.1,139.0,3.5,15.3,54,6500,4.9,no,no,no,good,no,no,notckd 383 | 381,71.0,70.0,1.025,0.0,0.0,,,notpresent,notpresent,79.0,47.0,0.5,142.0,4.8,16.6,40,5800,5.9,no,no,no,good,no,no,notckd 384 | 382,48.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,75.0,22.0,0.8,137.0,5.0,16.8,51,6000,6.5,no,no,no,good,no,no,notckd 385 | 383,80.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,119.0,46.0,0.7,141.0,4.9,13.9,49,5100,5.0,no,no,no,good,no,no,notckd 386 | 384,57.0,60.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,132.0,18.0,1.1,150.0,4.7,15.4,42,11000,4.5,no,no,no,good,no,no,notckd 387 | 385,63.0,70.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,113.0,25.0,0.6,146.0,4.9,16.5,52,8000,5.1,no,no,no,good,no,no,notckd 388 | 386,46.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,100.0,47.0,0.5,142.0,3.5,16.4,43,5700,6.5,no,no,no,good,no,no,notckd 389 | 387,15.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,93.0,17.0,0.9,136.0,3.9,16.7,50,6200,5.2,no,no,no,good,no,no,notckd 390 | 388,51.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,94.0,15.0,1.2,144.0,3.7,15.5,46,9500,6.4,no,no,no,good,no,no,notckd 391 | 389,41.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,112.0,48.0,0.7,140.0,5.0,17.0,52,7200,5.8,no,no,no,good,no,no,notckd 392 | 390,52.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,99.0,25.0,0.8,135.0,3.7,15.0,52,6300,5.3,no,no,no,good,no,no,notckd 393 | 391,36.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,85.0,16.0,1.1,142.0,4.1,15.6,44,5800,6.3,no,no,no,good,no,no,notckd 394 | 392,57.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,133.0,48.0,1.2,147.0,4.3,14.8,46,6600,5.5,no,no,no,good,no,no,notckd 395 | 393,43.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,117.0,45.0,0.7,141.0,4.4,13.0,54,7400,5.4,no,no,no,good,no,no,notckd 396 | 394,50.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,137.0,46.0,0.8,139.0,5.0,14.1,45,9500,4.6,no,no,no,good,no,no,notckd 397 | 395,55.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,140.0,49.0,0.5,150.0,4.9,15.7,47,6700,4.9,no,no,no,good,no,no,notckd 398 | 396,42.0,70.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,75.0,31.0,1.2,141.0,3.5,16.5,54,7800,6.2,no,no,no,good,no,no,notckd 399 | 397,12.0,80.0,1.02,0.0,0.0,normal,normal,notpresent,notpresent,100.0,26.0,0.6,137.0,4.4,15.8,49,6600,5.4,no,no,no,good,no,no,notckd 400 | 398,17.0,60.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,114.0,50.0,1.0,135.0,4.9,14.2,51,7200,5.9,no,no,no,good,no,no,notckd 401 | 399,58.0,80.0,1.025,0.0,0.0,normal,normal,notpresent,notpresent,131.0,18.0,1.1,141.0,3.5,15.8,53,6800,6.1,no,no,no,good,no,no,notckd 402 | --------------------------------------------------------------------------------