{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Importy" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Wczytanie danych" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv('data4.csv')" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "y = pd.DataFrame(df['isGoal'])\n", "X = df.drop(['isGoal'], axis=1)" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "d:\\anaconda3\\lib\\site-packages\\scipy\\__init__.py:146: UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.24.3\n", " warnings.warn(f\"A NumPy version >={np_minversion} and <{np_maxversion}\"\n" ] } ], "source": [ "from sklearn.model_selection import train_test_split\n", "\n", "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1)" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | match_minute | \n", "match_second | \n", "position_x | \n", "position_y | \n", "play_type | \n", "BodyPart | \n", "Number_Intervening_Opponents | \n", "Number_Intervening_Teammates | \n", "Interference_on_Shooter | \n", "outcome | \n", "... | \n", "Interference_on_Shooter_Code | \n", "distance_to_goalM | \n", "distance_to_centerM | \n", "angle | \n", "isFoot | \n", "isHead | \n", "header_distance_to_goalM | \n", "High | \n", "Low | \n", "Medium | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8767 | \n", "13 | \n", "28 | \n", "9.23 | \n", "-2.24 | \n", "Open Play | \n", "Head | \n", "3 | \n", "0 | \n", "Medium | \n", "Goal | \n", "... | \n", "2 | \n", "9.499168 | \n", "2.245283 | \n", "13.672174 | \n", "0 | \n", "1 | \n", "9.499168 | \n", "0 | \n", "0 | \n", "1 | \n", "
5798 | \n", "78 | \n", "9 | \n", "14.46 | \n", "12.72 | \n", "Open Play | \n", "Left | \n", "3 | \n", "0 | \n", "Low | \n", "Saved | \n", "... | \n", "1 | \n", "19.278332 | \n", "12.750000 | \n", "41.404002 | \n", "1 | \n", "0 | \n", "0.000000 | \n", "0 | \n", "1 | \n", "0 | \n", "
6018 | \n", "78 | \n", "27 | \n", "9.73 | \n", "14.22 | \n", "Open Play | \n", "Left | \n", "2 | \n", "0 | \n", "Low | \n", "Missed | \n", "... | \n", "1 | \n", "17.257933 | \n", "14.253538 | \n", "55.681087 | \n", "1 | \n", "0 | \n", "0.000000 | \n", "0 | \n", "1 | \n", "0 | \n", "
4961 | \n", "34 | \n", "34 | \n", "34.91 | \n", "0.25 | \n", "Open Play | \n", "Right | \n", "4 | \n", "1 | \n", "Low | \n", "Saved | \n", "... | \n", "1 | \n", "34.910899 | \n", "0.250590 | \n", "0.411271 | \n", "1 | \n", "0 | \n", "0.000000 | \n", "0 | \n", "1 | \n", "0 | \n", "
447 | \n", "52 | \n", "57 | \n", "26.93 | \n", "1.00 | \n", "Open Play | \n", "Left | \n", "2 | \n", "0 | \n", "Medium | \n", "Saved | \n", "... | \n", "2 | \n", "26.948648 | \n", "1.002358 | \n", "2.131616 | \n", "1 | \n", "0 | \n", "0.000000 | \n", "0 | \n", "0 | \n", "1 | \n", "
5 rows × 29 columns
\n", "\n", " | isGoal | \n", "
---|---|
8767 | \n", "1 | \n", "
5798 | \n", "0 | \n", "
6018 | \n", "0 | \n", "
4961 | \n", "0 | \n", "
447 | \n", "0 | \n", "
LogisticRegression(max_iter=500)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
LogisticRegression(max_iter=500)