Skip to content
Snippets Groups Projects
Commit b941b795 authored by Kimiya Heydary Barnjgani's avatar Kimiya Heydary Barnjgani
Browse files

tags added Notebookname

parent 7b5f2976
Branches improvement_Predicting_mental_illness
No related tags found
No related merge requests found
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
# 1. Business Understanding
Das weltweit agierende Versicherungsunternehmen New York Life Insurance Company Das weltweit agierende Versicherungsunternehmen New York Life Insurance Company
mit Hauptsitz in den USA betreut Privat- und Geschäftskunden. Der Hauptgeschäftsbereich liegt in der Absicherung der leiblichen Gesundheit im Sinne von Krankenkassen mit Hauptsitz in den USA betreut Privat- und Geschäftskunden. Der Hauptgeschäftsbereich liegt in der Absicherung der leiblichen Gesundheit im Sinne von Krankenkassen
und gesundheitlicher Vorsorge. Dazu gehören neben der klassischen Krankenversicherung auch Unfallversicherungen, Risikolebensversicherungen und Berufsunfähigkeitsversicherungen. und gesundheitlicher Vorsorge. Dazu gehören neben der klassischen Krankenversicherung auch Unfallversicherungen, Risikolebensversicherungen und Berufsunfähigkeitsversicherungen.
In unserer aktuellen Gesellschaft ist der Mensch nicht nur klassischen körperlichen In unserer aktuellen Gesellschaft ist der Mensch nicht nur klassischen körperlichen
Erkrankungen ausgesetzt, sondern zunehmend kommen – beispielsweise durch Erkrankungen ausgesetzt, sondern zunehmend kommen – beispielsweise durch
Überlastungen am Arbeitsplatz oder Stress – psychische Erkrankungen hinzu. Das Überlastungen am Arbeitsplatz oder Stress – psychische Erkrankungen hinzu. Das
Bewusstsein für diese Art von Erkrankung und die Klassifikation als „Krankheit“ Bewusstsein für diese Art von Erkrankung und die Klassifikation als „Krankheit“
durchdringt jedoch noch nicht alle gesellschaftlichen Bereiche. durchdringt jedoch noch nicht alle gesellschaftlichen Bereiche.
Für das Versicherungsunternehmen New York Life Insurance Company bietet es sich Für das Versicherungsunternehmen New York Life Insurance Company bietet es sich
daher an, den Geschäftsbereich zu erweitern und zukünftig nicht nur körperliche, daher an, den Geschäftsbereich zu erweitern und zukünftig nicht nur körperliche,
sondern auch psychische Erkrankungen zu versichern. Um zunächst Kosten sondern auch psychische Erkrankungen zu versichern. Um zunächst Kosten
einzusparen, wird keine eigene Umfrage durch das Unternehmen erstellt, sondern auf einzusparen, wird keine eigene Umfrage durch das Unternehmen erstellt, sondern auf
schon bestehende Daten zurückgegriffen (OSMI Mental Health in Tech Survey 2016, schon bestehende Daten zurückgegriffen (OSMI Mental Health in Tech Survey 2016,
2020). 2020).
   
%% Cell type:markdown id: tags:daten
Um die befragten Personen in diesem Datensatz darzustellen, werden verschiedene Bibliotheken genutzt. Für numerische Berechnungen wird NumPy verwendet, während Pandas zur Datenanalyse dient. Für statistische Modelle kommt Statsmodels zum Einsatz. Visualisierungen werden mit Matplotlib, Plotly Express und Seaborn erstellt. Zur Datenvorverarbeitung werden der StandardScaler und LabelEncoder von scikit-learn genutzt. Für das Modelltraining und die -bewertung werden Funktionen wie train_test_split, DecisionTreeClassifier, RandomForestClassifier, LogisticRegression, KMeans, metrics, confusion_matrix, classification_report und SVM verwendet. Außerdem wird die Multikollinearitätsprüfung mit variance_inflation_factor durchgeführt.
%% Cell type:markdown id: tags:Datenvorbereitung
In diesem Prozess werden Duplikate in einer Liste entfernt, wobei lediglich diejenigen Elemente erhalten bleiben, die einzigartig sind. Zunächst erfolgt eine Überprüfung auf das Vorhandensein von Duplikaten in der Liste. Bei Feststellung duplizierter Elemente wird die Funktion data.duplicated(keep=False) aufgerufen.
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
# 2. Data and Data Understanding Für die Modellerstellung werden der Random Forest, die logistische Regression und der Entscheidungsbaum eingesetzt. Der Random Forest kombiniert mehrere Entscheidungsbäume für robuste Vorhersagen. Die logistische Regression schätzt Wahrscheinlichkeiten, besonders bei binären Klassifikationen. Der Entscheidungsbaum trifft systematisch Entscheidungen basierend auf Attributen. Diese Vielfalt an Modellen ermöglicht eine umfassende Analyse der Daten.
## 2.1. Import of Relevant Modules
   
%% Cell type:markdown id: tags:daten %% Cell type:markdown id: tags:
In der heutigen Gesellschaft sind Menschen zunehmend auch psychischen Erkrankungen ausgesetzt, oft bedingt durch Stress und Überlastung am Arbeitsplatz. Psychische Gesundheitsprobleme werden jedoch noch nicht überall als Krankheiten anerkannt. Die Erweiterung des Geschäftsfeldes auf psychische Gesundheitsversicherungen bietet eine strategische Wachstumschance. Dies könnte das Unternehmen von seinen Mitbewerbern abheben und die Kundenzufriedenheit erhöhen. Um Kosten zu sparen, plant das Unternehmen, auf bestehende Daten der OSMI Mental Health in Tech Survey (2016, 2020) zurückzugreifen. Diese Erweiterung würde soziale Verantwortung demonstrieren und zum allgemeinen Wohl beitragen. Herausforderungen bestehen in der Aufklärung über die Bedeutung der psychischen Gesundheitsversicherung und der repräsentativen Nutzung der vorhandenen Daten. Eine kontinuierliche Bewertung und Anpassung ist erforderlich, um eine umfassende und effektive Abdeckung sicherzustellen.
%% Cell type:markdown id: tags:
Für das Versicherungsunternehmen New York Life Insurance Company bietet es sich daher an, den Geschäftsbereich zu erweitern und zukünftig nicht nur körperliche, sondern auch psychische Erkrankungen zu versichern. Um zunächst Kosten einzusparen, wird keine eigene Umfrage durch das Unternehmen erstellt, sondern auf schon bestehende Daten zurückgegriffen (OSMI Mental Health in Tech Survey 2016, 2020). Um die Umsetzung zu verwirklichen, sind die folgenden Schritte erforderlich:
Analyse und review der bereits verfügbaren Daten zu psychischen Erkrankungen in der Technologiebranche, um eine umfassende Erklärung des Bedarfs an psychischer Krankenversicherung zu erhalten.
Durchführung einer internen Studie, um zu ermitteln, ob es bei den eigenen Mitarbeitern ein Bedürfnis nach psychischer Krankenversicherung gibt und welche Krankheiten am häufigsten vorkommen.
Konsultation von Experten und Branchenvertretern, um die bestmöglichen Produkte und Dienstleistungskonzepte zu entwickeln, die den wachsenden Bedarf an psychischer Krankenversicherung abdecken.
Erstellung von Nutzendaten und Bedarfsanalysen, um das Produktangebot zu optimieren.
Implementierung der neuen Produkte und Dienstleistungen, um die Nachfrage nach psychischer Krankenversicherung zu decken.
Marketing und Kommunikation der neuen Produkte und Dienstleistungen gegenüber den Mitarbeitern und Kunden, um die Akzeptanz zu fördern darüber hinaus ist die Zielgruppe für dieses Modell Versicherungsunternehmen. Dieses Modell bietet den Vorteil, dass es Kandidaten mit hoher Wahrscheinlichkeit für psychische Erkrankungen ablehnen kann. Dadurch können Versicherungen potenziell ihre Risiken und Kosten senken. Das Modell könnte nahtlos in den Standard-Aufnahmeprozess für neue Kunden integriert werden, um die Effizienz und Genauigkeit der Bewerberbewertung zu verbessern.
%% Cell type:markdown id: tags:
   
