{"metadata": {"language_info": {"name": "python", "mimetype": "text/x-python", "file_extension": ".py", "pygments_lexer": "ipython3", "codemirror_mode": {"name": "ipython", "version": 3}, "version": "3.6.3", "nbconvert_exporter": "python"}, "kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}}, "nbformat_minor": 1, "cells": [{"source": ["# This Python 3 environment comes with many helpful analytics libraries installed\n", "# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n", "# For example, here's several helpful packages to load in \n", "\n", "import numpy as np # linear algebra\n", "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n", "\n", "# Input data files are available in the \"../input/\" directory.\n", "# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n", "\n", "from subprocess import check_output\n", "print(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n", "\n", "# Any results you write to the current directory are saved as output."], "metadata": {"_uuid": "a3234cbb54e47c04f02d031cce6bd15ba5129665", "collapsed": true, "_cell_guid": "0972876e-cd92-4a51-990c-bcb6ffdb4282"}, "cell_type": "code", "outputs": [], "execution_count": null}, {"source": ["train = pd.read_csv('../input/train.csv')"], "metadata": {"_uuid": "14b36e38b247dbe4d3ffe17f0b338408b1139dfb", "collapsed": true, "_cell_guid": "a39de7e4-4004-4970-b3f0-30992ca81c3c"}, "cell_type": "code", "outputs": [], "execution_count": null}, {"source": ["Calculating the fraction of users who churn"], "metadata": {"_uuid": "1c302a33578f921dd5e0f7d144340d011c9e0e1b", "_cell_guid": "19b0a025-7e7f-44da-9c58-6c334d485954"}, "cell_type": "markdown"}, {"source": ["train.groupby('is_churn').count()"], "metadata": {"_uuid": "f181bd3dcdf2664030c91fd9700da390ef6869e2", "collapsed": true, "_cell_guid": "5c60e183-7e7e-4e94-a4e4-13401a35087d"}, "cell_type": "code", "outputs": [], "execution_count": null}, {"source": ["63471/float(929460)"], "metadata": {"_uuid": "4870a702e894d421ac1dc65cf5d27f4dc1755038", "collapsed": true, "_cell_guid": "7d5cbcb7-d770-4c32-bd88-95f386bfb500"}, "cell_type": "code", "outputs": [], "execution_count": null}, {"source": ["Simply adding this fraction as output for all users"], "metadata": {"_uuid": "074fa3da9398d048acca3d675c571cadef8fe7fa", "_cell_guid": "44496b77-3d24-40a0-a01f-bfb64f2f34df"}, "cell_type": "markdown"}, {"source": ["submission = pd.read_csv('../input/sample_submission_zero.csv')"], "metadata": {"_uuid": "bcc39681c1ae32641a6d442f1117ff200a87982a", "collapsed": true, "_cell_guid": "6d7a25bb-f876-41fd-ba5b-e0b6507ea2e9"}, "cell_type": "code", "outputs": [], "execution_count": null}, {"source": ["submission['is_churn'] = 0.06828803821573817\n", "submission.head()"], "metadata": {"_uuid": "abb8888f0e39ddfbdf53a97d2de2a4c6cbf29b6b", "collapsed": true, "_cell_guid": "a31a0e43-eec6-4aef-9dbe-90a52d26cbb9"}, "cell_type": "code", "outputs": [], "execution_count": null}, {"source": ["submission.to_csv('most_basic_baseline_prediction.csv',index=False)"], "metadata": {"_uuid": "2e88185f2a2c202bfd532c937bddda772bf17df0", "_kg_hide-output": true, "collapsed": true, "_cell_guid": "b100d94f-b0cf-4fd7-a872-85fed5c594d3"}, "cell_type": "code", "outputs": [], "execution_count": null}, {"source": [], "metadata": {"_uuid": "75e32fbe33330502adf53269c2db057a815df030", "collapsed": true, "_cell_guid": "11614fdf-68a1-4d99-9ef2-b054c90f61db"}, "cell_type": "code", "outputs": [], "execution_count": null}], "nbformat": 4}