def main():
    sns.set()
    file_names = os.listdir()
    needed_files = ['sentence_length.csv', 'socio_econ.csv',
                    'Chicago_shape.zip', 'population.csv']
    for file_name in needed_files:
        if file_name not in file_names:
            save_useful_files()
    print('file_saved')
    crime_data = get_crime_data()
    print('get crime data')
    geo_data = get_geo_data()
    population_data = get_population_data()
    sentence_length_data = get_sentence_length_data()
    socio_econ_data = get_socio_econ_data()
    get_crime_sample(crime_data)

    q1 = Question1.Question1(crime_data, sentence_length_data,
                             geo_data, socio_econ_data)
    q1._plot_a_single_year(2018)
    q1._plot_change('42 43 45')
    q1._safety_ranking(2018)

    q2 = Question2.Question2()
    q2.aggregate_data(crime_data)
    q2.machine_learning()
    q2._report_predict('assault', 43, 23)
    q2._report_predict('theft', 9, 23)
    q2._report_predict('theft', 9, 10)
    q2._report_predict('theft', 9, 13)
    print('The mean square error of the model is ' + str(q2.mes()))

    Question3.Question3(crime_data, geo_data, population_data)
    Question4.Question4(crime_data, geo_data, population_data, socio_econ_data)
def main():
    sns.set()
    file_names = os.listdir()
    needed_files = [
        'sentence_length.csv', 'socio_econ.csv', 'Chicago_shape.zip',
        'population.csv'
    ]
    for file_name in needed_files:
        if file_name not in file_names:
            save_useful_files()
    print('file_saved')
    crime_data = get_crime_data()
    print('get crime data')
    geo_data = get_geo_data()
    population_data = get_population_data()
    sentence_length_data = get_sentence_length_data()
    socio_econ_data = get_socio_econ_data()
    # get_crime_sample(crime_data)

    q1 = Question1.Question1(crime_data, sentence_length_data, geo_data,
                             socio_econ_data)
    q1.plot_communities_single_year()
    q1.plot_change_through_years()
    q1.safety_ranking()

    q2 = Question2.Question2()
    q2.aggregate_data(crime_data)
    q2.machine_learning()
    q2.predict()
    print('The mean square error of the model is ' + str(q2.mes()))

    Question3.Question3(crime_data, geo_data, population_data)
    Question4.Question4(crime_data, geo_data, population_data, socio_econ_data)