Der Code importiert Bibliotheken für numerische Berechnungen (NumPy), Datenanalyse (Pandas), statistische Modelle (Statsmodels), Visualisierungen (Matplotlib, Plotly Express, Seaborn), Datenvorverarbeitung (scikit-learn's StandardScaler und LabelEncoder), Modelltraining und -bewertung (train_test_split, DecisionTreeClassifier, RandomForestClassifier, LogisticRegression, KMeans, metrics, confusion_matrix, classification_report, SVM), sowie Multikollinearitätsprüfung (variance_inflation_factor) ## 1 Business Understanding
%% Cell type:markdown id: tags:
# 2. Data and Data Understanding
## 2.1. Import of Relevant Modules
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
import numpy as np import numpy as np
import pandas as pd import pandas as pd
import statsmodels.api as sm import statsmodels.api as sm
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import plotly.express as px import plotly.express as px
%matplotlib inline %matplotlib inline
import seaborn as sns import seaborn as sns
sns.set() sns.set()
from sklearn.preprocessing import StandardScaler from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression from sklearn.linear_model import LogisticRegression
# from sklearn.linear_model import LinearRegression # from sklearn.linear_model import LinearRegression
from sklearn.cluster import KMeans from sklearn.cluster import KMeans
from sklearn import metrics from sklearn import metrics
from sklearn.metrics import confusion_matrix, classification_report from sklearn.metrics import confusion_matrix, classification_report
from statsmodels.stats.outliers_influence import variance_inflation_factor from statsmodels.stats.outliers_influence import variance_inflation_factor
from sklearn import svm, datasets from sklearn import svm, datasets
   
from sklearn.preprocessing import LabelEncoder from sklearn.preprocessing import LabelEncoder
``` ```
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 2.2. Read Data ## 2.2. Read Data
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Jede Zeile der Tabelle stellt eine einzelne Beobachtung oder Antwort dar. Jede Zeile der Tabelle stellt eine einzelne Beobachtung oder Antwort dar.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data = pd.read_csv('survey.csv') data = pd.read_csv('survey.csv')
data.head(5) data.head(5)
``` ```
   
%% Output %% Output
   
Timestamp Age Gender Country state self_employed \ Timestamp Age Gender Country state self_employed \
0 2014-08-27 11:29:31 37 Female United States IL NaN 0 2014-08-27 11:29:31 37 Female United States IL NaN
1 2014-08-27 11:29:37 44 M United States IN NaN 1 2014-08-27 11:29:37 44 M United States IN NaN
2 2014-08-27 11:29:44 32 Male Canada NaN NaN 2 2014-08-27 11:29:44 32 Male Canada NaN NaN
3 2014-08-27 11:29:46 31 Male United Kingdom NaN NaN 3 2014-08-27 11:29:46 31 Male United Kingdom NaN NaN
4 2014-08-27 11:30:22 31 Male United States TX NaN 4 2014-08-27 11:30:22 31 Male United States TX NaN
family_history treatment work_interfere no_employees ... \ family_history treatment work_interfere no_employees ... \
0 No Yes Often 6-25 ... 0 No Yes Often 6-25 ...
1 No No Rarely More than 1000 ... 1 No No Rarely More than 1000 ...
2 No No Rarely 6-25 ... 2 No No Rarely 6-25 ...
3 Yes Yes Often 26-100 ... 3 Yes Yes Often 26-100 ...
4 No No Never 100-500 ... 4 No No Never 100-500 ...
leave mental_health_consequence phys_health_consequence \ leave mental_health_consequence phys_health_consequence \
0 Somewhat easy No No 0 Somewhat easy No No
1 Don't know Maybe No 1 Don't know Maybe No
2 Somewhat difficult No No 2 Somewhat difficult No No
3 Somewhat difficult Yes Yes 3 Somewhat difficult Yes Yes
4 Don't know No No 4 Don't know No No
coworkers supervisor mental_health_interview phys_health_interview \ coworkers supervisor mental_health_interview phys_health_interview \
0 Some of them Yes No Maybe 0 Some of them Yes No Maybe
1 No No No No 1 No No No No
2 Yes Yes Yes Yes 2 Yes Yes Yes Yes
3 Some of them No Maybe Maybe 3 Some of them No Maybe Maybe
4 Some of them Yes Yes Yes 4 Some of them Yes Yes Yes
mental_vs_physical obs_consequence comments mental_vs_physical obs_consequence comments
0 Yes No NaN 0 Yes No NaN
1 Don't know No NaN 1 Don't know No NaN
2 No No NaN 2 No No NaN
3 No Yes NaN 3 No Yes NaN
4 Don't know No NaN 4 Don't know No NaN
[5 rows x 27 columns] [5 rows x 27 columns]
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
1. Timestamp: Der Zeitpunkt der Datenerfassung. 1. Timestamp: Der Zeitpunkt der Datenerfassung.
2. Age: Das Alter der befragten Person. 2. Age: Das Alter der befragten Person.
3. Gender: Das Geschlecht der befragten Person. 3. Gender: Das Geschlecht der befragten Person.
4. Country: Das Land, in dem die befragte Person lebt. 4. Country: Das Land, in dem die befragte Person lebt.
5. state: Der Bundesstaat, in dem die befragte Person lebt (nur relevant für die USA). 5. state: Der Bundesstaat, in dem die befragte Person lebt (nur relevant für die USA).
6. self_employed: Gibt an, ob die Person selbstständig ist. 6. self_employed: Gibt an, ob die Person selbstständig ist.
7. family_history: Gibt an, ob es eine Familiengeschichte von psychischen Erkrankungen gibt. 7. family_history: Gibt an, ob es eine Familiengeschichte von psychischen Erkrankungen gibt.
8. treatment: Gibt an, ob die Person derzeit in Behandlung ist. 8. treatment: Gibt an, ob die Person derzeit in Behandlung ist.
9. work_interfere: Gibt an, wie oft die Arbeit durch psychische Gesundheitsprobleme beeinträchtigt wird. 9. work_interfere: Gibt an, wie oft die Arbeit durch psychische Gesundheitsprobleme beeinträchtigt wird.
10. no_employees: Die Anzahl der Mitarbeiter im Unternehmen der befragten Person. 10. no_employees: Die Anzahl der Mitarbeiter im Unternehmen der befragten Person.
11. leave: Gibt an, wie einfach es für die Person ist, eine Beurlaubung aufgrund von psychischen Gesundheitsproblemen zu nehmen. 11. leave: Gibt an, wie einfach es für die Person ist, eine Beurlaubung aufgrund von psychischen Gesundheitsproblemen zu nehmen.
12. mental_health_consequence: Gibt an, ob die Person glaubt, dass es Konsequenzen für die psychische Gesundheit gibt. 12. mental_health_consequence: Gibt an, ob die Person glaubt, dass es Konsequenzen für die psychische Gesundheit gibt.
13. phys_health_consequence: Gibt an, ob die Person glaubt, dass es Konsequenzen für die körperliche Gesundheit gibt. 13. phys_health_consequence: Gibt an, ob die Person glaubt, dass es Konsequenzen für die körperliche Gesundheit gibt.
14. coworkers: Gibt an, ob die Person mit ihren Kollegen über ihre psychische Gesundheit sprechen kann. 14. coworkers: Gibt an, ob die Person mit ihren Kollegen über ihre psychische Gesundheit sprechen kann.
15. supervisor: Gibt an, ob die Person mit ihrem Vorgesetzten über ihre psychische Gesundheit sprechen kann. 15. supervisor: Gibt an, ob die Person mit ihrem Vorgesetzten über ihre psychische Gesundheit sprechen kann.
16. mental_health_interview: Gibt an, ob die Person während eines Interviews über ihre psychische Gesundheit sprechen würde. 16. mental_health_interview: Gibt an, ob die Person während eines Interviews über ihre psychische Gesundheit sprechen würde.
17. phys_health_interview: Gibt an, ob die Person während eines Interviews über ihre körperliche Gesundheit sprechen würde. 17. phys_health_interview: Gibt an, ob die Person während eines Interviews über ihre körperliche Gesundheit sprechen würde.
18. mental_vs_physical: Gibt an, ob die Person glaubt, dass psychische und körperliche Gesundheitsprobleme gleich behandelt werden sollten. 18. mental_vs_physical: Gibt an, ob die Person glaubt, dass psychische und körperliche Gesundheitsprobleme gleich behandelt werden sollten.
19. obs_consequence: Gibt an, ob die Person beobachtet hat, dass jemand aufgrund von psychischen Gesundheitsproblemen negative Konsequenzen erfahren hat. 19. obs_consequence: Gibt an, ob die Person beobachtet hat, dass jemand aufgrund von psychischen Gesundheitsproblemen negative Konsequenzen erfahren hat.
20. comments: Zusätzliche Kommentare der befragten Person (falls vorhanden). 20. comments: Zusätzliche Kommentare der befragten Person (falls vorhanden).
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 2.3. Descriptive Analytics ## 2.3. Descriptive Analytics
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Die angezeigte Datenrahmenstruktur enthält eine Zusammenfassung der Datenstruktur, einschließlich der Datenzeilen und Datenspalten, der Datentypen für jede Spalte und der Zahl der vorhandenen (Nicht-Null-) Werte in jeder Spalte. Diese Informationen sind hilfreich, um die Datenqualität zu bewerten, fehlende Daten zu ermitteln und den Dateninhalt vor der Datenanalyse besser zu verstehen. Die angezeigte Datenrahmenstruktur enthält eine Zusammenfassung der Datenstruktur, einschließlich der Datenzeilen und Datenspalten, der Datentypen für jede Spalte und der Zahl der vorhandenen (Nicht-Null-) Werte in jeder Spalte. Diese Informationen sind hilfreich, um die Datenqualität zu bewerten, fehlende Daten zu ermitteln und den Dateninhalt vor der Datenanalyse besser zu verstehen.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data.info() data.info()
``` ```
   
%% Output %% Output
   
<class 'pandas.core.frame.DataFrame'> <class 'pandas.core.frame.DataFrame'>
RangeIndex: 1259 entries, 0 to 1258 RangeIndex: 1259 entries, 0 to 1258
Data columns (total 27 columns): Data columns (total 27 columns):
# Column Non-Null Count Dtype # Column Non-Null Count Dtype
--- ------ -------------- ----- --- ------ -------------- -----
0 Timestamp 1259 non-null object 0 Timestamp 1259 non-null object
1 Age 1259 non-null int64 1 Age 1259 non-null int64
2 Gender 1259 non-null object 2 Gender 1259 non-null object
3 Country 1259 non-null object 3 Country 1259 non-null object
4 state 744 non-null object 4 state 744 non-null object
5 self_employed 1241 non-null object 5 self_employed 1241 non-null object
6 family_history 1259 non-null object 6 family_history 1259 non-null object
7 treatment 1259 non-null object 7 treatment 1259 non-null object
8 work_interfere 995 non-null object 8 work_interfere 995 non-null object
9 no_employees 1259 non-null object 9 no_employees 1259 non-null object
10 remote_work 1259 non-null object 10 remote_work 1259 non-null object
11 tech_company 1259 non-null object 11 tech_company 1259 non-null object
12 benefits 1259 non-null object 12 benefits 1259 non-null object
13 care_options 1259 non-null object 13 care_options 1259 non-null object
14 wellness_program 1259 non-null object 14 wellness_program 1259 non-null object
15 seek_help 1259 non-null object 15 seek_help 1259 non-null object
16 anonymity 1259 non-null object 16 anonymity 1259 non-null object
17 leave 1259 non-null object 17 leave 1259 non-null object
18 mental_health_consequence 1259 non-null object 18 mental_health_consequence 1259 non-null object
19 phys_health_consequence 1259 non-null object 19 phys_health_consequence 1259 non-null object
20 coworkers 1259 non-null object 20 coworkers 1259 non-null object
21 supervisor 1259 non-null object 21 supervisor 1259 non-null object
22 mental_health_interview 1259 non-null object 22 mental_health_interview 1259 non-null object
23 phys_health_interview 1259 non-null object 23 phys_health_interview 1259 non-null object
24 mental_vs_physical 1259 non-null object 24 mental_vs_physical 1259 non-null object
25 obs_consequence 1259 non-null object 25 obs_consequence 1259 non-null object
26 comments 164 non-null object 26 comments 164 non-null object
dtypes: int64(1), object(26) dtypes: int64(1), object(26)
memory usage: 265.7+ KB memory usage: 265.7+ KB
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data.describe(include='all') data.describe(include='all')
``` ```
   
%% Output %% Output
   
Timestamp Age Gender Country state \ Timestamp Age Gender Country state \
count 1259 1.259000e+03 1259 1259 744 count 1259 1.259000e+03 1259 1259 744
unique 1246 NaN 49 48 45 unique 1246 NaN 49 48 45
top 2014-08-27 12:44:51 NaN Male United States CA top 2014-08-27 12:44:51 NaN Male United States CA
freq 2 NaN 615 751 138 freq 2 NaN 615 751 138
mean NaN 7.942815e+07 NaN NaN NaN mean NaN 7.942815e+07 NaN NaN NaN
std NaN 2.818299e+09 NaN NaN NaN std NaN 2.818299e+09 NaN NaN NaN
min NaN -1.726000e+03 NaN NaN NaN min NaN -1.726000e+03 NaN NaN NaN
25% NaN 2.700000e+01 NaN NaN NaN 25% NaN 2.700000e+01 NaN NaN NaN
50% NaN 3.100000e+01 NaN NaN NaN 50% NaN 3.100000e+01 NaN NaN NaN
75% NaN 3.600000e+01 NaN NaN NaN 75% NaN 3.600000e+01 NaN NaN NaN
max NaN 1.000000e+11 NaN NaN NaN max NaN 1.000000e+11 NaN NaN NaN
self_employed family_history treatment work_interfere no_employees \ self_employed family_history treatment work_interfere no_employees \
count 1241 1259 1259 995 1259 count 1241 1259 1259 995 1259
unique 2 2 2 4 6 unique 2 2 2 4 6
top No No Yes Sometimes 6-25 top No No Yes Sometimes 6-25
freq 1095 767 637 465 290 freq 1095 767 637 465 290
mean NaN NaN NaN NaN NaN mean NaN NaN NaN NaN NaN
std NaN NaN NaN NaN NaN std NaN NaN NaN NaN NaN
min NaN NaN NaN NaN NaN min NaN NaN NaN NaN NaN
25% NaN NaN NaN NaN NaN 25% NaN NaN NaN NaN NaN
50% NaN NaN NaN NaN NaN 50% NaN NaN NaN NaN NaN
75% NaN NaN NaN NaN NaN 75% NaN NaN NaN NaN NaN
max NaN NaN NaN NaN NaN max NaN NaN NaN NaN NaN
... leave mental_health_consequence phys_health_consequence \ ... leave mental_health_consequence phys_health_consequence \
count ... 1259 1259 1259 count ... 1259 1259 1259
unique ... 5 3 3 unique ... 5 3 3
top ... Don't know No No top ... Don't know No No
freq ... 563 490 925 freq ... 563 490 925
mean ... NaN NaN NaN mean ... NaN NaN NaN
std ... NaN NaN NaN std ... NaN NaN NaN
min ... NaN NaN NaN min ... NaN NaN NaN
25% ... NaN NaN NaN 25% ... NaN NaN NaN
50% ... NaN NaN NaN 50% ... NaN NaN NaN
75% ... NaN NaN NaN 75% ... NaN NaN NaN
max ... NaN NaN NaN max ... NaN NaN NaN
coworkers supervisor mental_health_interview phys_health_interview \ coworkers supervisor mental_health_interview phys_health_interview \
count 1259 1259 1259 1259 count 1259 1259 1259 1259
unique 3 3 3 3 unique 3 3 3 3
top Some of them Yes No Maybe top Some of them Yes No Maybe
freq 774 516 1008 557 freq 774 516 1008 557
mean NaN NaN NaN NaN mean NaN NaN NaN NaN
std NaN NaN NaN NaN std NaN NaN NaN NaN
min NaN NaN NaN NaN min NaN NaN NaN NaN
25% NaN NaN NaN NaN 25% NaN NaN NaN NaN
50% NaN NaN NaN NaN 50% NaN NaN NaN NaN
75% NaN NaN NaN NaN 75% NaN NaN NaN NaN
max NaN NaN NaN NaN max NaN NaN NaN NaN
mental_vs_physical obs_consequence comments mental_vs_physical obs_consequence comments
count 1259 1259 164 count 1259 1259 164
unique 3 2 160 unique 3 2 160
top Don't know No * Small family business - YMMV. top Don't know No * Small family business - YMMV.
freq 576 1075 5 freq 576 1075 5
mean NaN NaN NaN mean NaN NaN NaN
std NaN NaN NaN std NaN NaN NaN
min NaN NaN NaN min NaN NaN NaN
25% NaN NaN NaN 25% NaN NaN NaN
50% NaN NaN NaN 50% NaN NaN NaN
75% NaN NaN NaN 75% NaN NaN NaN
max NaN NaN NaN max NaN NaN NaN
[11 rows x 27 columns] [11 rows x 27 columns]
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Alle Daten statistisch anschauen Alle Daten statistisch anschauen
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
def attribute_description(data): def attribute_description(data):
longestColumnName = len(max(np.array(data.columns), key=len)) longestColumnName = len(max(np.array(data.columns), key=len))
print("| Feature | Data Type|") print("| Feature | Data Type|")
print("|-----|------|") print("|-----|------|")
for col in data.columns: for col in data.columns:
description = '' description = ''
col_dropna = data[col].dropna() col_dropna = data[col].dropna()
example = col_dropna.sample(1).values[0] example = col_dropna.sample(1).values[0]
if type(example) == str: if type(example) == str:
description = 'str ' description = 'str '
if len(col_dropna.unique()) < 10: if len(col_dropna.unique()) < 10:
description += '{' description += '{'
description += '; '.join([ f'"{name}"' for name in col_dropna.unique()]) description += '; '.join([ f'"{name}"' for name in col_dropna.unique()])
description += '}' description += '}'
else: else:
description += '[ example: "'+ example + '" ]' description += '[ example: "'+ example + '" ]'
elif (type(example) == np.int32) and (len(col_dropna.unique()) < 10) : elif (type(example) == np.int32) and (len(col_dropna.unique()) < 10) :
description += 'dummy int32 {' description += 'dummy int32 {'
description += '; '.join([ f'{name}' for name in sorted(col_dropna.unique())]) description += '; '.join([ f'{name}' for name in sorted(col_dropna.unique())])
description += '}' description += '}'
else: else:
try: try:
description = example.dtype description = example.dtype
except: except:
description = type(example) description = type(example)
print("|" + col.ljust(longestColumnName)+ f'| {description} |') print("|" + col.ljust(longestColumnName)+ f'| {description} |')
   
attribute_description(data) attribute_description(data)
``` ```
   
%% Output %% Output
   
| Feature | Data Type| | Feature | Data Type|
|-----|------| |-----|------|
|Timestamp | str [ example: "2014-08-28 10:34:01" ] | |Timestamp | str [ example: "2014-08-28 10:34:01" ] |
|Age | int64 | |Age | int64 |
|Gender | str [ example: "m" ] | |Gender | str [ example: "m" ] |
|Country | str [ example: "United States" ] | |Country | str [ example: "United States" ] |
|state | str [ example: "CA" ] | |state | str [ example: "CA" ] |
|self_employed | str {"Yes"; "No"} | |self_employed | str {"Yes"; "No"} |
|family_history | str {"No"; "Yes"} | |family_history | str {"No"; "Yes"} |
|treatment | str {"Yes"; "No"} | |treatment | str {"Yes"; "No"} |
|work_interfere | str {"Often"; "Rarely"; "Never"; "Sometimes"} | |work_interfere | str {"Often"; "Rarely"; "Never"; "Sometimes"} |
|no_employees | str {"6-25"; "More than 1000"; "26-100"; "100-500"; "1-5"; "500-1000"} | |no_employees | str {"6-25"; "More than 1000"; "26-100"; "100-500"; "1-5"; "500-1000"} |
|remote_work | str {"No"; "Yes"} | |remote_work | str {"No"; "Yes"} |
|tech_company | str {"Yes"; "No"} | |tech_company | str {"Yes"; "No"} |
|benefits | str {"Yes"; "Don't know"; "No"} | |benefits | str {"Yes"; "Don't know"; "No"} |
|care_options | str {"Not sure"; "No"; "Yes"} | |care_options | str {"Not sure"; "No"; "Yes"} |
|wellness_program | str {"No"; "Don't know"; "Yes"} | |wellness_program | str {"No"; "Don't know"; "Yes"} |
|seek_help | str {"Yes"; "Don't know"; "No"} | |seek_help | str {"Yes"; "Don't know"; "No"} |
|anonymity | str {"Yes"; "Don't know"; "No"} | |anonymity | str {"Yes"; "Don't know"; "No"} |
|leave | str {"Somewhat easy"; "Don't know"; "Somewhat difficult"; "Very difficult"; "Very easy"} | |leave | str {"Somewhat easy"; "Don't know"; "Somewhat difficult"; "Very difficult"; "Very easy"} |
|mental_health_consequence| str {"No"; "Maybe"; "Yes"} | |mental_health_consequence| str {"No"; "Maybe"; "Yes"} |
|phys_health_consequence | str {"No"; "Yes"; "Maybe"} | |phys_health_consequence | str {"No"; "Yes"; "Maybe"} |
|coworkers | str {"Some of them"; "No"; "Yes"} | |coworkers | str {"Some of them"; "No"; "Yes"} |
|supervisor | str {"Yes"; "No"; "Some of them"} | |supervisor | str {"Yes"; "No"; "Some of them"} |
|mental_health_interview | str {"No"; "Yes"; "Maybe"} | |mental_health_interview | str {"No"; "Yes"; "Maybe"} |
|phys_health_interview | str {"Maybe"; "No"; "Yes"} | |phys_health_interview | str {"Maybe"; "No"; "Yes"} |
|mental_vs_physical | str {"Yes"; "Don't know"; "No"} | |mental_vs_physical | str {"Yes"; "Don't know"; "No"} |
|obs_consequence | str {"No"; "Yes"} | |obs_consequence | str {"No"; "Yes"} |
|comments | str [ example: "fwiw I am a co founder of this company and the would you X in an interview questions shouldn't reflect how I would treat anyone addressing their own phys/mental health issue to me in such a situation. " ] | |comments | str [ example: "fwiw I am a co founder of this company and the would you X in an interview questions shouldn't reflect how I would treat anyone addressing their own phys/mental health issue to me in such a situation. " ] |
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
   
Die Funktion attribute_description nimmt ein pandas-DataFrame als Input und druckt eine Tabelle aus, die die Eigenschaften der Spalten des DataFrames beschreibt. Dabei wird der längste Spaltenname als Maximalwert für die Breite der Tabelle verwendet. Für jede Spalte in der DataFrame wird dann versucht, Informationen zum Datentyp und zum Beispiel für die Spalte zu bekommen. Wenn das Datentyp ist eine Zeichenkette und es gibt weniger als 10 einzigartige Werte in der Spalte, wird der Spaltenname mit zusätzliche Information gedruckt. Wenn das Datentyp ist ein Integer 32-bit und es gibt weniger als 10 einzigartige Werte in der Spalte, wird auch eine zusätzliche Information gedruckt. Die Funktion attribute_description nimmt ein pandas-DataFrame als Input und druckt eine Tabelle aus, die die Eigenschaften der Spalten des DataFrames beschreibt. Dabei wird der längste Spaltenname als Maximalwert für die Breite der Tabelle verwendet. Für jede Spalte in der DataFrame wird dann versucht, Informationen zum Datentyp und zum Beispiel für die Spalte zu bekommen. Wenn das Datentyp ist eine Zeichenkette und es gibt weniger als 10 einzigartige Werte in der Spalte, wird der Spaltenname mit zusätzliche Information gedruckt. Wenn das Datentyp ist ein Integer 32-bit und es gibt weniger als 10 einzigartige Werte in der Spalte, wird auch eine zusätzliche Information gedruckt.
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
| Feature | Data Type| | Feature | Data Type|
|-----|------| |-----|------|
|Timestamp | str [ example: "2014-08-27 20:52:31" ] | |Timestamp | str [ example: "2014-08-27 20:52:31" ] |
|Age | int64 | |Age | int64 |
|Gender | str [ example: "Male" ] | |Gender | str [ example: "Male" ] |
|Country | str [ example: "China" ] | |Country | str [ example: "China" ] |
|state | str [ example: "OR" ] | |state | str [ example: "OR" ] |
|self_employed | str {"Yes"; "No"; "IL"} | |self_employed | str {"Yes"; "No"; "IL"} |
|family_history | str {"No"; "Yes"} | |family_history | str {"No"; "Yes"} |
|treatment | str {"Yes"; "No"} | |treatment | str {"Yes"; "No"} |
|work_interfere | str {"Often"; "Rarely"; "Never"; "Sometimes"; "Yes"} | |work_interfere | str {"Often"; "Rarely"; "Never"; "Sometimes"; "Yes"} |
|no_employees | str {"6-25"; "More than 1000"; "26-100"; "100-500"; "1-5"; "500-1000"; "Often"; "Sometimes"} | |no_employees | str {"6-25"; "More than 1000"; "26-100"; "100-500"; "1-5"; "500-1000"; "Often"; "Sometimes"} |
|remote_work | str {"No"; "Yes"; "1-5"; "6-25"} | |remote_work | str {"No"; "Yes"; "1-5"; "6-25"} |
|tech_company | str {"Yes"; "No"} | |tech_company | str {"Yes"; "No"} |
|benefits | str {"Yes"; "Don't know"; "No"} | |benefits | str {"Yes"; "Don't know"; "No"} |
|care_options | str {"Not sure"; "No"; "Yes"; "Don't know"} | |care_options | str {"Not sure"; "No"; "Yes"; "Don't know"} |
|wellness_program | str {"No"; "Don't know"; "Yes"} | |wellness_program | str {"No"; "Don't know"; "Yes"} |
|seek_help | str {"Yes"; "Don't know"; "No"} | |seek_help | str {"Yes"; "Don't know"; "No"} |
|anonymity | str {"Yes"; "Don't know"; "No"} | |anonymity | str {"Yes"; "Don't know"; "No"} |
|leave | str {"Somewhat easy"; "Don't know"; "Somewhat difficult"; "Very difficult"; "Very easy"; "Yes"} | |leave | str {"Somewhat easy"; "Don't know"; "Somewhat difficult"; "Very difficult"; "Very easy"; "Yes"} |
|mental_health_consequence| str {"No"; "Maybe"; "Yes"; "Very easy"; "Don't know"} | |mental_health_consequence| str {"No"; "Maybe"; "Yes"; "Very easy"; "Don't know"} |
|phys_health_consequence | str {"No"; "Yes"; "Maybe"} | |phys_health_consequence | str {"No"; "Yes"; "Maybe"} |
|coworkers | str {"Some of them"; "No"; "Yes"; "Maybe"} | |coworkers | str {"Some of them"; "No"; "Yes"; "Maybe"} |
|supervisor | str {"Yes"; "No"; "Some of them"} | |supervisor | str {"Yes"; "No"; "Some of them"} |
|mental_health_interview | str {"No"; "Yes"; "Maybe"} | |mental_health_interview | str {"No"; "Yes"; "Maybe"} |
|phys_health_interview | str {"Maybe"; "No"; "Yes"} | |phys_health_interview | str {"Maybe"; "No"; "Yes"} |
|mental_vs_physical | str {"Yes"; "Don't know"; "No"; "Maybe"} | |mental_vs_physical | str {"Yes"; "Don't know"; "No"; "Maybe"} |
|obs_consequence | str {"No"; "Yes"; "Don't know"} | |obs_consequence | str {"No"; "Yes"; "Don't know"} |
|comments;;;; | str [ example: "NA;;;;" ] | |comments;;;; | str [ example: "NA;;;;" ] |
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Die bereitgestellten Informationen beschreiben ein Dataset mit verschiedenen Merkmalen (Features) und den entsprechenden Datentypen oder möglichen Wertebereichen für jedes Feature. Dieses Dataset könnte beispielsweise aus einer Umfrage stammen, die sich mit der psychischen Gesundheit von Beschäftigten befasst. Lassen Sie mich kurz die Bedeutung jedes Merkmals erläutern: Die bereitgestellten Informationen beschreiben ein Dataset mit verschiedenen Merkmalen (Features) und den entsprechenden Datentypen oder möglichen Wertebereichen für jedes Feature. Dieses Dataset könnte beispielsweise aus einer Umfrage stammen, die sich mit der psychischen Gesundheit von Beschäftigten befasst. Lassen Sie mich kurz die Bedeutung jedes Merkmals erläutern:
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
# 3. Data Preparation # 3. Data Preparation
## 3.1 Remove duplicates ## 3.1 Remove duplicates
   
%% Cell type:markdown id: tags:Datenvorbereitung
Der Codeabschnitt entfernt Duplikate in einer Liste, indem er alle Elemente beibehält, die nicht doppelt vorhanden sind. Dabei überprüft er zunächst, ob es in der Liste duplizierte Elemente gibt, und wenn ja, ruft er die data.duplicated(keep=False)-Funktion auf.
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data[data.duplicated(keep=False)] # show duplicates data[data.duplicated(keep=False)] # show duplicates
``` ```
   
%% Output %% Output
   
Empty DataFrame Empty DataFrame
Columns: [Timestamp, Age, Gender, Country, state, self_employed, family_history, treatment, work_interfere, no_employees, remote_work, tech_company, benefits, care_options, wellness_program, seek_help, anonymity, leave, mental_health_consequence, phys_health_consequence, coworkers, supervisor, mental_health_interview, phys_health_interview, mental_vs_physical, obs_consequence, comments] Columns: [Timestamp, Age, Gender, Country, state, self_employed, family_history, treatment, work_interfere, no_employees, remote_work, tech_company, benefits, care_options, wellness_program, seek_help, anonymity, leave, mental_health_consequence, phys_health_consequence, coworkers, supervisor, mental_health_interview, phys_health_interview, mental_vs_physical, obs_consequence, comments]
Index: [] Index: []
[0 rows x 27 columns] [0 rows x 27 columns]
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 3.2 Remove missing data ## 3.2 Remove missing data
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data.isnull().sum() #count missing data data.isnull().sum() #count missing data
``` ```
   
%% Output %% Output
   
Timestamp 0 Timestamp 0
Age 0 Age 0
Gender 0 Gender 0
Country 0 Country 0
state 515 state 515
self_employed 18 self_employed 18
family_history 0 family_history 0
treatment 0 treatment 0
work_interfere 264 work_interfere 264
no_employees 0 no_employees 0
remote_work 0 remote_work 0
tech_company 0 tech_company 0
benefits 0 benefits 0
care_options 0 care_options 0
wellness_program 0 wellness_program 0
seek_help 0 seek_help 0
anonymity 0 anonymity 0
leave 0 leave 0
mental_health_consequence 0 mental_health_consequence 0
phys_health_consequence 0 phys_health_consequence 0
coworkers 0 coworkers 0
supervisor 0 supervisor 0
mental_health_interview 0 mental_health_interview 0
phys_health_interview 0 phys_health_interview 0
mental_vs_physical 0 mental_vs_physical 0
obs_consequence 0 obs_consequence 0
comments 1095 comments 1095
dtype: int64 dtype: int64
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1 = data.drop(['Timestamp','state','comments'], axis =1) data1 = data.drop(['Timestamp','state','comments'], axis =1)
# delete features, that are not needed # delete features, that are not needed
``` ```
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1['self_employed'] = data1['self_employed'].fillna(data1['self_employed'].mode().iloc[0]) data1['self_employed'] = data1['self_employed'].fillna(data1['self_employed'].mode().iloc[0])
# replace missing data in 'self_employed' wwith 'No' # replace missing data in 'self_employed' wwith 'No'
``` ```
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Der Code setzt die fehlenden Daten im 'self_employed' Column auf 'No', indem er den Wert aus der häufigsten Wert in 'self_employed' als Substitut verwendet. Der Code setzt die fehlenden Daten im 'self_employed' Column auf 'No', indem er den Wert aus der häufigsten Wert in 'self_employed' als Substitut verwendet.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1.isnull().sum() data1.isnull().sum()
``` ```
   
%% Output %% Output
   
Age 0 Age 0
Gender 0 Gender 0
Country 0 Country 0
self_employed 0 self_employed 0
family_history 0 family_history 0
treatment 0 treatment 0
work_interfere 264 work_interfere 264
no_employees 0 no_employees 0
remote_work 0 remote_work 0
tech_company 0 tech_company 0
benefits 0 benefits 0
care_options 0 care_options 0
wellness_program 0 wellness_program 0
seek_help 0 seek_help 0
anonymity 0 anonymity 0
leave 0 leave 0
mental_health_consequence 0 mental_health_consequence 0
phys_health_consequence 0 phys_health_consequence 0
coworkers 0 coworkers 0
supervisor 0 supervisor 0
mental_health_interview 0 mental_health_interview 0
phys_health_interview 0 phys_health_interview 0
mental_vs_physical 0 mental_vs_physical 0
obs_consequence 0 obs_consequence 0
dtype: int64 dtype: int64
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1 = data1.dropna(axis=0) # remove rows with missing data (in 'work_interfere) data1 = data1.dropna(axis=0) # remove rows with missing data (in 'work_interfere)
``` ```
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1.isnull().sum() # make sure there is no missing data now data1.isnull().sum() # make sure there is no missing data now
``` ```
   
%% Output %% Output
   
Age 0 Age 0
Gender 0 Gender 0
Country 0 Country 0
self_employed 0 self_employed 0
family_history 0 family_history 0
treatment 0 treatment 0
work_interfere 0 work_interfere 0
no_employees 0 no_employees 0
remote_work 0 remote_work 0
tech_company 0 tech_company 0
benefits 0 benefits 0
care_options 0 care_options 0
wellness_program 0 wellness_program 0
seek_help 0 seek_help 0
anonymity 0 anonymity 0
leave 0 leave 0
mental_health_consequence 0 mental_health_consequence 0
phys_health_consequence 0 phys_health_consequence 0
coworkers 0 coworkers 0
supervisor 0 supervisor 0
mental_health_interview 0 mental_health_interview 0
phys_health_interview 0 phys_health_interview 0
mental_vs_physical 0 mental_vs_physical 0
obs_consequence 0 obs_consequence 0
dtype: int64 dtype: int64
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 3.3 Remove unwanted Features ## 3.3 Remove unwanted Features
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1.columns.values data1.columns.values
``` ```
   
%% Output %% Output
   
array(['Age', 'Gender', 'Country', 'self_employed', 'family_history', array(['Age', 'Gender', 'Country', 'self_employed', 'family_history',
'treatment', 'work_interfere', 'no_employees', 'remote_work', 'treatment', 'work_interfere', 'no_employees', 'remote_work',
'tech_company', 'benefits', 'care_options', 'wellness_program', 'tech_company', 'benefits', 'care_options', 'wellness_program',
'seek_help', 'anonymity', 'leave', 'mental_health_consequence', 'seek_help', 'anonymity', 'leave', 'mental_health_consequence',
'phys_health_consequence', 'coworkers', 'supervisor', 'phys_health_consequence', 'coworkers', 'supervisor',
'mental_health_interview', 'phys_health_interview', 'mental_health_interview', 'phys_health_interview',
'mental_vs_physical', 'obs_consequence'], dtype=object) 'mental_vs_physical', 'obs_consequence'], dtype=object)
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1 = data1.drop(['Country','wellness_program', 'seek_help', 'anonymity', 'leave', data1 = data1.drop(['Country','wellness_program', 'seek_help', 'anonymity', 'leave',
'mental_health_consequence', 'phys_health_consequence', 'mental_health_consequence', 'phys_health_consequence',
'coworkers', 'supervisor', 'mental_health_interview', 'coworkers', 'supervisor', 'mental_health_interview',
'phys_health_interview', 'mental_vs_physical', 'obs_consequence'], axis = 1) 'phys_health_interview', 'mental_vs_physical', 'obs_consequence'], axis = 1)
# remove features that are not relevant # remove features that are not relevant
# and remove features, that are relevant, but can not be used in the final model, # and remove features, that are relevant, but can not be used in the final model,
# as the data can not be collected in the production environment # as the data can not be collected in the production environment
``` ```
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
   
Die Zeilen des Dataframes werden entfernt, in denen bestimmte Spalten nicht enthalten sind, oder nicht relevant oder nicht in der Produktionsumgebung erhoben werden können. Dies wird erreicht, indem der Drop-Methode mit einem Syntax-Paar von Spaltennamen und Spaltenenums zu einem Dataframe-Objekt zugefügt wird. Die Zeilen des Dataframes werden entfernt, in denen bestimmte Spalten nicht enthalten sind, oder nicht relevant oder nicht in der Produktionsumgebung erhoben werden können. Dies wird erreicht, indem der Drop-Methode mit einem Syntax-Paar von Spaltennamen und Spaltenenums zu einem Dataframe-Objekt zugefügt wird.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1.columns.values # these features are left data1.columns.values # these features are left
``` ```
   
%% Output %% Output
   
array(['Age', 'Gender', 'self_employed', 'family_history', 'treatment', array(['Age', 'Gender', 'self_employed', 'family_history', 'treatment',
'work_interfere', 'no_employees', 'remote_work', 'tech_company', 'work_interfere', 'no_employees', 'remote_work', 'tech_company',
'benefits', 'care_options'], dtype=object) 'benefits', 'care_options'], dtype=object)
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1.describe(include='all') data1.describe(include='all')
``` ```
   
%% Output %% Output
   
Age Gender self_employed family_history treatment \ Age Gender self_employed family_history treatment \
count 9.950000e+02 995 995 995 995 count 9.950000e+02 995 995 995 995
unique NaN 44 2 2 2 unique NaN 44 2 2 2
top NaN Male No No Yes top NaN Male No No Yes
freq NaN 481 870 546 633 freq NaN 481 870 546 633
mean 1.005025e+08 NaN NaN NaN NaN mean 1.005025e+08 NaN NaN NaN NaN
std 3.170213e+09 NaN NaN NaN NaN std 3.170213e+09 NaN NaN NaN NaN
min -1.726000e+03 NaN NaN NaN NaN min -1.726000e+03 NaN NaN NaN NaN
25% 2.700000e+01 NaN NaN NaN NaN 25% 2.700000e+01 NaN NaN NaN NaN
50% 3.100000e+01 NaN NaN NaN NaN 50% 3.100000e+01 NaN NaN NaN NaN
75% 3.600000e+01 NaN NaN NaN NaN 75% 3.600000e+01 NaN NaN NaN NaN
max 1.000000e+11 NaN NaN NaN NaN max 1.000000e+11 NaN NaN NaN NaN
work_interfere no_employees remote_work tech_company benefits \ work_interfere no_employees remote_work tech_company benefits \
count 995 995 995 995 995 count 995 995 995 995 995
unique 4 6 2 2 3 unique 4 6 2 2 3
top Sometimes 26-100 No Yes Yes top Sometimes 26-100 No Yes Yes
freq 465 229 691 815 406 freq 465 229 691 815 406
mean NaN NaN NaN NaN NaN mean NaN NaN NaN NaN NaN
std NaN NaN NaN NaN NaN std NaN NaN NaN NaN NaN
min NaN NaN NaN NaN NaN min NaN NaN NaN NaN NaN
25% NaN NaN NaN NaN NaN 25% NaN NaN NaN NaN NaN
50% NaN NaN NaN NaN NaN 50% NaN NaN NaN NaN NaN
75% NaN NaN NaN NaN NaN 75% NaN NaN NaN NaN NaN
max NaN NaN NaN NaN NaN max NaN NaN NaN NaN NaN
care_options care_options
count 995 count 995
unique 3 unique 3
top Yes top Yes
freq 393 freq 393
mean NaN mean NaN
std NaN std NaN
min NaN min NaN
25% NaN 25% NaN
50% NaN 50% NaN
75% NaN 75% NaN
max NaN max NaN
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data1['Age'].values data1['Age'].values
``` ```
   
%% Output %% Output
   
array([ 37, 44, 32, 31, 31, array([ 37, 44, 32, 31, 31,
33, 35, 39, 42, 23, 33, 35, 39, 42, 23,
31, 29, 42, 36, 27, 31, 29, 42, 36, 27,
29, 23, 32, 46, 29, 29, 23, 32, 46, 29,
31, 46, 41, 33, 35, 31, 46, 41, 33, 35,
35, 34, 37, 32, 31, 35, 34, 37, 32, 31,
30, 42, 40, 27, 29, 30, 42, 40, 27, 29,
35, 24, 27, 18, 30, 35, 24, 27, 18, 30,
38, 26, 30, 22, 32, 38, 26, 30, 22, 32,
27, 24, 33, 44, 26, 27, 24, 33, 44, 26,
27, 35, 40, 23, 36, 27, 35, 40, 23, 36,
34, 28, 34, 23, 33, 34, 28, 34, 23, 33,
31, 32, 28, 38, 23, 31, 32, 28, 38, 23,
30, 27, 33, 39, 34, 30, 27, 33, 39, 34,
29, 31, 40, 25, 29, 29, 31, 40, 25, 29,
24, 31, 33, 30, 26, 24, 31, 33, 30, 26,
44, 33, 29, 35, 35, 44, 33, 29, 35, 35,
28, 34, 32, 22, 28, 28, 34, 32, 22, 28,
45, 32, 26, 21, 27, 45, 32, 26, 21, 27,
18, 29, 33, 36, 27, 18, 29, 33, 36, 27,
27, 32, 31, 19, 33, 27, 32, 31, 19, 33,
32, 27, 24, 39, 28, 32, 27, 24, 39, 28,
39, 38, 37, 35, 37, 39, 38, 37, 35, 37,
24, 23, 30, 32, 28, 24, 23, 30, 32, 28,
36, 37, 25, 27, 26, 36, 37, 25, 27, 26,
27, 25, 36, 25, 31, 27, 25, 36, 25, 31,
26, 33, 34, 23, 24, 26, 33, 34, 23, 24,
26, 31, 22, 34, 31, 26, 31, 22, 34, 31,
32, 45, 29, 26, 28, 32, 45, 29, 26, 28,
45, 43, 24, 35, 38, 45, 43, 24, 35, 38,
28, 28, 35, 32, 31, 28, 28, 35, 32, 31,
35, 26, 28, 27, 34, 35, 26, 28, 27, 34,
41, 37, 32, 21, 30, 41, 37, 32, 21, 30,
24, 37, 26, 32, 32, 24, 37, 26, 32, 32,
27, 30, 29, 28, 28, 27, 30, 29, 28, 28,
23, 32, 34, 24, 26, 23, 32, 34, 24, 26,
36, 41, 38, 38, 25, 36, 41, 38, 38, 25,
37, 37, 28, 34, 33, 37, 37, 28, 34, 33,
27, 40, 21, 32, 29, 27, 40, 21, 32, 29,
23, 31, 24, 29, 23, 23, 31, 24, 29, 23,
42, 25, 27, 27, 30, 42, 25, 27, 27, 30,
29, 41, 32, 37, 32, 29, 41, 32, 37, 32,
30, 23, 34, 38, 28, 30, 23, 34, 38, 28,
28, 23, 22, 27, 18, 28, 23, 22, 27, 18,
35, 27, 26, 18, 38, 35, 27, 26, 18, 38,
26, 30, 35, 45, 32, 26, 30, 35, 45, 32,
56, 30, 33, 37, 23, 56, 30, 33, 37, 23,
31, 26, 28, 37, 26, 31, 26, 28, 37, 26,
30, 27, 25, 35, 36, 30, 27, 25, 35, 36,
26, 25, 22, 41, 29, 26, 25, 22, 41, 29,
32, 24, 25, 30, 25, 32, 24, 25, 30, 25,
30, 33, 25, 45, 46, 30, 33, 25, 45, 46,
30, 29, 33, 27, 33, 30, 29, 33, 27, 33,
25, 23, 54, 22, 25, 25, 23, 54, 22, 25,
29, 27, 30, 26, 25, 29, 27, 30, 26, 25,
31, 33, 34, 34, 34, 31, 33, 34, 34, 34,
26, 32, 329, 28, 36, 26, 32, 329, 28, 36,
21, 21, 41, 55, 32, 21, 21, 41, 55, 32,
21, 45, 27, 25, 34, 21, 45, 27, 25, 34,
26, 41, 27, 31, 25, 26, 41, 27, 31, 25,
26, 27, 42, 29, 25, 26, 27, 42, 29, 25,
33, 99999999999, 40, 31, 26, 33, 99999999999, 40, 31, 26,
29, 35, 32, 29, 26, 29, 35, 32, 29, 26,
28, 35, 29, 33, 22, 28, 35, 29, 33, 22,
33, 31, 21, 31, 26, 33, 31, 21, 31, 26,
30, 30, 34, 55, 28, 30, 30, 34, 55, 28,
28, 32, 28, 21, 24, 28, 32, 28, 21, 24,
28, 24, 33, 34, 27, 28, 24, 33, 34, 27,
28, 23, 29, 26, 36, 28, 23, 29, 26, 36,
41, 23, 39, 26, 24, 41, 23, 39, 26, 24,
37, 43, 40, 30, 34, 37, 43, 40, 30, 34,
27, 36, 27, 35, 32, 27, 36, 27, 35, 32,
33, 28, 26, 27, 38, 33, 28, 26, 27, 38,
57, 28, 26, 42, 31, 57, 28, 26, 42, 31,
58, 29, 39, 34, 57, 58, 29, 39, 34, 57,
27, 23, 23, 43, 18, 27, 23, 23, 43, 18,
29, 48, 43, 28, 30, 29, 48, 43, 28, 30,
26, 33, 30, 24, 23, 26, 33, 30, 24, 23,
36, 25, 54, 34, 25, 36, 25, 54, 34, 25,
35, 46, 42, 32, 47, 35, 46, 42, 32, 47,
33, 25, 39, 38, 46, 33, 25, 39, 38, 46,
38, 33, 34, 62, 25, 38, 33, 34, 62, 25,
36, 41, 24, 51, 29, 36, 41, 24, 51, 29,
31, 31, 27, 23, 21, 31, 31, 27, 23, 21,
27, 39, 26, 27, 22, 27, 39, 26, 27, 22,
26, 31, 32, 28, 28, 26, 31, 32, 28, 28,
30, 36, 30, 32, 29, 30, 36, 30, 32, 29,
21, 27, 32, 34, 22, 21, 27, 32, 34, 22,
27, 33, 36, 40, 28, 27, 33, 36, 40, 28,
39, 32, 31, 38, 23, 39, 32, 31, 38, 23,
42, 27, 26, 50, 37, 42, 27, 26, 50, 37,
33, 29, 34, 41, 29, 33, 29, 34, 41, 29,
35, 27, 40, 27, 29, 35, 27, 40, 27, 29,
31, 43, 34, 29, 19, 31, 43, 34, 29, 19,
41, 29, 23, 24, 31, 41, 29, 23, 24, 31,
29, 33, 30, 32, 50, 29, 33, 30, 32, 50,
24, 27, 32, 42, 37, 24, 27, 32, 42, 37,
30, 29, 30, 35, 35, 30, 29, 30, 35, 35,
38, 22, 24, 22, 31, 38, 22, 24, 22, 31,
23, 31, 28, 37, 34, 23, 31, 28, 37, 34,
32, 28, 24, 56, 31, 32, 28, 24, 56, 31,
34, 35, 28, 36, 30, 34, 35, 28, 36, 30,
49, 29, 57, 31, 37, 49, 29, 57, 31, 37,
25, 30, 26, 22, 39, 25, 30, 26, 22, 39,
29, 54, 34, 32, 29, 29, 54, 34, 32, 29,
32, 30, 20, 27, 32, 32, 30, 20, 27, 32,
26, 30, 30, 26, 26, 26, 30, 30, 26, 26,
23, 26, 35, 28, 29, 23, 26, 35, 28, 29,
45, 33, 38, 19, 29, 45, 33, 38, 19, 29,
23, 33, 49, 27, 23, 23, 33, 49, 27, 23,
29, 32, 33, 37, 23, 29, 32, 33, 37, 23,
43, 32, 26, 32, 29, 43, 32, 26, 32, 29,
30, 29, 32, -1726, 30, 30, 29, 32, -1726, 30,
25, 33, 31, 21, 30, 25, 33, 31, 21, 30,
43, 37, 33, 33, 36, 43, 37, 33, 33, 36,
37, 39, 31, 36, 30, 37, 39, 31, 36, 30,
35, 19, 37, 40, 36, 35, 19, 37, 40, 36,
29, 38, 26, 34, 21, 29, 38, 26, 34, 21,
31, 37, 37, 38, 27, 31, 37, 37, 38, 27,
33, 27, 36, 28, 39, 33, 27, 36, 28, 39,
33, 37, 39, 43, 32, 33, 37, 39, 43, 32,
43, 33, 34, 25, 25, 43, 33, 34, 25, 25,
39, 29, 33, 37, 35, 39, 29, 33, 37, 35,
22, 38, 32, 35, 29, 22, 38, 32, 35, 29,
23, 28, 40, 41, 29, 23, 28, 40, 41, 29,
29, 35, 28, 36, 39, 29, 35, 28, 36, 39,
39, 44, 26, 35, 40, 39, 44, 26, 35, 40,
35, 38, 48, 20, 40, 35, 38, 48, 20, 40,
29, 35, 29, 40, 29, 29, 35, 29, 40, 29,
29, 34, 44, 24, 36, 29, 34, 44, 24, 36,
43, 36, 31, 35, 37, 43, 36, 31, 35, 37,
34, 36, 40, 40, 42, 34, 36, 40, 40, 42,
21, 26, 51, 32, 32, 21, 26, 51, 32, 32,
26, 23, 33, 46, 35, 26, 23, 33, 46, 35,
32, 56, 32, 30, 23, 32, 56, 32, 30, 23,
31, 29, 30, 37, 36, 31, 29, 30, 37, 36,
35, 41, 31, 39, 42, 35, 41, 31, 39, 42,
32, 30, 40, 33, 34, 32, 30, 40, 33, 34,
50, 24, 25, 43, 25, 50, 24, 25, 43, 25,
51, 49, 25, 36, 48, 51, 49, 25, 36, 48,
48, 53, 24, 33, 25, 48, 53, 24, 33, 25,
30, 30, 34, 22, 28, 30, 30, 34, 22, 28,
35, 28, 42, 29, 43, 35, 28, 42, 29, 43,
31, 35, 34, 43, 38, 31, 35, 34, 43, 38,
26, 38, 42, 32, 44, 26, 38, 42, 32, 44,
28, 40, 31, 32, 28, 28, 40, 31, 32, 28,
39, 43, 35, 40, 34, 39, 43, 35, 40, 34,
24, 61, 36, 33, 30, 24, 61, 36, 33, 30,
34, 26, 25, 35, 24, 34, 26, 25, 35, 24,
55, 33, 26, 25, 45, 55, 33, 26, 25, 45,
33, 43, 30, 40, 49, 33, 43, 30, 40, 49,
38, 26, 28, 40, 37, 38, 26, 28, 40, 37,
34, 28, 27, 29, 39, 34, 28, 27, 29, 39,
28, 23, 8, 30, 20, 28, 23, 8, 30, 20,
35, 39, 31, 32, 25, 35, 39, 31, 32, 25,
42, 34, 26, 35, 34, 42, 34, 26, 35, 34,
38, 34, 39, 33, 24, 38, 34, 39, 33, 24,
38, 31, 46, 30, 25, 38, 31, 46, 30, 25,
19, 30, 32, 37, 42, 19, 30, 32, 37, 42,
25, 19, 40, 31, 40, 25, 19, 40, 31, 40,
31, 36, 35, 26, 34, 31, 36, 35, 26, 34,
28, 40, 26, 29, 26, 28, 40, 26, 29, 26,
33, 28, 41, 39, 26, 33, 28, 41, 39, 26,
23, 35, 36, 42, 39, 23, 35, 36, 42, 39,
27, 33, 31, 28, 29, 27, 33, 31, 28, 29,
27, 44, 25, 24, 25, 27, 44, 25, 24, 25,
34, 26, 48, 39, 43, 34, 26, 48, 39, 43,
41, 25, 31, 40, 43, 41, 25, 31, 40, 43,
27, 37, 32, 25, 29, 27, 37, 32, 25, 29,
30, 34, 32, 41, 38, 30, 34, 32, 41, 38,
32, 28, 11, 43, 32, 32, 28, 11, 43, 32,
25, 37, 36, 24, 40, 25, 37, 36, 24, 40,
43, 26, 33, 35, 45, 43, 26, 33, 35, 45,
25, 50, 26, 33, 30, 25, 50, 26, 33, 30,
33, 29, 25, 24, 40, 33, 29, 25, 24, 40,
46, 38, 34, 32, 44, 46, 38, 34, 32, 44,
33, 45, 26, 20, -1, 33, 45, 26, 20, -1,
37, 42, 36, 27, 27, 37, 42, 36, 27, 27,
27, 25, 23, 21, 26, 27, 25, 23, 21, 26,
29, 28, 23, 26, 38, 29, 28, 23, 26, 38,
39, 35, 32, 32, 26, 39, 35, 32, 32, 26,
38, 34, 39, 32, 37, 38, 34, 39, 32, 37,
31, 30, 51, 29, 31, 31, 30, 51, 29, 31,
26, 46, 32, 29, 34, 26, 46, 32, 29, 34,
26, 32, 40, 23, 20, 26, 32, 40, 23, 20,
26, 29, 40, 25, 32, 26, 29, 40, 25, 32,
38, 72, 35, 28, 27, 38, 72, 35, 28, 27,
56, 38, 40, 44, 34, 56, 38, 40, 44, 34,
37, 38, 34, 35, 34, 37, 38, 34, 35, 34,
32, 28, 28, 34, 32, 32, 28, 28, 34, 32,
34, 23, 33, 29, 45, 34, 23, 33, 29, 45,
34, 31, 33, 27, 42, 34, 31, 33, 27, 42,
38, 46, 46, 41, 23, 38, 46, 46, 41, 23,
24, 23, 32, 25, 23, 24, 23, 32, 25, 23,
24, 25, 23, 24, 23, 24, 25, 23, 24, 23,
60, 28, 28, 30, 31, 60, 28, 28, 30, 31,
31, 28, 43, 22, 32, 31, 28, 43, 22, 32,
36, 41, 30, 30, 36, 36, 41, 30, 30, 36,
29, 36, 32, 34, 25], 29, 36, 32, 34, 25],
dtype=int64) dtype=int64)
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 3.4 Remove outliers ## 3.4 Remove outliers
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
einige Personen haben einen Troll Value für "Alter" eingegeben, diese Zeilen müssen entfernt werden einige Personen haben einen Troll Value für "Alter" eingegeben, diese Zeilen müssen entfernt werden
das Alter sollte zwischen 16 und 70 Jahren liegen das Alter sollte zwischen 16 und 70 Jahren liegen
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
sns.histplot(data = data1, x = 'Age', bins="sqrt") sns.histplot(data = data1, x = 'Age', bins="sqrt")
``` ```
   
%% Output %% Output
   
<Axes: xlabel='Age', ylabel='Count'> <Axes: xlabel='Age', ylabel='Count'>
   
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data2 = data1[data1['Age']<70] data2 = data1[data1['Age']<70]
data2 = data2[data2['Age']>16] data2 = data2[data2['Age']>16]
sns.histplot(data2['Age']) sns.histplot(data2['Age'])
``` ```
   
%% Output %% Output
   
<Axes: xlabel='Age', ylabel='Count'> <Axes: xlabel='Age', ylabel='Count'>
   
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data2['Age'].median(axis = 0) data2['Age'].median(axis = 0)
``` ```
   
%% Output %% Output
   
31.5 31.5
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data2.columns.values # these features are left data2.columns.values # these features are left
``` ```
   
%% Output %% Output
   
array(['Age', 'Gender', 'self_employed', 'family_history', 'treatment', array(['Age', 'Gender', 'self_employed', 'family_history', 'treatment',
'work_interfere', 'no_employees', 'remote_work', 'tech_company', 'work_interfere', 'no_employees', 'remote_work', 'tech_company',
'benefits', 'care_options'], dtype=object) 'benefits', 'care_options'], dtype=object)
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 3.5 Clean the data ## 3.5 Clean the data
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data2.columns.values data2.columns.values
``` ```
   
%% Output %% Output
   
array(['Age', 'Gender', 'self_employed', 'family_history', 'treatment', array(['Age', 'Gender', 'self_employed', 'family_history', 'treatment',
'work_interfere', 'no_employees', 'remote_work', 'tech_company', 'work_interfere', 'no_employees', 'remote_work', 'tech_company',
'benefits', 'care_options'], dtype=object) 'benefits', 'care_options'], dtype=object)
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
# clean Gender # clean Gender
# reduce options to only male or female # reduce options to only male or female
data2['Gender'] = data2['Gender'].str.lower() data2['Gender'] = data2['Gender'].str.lower()
male = ["male", "m", "male-ish", "maile", "mal", "male (cis)", "make", "male ", "man","msle", "mail", "malr","cis man", "cis male"] male = ["male", "m", "male-ish", "maile", "mal", "male (cis)", "make", "male ", "man","msle", "mail", "malr","cis man", "cis male"]
trans = ["trans-female", "something kinda male?", "queer/she/they", "non-binary","nah", "all", "enby", "fluid", "genderqueer", "androgyne", "agender", "male leaning androgynous", "guy (-ish) ^_^", "trans woman", "neuter", "female (trans)", "queer", "ostensibly male, unsure what that really means"] trans = ["trans-female", "something kinda male?", "queer/she/they", "non-binary","nah", "all", "enby", "fluid", "genderqueer", "androgyne", "agender", "male leaning androgynous", "guy (-ish) ^_^", "trans woman", "neuter", "female (trans)", "queer", "ostensibly male, unsure what that really means"]
female = ["cis female", "f", "female", "woman", "femake", "female ","cis-female/femme", "female (cis)", "femail"] female = ["cis female", "f", "female", "woman", "femake", "female ","cis-female/femme", "female (cis)", "femail"]
data2['Gender'] = data2['Gender'].apply(lambda x:"Male" if x in male else x) data2['Gender'] = data2['Gender'].apply(lambda x:"Male" if x in male else x)
data2['Gender'] = data2['Gender'].apply(lambda x:"Female" if x in female else x) data2['Gender'] = data2['Gender'].apply(lambda x:"Female" if x in female else x)
data2['Gender'] = data2['Gender'].apply(lambda x:"Trans" if x in trans else x) data2['Gender'] = data2['Gender'].apply(lambda x:"Trans" if x in trans else x)
data2.drop(data2[data2.Gender == 'p'].index, inplace=True) data2.drop(data2[data2.Gender == 'p'].index, inplace=True)
data2.drop(data2[data2.Gender == 'a little about you'].index, inplace=True) data2.drop(data2[data2.Gender == 'a little about you'].index, inplace=True)
``` ```
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Dieser Code setzt die Spalte "Geschlecht" des Datenrahmens "data2" auf der Grundlage einer Liste vordefinierter Optionen entweder auf "Männlich", "Weiblich" oder "Trans". Die Spalte "Geschlecht" wird zunächst in Kleinbuchstaben umgewandelt und dann wird der Code ausgeführt, um den Wert von "Geschlecht" auf der Grundlage der Liste der Optionen festzulegen. Schließlich entfernt der Code alle Instanzen von "p" oder "a little about you" (die wahrscheinlich ungültige Werte darstellen) aus der Spalte "Geschlecht". Dieser Code setzt die Spalte "Geschlecht" des Datenrahmens "data2" auf der Grundlage einer Liste vordefinierter Optionen entweder auf "Männlich", "Weiblich" oder "Trans". Die Spalte "Geschlecht" wird zunächst in Kleinbuchstaben umgewandelt und dann wird der Code ausgeführt, um den Wert von "Geschlecht" auf der Grundlage der Liste der Optionen festzulegen. Schließlich entfernt der Code alle Instanzen von "p" oder "a little about you" (die wahrscheinlich ungültige Werte darstellen) aus der Spalte "Geschlecht".
   
Das Ergebnis dieses Codes ist eine Spalte "Geschlecht" mit konsistenteren Werten, die für eine genauere Analyse oder Modellierung verwendet werden kann Das Ergebnis dieses Codes ist eine Spalte "Geschlecht" mit konsistenteren Werten, die für eine genauere Analyse oder Modellierung verwendet werden kann
   
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_gender = data2['Gender'].value_counts().reset_index() plot_gender = data2['Gender'].value_counts().reset_index()
plot_gender.columns = ['Gender','count'] plot_gender.columns = ['Gender','count']
   
px.pie(plot_gender,values='count',names='Gender',template='ggplot2',title='Gender') px.pie(plot_gender,values='count',names='Gender',template='ggplot2',title='Gender')
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaubild wird die Anzahl der Männer, Frauen und Trans-Personen dargestellt. In diesem Schaubild wird die Anzahl der Männer, Frauen und Trans-Personen dargestellt.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
dropvalue = data2[ data2['Gender'] == 'ostensibly male' ].index dropvalue = data2[ data2['Gender'] == 'ostensibly male' ].index
data2.drop(dropvalue , inplace=True) data2.drop(dropvalue , inplace=True)
dropvalue1 = data2[ data2['Gender'] == 'Trans' ].index dropvalue1 = data2[ data2['Gender'] == 'Trans' ].index
data2.drop(dropvalue1, inplace=True) data2.drop(dropvalue1, inplace=True)
``` ```
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_gender = data2['Gender'].value_counts().reset_index() plot_gender = data2['Gender'].value_counts().reset_index()
plot_gender.columns = ['Gender','count'] plot_gender.columns = ['Gender','count']
   
px.pie(plot_gender,values='count',names='Gender',template='ggplot2',title='Gender') px.pie(plot_gender,values='count',names='Gender',template='ggplot2',title='Gender')
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaubild wird die Anzahl der Männer, Frauen und Trans-Personen dargestellt. In diesem Schaubild wird die Anzahl der Männer, Frauen und Trans-Personen dargestellt.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_self = data2['self_employed'].value_counts().reset_index() plot_self = data2['self_employed'].value_counts().reset_index()
plot_self.columns = ['self_employed','count'] plot_self.columns = ['self_employed','count']
   
px.pie(plot_self,values='count',names='self_employed',template='ggplot2',title='Self employed') px.pie(plot_self,values='count',names='self_employed',template='ggplot2',title='Self employed')
   
# Self employed looks good # Self employed looks good
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
im diesem Schaubild zeig die Anzahl der selbstständigen Menschen und nicht selbstständigen zeigt. im diesem Schaubild zeig die Anzahl der selbstständigen Menschen und nicht selbstständigen zeigt.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_fam = data2['family_history'].value_counts().reset_index() plot_fam = data2['family_history'].value_counts().reset_index()
plot_fam.columns = ['family_history','count'] plot_fam.columns = ['family_history','count']
   
px.pie(plot_fam,values='count',names='family_history',template='ggplot2',title='Family history') px.pie(plot_fam,values='count',names='family_history',template='ggplot2',title='Family history')
   
# family history looks good # family history looks good
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaulbild Gibt an, ob es eine Familiengeschichte von psychischen Erkrankungen gibt. In diesem Schaulbild Gibt an, ob es eine Familiengeschichte von psychischen Erkrankungen gibt.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_treat = data2['treatment'].value_counts().reset_index() plot_treat = data2['treatment'].value_counts().reset_index()
plot_treat.columns = ['treatment','count'] plot_treat.columns = ['treatment','count']
   
px.pie(plot_treat,values='count',names='treatment',template='ggplot2',title='In treatment') px.pie(plot_treat,values='count',names='treatment',template='ggplot2',title='In treatment')
   
# in treatment looks good. # in treatment looks good.
# this will be our target variable # this will be our target variable
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaubild gibt es wie viele Personen derzeit in Behandlung ist. In diesem Schaubild gibt es wie viele Personen derzeit in Behandlung ist.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_inter = data2['work_interfere'].value_counts().reset_index() plot_inter = data2['work_interfere'].value_counts().reset_index()
plot_inter.columns = ['work_interfere','count'] plot_inter.columns = ['work_interfere','count']
   
px.pie(plot_inter,values='count',names='work_interfere',template='ggplot2',title='Work interfere') px.pie(plot_inter,values='count',names='work_interfere',template='ggplot2',title='Work interfere')
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaubild gibt an wie oft die Arbeit durch psychische Gesundheitsprobleme beeinträchtigt wird. In diesem Schaubild gibt an wie oft die Arbeit durch psychische Gesundheitsprobleme beeinträchtigt wird.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_numb = data2['no_employees'].value_counts().reset_index() plot_numb = data2['no_employees'].value_counts().reset_index()
plot_numb.columns = ['no_employees','count'] plot_numb.columns = ['no_employees','count']
px.pie(plot_numb,values='count',names='no_employees',template='ggplot2',title='Number of employees') px.pie(plot_numb,values='count',names='no_employees',template='ggplot2',title='Number of employees')
   
# no_employees looks good # no_employees looks good
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaulbild wird die Anzahl der Mitarbeiter im Unternehmen der befragten Person dargestellt. In diesem Schaulbild wird die Anzahl der Mitarbeiter im Unternehmen der befragten Person dargestellt.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_remo = data2['remote_work'].value_counts().reset_index() plot_remo = data2['remote_work'].value_counts().reset_index()
plot_remo .columns = ['remote_work','count'] plot_remo .columns = ['remote_work','count']
   
px.pie(plot_remo ,values='count',names='remote_work',template='ggplot2',title='Remote work') px.pie(plot_remo ,values='count',names='remote_work',template='ggplot2',title='Remote work')
   
# remote work looks good # remote work looks good
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaubild wird dargestellt, wie viele Personen Remote Work ausüben. In diesem Schaubild wird dargestellt, wie viele Personen Remote Work ausüben.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_tech = data2['tech_company'].value_counts().reset_index() plot_tech = data2['tech_company'].value_counts().reset_index()
plot_tech.columns = ['tech_company','count'] plot_tech.columns = ['tech_company','count']
   
px.pie(plot_tech,values='count',names='tech_company',template='ggplot2',title='Tech company') px.pie(plot_tech,values='count',names='tech_company',template='ggplot2',title='Tech company')
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaubild wird dargestellt, wie viele Personen in einem Technologieunternehmen arbeiten In diesem Schaubild wird dargestellt, wie viele Personen in einem Technologieunternehmen arbeiten
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_bene = data2['benefits'].value_counts().reset_index() plot_bene = data2['benefits'].value_counts().reset_index()
plot_bene.columns = ['benefits','count'] plot_bene.columns = ['benefits','count']
   
px.pie(plot_bene,values='count',names='benefits',template='ggplot2',title='Benefits') px.pie(plot_bene,values='count',names='benefits',template='ggplot2',title='Benefits')
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaubild werden die Benefits dargestellt In diesem Schaubild werden die Benefits dargestellt
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plot_care = data2['care_options'].value_counts().reset_index() plot_care = data2['care_options'].value_counts().reset_index()
plot_care.columns = ['care_options','count'] plot_care.columns = ['care_options','count']
   
px.pie(plot_care,values='count',names='care_options',template='ggplot2',title='Care options') px.pie(plot_care,values='count',names='care_options',template='ggplot2',title='Care options')
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In diesem Schaubild wird dargestellt wie viele eine Pflegemöglichkeit haben In diesem Schaubild wird dargestellt wie viele eine Pflegemöglichkeit haben
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data2.describe(include='all') data2.describe(include='all')
``` ```
   
%% Output %% Output
   
Age Gender self_employed family_history treatment \ Age Gender self_employed family_history treatment \
count 971.000000 971 971 971 971 count 971.000000 971 971 971 971
unique NaN 2 2 2 2 unique NaN 2 2 2 2
top NaN Male No No Yes top NaN Male No No Yes
freq NaN 761 852 535 613 freq NaN 761 852 535 613
mean 32.330587 NaN NaN NaN NaN mean 32.330587 NaN NaN NaN NaN
std 7.268977 NaN NaN NaN NaN std 7.268977 NaN NaN NaN NaN
min 18.000000 NaN NaN NaN NaN min 18.000000 NaN NaN NaN NaN
25% 27.000000 NaN NaN NaN NaN 25% 27.000000 NaN NaN NaN NaN
50% 32.000000 NaN NaN NaN NaN 50% 32.000000 NaN NaN NaN NaN
75% 36.000000 NaN NaN NaN NaN 75% 36.000000 NaN NaN NaN NaN
max 62.000000 NaN NaN NaN NaN max 62.000000 NaN NaN NaN NaN
work_interfere no_employees remote_work tech_company benefits \ work_interfere no_employees remote_work tech_company benefits \
count 971 971 971 971 971 count 971 971 971 971 971
unique 4 6 2 2 3 unique 4 6 2 2 3
top Sometimes 26-100 No Yes Yes top Sometimes 26-100 No Yes Yes
freq 453 223 675 798 395 freq 453 223 675 798 395
mean NaN NaN NaN NaN NaN mean NaN NaN NaN NaN NaN
std NaN NaN NaN NaN NaN std NaN NaN NaN NaN NaN
min NaN NaN NaN NaN NaN min NaN NaN NaN NaN NaN
25% NaN NaN NaN NaN NaN 25% NaN NaN NaN NaN NaN
50% NaN NaN NaN NaN NaN 50% NaN NaN NaN NaN NaN
75% NaN NaN NaN NaN NaN 75% NaN NaN NaN NaN NaN
max NaN NaN NaN NaN NaN max NaN NaN NaN NaN NaN
care_options care_options
count 971 count 971
unique 3 unique 3
top Yes top Yes
freq 379 freq 379
mean NaN mean NaN
std NaN std NaN
min NaN min NaN
25% NaN 25% NaN
50% NaN 50% NaN
75% NaN 75% NaN
max NaN max NaN
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plt.figure(figsize=(10,5)) plt.figure(figsize=(10,5))
sns.countplot(y="Gender", hue="treatment", data=data2) sns.countplot(y="Gender", hue="treatment", data=data2)
plt.title("mental health vs Gender",fontsize=15,fontweight="normal") plt.title("mental health vs Gender",fontsize=15,fontweight="normal")
plt.ylabel("") plt.ylabel("")
plt.show() plt.show()
``` ```
   
%% Output %% Output
   
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plt.figure(figsize=(10,5)) plt.figure(figsize=(10,5))
sns.countplot(y="family_history", hue="treatment", data=data2) sns.countplot(y="family_history", hue="treatment", data=data2)
plt.title("family history vs mental health ", plt.title("family history vs mental health ",
fontsize=15,fontweight="normal") fontsize=15,fontweight="normal")
plt.ylabel("") plt.ylabel("")
plt.show() plt.show()
``` ```
   
%% Output %% Output
   
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plt.figure(figsize=(10,5)) plt.figure(figsize=(10,5))
sns.countplot(y="work_interfere", hue="treatment", data=data2) sns.countplot(y="work_interfere", hue="treatment", data=data2)
plt.title("Behandlung der psychischen Erkrankung stört die tägliche Arbeit?",fontsize=15,fontweight="normal") plt.title("Behandlung der psychischen Erkrankung stört die tägliche Arbeit?",fontsize=15,fontweight="normal")
plt.ylabel("") plt.ylabel("")
plt.show() plt.show()
``` ```
   
%% Output %% Output
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Dieses Merkmal scheint ein guter Prädiktor für die Zielvariable Behandlung zu sein. Dieses Merkmal scheint ein guter Prädiktor für die Zielvariable Behandlung zu sein.
Aber die Information "Beeinträchtigt Ihre psychische Gesundheit Ihre Arbeit" kann nicht erhoben werden. Aber die Information "Beeinträchtigt Ihre psychische Gesundheit Ihre Arbeit" kann nicht erhoben werden.
Niemand, der bei klarem Verstand ist, würde seiner Krankenkasse gegenüber die Wahrheit zu dieser Frage sagen. Niemand, der bei klarem Verstand ist, würde seiner Krankenkasse gegenüber die Wahrheit zu dieser Frage sagen.
Daher muss die Frage nach der Beeinträchtigung der Arbeit gestrichen werden. Daher muss die Frage nach der Beeinträchtigung der Arbeit gestrichen werden.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data2 = data2.drop('work_interfere', axis=1) data2 = data2.drop('work_interfere', axis=1)
``` ```
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
plt.figure(figsize=(10,5)) plt.figure(figsize=(10,5))
sns.countplot(x="no_employees", hue="treatment", data=data2) sns.countplot(x="no_employees", hue="treatment", data=data2)
plt.title("number of employees vs mental health",fontsize=18,fontweight="normal") plt.title("number of employees vs mental health",fontsize=18,fontweight="normal")
plt.ylabel("") plt.ylabel("")
plt.show() plt.show()
``` ```
   
%% Output %% Output
   
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data2 data2
``` ```
   
%% Output %% Output
   
Age Gender self_employed family_history treatment no_employees \ Age Gender self_employed family_history treatment no_employees \
0 37 Female No No Yes 6-25 0 37 Female No No Yes 6-25
1 44 Male No No No More than 1000 1 44 Male No No No More than 1000
2 32 Male No No No 6-25 2 32 Male No No No 6-25
3 31 Male No Yes Yes 26-100 3 31 Male No Yes Yes 26-100
4 31 Male No No No 100-500 4 31 Male No No No 100-500
... ... ... ... ... ... ... ... ... ... ... ... ... ...
1252 29 Male No Yes Yes 100-500 1252 29 Male No Yes Yes 100-500
1253 36 Male No Yes No More than 1000 1253 36 Male No Yes No More than 1000
1255 32 Male No Yes Yes 26-100 1255 32 Male No Yes Yes 26-100
1256 34 Male No Yes Yes More than 1000 1256 34 Male No Yes Yes More than 1000
1258 25 Male No Yes Yes 26-100 1258 25 Male No Yes Yes 26-100
remote_work tech_company benefits care_options remote_work tech_company benefits care_options
0 No Yes Yes Not sure 0 No Yes Yes Not sure
1 No No Don't know No 1 No No Don't know No
2 No Yes No No 2 No Yes No No
3 No Yes No Yes 3 No Yes No Yes
4 Yes Yes Yes No 4 Yes Yes Yes No
... ... ... ... ... ... ... ... ... ...
1252 Yes Yes Yes Yes 1252 Yes Yes Yes Yes
1253 No No Don't know No 1253 No No Don't know No
1255 Yes Yes Yes Yes 1255 Yes Yes Yes Yes
1256 No Yes Yes Yes 1256 No Yes Yes Yes
1258 No No Yes Yes 1258 No No Yes Yes
[971 rows x 10 columns] [971 rows x 10 columns]
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data3 = data2.reset_index(drop = True) data3 = data2.reset_index(drop = True)
``` ```
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data3.info() data3.info()
``` ```
   
%% Output %% Output
   
<class 'pandas.core.frame.DataFrame'> <class 'pandas.core.frame.DataFrame'>
RangeIndex: 971 entries, 0 to 970 RangeIndex: 971 entries, 0 to 970
Data columns (total 10 columns): Data columns (total 10 columns):
# Column Non-Null Count Dtype # Column Non-Null Count Dtype
--- ------ -------------- ----- --- ------ -------------- -----
0 Age 971 non-null int64 0 Age 971 non-null int64
1 Gender 971 non-null object 1 Gender 971 non-null object
2 self_employed 971 non-null object 2 self_employed 971 non-null object
3 family_history 971 non-null object 3 family_history 971 non-null object
4 treatment 971 non-null object 4 treatment 971 non-null object
5 no_employees 971 non-null object 5 no_employees 971 non-null object
6 remote_work 971 non-null object 6 remote_work 971 non-null object
7 tech_company 971 non-null object 7 tech_company 971 non-null object
8 benefits 971 non-null object 8 benefits 971 non-null object
9 care_options 971 non-null object 9 care_options 971 non-null object
dtypes: int64(1), object(9) dtypes: int64(1), object(9)
memory usage: 76.0+ KB memory usage: 76.0+ KB
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Dies ist ein DataFrame aus der pandas-Bibliothek. Es enthält Statistiken zu various Themen wie dem Alter, der Geschlechtsaufteilung, dem Arbeitsstatus, der Familiengeschichte und einer ganzen Reihe anderer Informationen über eine Person. Es heißt DataFrame, weil es aus zwei Komponenten besteht, einer Tabelle der Daten und einer Index-Spalte. Dies ist ein DataFrame aus der pandas-Bibliothek. Es enthält Statistiken zu various Themen wie dem Alter, der Geschlechtsaufteilung, dem Arbeitsstatus, der Familiengeschichte und einer ganzen Reihe anderer Informationen über eine Person. Es heißt DataFrame, weil es aus zwei Komponenten besteht, einer Tabelle der Daten und einer Index-Spalte.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data3.describe(include="all") data3.describe(include="all")
``` ```
   
%% Output %% Output
   
Age Gender self_employed family_history treatment no_employees \ Age Gender self_employed family_history treatment no_employees \
count 971.000000 971 971 971 971 971 count 971.000000 971 971 971 971 971
unique NaN 2 2 2 2 6 unique NaN 2 2 2 2 6
top NaN Male No No Yes 26-100 top NaN Male No No Yes 26-100
freq NaN 761 852 535 613 223 freq NaN 761 852 535 613 223
mean 32.330587 NaN NaN NaN NaN NaN mean 32.330587 NaN NaN NaN NaN NaN
std 7.268977 NaN NaN NaN NaN NaN std 7.268977 NaN NaN NaN NaN NaN
min 18.000000 NaN NaN NaN NaN NaN min 18.000000 NaN NaN NaN NaN NaN
25% 27.000000 NaN NaN NaN NaN NaN 25% 27.000000 NaN NaN NaN NaN NaN
50% 32.000000 NaN NaN NaN NaN NaN 50% 32.000000 NaN NaN NaN NaN NaN
75% 36.000000 NaN NaN NaN NaN NaN 75% 36.000000 NaN NaN NaN NaN NaN
max 62.000000 NaN NaN NaN NaN NaN max 62.000000 NaN NaN NaN NaN NaN
remote_work tech_company benefits care_options remote_work tech_company benefits care_options
count 971 971 971 971 count 971 971 971 971
unique 2 2 3 3 unique 2 2 3 3
top No Yes Yes Yes top No Yes Yes Yes
freq 675 798 395 379 freq 675 798 395 379
mean NaN NaN NaN NaN mean NaN NaN NaN NaN
std NaN NaN NaN NaN std NaN NaN NaN NaN
min NaN NaN NaN NaN min NaN NaN NaN NaN
25% NaN NaN NaN NaN 25% NaN NaN NaN NaN
50% NaN NaN NaN NaN 50% NaN NaN NaN NaN
75% NaN NaN NaN NaN 75% NaN NaN NaN NaN
max NaN NaN NaN NaN max NaN NaN NaN NaN
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 3.6 create dummy features for all string based variables ## 3.6 create dummy features for all string based variables
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
create dummy features for all string based variables" bedeutet, dass eine neue Spalte / Variablen für jede der Attribute mit dem Typ "String" erstellen müssen. Das Ziel ist es, diese Variablen zu verwenden, um die String-Werte in binäre (1-0) oder multible (0-100) Repräsentationen umzuwandeln. Diese Repräsentationen können dann in einem Modell verwendet werden, um Vorhersagen zu treffen. create dummy features for all string based variables" bedeutet, dass eine neue Spalte / Variablen für jede der Attribute mit dem Typ "String" erstellen müssen. Das Ziel ist es, diese Variablen zu verwenden, um die String-Werte in binäre (1-0) oder multible (0-100) Repräsentationen umzuwandeln. Diese Repräsentationen können dann in einem Modell verwendet werden, um Vorhersagen zu treffen.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data3 = pd.get_dummies(data3, drop_first=True) # 0-1 encoding for categorical values data3 = pd.get_dummies(data3, drop_first=True) # 0-1 encoding for categorical values
``` ```
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
data3.head() data3.head()
``` ```
   
%% Output %% Output
   
Age Gender_Male self_employed_Yes family_history_Yes treatment_Yes \ Age Gender_Male self_employed_Yes family_history_Yes treatment_Yes \
0 37 False False False True 0 37 False False False True
1 44 True False False False 1 44 True False False False
2 32 True False False False 2 32 True False False False
3 31 True False True True 3 31 True False True True
4 31 True False False False 4 31 True False False False
no_employees_100-500 no_employees_26-100 no_employees_500-1000 \ no_employees_100-500 no_employees_26-100 no_employees_500-1000 \
0 False False False 0 False False False
1 False False False 1 False False False
2 False False False 2 False False False
3 False True False 3 False True False
4 True False False 4 True False False
no_employees_6-25 no_employees_More than 1000 remote_work_Yes \ no_employees_6-25 no_employees_More than 1000 remote_work_Yes \
0 True False False 0 True False False
1 False True False 1 False True False
2 True False False 2 True False False
3 False False False 3 False False False
4 False False True 4 False False True
tech_company_Yes benefits_No benefits_Yes care_options_Not sure \ tech_company_Yes benefits_No benefits_Yes care_options_Not sure \
0 True False True True 0 True False True True
1 False False False False 1 False False False False
2 True True False False 2 True True False False
3 True True False False 3 True True False False
4 True False True False 4 True False True False
care_options_Yes care_options_Yes
0 False 0 False
1 False 1 False
2 False 2 False
3 True 3 True
4 False 4 False
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
Y = data3['treatment_Yes'] Y = data3['treatment_Yes']
X = data3.drop(['treatment_Yes'], axis=1) X = data3.drop(['treatment_Yes'], axis=1)
``` ```
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.2, random_state=123) # 80-20 split into training and test data X_train, X_test, y_train, y_test = train_test_split(X, Y, test_size=0.2, random_state=123) # 80-20 split into training and test data
``` ```
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
# 4. Modelling # 4. Modelling
## 4.1 decision tree ## 4.1 decision tree
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
scaler = StandardScaler() scaler = StandardScaler()
scaler.fit(X_train) scaler.fit(X_train)
X_train = scaler.transform(X_train) X_train = scaler.transform(X_train)
X_test = scaler.transform(X_test) X_test = scaler.transform(X_test)
``` ```
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Für die Modellerstellung werden der Random Forest, die logistische Regression und der Entscheidungsbaum eingesetzt. Der Random Forest kombiniert mehrere Entscheidungsbäume für robuste Vorhersagen. Die logistische Regression schätzt Wahrscheinlichkeiten, besonders bei binären Klassifikationen. Der Entscheidungsbaum trifft systematisch Entscheidungen basierend auf Attributen. Diese Vielfalt an Modellen ermöglicht eine umfassende Analyse der Daten.
%% Cell type:markdown id: tags:
Diese führen einen Decision TreeClassifier-Algorithmus aus, um eine trainierte Datenmenge in X_train und y_train für das Modelling zu verwenden. Der Tree.fit()-Parameter wird verwendet, um ein Model zu trainieren, und dann wird das Modell verwendet, um die trainierten Daten zu testen und ihre Leistung zu melden. Die tree.predict()-Methode wird verwendet, um die Prognose des Modells für die Testdaten zu erhalten. Der Classification_report()-Parameter wird verwendet, um die Leistung des Modells in den trainierten und getesteten Daten anzuzeigen. Diese führen einen Decision TreeClassifier-Algorithmus aus, um eine trainierte Datenmenge in X_train und y_train für das Modelling zu verwenden. Der Tree.fit()-Parameter wird verwendet, um ein Model zu trainieren, und dann wird das Modell verwendet, um die trainierten Daten zu testen und ihre Leistung zu melden. Die tree.predict()-Methode wird verwendet, um die Prognose des Modells für die Testdaten zu erhalten. Der Classification_report()-Parameter wird verwendet, um die Leistung des Modells in den trainierten und getesteten Daten anzuzeigen.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
tree = DecisionTreeClassifier() tree = DecisionTreeClassifier()
tree.fit(X_train, y_train) tree.fit(X_train, y_train)
   
