Screen Link: Learn data science with Python and R projects
My Code:
testing_probs = pd.DataFrame(columns=unique_origins)
for origin in unique_origins:
# Select testing features.
X_test = test[features]
# Compute probability of observation being in the origin.
testing_probs[origin] = models[origin].predict_proba(X_test)[:,1]
I am confused what the [:,1] part of this code does as I understood we need to apply prediction to find the classification between 3 origins. However wouldn’t index [:,1] call the first column and only apply to origin 1? Why am i unable to replace the code with [:,2] for example if the are 3 origins.
I am also confused why we are putting [:,1] at the end of the line in such a way.
Please explain as i am super confused with this and struggling to find answer