Skip to content

Commit

Permalink
Changed all files in dev_code to have correct file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharymeurer committed Jun 28, 2024
1 parent ef761eb commit 1ca1598
Show file tree
Hide file tree
Showing 37 changed files with 22 additions and 276 deletions.
22 changes: 0 additions & 22 deletions data/db_filenames.csv

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
"from sklearn.cluster import KMeans\n",
"from kmodes.kprototypes import KPrototypes\n",
"\n",
"k_df = pd.read_csv(\"all data/citizen/maharashtra.csv\")\n",
"k_df = pd.read_csv(\"../data/citizen_states_cleaned/maharashtra.csv\")\n",
"k_df = k_df[k_df[\"Species_name\"] == \"Peepal-Ficus religiosa\"]\n",
"\n",
"species = {}\n",
Expand Down Expand Up @@ -466,7 +466,7 @@
"from sklearn.preprocessing import OneHotEncoder\n",
"import numpy as np\n",
"\n",
"k_df = pd.read_csv(\"all data/citizen/maharashtra.csv\")\n",
"k_df = pd.read_csv(\"../data/citizen_states_cleaned/maharashtra.csv\")\n",
"k_df = k_df[k_df[\"Species_name\"] == \"Peepal-Ficus religiosa\"]\n",
"\n",
"k_df = k_df.drop([\"Date_of_observation\", \"Observation_ID\", \"User_id\", \"User_Tree_id\", \"Lat\", \"Long\"], axis=1)\n",
Expand Down Expand Up @@ -515,16 +515,6 @@
"plt.ylabel('Principal Component 2')\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f7cf1ba4",
"metadata": {},
"outputs": [],
"source": [
"# "
]
}
],
"metadata": {
Expand All @@ -543,7 +533,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions dev_code/mean transition times from repeat observations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"outputs": [],
"source": [
"def plot_probs(species_id, attr, year):\n",
" state_df = pd.read_csv('all data/citizen/kerala.csv')\n",
" state_df = pd.read_csv('../data/citizen_states_cleaned/kerala.csv')\n",
" transition_data = get_transition_data(state_df, species_id, attr, year)\n",
" transition_probs = transition_data / np.sum(transition_data)\n",
" pcts = get_percent_data(state_df, species_id, attr, year)\n",
Expand Down Expand Up @@ -186,7 +186,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
18 changes: 9 additions & 9 deletions dev_code/mean_transition_times_dev.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
"outputs": [],
"source": [
"def plot_score_and_pcts(species_id, attr, L=5, M=3, w_1=1, w_2=1, w_3=1, size_term=False):\n",
" state_df = pd.read_csv('all data/citizen/kerala.csv')\n",
" state_df = pd.read_csv('../data/citizen_state_names/kerala.csv')\n",
" pcts = []\n",
" for year in range(2018, 2024):\n",
" pcts += get_percent_of_positive_observations_for_each_week(state_df, year, species_id, attr)\n",
Expand Down Expand Up @@ -209,7 +209,7 @@
"outputs": [],
"source": [
"def plot_score_for_one_year(year, species_id, attr, L=5, M=3, w_1=1, w_2=1):\n",
" state_df = pd.read_csv('all data/citizen/kerala.csv')\n",
" state_df = pd.read_csv('../data/citizen_state_names/kerala.csv')\n",
" pcts = []\n",
" for y in range(2018, 2024):\n",
" pcts += get_percent_of_positive_observations_for_each_week(state_df, y, species_id, attr)\n",
Expand Down Expand Up @@ -250,7 +250,7 @@
"outputs": [],
"source": [
"def plot_stagnations(species_id, attr, L=5, M=3, w_1=1, w_2=1, w_3=1, size_term=False):\n",
" state_df = pd.read_csv('all data/citizen/kerala.csv')\n",
" state_df = pd.read_csv('../data/citizen_state_names/kerala.csv')\n",
" pcts = []\n",
" if size_term:\n",
" scores, spikes, stagns, sizes = get_scores(state_df, species_id, attr, L=L, M=M, w_1=w_1, w_2=w_2, w_3=w_3, size_term=size_term)\n",
Expand Down Expand Up @@ -300,7 +300,7 @@
" # plt.title(f\"Average transition time for Mango (all species) {attr} in Kerala, {year}, L={L}, M={M}, w_1={w_1}, w_2={w_2}\")\n",
"\n",
"def plot_spikes(species_id, attr, L=5, M=3, w_1=1, w_2=1, w_3=1, size_term=False):\n",
" state_df = pd.read_csv('all data/citizen/kerala.csv')\n",
" state_df = pd.read_csv('../data/citizen_state_names/kerala.csv')\n",
" pcts = []\n",
" for year in range(2018, 2024):\n",
" pcts += get_percent_of_positive_observations_for_each_week(state_df, year, species_id, attr)\n",
Expand Down Expand Up @@ -3247,7 +3247,7 @@
}
],
"source": [
"state_df = pd.read_csv('all data/citizen/kerala.csv')\n",
"state_df = pd.read_csv('../data/citizen_state_names/kerala.csv')\n",
"top_20_species = state_df['Species_id'].value_counts().index.tolist()[:20]\n",
"for species_id in top_20_species:\n",
" for w_1 in [0.5]:\n",
Expand Down Expand Up @@ -3319,7 +3319,7 @@
" return list(scores), list(spikes), list(stagns)\n",
"\n",
"def plot_score_and_pcts(species_id, attr, L=5, M_short=3, M_long=15, w_1=1, w_2=1, w_3=1, size_term=False):\n",
" state_df = pd.read_csv('all data/citizen/kerala.csv')\n",
" state_df = pd.read_csv('../data/citizen_state_names/kerala.csv')\n",
" pcts = []\n",
" for year in range(2018, 2024):\n",
" pcts += get_percent_of_positive_observations_for_each_week(state_df, year, species_id, attr)\n",
Expand Down Expand Up @@ -3367,7 +3367,7 @@
" plt.title(f\"Average transition time for Mango (all species) {attr} in Kerala, {year}, L={L}, M_short={M_short}, M_long={M_long}, w_1={w_1}, w_2={w_2}, w_3={w_3}\")\n",
"\n",
"def plot_spikes(species_id, attr, L=5, M_short=3, M_long=15, w_1=1, w_2=1, w_3=1, size_term=False):\n",
" state_df = pd.read_csv('all data/citizen/kerala.csv')\n",
" state_df = pd.read_csv('../data/citizen_state_names/kerala.csv')\n",
" pcts = []\n",
" for year in range(2018, 2024):\n",
" pcts += get_percent_of_positive_observations_for_each_week(state_df, year, species_id, attr)\n",
Expand Down Expand Up @@ -3402,7 +3402,7 @@
" plt.show()\n",
"\n",
"def plot_stagnations(species_id, attr, L=5, M_short=3, M_long=15, w_1=1, w_2=1, w_3=1, size_term=False):\n",
" state_df = pd.read_csv('all data/citizen/kerala.csv')\n",
" state_df = pd.read_csv('../data/citizen_state_names/kerala.csv')\n",
" pcts = []\n",
" if size_term:\n",
" scores, spikes, stagns, sizes = get_scores(state_df, species_id, attr, L=L, M_short=M_short, M_long=M_long, w_1=w_1, w_2=w_2, w_3=w_3, size_term=size_term)\n",
Expand Down Expand Up @@ -4613,7 +4613,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.12.2"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 1ca1598

Please sign in to comment.