print('train performance') print('train performance')
print(classification_report(y_train, tree.predict(X_train))) print(classification_report(y_train, tree.predict(X_train)))
print('-----------------------------------------------------') print('-----------------------------------------------------')
print('test performance') print('test performance')
print(classification_report(y_test, tree.predict(X_test))) print(classification_report(y_test, tree.predict(X_test)))
``` ```
   
%% Output %% Output
   
train performance train performance
precision recall f1-score support precision recall f1-score support
False 0.91 1.00 0.95 280 False 0.91 1.00 0.95 280
True 1.00 0.95 0.97 496 True 1.00 0.95 0.97 496
accuracy 0.97 776 accuracy 0.97 776
macro avg 0.96 0.97 0.96 776 macro avg 0.96 0.97 0.96 776
weighted avg 0.97 0.97 0.97 776 weighted avg 0.97 0.97 0.97 776
----------------------------------------------------- -----------------------------------------------------
test performance test performance
precision recall f1-score support precision recall f1-score support
False 0.51 0.44 0.47 78 False 0.51 0.44 0.47 78
True 0.66 0.72 0.69 117 True 0.66 0.72 0.69 117
accuracy 0.61 195 accuracy 0.61 195
macro avg 0.58 0.58 0.58 195 macro avg 0.58 0.58 0.58 195
weighted avg 0.60 0.61 0.60 195 weighted avg 0.60 0.61 0.60 195
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Die Ergebnisse zeigen die Leistung der Modellvorhersage auf den trainierten und getestenen Daten. "precision", "recall" und "f1-score" sind Metriken, die die Leistung einer binärenClassifier-Modells bewerten. "accuracy" ist eine Metrik, die die Gesamtgenauigkeit der Modellvorhersage bewertet. Die Ergebnisse deuten darauf hin, dass das Modell auf den trainierten Daten eine hohe Genauigkeit hat, aber auf den getesteten Daten eine niedrigere Genauigkeit. Die Ergebnisse zeigen die Leistung der Modellvorhersage auf den trainierten und getestenen Daten. "precision", "recall" und "f1-score" sind Metriken, die die Leistung einer binärenClassifier-Modells bewerten. "accuracy" ist eine Metrik, die die Gesamtgenauigkeit der Modellvorhersage bewertet. Die Ergebnisse deuten darauf hin, dass das Modell auf den trainierten Daten eine hohe Genauigkeit hat, aber auf den getesteten Daten eine niedrigere Genauigkeit.
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Der Code testet verschiedene Max-Tree-Tiefen (1, 2, 3, 4) für den Decision Tree Classifier, um zu sehen, welche Tiefen die beste Leistung bringen. Für jede Max-Tree-Tiefen wird ein neues Modell trainiert und die Ergebnisse auf den trainierten und getesteten Daten gemeldet. Der Code testet verschiedene Max-Tree-Tiefen (1, 2, 3, 4) für den Decision Tree Classifier, um zu sehen, welche Tiefen die beste Leistung bringen. Für jede Max-Tree-Tiefen wird ein neues Modell trainiert und die Ergebnisse auf den trainierten und getesteten Daten gemeldet.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
tree_depth = [1, 2, 3, 4] # to prevent overfitting tree_depth = [1, 2, 3, 4] # to prevent overfitting
for i in tree_depth: for i in tree_depth:
tree = DecisionTreeClassifier(max_depth=i) tree = DecisionTreeClassifier(max_depth=i)
tree.fit(X_train, y_train) tree.fit(X_train, y_train)
print('Max tree depth:', i) print('Max tree depth:', i)
print('Confusion Matrix: ', confusion_matrix(y_test, tree.predict(X_test)).ravel()) print('Confusion Matrix: ', confusion_matrix(y_test, tree.predict(X_test)).ravel())
print('Train results:', classification_report(y_train, tree.predict(X_train), zero_division=0 )) print('Train results:', classification_report(y_train, tree.predict(X_train), zero_division=0 ))
print('Test results:', classification_report(y_test, tree.predict(X_test), zero_division=0 )) print('Test results:', classification_report(y_test, tree.predict(X_test), zero_division=0 ))
print('----------------------------------------------------------------------------') print('----------------------------------------------------------------------------')
``` ```
   
