dhcp dora
Exploratory Data Analysis is the most crucial part, to begin with whenever we are working with a dataset. It allows us to analyze the data and works on initial findings from the data. EDA is an approach where we summarize the main characteristics of the data using different methods and mainly visualization. Before modeling the data should be analyzed, cleaned, and clearly understood in order to make modeling suceessful.
无论何时使用数据集,探索性数据分析都是最关键的部分。 它使我们能够分析数据并处理数据的初步发现。 EDA是一种使用不同方法(主要是可视化)总结数据主要特征的方法。 在建模之前,应该对数据进行分析,清理和清楚地理解,以使建模成功。
EDA takes us most of the time as we have to clearly analyze the data so that we can clean it and visualize the data to preprocess it before modelling. This is whuy EDA is most important but we can save this time by automating all the time taking EDA jobs and can use the time saved in modelling.
EDA花费了我们大部分时间,因为我们必须清楚地分析数据,以便我们可以清理数据并可视化数据以在建模之前对其进行预处理。 这是EDA最重要的原因,但是我们可以通过自动执行所有EDA作业时间来节省时间,并可以使用建模中节省的时间。
Dora is an open-source python library used to automate the painful parts of the Exploratory Data Analysis. It simply cleans your data, allows you to visualize, and not only this it also allows you to prepare your data for the modelling purpose.
Dora是一个开源python库,用于自动执行Exploratory Data Analysis的痛苦部分。 它只是清除数据,使您可视化,不仅如此,还可以为建模目的准备数据。
In this article, we will explore dora and see what all different functionalities it provides us with.
在本文中,我们将探索dora并查看它提供给我们的所有不同功能。
安装: (Installation:)
We can install dora easily by running the below given command in anaconda command prompt.
我们可以通过在anaconda命令提示符下运行以下给定的命令来轻松安装dora。
pip install dora
实现方式: (Implementation:)
a. Importing required libraries
一种。 导入所需的库
We will start by importing the required libraries. We will import pandas in order to load the dataset and import Dora for EDA purpose.
我们将从导入所需的库开始。 我们将导入熊猫以加载数据集,并为EDA导入Dora。
import pandas as pd
from Dora import Dora
dora = Dora() #Intialize dora
b. Loading the dataset
b。 加载数据集
The dataset we will be using here is an advertisement data of an MNC which contains different attributes like ‘Sales’, ‘TV’ etc. where ‘Sales’ is the dependant variable and every other attribute is the feature variable. After loading the dataset we will pass it to dora to create a dora dataset and define the target variable.
我们将在此处使用的数据集是MNC的广告数据,其中包含“ Sales”,“ TV”等不同属性,其中“ Sales”是因变量,其他每个属性都是特征变量。 加载数据集后,我们会将其传递给dora以创建dora数据集并定义目标变量。
df = pd.read_csv('Advertising.csv')
dora.configure(output = 'Sales', data = df)
dora.data
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/eae0be6b98e39c6ac6ce7d2353a978f9.png)
c. Data Preprocessing
C。 数据预处理
Dora allows us to impute the null data with the mean of that column and also allows us to scale the data. Here we will impute empty data if any.
Dora允许我们用该列的平均值估算空数据,还可以缩放数据。 在这里,我们将估算空数据(如果有)。
dora.impute_missing_values()
After this, we will visualize the data and see what the data is trying to tell. For visualization we can the whole dataset at one go or we can select the column that we want to visualize.
此后,我们将可视化数据并查看数据试图说明的内容。 为了进行可视化,我们可以一次完成整个数据集,也可以选择要可视化的列。
dora.plot_feature('TV') #Visualizing Single Feature
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/12eb295910d5580d4953cf6b86cd9216.png)
dora.explore() #Visualizing all feature variable
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/495d18cf6f3309b510bfafce9166c0a9.png)
Next we will look at the data splitting capabilities of dora for modelling purpose. By default dora split data into 80:20 ratio.
接下来,我们将研究dora的数据拆分功能以进行建模。 默认情况下,朵拉将数据分成80:20的比例。
d. Data Modelling
d。 资料建模
Here we will split the data and create machine learning model using sklearn.
在这里,我们将分割数据并使用sklearn创建机器学习模型。
dora.set_training_and_validation() #Splitting the data
#Linear Regression Model
from sklearn.linear_model import LinearRegression
X = dora.training_data[dora.input_columns()]
y = dora.training_data[dora.output]
The above-given commands will let us create the Linear Regression model for the dataset we are using now let us fit the data and print the score of the model to show its accuracy.
上面给出的命令将让我们为正在使用的数据集创建线性回归模型,现在让我们拟合数据并打印模型的分数以显示其准确性。
reg = LinearRegression().fit(X, y)
reg.score(X, y)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/dd5224025f20a45b8eca7261f23aab87.png)
Similarly, we can also create other models like Ridge Regression model I have created below.
同样,我们也可以创建其他模型,例如我在下面创建的Ridge回归模型。
from sklearn.linear_model import Ridge
clf = Ridge(alpha=1.0)
a = clf.fit(X, y)
a.score(X,y)
![Image for post](https://miro.medium.com/max/9999/1*oNHEZHZ8RkBoVUGL94jV1Q.png)
结论:(Conclusion:)
In this article, we started with loading the data and passing it to Dora by passing the target variable as ‘Sales’, after that we perform operations on data to analyze it and visualize it. In the end, we pre-processed the data and create different machine learning models.
在本文中,我们首先通过将目标变量作为“ Sales”传递来加载数据并将其传递给Dora,然后对数据执行操作以对其进行分析和可视化。 最后,我们对数据进行了预处理,并创建了不同的机器学习模型。
你走之前 (Before You Go)
Thanks for reading! If you want to get in touch with me, feel free to reach me on hmix13@gmail.com or my LinkedIn Profile. You can also view my Github profile for different projects on data science.
感谢您的阅读! 如果您想与我联系,请随时通过hmix13@gmail.com或我的LinkedIn个人资料与我联系。 您也可以查看我的G ithub 数据科学不同项目的配置文件。
翻译自: https://towardsdatascience.com/exploratory-data-analysis-using-dora-ac596e5a32a6
dhcp dora