Wie man mit fehlenden NaNs für maschinelles Lernen in Python umgeht

Wie werden fehlende Werte in Datensätzen behandelt, bevor der Algorithmus für maschinelles Lernen angewendet wird?

Mir ist aufgefallen, dass es nicht klug ist, fehlende NAN-Werte zu löschen. Normalerweise interpoliere ich (berechne den Mittelwert) mit Pandas und fülle die Daten auf, was funktioniert und die Klassifizierungsgenauigkeit verbessert, aber möglicherweise nicht das Beste ist.

Hier ist eine sehr wichtige Frage.Was ist der beste Weg, um mit fehlenden Werten im Datensatz umzugehen?

Wenn Sie zum Beispiel diesen Datensatz sehen, haben nur 30% Originaldaten.

Int64Index: 7049 entries, 0 to 7048
Data columns (total 31 columns):
left_eye_center_x            7039 non-null float64
left_eye_center_y            7039 non-null float64
right_eye_center_x           7036 non-null float64
right_eye_center_y           7036 non-null float64
left_eye_inner_corner_x      2271 non-null float64
left_eye_inner_corner_y      2271 non-null float64
left_eye_outer_corner_x      2267 non-null float64
left_eye_outer_corner_y      2267 non-null float64
right_eye_inner_corner_x     2268 non-null float64
right_eye_inner_corner_y     2268 non-null float64
right_eye_outer_corner_x     2268 non-null float64
right_eye_outer_corner_y     2268 non-null float64
left_eyebrow_inner_end_x     2270 non-null float64
left_eyebrow_inner_end_y     2270 non-null float64
left_eyebrow_outer_end_x     2225 non-null float64
left_eyebrow_outer_end_y     2225 non-null float64
right_eyebrow_inner_end_x    2270 non-null float64
right_eyebrow_inner_end_y    2270 non-null float64
right_eyebrow_outer_end_x    2236 non-null float64
right_eyebrow_outer_end_y    2236 non-null float64
nose_tip_x                   7049 non-null float64
nose_tip_y                   7049 non-null float64
mouth_left_corner_x          2269 non-null float64
mouth_left_corner_y          2269 non-null float64
mouth_right_corner_x         2270 non-null float64
mouth_right_corner_y         2270 non-null float64
mouth_center_top_lip_x       2275 non-null float64
mouth_center_top_lip_y       2275 non-null float64
mouth_center_bottom_lip_x    7016 non-null float64
mouth_center_bottom_lip_y    7016 non-null float64
Image                        7049 non-null object

Antworten auf die Frage(4)

Ihre Antwort auf die Frage