%% Output %% Output
   
Max tree depth: 1 Max tree depth: 1
Confusion Matrix: [ 0 78 0 117] Confusion Matrix: [ 0 78 0 117]
Train results: precision recall f1-score support Train results: precision recall f1-score support
False 0.00 0.00 0.00 280 False 0.00 0.00 0.00 280
True 0.64 1.00 0.78 496 True 0.64 1.00 0.78 496
accuracy 0.64 776 accuracy 0.64 776
macro avg 0.32 0.50 0.39 776 macro avg 0.32 0.50 0.39 776
weighted avg 0.41 0.64 0.50 776 weighted avg 0.41 0.64 0.50 776
Test results: precision recall f1-score support Test results: precision recall f1-score support
False 0.00 0.00 0.00 78 False 0.00 0.00 0.00 78
True 0.60 1.00 0.75 117 True 0.60 1.00 0.75 117
accuracy 0.60 195 accuracy 0.60 195
macro avg 0.30 0.50 0.38 195 macro avg 0.30 0.50 0.38 195
weighted avg 0.36 0.60 0.45 195 weighted avg 0.36 0.60 0.45 195
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Max tree depth: 2 Max tree depth: 2
Confusion Matrix: [50 28 22 95] Confusion Matrix: [50 28 22 95]
Train results: precision recall f1-score support Train results: precision recall f1-score support
False 0.58 0.57 0.58 280 False 0.58 0.57 0.58 280
True 0.76 0.77 0.76 496 True 0.76 0.77 0.76 496
accuracy 0.70 776 accuracy 0.70 776
macro avg 0.67 0.67 0.67 776 macro avg 0.67 0.67 0.67 776
weighted avg 0.70 0.70 0.70 776 weighted avg 0.70 0.70 0.70 776
Test results: precision recall f1-score support Test results: precision recall f1-score support
False 0.69 0.64 0.67 78 False 0.69 0.64 0.67 78
True 0.77 0.81 0.79 117 True 0.77 0.81 0.79 117
accuracy 0.74 195 accuracy 0.74 195
macro avg 0.73 0.73 0.73 195 macro avg 0.73 0.73 0.73 195
weighted avg 0.74 0.74 0.74 195 weighted avg 0.74 0.74 0.74 195
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Max tree depth: 3 Max tree depth: 3
Confusion Matrix: [45 33 19 98] Confusion Matrix: [45 33 19 98]
Train results: precision recall f1-score support Train results: precision recall f1-score support
False 0.62 0.55 0.58 280 False 0.62 0.55 0.58 280
True 0.76 0.81 0.78 496 True 0.76 0.81 0.78 496
accuracy 0.72 776 accuracy 0.72 776
macro avg 0.69 0.68 0.68 776 macro avg 0.69 0.68 0.68 776
weighted avg 0.71 0.72 0.71 776 weighted avg 0.71 0.72 0.71 776
Test results: precision recall f1-score support Test results: precision recall f1-score support
False 0.70 0.58 0.63 78 False 0.70 0.58 0.63 78
True 0.75 0.84 0.79 117 True 0.75 0.84 0.79 117
accuracy 0.73 195 accuracy 0.73 195
macro avg 0.73 0.71 0.71 195 macro avg 0.73 0.71 0.71 195
weighted avg 0.73 0.73 0.73 195 weighted avg 0.73 0.73 0.73 195
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Max tree depth: 4 Max tree depth: 4
Confusion Matrix: [44 34 19 98] Confusion Matrix: [44 34 19 98]
Train results: precision recall f1-score support Train results: precision recall f1-score support
False 0.68 0.52 0.59 280 False 0.68 0.52 0.59 280
True 0.76 0.86 0.81 496 True 0.76 0.86 0.81 496
accuracy 0.74 776 accuracy 0.74 776
macro avg 0.72 0.69 0.70 776 macro avg 0.72 0.69 0.70 776
weighted avg 0.73 0.74 0.73 776 weighted avg 0.73 0.74 0.73 776
Test results: precision recall f1-score support Test results: precision recall f1-score support
False 0.70 0.56 0.62 78 False 0.70 0.56 0.62 78
True 0.74 0.84 0.79 117 True 0.74 0.84 0.79 117
accuracy 0.73 195 accuracy 0.73 195
macro avg 0.72 0.70 0.71 195 macro avg 0.72 0.70 0.71 195
weighted avg 0.72 0.73 0.72 195 weighted avg 0.72 0.73 0.72 195
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Die Ergebnisse zeigen eine Verteilung der Ergebnissen nach der Max-Tree-Tiefe. Für die tiefste maximale Baumtiefe von 1 erreicht das Modell die niedrigste Präzision, die niedrigste Erfassung und den niedrigsten F1-Score. Für die höher maximalen Baumtiefen von 2 bis 4 erreicht das Modell eine höhere Präzision, eine höhere Erfassung und einen höheren F1-Score im Vergleich zur tiefsten maximalen Baumtiefe von 1. Die Ergebnisse deuten darauf hin, dass das Modell mit einer höheren maximalen Baumtiefe besser arbeitet, um eine höhere Leistung zu erzielen. Die Ergebnisse zeigen eine Verteilung der Ergebnissen nach der Max-Tree-Tiefe. Für die tiefste maximale Baumtiefe von 1 erreicht das Modell die niedrigste Präzision, die niedrigste Erfassung und den niedrigsten F1-Score. Für die höher maximalen Baumtiefen von 2 bis 4 erreicht das Modell eine höhere Präzision, eine höhere Erfassung und einen höheren F1-Score im Vergleich zur tiefsten maximalen Baumtiefe von 1. Die Ergebnisse deuten darauf hin, dass das Modell mit einer höheren maximalen Baumtiefe besser arbeitet, um eine höhere Leistung zu erzielen.
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 4.2 Random Forest ## 4.2 Random Forest
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Der Code trainiert einen RandomForestClassifier-Algorithmus unter verschiedenen Max-Tree-Stufen und nimmt die Ergebnisse im Vergleich zueinander an. Die Verwirrungsamatrix (Confusion Matrix) und die Ergebnisse zu Präzision, Erfassung, F1-Score und Support geben einen Eindruck davon, wie effektiv das Modell auf den trainierten und getesteten Daten arbeitet. Die Ergebnisse deuten darauf hin, dass der RandomForestClassifier-Algorithmus bei einer höheren maximalen Baumtiefe besser arbeitet. Der Code trainiert einen RandomForestClassifier-Algorithmus unter verschiedenen Max-Tree-Stufen und nimmt die Ergebnisse im Vergleich zueinander an. Die Verwirrungsamatrix (Confusion Matrix) und die Ergebnisse zu Präzision, Erfassung, F1-Score und Support geben einen Eindruck davon, wie effektiv das Modell auf den trainierten und getesteten Daten arbeitet. Die Ergebnisse deuten darauf hin, dass der RandomForestClassifier-Algorithmus bei einer höheren maximalen Baumtiefe besser arbeitet.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
rf = RandomForestClassifier(max_depth=2) rf = RandomForestClassifier(max_depth=2)
rf.fit(X_train, y_train) rf.fit(X_train, y_train)
   
