# Can machine learning find a set of ages that has best survival chance? Titanic

I'm new to machine learning, and I have gone through a bunch of tutorials on youtube, but I'm still having some trouble understanding the limitations of machine learning as well as how to apply them beyond the simple examples given in tutorials.

I"m playing around with the titanic data using scikit learn and seaborn.

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib as mpl
import matplotlib.pyplot as plt

df =titanic[['age','survived']]
df['age']= df.fillna(df.age.mean())  #filling NA values with mean

g= sns.FacetGrid(titanic, col ='survived', size = 3, aspect = 2)
g.map(plt.hist, 'age', color = 'r'), plt.show()
plt.show()


So just looking at the chart it seems children less than around 10 or so seem to have a much higher chance of survival than those older. 10-20 age range doesn't look as bad as those in the 20+ range. So I'm guessing those in the age range 0-17 have a much higher chance of surviving than those older. If I do a little bit of data exploring with pandas etc, I think I would be able to find a range of ages that has much higher chance of living than their counterparts regardless of the other features. Thus allowing me to label some as group 1 (belonging to an age range that has survival privileges) and group 2 who has no such privileges.

Would machine learning be able calculate such a range as an output if the input is df.age and df.survived? Would I have to manually divide up the age ranges on my own and transform them into [0,1,2] each number representing a different age group. Or can a machine learning algorithm some how do this classification on their own.

I was thinking of playing around with the Random Forest classifier, but I guess I just want to make sure what I"m trying do is somewhat possible.

I'm sorry if my question is a little vague, as I'm still not fully understanding what exactly machine learning is capable of despite going through vast amount of tutorials.