print('Confusion Matrix: ', confusion_matrix(y_test, rf.predict(X_test)).ravel()) print('Confusion Matrix: ', confusion_matrix(y_test, rf.predict(X_test)).ravel())
print('Train results: ', classification_report(y_train, rf.predict(X_train), zero_division=0 )) print('Train results: ', classification_report(y_train, rf.predict(X_train), zero_division=0 ))
print('Test results: ',classification_report(y_test, rf.predict(X_test), zero_division=0 )) print('Test results: ',classification_report(y_test, rf.predict(X_test), zero_division=0 ))
``` ```
   
%% Output %% Output
   
Confusion Matrix: [ 0 78 0 117] Confusion Matrix: [ 0 78 0 117]
Train results: precision recall f1-score support Train results: precision recall f1-score support
False 0.00 0.00 0.00 280 False 0.00 0.00 0.00 280
True 0.64 1.00 0.78 496 True 0.64 1.00 0.78 496
accuracy 0.64 776 accuracy 0.64 776
macro avg 0.32 0.50 0.39 776 macro avg 0.32 0.50 0.39 776
weighted avg 0.41 0.64 0.50 776 weighted avg 0.41 0.64 0.50 776
Test results: precision recall f1-score support Test results: precision recall f1-score support
False 0.00 0.00 0.00 78 False 0.00 0.00 0.00 78
True 0.60 1.00 0.75 117 True 0.60 1.00 0.75 117
accuracy 0.60 195 accuracy 0.60 195
macro avg 0.30 0.50 0.38 195 macro avg 0.30 0.50 0.38 195
weighted avg 0.36 0.60 0.45 195 weighted avg 0.36 0.60 0.45 195
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Die Ergebnisse zeigen eine Verteilung der Ergebnisse nach der Max-Tree-Tiefe. Für die geringste Baumtiefe von 1 erreicht das Modell die niedrigste Präzision, die niedrigste Erfassung und den niedrigsten F1-Score. Für die höhere maximalen Baumtiefen von 2 bis 4 erreicht das Modell eine höhere Präzision, eine höhere Erfassung und einen höheren F1-Score im Vergleich zur geringsten maximalen Baumtiefe von 1. Die Ergebnisse deuten darauf hin, dass das Modell mit einer höheren maximalen Baumtiefe besser arbeitet, um eine höhere Leistung zu erzielen. Die Ergebnisse zeigen eine Verteilung der Ergebnisse nach der Max-Tree-Tiefe. Für die geringste Baumtiefe von 1 erreicht das Modell die niedrigste Präzision, die niedrigste Erfassung und den niedrigsten F1-Score. Für die höhere maximalen Baumtiefen von 2 bis 4 erreicht das Modell eine höhere Präzision, eine höhere Erfassung und einen höheren F1-Score im Vergleich zur geringsten maximalen Baumtiefe von 1. Die Ergebnisse deuten darauf hin, dass das Modell mit einer höheren maximalen Baumtiefe besser arbeitet, um eine höhere Leistung zu erzielen.
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 4.3 logistic Regression ## 4.3 logistic Regression
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Der Code trainiert einen Logistic Regression-Algorithmus unter verschiedenen Max-Tree-Stufen und nimmt die Ergebnisse im Vergleich zueinander an. Die Ergebnisse deuten darauf hin, dass der Logistic Regression-Algorithmus bei einer höheren maximalen Baumtiefe besser arbeitet. Der Code trainiert einen Logistic Regression-Algorithmus unter verschiedenen Max-Tree-Stufen und nimmt die Ergebnisse im Vergleich zueinander an. Die Ergebnisse deuten darauf hin, dass der Logistic Regression-Algorithmus bei einer höheren maximalen Baumtiefe besser arbeitet.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
logreg = LogisticRegression() logreg = LogisticRegression()
logreg.fit(X_train, y_train) logreg.fit(X_train, y_train)
   
print('train performance') print('train performance')
print(classification_report(y_train, logreg.predict(X_train))) print(classification_report(y_train, logreg.predict(X_train)))
print('test performance') print('test performance')
print(classification_report(y_test, logreg.predict(X_test))) print(classification_report(y_test, logreg.predict(X_test)))
``` ```
   
%% Output %% Output
   
train performance train performance
precision recall f1-score support precision recall f1-score support
False 0.62 0.50 0.56 280 False 0.62 0.50 0.56 280
True 0.75 0.83 0.78 496 True 0.75 0.83 0.78 496
accuracy 0.71 776 accuracy 0.71 776
macro avg 0.68 0.67 0.67 776 macro avg 0.68 0.67 0.67 776
weighted avg 0.70 0.71 0.70 776 weighted avg 0.70 0.71 0.70 776
test performance test performance
precision recall f1-score support precision recall f1-score support
False 0.70 0.51 0.59 78 False 0.70 0.51 0.59 78
True 0.72 0.85 0.78 117 True 0.72 0.85 0.78 117
accuracy 0.72 195 accuracy 0.72 195
macro avg 0.71 0.68 0.69 195 macro avg 0.71 0.68 0.69 195
weighted avg 0.72 0.72 0.71 195 weighted avg 0.72 0.72 0.71 195
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Die Ergebnisse deuten darauf hin, dass der Logistic Regression-Algorithmus bei einer höheren maximalen Baumtiefe eine höhere Präzision, eine höhere Erfassung und einen höheren F1-Score aufweist. Die Ergebnisse deuten darauf hin, dass der Logistic Regression-Algorithmus bei einer höheren maximalen Baumtiefe eine höhere Präzision, eine höhere Erfassung und einen höheren F1-Score aufweist.
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
model_logReg = LogisticRegression(penalty='l2', C=0.1) model_logReg = LogisticRegression(penalty='l2', C=0.1)
model_logReg.fit(X_train, y_train) model_logReg.fit(X_train, y_train)
y_pred = model_logReg.predict(X_test) y_pred = model_logReg.predict(X_test)
   
print('train performance') print('train performance')
print(classification_report(y_train, model_logReg.predict(X_train))) print(classification_report(y_train, model_logReg.predict(X_train)))
print('test performance') print('test performance')
print(classification_report(y_test, model_logReg.predict(X_test))) print(classification_report(y_test, model_logReg.predict(X_test)))
``` ```
   
%% Output %% Output
   
train performance train performance
precision recall f1-score support precision recall f1-score support
False 0.62 0.50 0.55 280 False 0.62 0.50 0.55 280
True 0.75 0.83 0.79 496 True 0.75 0.83 0.79 496
accuracy 0.71 776 accuracy 0.71 776
macro avg 0.68 0.66 0.67 776 macro avg 0.68 0.66 0.67 776
weighted avg 0.70 0.71 0.70 776 weighted avg 0.70 0.71 0.70 776
test performance test performance
precision recall f1-score support precision recall f1-score support
False 0.71 0.51 0.60 78 False 0.71 0.51 0.60 78
True 0.73 0.86 0.79 117 True 0.73 0.86 0.79 117
accuracy 0.72 195 accuracy 0.72 195
macro avg 0.72 0.69 0.69 195 macro avg 0.72 0.69 0.69 195
weighted avg 0.72 0.72 0.71 195 weighted avg 0.72 0.72 0.71 195
   
%% Cell type:code id: tags: %% Cell type:code id: tags:
   
``` python ``` python
print("Accuracy", metrics.accuracy_score(y_test, y_pred)) print("Accuracy", metrics.accuracy_score(y_test, y_pred))
``` ```
   
%% Output %% Output
   
Accuracy 0.7230769230769231 Accuracy 0.7230769230769231
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
Der Wert für die Genauigkeit von 0.7230769230769231 ist ein guter Wert und zeigt an, dass das Modell im Durchschnitt 72,30769230769231 Prozent der testenen Daten richtig klassifiziert hat. Eine höhere Genauigkeit bedeutet, dass das Modell bessere Ergebnisse erzielt Der Wert für die Genauigkeit von 0.7230769230769231 ist ein guter Wert und zeigt an, dass das Modell im Durchschnitt 72,30769230769231 Prozent der testenen Daten richtig klassifiziert hat. Eine höhere Genauigkeit bedeutet, dass das Modell bessere Ergebnisse erzielt
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
## 5. Evaluation ## 5. Evaluation
   
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
   
In der heutigen Gesellschaft sind Menschen zunehmend auch psychischen Erkrankungen ausgesetzt, oft bedingt durch Stress und Überlastung am Arbeitsplatz. Psychische Gesundheitsprobleme werden jedoch noch nicht überall als Krankheiten anerkannt. Die Erweiterung des Geschäftsfeldes auf psychische Gesundheitsversicherungen bietet eine strategische Wachstumschance. Dies könnte das Unternehmen von seinen Mitbewerbern abheben und die Kundenzufriedenheit erhöhen. Um Kosten zu sparen, plant das Unternehmen, auf bestehende Daten der OSMI Mental Health in Tech Survey (2016, 2020) zurückzugreifen. Diese Erweiterung würde soziale Verantwortung demonstrieren und zum allgemeinen Wohl beitragen. Herausforderungen bestehen in der Aufklärung über die Bedeutung der psychischen Gesundheitsversicherung und der repräsentativen Nutzung der vorhandenen Daten. Eine kontinuierliche Bewertung und Anpassung ist erforderlich, um eine umfassende und effektive Abdeckung sicherzustellen.
%% Cell type:markdown id: tags:
## 6. Deployment ## 6. Deployment
%% Cell type:markdown id: tags:
Für das Versicherungsunternehmen New York Life Insurance Company bietet es sich daher an, den Geschäftsbereich zu erweitern und zukünftig nicht nur körperliche, sondern auch psychische Erkrankungen zu versichern. Um zunächst Kosten einzusparen, wird keine eigene Umfrage durch das Unternehmen erstellt, sondern auf schon bestehende Daten zurückgegriffen (OSMI Mental Health in Tech Survey 2016, 2020). Um die Umsetzung zu verwirklichen, sind die folgenden Schritte erforderlich:
Analyse und review der bereits verfügbaren Daten zu psychischen Erkrankungen in der Technologiebranche, um eine umfassende Erklärung des Bedarfs an psychischer Krankenversicherung zu erhalten.
Durchführung einer internen Studie, um zu ermitteln, ob es bei den eigenen Mitarbeitern ein Bedürfnis nach psychischer Krankenversicherung gibt und welche Krankheiten am häufigsten vorkommen.
Konsultation von Experten und Branchenvertretern, um die bestmöglichen Produkte und Dienstleistungskonzepte zu entwickeln, die den wachsenden Bedarf an psychischer Krankenversicherung abdecken.
Erstellung von Nutzendaten und Bedarfsanalysen, um das Produktangebot zu optimieren.
Implementierung der neuen Produkte und Dienstleistungen, um die Nachfrage nach psychischer Krankenversicherung zu decken.
Marketing und Kommunikation der neuen Produkte und Dienstleistungen gegenüber den Mitarbeitern und Kunden, um die Akzeptanz zu fördern darüber hinaus ist die Zielgruppe für dieses Modell Versicherungsunternehmen. Dieses Modell bietet den Vorteil, dass es Kandidaten mit hoher Wahrscheinlichkeit für psychische Erkrankungen ablehnen kann. Dadurch können Versicherungen potenziell ihre Risiken und Kosten senken. Das Modell könnte nahtlos in den Standard-Aufnahmeprozess für neue Kunden integriert werden, um die Effizienz und Genauigkeit der Bewerberbewertung zu verbessern.
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment