<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Muhammet miraç Yüzaklı on Medium]]></title>
        <description><![CDATA[Stories by Muhammet miraç Yüzaklı on Medium]]></description>
        <link>https://medium.com/@miracyuzakli?source=rss-be8bb9eee416------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*H1zgAWbU3hCBKarKZX0UkQ.png</url>
            <title>Stories by Muhammet miraç Yüzaklı on Medium</title>
            <link>https://medium.com/@miracyuzakli?source=rss-be8bb9eee416------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 07:12:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@miracyuzakli/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What is Git and Why is it Important?]]></title>
            <link>https://medium.com/@miracyuzakli/what-is-git-and-why-is-it-important-69993b244487?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/69993b244487</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[git-repositories]]></category>
            <category><![CDATA[git-init]]></category>
            <category><![CDATA[git-commit]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Thu, 16 Nov 2023 22:17:48 GMT</pubDate>
            <atom:updated>2023-11-16T22:17:48.571Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eDY2x8PSjkENsXf4SvOMYA.png" /></figure><h3>Definition of Git:</h3><p>Git is a Distributed Version Control System (DVCS) that facilitates tracking changes in software development and enables multiple people to work collaboratively on the same project. Created by Linus Torvalds in 2005, it was designed to support the development process of the Linux kernel.</p><h3>Advantages of Git:</h3><p>Version Control: Keeps records of changes made in projects.</p><p>Collaborative Work: Allows different individuals to work on the same project without conflicts.</p><p>Ability to Revert: Offers the option to return to previous states in case of erroneous changes.</p><h3>Installing Git</h3><h4>Windows:</h4><ul><li>Download and install Git for Windows from the official website <a href="https://git-scm.com/download/win">Git for Windows</a>, following the installation steps.</li></ul><h4>macOS:</h4><ul><li>Using <a href="https://brew.sh/">Homebrew</a>, run brew install git in the terminal.</li></ul><h4>Linux:</h4><ul><li>On Debian-based systems like Ubuntu, use sudo apt-get install git.</li><li>On RPM-based systems like Fedora, use sudo yum install git.</li></ul><h3>Basic Configuration of Git</h3><h4>Setting User Information:</h4><p>For first-time Git users, setting up user name and email is crucial. These details are used to identify who makes changes in commits.</p><pre>git config --global user.name &quot;Your Name&quot;<br>git config --global user.email &quot;your.email@example.com&quot;</pre><h4>Other Useful Settings:</h4><ul><li>For a colored interface: git config --global color.ui auto</li><li>To change the default text editor: git config --global core.editor &quot;editor_name&quot;</li></ul><h3>Basic Git Commands and Their Uses</h3><h4>Creating and Cloning Repositories:</h4><ul><li>Initializing a New Repository: git init starts a new Git repository in the current directory, creating a .git folder to manage the repository.</li><li>Cloning a Repository: To copy an existing remote repository to your machine, use git clone [url]. This command copies the entire project.</li></ul><h4>Managing Changes:</h4><ul><li>Staging Changes: git add [file_name] adds changes to the staging area. To add all changes, you can use git add ..</li><li>Committing Changes: To save changes, use git commit -m &quot;commit message&quot;. Each commit acts as a checkpoint for the project&#39;s current state.</li></ul><h4>Sharing and Updating Changes:</h4><ul><li>Pushing (Uploading): To upload local changes to a remote repository, use git push origin [branch_name].</li><li>Pulling (Downloading): To fetch changes from a remote repository to your local one, use git pull origin [branch_name].</li></ul><h4>Working with Branches:</h4><ul><li>Creating and Switching Branches: Create a new branch with git branch [branch_name]. To switch to a branch, use git checkout [branch_name].</li><li>Merging Branches: To merge two branches, run git merge [source_branch_name] in the target branch.</li></ul><h3>Git Workflow Models</h3><h4>Central Repository Model:</h4><p>In this model, all developers commit to and pull from the same central repository (e.g., a repository on GitHub).</p><h4>Feature Branch Model:</h4><p>Each new feature or fix is developed in separate branches and merged into the main branch (usually master or main) upon completion.</p><h4>Gitflow Workflow Model:</h4><p>This model, suitable for larger projects, offers a more complex structure including development, feature, release, and hotfix branches.</p><h3>Common Problems and Solutions</h3><h4>Merge Conflicts:</h4><p>Conflicts arise when the same part of a file is modified in two different branches. Git marks the conflicting areas and requires manual resolution.</p><h4>Reverting and Resetting Changes:</h4><ul><li>Revert: To undo a commit, use git revert [commit_id]. This creates a new commit that reverses the changes.</li><li>Reset: To undo local changes or cancel commits, use git reset. There are different levels of reset operations (--soft, --mixed, --hard).</li></ul><h3>Conclusion</h3><p>This documentation provides fundamental information and practical examples for beginners in Git. Each section details how Git works and how to use basic commands. It also includes information on common situations and their solutions. This guide is an ideal resource for anyone looking to learn the basics of Git and practice its applications.</p><ul><li><a href="https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/">Linkedln</a></li><li><a href="https://github.com/miracyuzakli">Github</a></li><li><a href="https://www.kaggle.com/code/muhammetmirayzakl/">Kaggle</a></li><li><a href="https://www.upwork.com/freelancers/~0178f4cf3eb93b5f83">UpWork</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69993b244487" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[XGBoost Classification on Titanic Dataset]]></title>
            <link>https://medium.com/@miracyuzakli/xgboost-classification-on-titanic-dataset-97635e4972b4?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/97635e4972b4</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[xgboost]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[pandas]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Tue, 08 Aug 2023 01:47:25 GMT</pubDate>
            <atom:updated>2023-08-08T01:47:25.708Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*8_xxHZrvifsv7Mw3eqffLA.png" /></figure><p>XGBoost (Extreme Gradient Boosting) is a powerful algorithm widely used in machine learning, known for its high performance in various applications. In this article, we will use XGBoost to perform classification on the famous Titanic dataset. We’ll walk through the steps of data preprocessing, model training, cross-validation, and result evaluation in Python.</p><h3>Titanic Dataset</h3><p>The Titanic dataset contains information about passengers who traveled on the RMS Titanic, including whether they survived or not. Our goal is to build a classification model that predicts the survival of passengers.</p><h3>Step 1: Data Loading and Preprocessing</h3><p>Let’s start by loading the dataset and performing some preprocessing steps:</p><pre>import numpy as np<br>import pandas as pd<br>import xgboost as xgb<br>from sklearn.model_selection import train_test_split<br>from sklearn.metrics import accuracy_score<br><br># Load the Titanic dataset<br>data = pd.read_csv(&quot;titanic.csv&quot;)</pre><pre>data.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*BiFyPFe7u24uBfI7nc4GRQ.png" /></figure><pre># Data preprocessing<br>data.drop([&#39;PassengerId&#39;, &#39;Name&#39;, &#39;Ticket&#39;, &#39;Cabin&#39;], axis=1, inplace=True)<br>data[&#39;Sex&#39;] = data[&#39;Sex&#39;].map({&#39;male&#39;: 0, &#39;female&#39;: 1})<br>data[&#39;Age&#39;].fillna(data[&#39;Age&#39;].median(), inplace=True)<br>data[&#39;Embarked&#39;].fillna(data[&#39;Embarked&#39;].mode()[0], inplace=True)<br>data = pd.get_dummies(data, columns=[&#39;Embarked&#39;, &#39;Pclass&#39;], drop_first=True)<br><br># Separate independent variables and target variable<br>X = data.drop(&#39;Survived&#39;, axis=1)<br>y = data[&#39;Survived&#39;]</pre><h3>Step 2: Splitting the Data into Training and Testing Sets</h3><p>Let’s split our dataset into training and testing sets:</p><pre>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)</pre><h3>Step 3: Creating the XGBoost Model</h3><p>Before creating the XGBoost model, let’s set some hyperparameters:</p><pre>dtrain = xgb.DMatrix(X_train, label=y_train)<br><br># Set hyperparameters<br>params = {<br>    &#39;max_depth&#39;: 6,<br>    &#39;eta&#39;: 0.1,<br>    &#39;objective&#39;: &#39;binary:logistic&#39;,<br>    &#39;eval_metric&#39;: &#39;error&#39;<br>}</pre><h3>Step 4: Training the Model with Cross-Validation</h3><p>Cross-validation is used to evaluate the model’s performance more reliably. In this step, we’ll find the best model using cross-validation:</p><pre>cv_results = xgb.cv(<br>    params=params,<br>    dtrain=dtrain,<br>    num_boost_round=1000,<br>    nfold=5,<br>    metrics=[&#39;error&#39;],<br>    early_stopping_rounds=10,<br>    stratified=True,<br>    seed=42<br>)<br><br>best_iteration = cv_results[&#39;test-error-mean&#39;].idxmin()<br>best_error = cv_results.loc[best_iteration, &#39;test-error-mean&#39;]<br><br>print(f&quot;Best error rate: {best_error:.4f} (iteration: {best_iteration+1})&quot;)</pre><pre>Best error rate: 0.1728 (iteration: 5)</pre><h3>Step 5: Making Predictions on Test Data and Evaluating the Results</h3><p>Finally, we’ll select the best model and make predictions on the test data to evaluate its performance:</p><pre>dtest = xgb.DMatrix(X_test)<br><br>best_model = xgb.train(params, dtrain, num_boost_round=best_iteration+1)<br><br>predictions = best_model.predict(dtest)<br>predictions = [round(value) for value in predictions]<br><br>accuracy = accuracy_score(y_test, predictions)<br>print(&quot;Test accuracy:&quot;, accuracy)</pre><h3>Conclusion</h3><p>In this article, we’ve learned how to use the XGBoost algorithm to build a classification model on the Titanic dataset in Python. We covered data loading, preprocessing, training-test data split, model creation, cross-validation, and result evaluation. Thanks to XGBoost’s powerful features, you can achieve high accuracy even with more complex and larger datasets.</p><p>I hope this article helps you in developing your machine learning projects using the XGBoost algorithm. Happy coding!</p><ul><li><a href="https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/">Linkedln</a></li><li><a href="https://github.com/miracyuzakli">Github</a></li><li><a href="https://www.kaggle.com/code/muhammetmirayzakl/">Kaggle</a></li><li><a href="https://www.upwork.com/freelancers/~0178f4cf3eb93b5f83">UpWork</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97635e4972b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[User Login and Registration with Flask and Google OAuth 2.0]]></title>
            <link>https://medium.com/@miracyuzakli/user-login-and-registration-with-flask-and-google-oauth-2-0-6f5aee1b64ad?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f5aee1b64ad</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[login]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Mon, 07 Aug 2023 02:49:24 GMT</pubDate>
            <atom:updated>2023-08-07T02:49:24.075Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*_7Sl4vCB8g19PB7Zft6rtg.png" /></figure><p>In modern web applications, user login and registration processes are crucial. Instead of designing separate login systems for each website, allowing users to use their Google accounts for authentication provides convenience for users and saves time for developers. In this article, we will create a sample project using Flask web framework to enable users to log in and register with their Google accounts.</p><h3>1. Installing Flask and Flask-OAuthlib</h3><p>To begin, we need to install Flask and Flask-OAuthlib packages to implement this project. You can do this by running the following terminal commands:</p><pre>pip install Flask Flask-OAuthlib</pre><h3>2. Creating a Project in Google Developers Console</h3><p>To use Google OAuth 2.0 authentication, we need to create a new project in the Google Developers Console. Log in with your Google account and create “Credentials” that will allow our application to access Google APIs</p><h3>3. Initializing the Flask Application</h3><p>Let’s start by initializing our Flask application. We will set up the basic code structure as follows:</p><pre>from flask import Flask, redirect, url_for, session, request, jsonify<br>from flask_oauthlib.client import OAuth<br>import requests<br><br>app = Flask(__name__)<br>app.secret_key = &#39;your_secret_key_here&#39;</pre><p>Here, we imported Flask and other necessary modules, created our Flask application, and set a secret key for the application’s security. Make sure to set the secret key appropriately for your project.</p><h3>4. Configuring Google OAuth</h3><p>By configuring Google OAuth, we enable our application to communicate with Google. Use the “Credentials” you created earlier for the following steps:</p><pre>google_client_id = &#39;your_google_client_id_here&#39;<br>google_client_secret = &#39;your_google_client_secret_here&#39;<br>google_redirect_uri = &#39;your_google_redirect_uri_here&#39;<br><br>oauth = OAuth(app)<br>google = oauth.remote_app(<br>    &#39;google&#39;,<br>    consumer_key=google_client_id,<br>    consumer_secret=google_client_secret,<br>    request_token_params={<br>        &#39;scope&#39;: &#39;email&#39;,<br>    },<br>    base_url=&#39;https://www.googleapis.com/oauth2/v1/&#39;,<br>    request_token_url=None,<br>    access_token_method=&#39;POST&#39;,<br>    access_token_url=&#39;https://accounts.google.com/o/oauth2/token&#39;,<br>    authorize_url=&#39;https://accounts.google.com/o/oauth2/auth&#39;,<br>)</pre><p>Configure the Google OAuth credentials specific to your project. These credentials will be used to access Google-provided user data.</p><h3>5. Creating User Login and Registration Pages</h3><p>Next, let’s create the pages that will direct users to log in and register with their Google accounts:</p><pre>@app.route(&#39;/&#39;)<br>def index():<br>    if &#39;google_token&#39; in session:<br>        me = google.get(&#39;userinfo&#39;)<br>        return jsonify({&#39;data&#39;: me.data})<br>    return &#39;Hello! Log in with your Google account: &lt;a href=&quot;/login&quot;&gt;Log in&lt;/a&gt;&#39;</pre><p>The home page will display user information if the user is already logged in. Otherwise, it will redirect the user to the “Log in” page.</p><pre>@app.route(&#39;/login&#39;)<br>def login():<br>    return google.authorize(callback=url_for(&#39;authorized&#39;, _external=True))</pre><p>The “login” page contains a link that redirects users to the Google OAuth authentication page.</p><pre>@app.route(&#39;/login/authorized&#39;)<br>def authorized():<br>    response = google.authorized_response()<br>    if response is None or response.get(&#39;access_token&#39;) is None:<br>        return &#39;Login failed.&#39;<br><br>    session[&#39;google_token&#39;] = (response[&#39;access_token&#39;], &#39;&#39;)<br>    me = google.get(&#39;userinfo&#39;)<br>    # Here, &#39;me.data&#39; contains user information.<br>    # You can perform registration process using this information if needed.<br><br>    return redirect(url_for(&#39;index&#39;))</pre><p>The “authorized” function is called when Google returns the user’s access code. It retrieves the access token and calls the Google API to get user information.</p><pre>@app.route(&#39;/logout&#39;)<br>def logout():<br>    session.pop(&#39;google_token&#39;,p None)<br>    return redirect(url_for(&#39;index&#39;))</pre><p>The “logout” function ends the user’s session and redirects them to the home page.</p><pre>@oauth.tokengetter<br>def get_google_oauth_token():<br>    return session.get(&#39;google_token&#39;)</pre><p>Finally, the “get_google_oauth_token” function is used to retrieve the Google OAuth access token.</p><h3>6. Running the Flask Application</h3><p>To run our application, add the following lines:</p><pre>if __name__ == &#39;__main__&#39;:<br>    app.run(debug=True)</pre><p>Your application is now ready! By running the Flask application, users can log in and register with their Google accounts. Integrating this authentication system into your project will enhance the user experience for your users.</p><p>In this article, we learned how to use Flask web framework and Google OAuth 2.0 to implement user login and registration processes. By enabling users to log in with their Google accounts, you can provide a more user-friendly experience and save development time. I hope this article is understandable and helpful even for those who are not familiar with the topic. Happy coding!</p><p><strong>Linkedin:</strong> <a href="https://medium.com/www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0">https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/</a></p><p><strong>UpWork:</strong> <a href="https://www.upwork.com/freelancers/~01bf568447a6c5b025">https://www.upwork.com/freelancers/~0178f4cf3eb93b5f83</a></p><p><strong>Github: </strong><a href="https://github.com/miracyuzakli">https://github.com/miracyuzakli</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f5aee1b64ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Efficient Data Processing with Polars: A Python Library for High-Performance Big Data Analytics]]></title>
            <link>https://medium.com/@miracyuzakli/efficient-data-processing-with-polars-a-python-library-for-high-performance-big-data-analytics-8b1a4905378a?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b1a4905378a</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-programming]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Fri, 24 Feb 2023 15:56:54 GMT</pubDate>
            <atom:updated>2023-02-24T15:56:54.745Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*spSVbEOEgkhMhegtJMKy6g.jpeg" /></figure><h3>What is Polars Library?</h3><p>Polars is a data processing library for the Python programming language. Polars is designed to perform fast and efficient processing on large datasets. Polars works similar to other popular data processing libraries like pandas and dask, but is faster.</p><p>Polars is written in the Rust programming language. This makes Polars both fast and reliable. Polars divides large-sized data into parts and processes them simultaneously. This makes Polars a fast and efficient data processing tool.</p><h3>How to Use Polars Library?</h3><p>Polars library offers a similar usage to the pandas library. Polars library works with data as DataFrame objects. DataFrame objects represent a table consisting of data tables and columns.</p><p>Polars library can read data in different formats. For example, Polars can read data in CSV, Parquet, JSON, Arrow, and SQLite formats.</p><p>Polars library can perform operations such as filtering, grouping, sorting, and merging data similar to the pandas library. Polars also includes many pre-optimized functions that make it easy to perform large data exploration and review.</p><h3>Advantages of Polars Library</h3><p>Polars library is designed to perform fast and efficient processing on large datasets. This makes Polars faster than other data processing libraries such as pandas and dask.</p><p>Polars library provides reliable performance since it is written in the Rust programming language. Rust is known as a fast and reliable programming language.</p><p>Polars library works effectively on large data exploration. Polars divides data into parts and processes them simultaneously. This makes Polars a fast and efficient tool for large data exploration.</p><h4>Creating Data</h4><pre>import polars as pl<br><br># Create a sample dataset<br>df = pl.DataFrame({<br>    &quot;name&quot;: [&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;, &quot;David&quot;, &quot;Emily&quot;],<br>    &quot;age&quot;: [25, 32, 18, 47, 22],<br>    &quot;gender&quot;: [&quot;female&quot;, &quot;male&quot;, &quot;male&quot;, &quot;male&quot;, &quot;female&quot;],<br>    &quot;country&quot;: [&quot;US&quot;, &quot;Canada&quot;, &quot;UK&quot;, &quot;US&quot;, &quot;Canada&quot;]<br>})</pre><h4>Printing Column Names</h4><pre># Printing Column Names<br>print(&quot;Column Names:&quot;)<br>print(df.columns)</pre><pre>Column Names:<br>[&#39;name&#39;, &#39;age&#39;, &#39;gender&#39;, &#39;country&#39;]</pre><h4>Grouping</h4><pre># Grouping<br>grouped = df.groupby(&quot;country&quot;).agg({&quot;age&quot;: &quot;mean&quot;})<br>print(&quot;Grouped Data:&quot;)<br>print(grouped)</pre><pre>Grouped Data:<br>shape: (3, 2)<br>┌─────────┬───────────┐<br>│ country ┆ age       │<br>│ ---     ┆ ---       │<br>│ str     ┆ list[i64] │<br>╞═════════╪═══════════╡<br>│ US      ┆ [25, 47]  │<br>│ UK      ┆ [18]      │<br>│ Canada  ┆ [32, 22]  │<br>└─────────┴───────────┘</pre><h4>Value Count</h4><pre># Value Count<br>counts = df[&quot;country&quot;].value_counts()<br>print(&quot;Value Counts:&quot;)<br>print(counts)</pre><pre>Value Counts:<br>shape: (3, 2)<br>┌─────────┬────────┐<br>│ country ┆ counts │<br>│ ---     ┆ ---    │<br>│ str     ┆ u32    │<br>╞═════════╪════════╡<br>│ UK      ┆ 1      │<br>│ US      ┆ 2      │<br>│ Canada  ┆ 2      │<br>└─────────┴────────┘</pre><h4>Filtering</h4><pre># Filtering<br>filtered = df.filter(pl.col(&quot;age&quot;) &gt; 25)<br>print(&quot;Filtered Data:&quot;)<br>print(filtered)</pre><pre>Filtered Data:<br>shape: (2, 4)<br>┌───────┬─────┬────────┬─────────┐<br>│ name  ┆ age ┆ gender ┆ country │<br>│ ---   ┆ --- ┆ ---    ┆ ---     │<br>│ str   ┆ i64 ┆ str    ┆ str     │<br>╞═══════╪═════╪════════╪═════════╡<br>│ Bob   ┆ 32  ┆ male   ┆ Canada  │<br>│ David ┆ 47  ┆ male   ┆ US      │<br>└───────┴─────┴────────┴─────────┘</pre><h4>Describe</h4><pre># Describe<br>print(&quot;Data Description:&quot;)<br>print(df.describe())</pre><pre>Data Description:<br>shape: (7, 5)<br>┌────────────┬───────┬───────────┬────────┬─────────┐<br>│ describe   ┆ name  ┆ age       ┆ gender ┆ country │<br>│ ---        ┆ ---   ┆ ---       ┆ ---    ┆ ---     │<br>│ str        ┆ str   ┆ f64       ┆ str    ┆ str     │<br>╞════════════╪═══════╪═══════════╪════════╪═════════╡<br>│ count      ┆ 5     ┆ 5.0       ┆ 5      ┆ 5       │<br>│ null_count ┆ 0     ┆ 0.0       ┆ 0      ┆ 0       │<br>│ mean       ┆ null  ┆ 28.8      ┆ null   ┆ null    │<br>│ std        ┆ null  ┆ 11.388591 ┆ null   ┆ null    │<br>│ min        ┆ Alice ┆ 18.0      ┆ female ┆ Canada  │<br>│ max        ┆ Emily ┆ 47.0      ┆ male   ┆ US      │<br>│ median     ┆ null  ┆ 25.0      ┆ null   ┆ null    │<br>└────────────┴───────┴───────────┴────────┴─────────┘</pre><h4>Melt</h4><pre># Melt<br>melted = df.melt(id_vars=[&quot;name&quot;], value_vars=[&quot;age&quot;, &quot;gender&quot;])<br>print(&quot;Melted Data:&quot;)<br>print(melted)</pre><pre>Melted Data:<br>shape: (10, 3)<br>┌─────────┬──────────┬────────┐<br>│ name    ┆ variable ┆ value  │<br>│ ---     ┆ ---      ┆ ---    │<br>│ str     ┆ str      ┆ str    │<br>╞═════════╪══════════╪════════╡<br>│ Alice   ┆ age      ┆ 25     │<br>│ Bob     ┆ age      ┆ 32     │<br>│ Charlie ┆ age      ┆ 18     │<br>│ David   ┆ age      ┆ 47     │<br>│ ...     ┆ ...      ┆ ...    │<br>│ Bob     ┆ gender   ┆ male   │<br>│ Charlie ┆ gender   ┆ male   │<br>│ David   ┆ gender   ┆ male   │<br>│ Emily   ┆ gender   ┆ female │<br>└─────────┴──────────┴────────┘</pre><h4>Merge</h4><pre># Merge<br>df2 = pl.DataFrame({<br>    &quot;name&quot;: [&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;],<br>    &quot;score&quot;: [85, 92, 78]<br>})<br>merged = df.join(df2, on=&quot;name&quot;)<br>print(&quot;Merged Data:&quot;)<br>print(merged)</pre><pre>Merged Data:<br>shape: (3, 5)<br>┌─────────┬─────┬────────┬─────────┬───────┐<br>│ name    ┆ age ┆ gender ┆ country ┆ score │<br>│ ---     ┆ --- ┆ ---    ┆ ---     ┆ ---   │<br>│ str     ┆ i64 ┆ str    ┆ str     ┆ i64   │<br>╞═════════╪═════╪════════╪═════════╪═══════╡<br>│ Alice   ┆ 25  ┆ female ┆ US      ┆ 85    │<br>│ Bob     ┆ 32  ┆ male   ┆ Canada  ┆ 92    │<br>│ Charlie ┆ 18  ┆ male   ┆ UK      ┆ 78    │<br>└─────────┴─────┴────────┴─────────┴───────┘</pre><h4>Apply</h4><pre># Apply<br>applied = df[&quot;age&quot;].apply(lambda x: x/2)<br>print(&quot;Applied Data:&quot;)<br>print(applied)</pre><pre>Applied Data:<br>shape: (5,)<br>Series: &#39;age&#39; [f64]<br>[<br> 12.5<br> 16.0<br> 9.0<br> 23.5<br> 11.0<br>]</pre><h4>Drop</h4><pre># Drop<br>dropped = df.drop(&quot;gender&quot;)<br>print(&quot;Dropped Data:&quot;)<br>print(dropped)</pre><pre>Dropped Data:<br>shape: (5, 3)<br>┌─────────┬─────┬─────────┐<br>│ name    ┆ age ┆ country │<br>│ ---     ┆ --- ┆ ---     │<br>│ str     ┆ i64 ┆ str     │<br>╞═════════╪═════╪═════════╡<br>│ Alice   ┆ 25  ┆ US      │<br>│ Bob     ┆ 32  ┆ Canada  │<br>│ Charlie ┆ 18  ┆ UK      │<br>│ David   ┆ 47  ┆ US      │<br>│ Emily   ┆ 22  ┆ Canada  │<br>└─────────┴─────┴─────────┘</pre><h3>Conclusion</h3><p>Polars library is a Python data processing library designed for fast and efficient processing on large datasets. Polars library works similarly to the pandas library. However, it provides faster processing on large datasets.</p><ul><li><a href="https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/">Linkedln</a></li><li><a href="https://github.com/miracyuzakli">Github</a></li><li><a href="https://www.kaggle.com/code/muhammetmirayzakl/">Kaggle</a></li><li><a href="https://www.upwork.com/freelancers/~0178f4cf3eb93b5f83">UpWork</a></li></ul><h3>Source</h3><ol><li>Python Official Documentation: <a href="https://docs.python.org/3/">https://docs.python.org/3/</a></li><li>NumPy Official Documentation: <a href="https://numpy.org/doc/">https://numpy.org/doc/</a></li><li>Pandas Official Documentation: <a href="https://pandas.pydata.org/docs/">https://pandas.pydata.org/docs/</a></li><li>Dask Official Documentation: <a href="https://docs.dask.org/en/latest/">https://docs.dask.org/en/latest/</a></li><li>Polars Official Documentation: <a href="https://pola-rs.github.io/polars-book/">https://pola-rs.github.io/polars-book/</a></li><li>“Introduction to NumPy” by Charles R. Harris, K. Jarrod Millman, Stéfan J. van der Walt, and Nathaniel J. Smith: <a href="https://numpy.org/doc/stable/user/absolute_beginners.html">https://numpy.org/doc/stable/user/absolute_beginners.html</a></li><li>“Getting started with pandas” by the pandas development team: <a href="https://pandas.pydata.org/docs/getting_started/index.html">https://pandas.pydata.org/docs/getting_started/index.html</a></li><li>“Dask Tutorial” by Matthew Rocklin: <a href="https://github.com/dask/dask-tutorial">https://github.com/dask/dask-tutorial</a></li><li>“Polars: A Fast DataFrame Library for Python and Rust” by Arseny Kravchenko: <a href="https://towardsdatascience.com/polars-a-fast-dataframe-library-for-python-and-rust-a5ecd29a6af5">https://towardsdatascience.com/polars-a-fast-dataframe-library-for-python-and-rust-a5ecd29a6af5</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b1a4905378a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Cleaning in Python]]></title>
            <link>https://medium.com/@miracyuzakli/data-cleaning-in-python-6cd7f1196aa1?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cd7f1196aa1</guid>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[data-cleaning]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[numpy]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Wed, 21 Dec 2022 09:06:59 GMT</pubDate>
            <atom:updated>2022-12-21T09:06:59.052Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*Z4417e2vPRJ2vED8yuPCLg.png" /></figure><p>Data cleaning is an essential process in the data analysis workflow. It involves identifying and correcting errors, inconsistencies, and missing values in the data. Data cleaning is crucial for accurate and meaningful analysis and modeling.</p><p>In this tutorial, we will learn how to perform data cleaning in Python using built-in functions and manual methods. We will also use some visualization techniques to understand and explore the data better.</p><h3>Built-in Functions</h3><p>Python provides several built-in functions and libraries that can be used to clean data effectively. Some of the commonly used functions and libraries are:</p><p><strong>pandas:</strong> A powerful library for data manipulation and analysis. It provides several functions for cleaning and preprocessing data.</p><p><strong>numpy:</strong> A library for scientific computing. It provides functions for handling missing values and performing mathematical operations on arrays.</p><p><strong>sklearn:</strong> A library for machine learning. It provides functions for scaling and normalizing data.</p><p>Let’s start by importing the necessary libraries:</p><pre>import pandas as pd<br>import numpy as np<br>from sklearn import preprocessing</pre><h3>Handling Missing Values</h3><p>One of the common problems in real-world data is missing values. There can be various reasons for missing values, such as data not being recorded, data being lost, or data being incomplete.</p><p>Pandas provides several functions for handling missing values:</p><p><strong>isnull():</strong> Returns a boolean array indicating whether each element in the dataframe is null or not.</p><p><strong>notnull():</strong> Returns a boolean array indicating whether each element in the dataframe is not null or null.</p><p><strong>dropna():</strong> Drops rows or columns with null values.</p><p><strong>fillna():</strong> Fills null values with a specified value.</p><p>Let’s use the built-in Titanic dataset from seaborn library to demonstrate these functions:</p><pre>import seaborn as sns<br><br># Load the Titanic dataset<br>df = sns.load_dataset(&#39;titanic&#39;)<br><br># Check for missing values<br>print(df.isnull().sum())<br><br># Drop rows with missing values<br>df_drop = df.dropna()<br><br># Fill missing values with 0<br>df_fill = df.fillna(0)</pre><h3>Handling Outliers</h3><p>Outliers are data points that are significantly different from the rest of the data. Outliers can be caused by errors in data collection, measurement, or entry. They can distort the overall distribution of the data and affect the results of the analysis and modeling.</p><p>One way to identify and handle outliers is by using the <strong>Z-score</strong> method. The Z-score is the number of standard deviations a data point is from the mean. Data points with a Z-score greater than 3 or less than -3 are considered as outliers.</p><p>We can use the <strong>scipy </strong>library to calculate the Z-score and identify the outliers:</p><pre>from scipy import stats<br><br># Calculate the Z-score of each data point<br>z = np.abs(stats.zscore(df))<br><br># Identify the outliers<br>outliers = np.where(z &gt; 3)<br><br># Drop the outliers<br>df_clean = df[(z &lt; 3).all(axis=1)]</pre><h3>Normalization and Scaling</h3><p>Normalization and scaling are techniques used to transform the data to a common scale. Normalization scales the data between 0 and 1, while scaling scales the data to have a mean of 0 and a standard deviation of 1.</p><p>We can use the <strong>MinMaxScaler</strong> and <strong>StandardScaler </strong>functions from the <strong>sklearn.preprocessing</strong> library to normalize and scale the data, respectively:</p><pre># Normalize the data<br>scaler = preprocessing.MinMaxScaler()<br>df_norm = pd.DataFrame(scaler.fit_transform(df), columns=df.columns)<br><br># Scale the data<br>scaler = preprocessing.StandardScaler()<br>df_scaled = pd.DataFrame(scaler.fit_transform(df), columns=df.columns)</pre><h3>Manual Methods</h3><p>In addition to the built-in functions, we can also use manual methods for data cleaning. Some of the common manual methods are:</p><p><strong>Checking for errors and inconsistencies:</strong> We can manually check the data for errors and inconsistencies, such as incorrect data types, incorrect values, and spelling mistakes.</p><p><strong>Fixing errors and inconsistencies:</strong> We can fix the errors and inconsistencies by manually replacing or correcting the values.</p><p><strong>Exploratory Data Analysis (EDA):</strong> We can use visualization techniques to explore and understand the data better. Some of the common visualization techniques are:</p><p><strong>Univariate plots:</strong> Plots for analyzing individual variables. Examples include histograms, bar plots, and box plots.</p><p><strong>Multivariate plots:</strong> Plots for analyzing the relationships between variables. Examples include scatter plots and pair plots.</p><p>Let’s use the Titanic dataset to demonstrate these manual methods:</p><pre>import matplotlib.pyplot as plt<br><br># Check for errors and inconsistencies<br>df.info()<br>df.describe()<br><br># Fix errors and inconsistencies<br>df[&#39;age&#39;].fillna(df[&#39;age&#39;].median(), inplace=True)<br>df[&#39;fare&#39;] = df[&#39;fare&#39;].astype(int)<br><br># Explore the data<br>df.hist(figsize=(10, 10))<br>plt.show()<br><br># Plot univariate plots<br>df[&#39;age&#39;].plot.hist()<br>plt.show()<br><br>df[&#39;fare&#39;].plot.box()<br>plt.show()<br><br># Plot multivariate plots<br>sns.scatterplot(x=&#39;age&#39;, y=&#39;fare&#39;, data=df)<br>plt.show()<br><br>sns.pairplot(df)<br>plt.show()</pre><h3>Conclusion</h3><p>In this tutorial, we learned how to perform data cleaning in Python using built-in functions and manual methods. We saw how to handle missing values, identify and remove outliers, normalize and scale the data, and explore the data using visualization techniques. Data cleaning is an essential step in the data analysis workflow, and using the right tools and techniques can help us clean and prepare the data for accurate and meaningful analysis and modeling.</p><p><strong>Linkedln:</strong> <a href="https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/">https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/</a></p><p><strong>UpWork:</strong> <a href="https://www.upwork.com/freelancers/~01bf568447a6c5b025">https://www.upwork.com/freelancers/~0178f4cf3eb93b5f83</a></p><p><strong>Github: </strong><a href="https://github.com/miracyuzakli">https://github.com/miracyuzakli</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cd7f1196aa1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linear Regression | Theory and Practice]]></title>
            <link>https://medium.com/@miracyuzakli/linear-regression-theory-and-practice-21e7fc48af2c?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/21e7fc48af2c</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sklearn]]></category>
            <category><![CDATA[math]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Wed, 03 Aug 2022 06:28:17 GMT</pubDate>
            <atom:updated>2022-08-03T06:28:17.513Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*Ptg7lxdgRrcdWerYvBygOg.png" /></figure><p>Hello everyone.</p><p>We’ve all heard of machine learning in software. machine learning algorithm<br>The first thing that comes to mind is simple linear regression. So how did simple linear regression come about,<br>What way of thinking was followed?</p><p>Let’s say you only have one store’s monthly earnings for 12 months. According to these data<br>We want to predict next month’s earnings. Think about how you can do this.</p><p>That’s what this algorithm can do!</p><p>We said we have a monthly income. Now let’s plot the point graph of this data and create an imaginary line segment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0nXzGa9SCCphwcbQkKs_w.jpeg" /></figure><p>Logically, this should be close to the correct monthly earnings values in the two-dimensional plane.<br>Let’s make a good guess. That is, there must be a perpendicular distance between the point and the line, and this distance is the smallest.<br>should take the minimum value. I would like to say that you are talking about derivatives.<br>Because when we take the derivative of an equation and set it equal to zero, it is equal to the minimum value that the equation will take. This way we should get a straight equation.</p><p>Let the equation of this imaginary line be like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*9Vqabduj___Vh0jBLQIm5A.png" /></figure><p>What we have to do is find the coefficients α and β.</p><p>If we say the distance from a point to the line,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*MQ3_m8ipCLdFJo8rVoE_Tg.png" /></figure><p>Then, if the coefficients α and β are,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*T6UDJKslos2HDtW7Pvqhwg.png" /></figure><p>Here we see the equations we have obtained as a result of partial differentiation.<br>These equations give us the set of normal equations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*nRgfCOM4LED4sb6U5ds34A.png" /></figure><p>If we solve this set of equations using the determinant and elimination method, the value of β will be,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*LdPXTG3kPKSoEehZ0ihu0g.png" /></figure><p>Then, by solving α from the first of the two normal equations, we find the value of α as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*0OUe0WHBgIcsohDBcUQ80g.png" /></figure><p>If we want to write more simply,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*wLRVqjA20pfTPijVkdpoAw.png" /></figure><p>Now let’s rearrange β’s equation using some math magic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cJ9b_yXcBVjs_Bpia-0m6A.png" /></figure><p>Now we can write;</p><p>Theorem : Sample data {(𝑥𝑖 , 𝑦𝑖 ); If ; 𝑖 = 1, 2, 3, ⋯ , 𝑛} then 𝑦 = 𝛼 + 𝛽x</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*v6QhCRm1yaRKmEVcymQYuQ.png" /></figure><p>Yes, we have learned the theoretical parts so far, now let’s try these processes by applying them.</p><p>First, let’s create a data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*i8F_5faKXQu-ipyXUnXCpQ.png" /></figure><p>This data shows the score that high school students get from the exam as a result of determined working hours.</p><p>Now let’s create the alpha and beta coefficients according to the above equations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*0T1dQv6W4JH_rs-tSQNXRQ.png" /></figure><p>Now let’s do it using the linear regression module in the sklearn library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*XdyfE4ayJCBERvG13hD97g.png" /></figure><p>As can be seen, the alpha and beta coefficients have the same values in both methods.</p><p>Now let’s visualize the values we get.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*l60f7egr0LWp6nC_JHfRNA.png" /><figcaption>My Linear Regression</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*TRK6xQ3VCHwb1XBs_QZBZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*GXGFutVganCYC7zVTTtiug.png" /><figcaption>Sklearn Linear Regression</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*98YifC0cn69h8NCWIhDxbA.png" /></figure><p>As you can see, both graphs are the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*TRK6xQ3VCHwb1XBs_QZBZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*98YifC0cn69h8NCWIhDxbA.png" /></figure><p>Yes, now let’s get new predictions by giving test data to our model.</p><p>We will create a simple function for this, we will use the coefficients that we calculated manually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*OhvVvt3muAnjfA8FrxR5NQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*9zTwnJ0LAkINrJ6aDMs4TQ.png" /></figure><p>Now let’s compare our estimates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*Gm96Dk8NegMNod87x8RqRg.png" /></figure><p>As can be seen, we obtained the same results with both methods.</p><h3>Conclusion</h3><p>Now you know how linear regression works. . The theoretical aspects of the processes are as important as the applied aspects. Many data analysts do not know the theoretical part of these processes. If you want to be a successful data analyst, I suggest you pay attention to these issues.</p><p>Happy coding…</p><p>Kaggle : <a href="https://www.kaggle.com/code/muhammetmirayzakl/effect-of-cost-of-living-on-level-of-development">https://www.kaggle.com/code/muhammetmirayzakl</a>/</p><p>Linkedln : <a href="https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/">https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/</a></p><p>UpWork : <a href="https://www.upwork.com/freelancers/~01bf568447a6c5b025">https://www.upwork.com/freelancers/~0178f4cf3eb93b5f83</a></p><p>Github : <a href="https://github.com/miracyuzakli">https://github.com/miracyuzakli</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21e7fc48af2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Effect of Country Living Costs on the Level of Development | Analysis — ML]]></title>
            <link>https://medium.com/@miracyuzakli/the-effect-of-country-living-costs-on-the-level-of-development-analysis-ml-789101675491?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/789101675491</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[sklearn]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Sat, 09 Jul 2022 22:50:52 GMT</pubDate>
            <atom:updated>2022-07-09T22:57:57.972Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Effect of Country Living Costs on the Level of Development | Analysis — ML</h3><p>Hello, I will tell you about the work that I created and analyzed the data set myself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*CNo_eUiLKM9P-K03Z3lytw.png" /></figure><h3>Note</h3><p>These data are taken from <a href="https://www.numbeo.com/cost-of-living/">https://www.numbeo.com/cost-of-living/</a>. Thank you numbeo.com for everything.<br>These data include the cost of living values of the countries.</p><h3>What can you expect?</h3><ul><li>Data Cleaning and Editing</li><li>Detection and removal of outliers</li><li>Data Visualization and Analysis</li><li>Machine learning</li></ul><p>We import the libraries we will use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*JtU1P8qAD9kLEeQ8SZfGEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*rZD-XyGjXcX5YxC9IIDQCw.png" /></figure><p><a href="https://www.kaggle.com/datasets/muhammetmirayzakl/country-costs-of-living-numbeocom">Click </a>to access the data set.</p><p>In the dataset “?” we’re removing values that have value. Then we reset the index values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*JpE4xoDGJ5e5gy-qc4vgWA.png" /></figure><p>Now we delete the “$” and “,” characters from the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*nMgZ5zEN7_FQWdqgUgb02w.png" /></figure><p>Let’s see the types of columns in the data set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*z9vfaxOseR_G3fqrFuPc-w.png" /></figure><p>Here we see that the data is all columns are categorical and we convert all columns to numeric type except the column named “CountryName”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*LueBWW_4gU850KrooCcnsg.png" /></figure><p>We will add a new column to our dataset, this column will show the development status of the countries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/963/1*Bi3iqR_9NzALYK5hTlPs1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/955/1*11PvkPIhx5V0SKEX4qIneQ.png" /></figure><p>Now let’s clear the missing data and reset the indexes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*NVF209ZH1MA3mna9mx1MKQ.png" /></figure><h3>Detection and removal of outliers</h3><p>Here we will check whether there are outliers in each column in the data set.<br>If there is outlier data, we will deduct these values from our data set.<br>The reason we do this process is that we can get more accurate results in the analysis and machine learning parts.</p><p>Here we select only the numeric value columns from our dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*S3xzyov-3wvaOg3d96UFpQ.png" /></figure><p>Then, we detect outliers for each column, and if there is an outlier, we remove those values from our data set.<br>We will use a for loop to do these operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*8p-T-mUQrNh_Kd6Byb9tdQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*aBkZNAHrezCKZ40wkRBNGg.png" /></figure><p>Here, we see the average and median of the data according to the development status of the countries.</p><p>We prepared our data set for the analysis part. After that we will move on to data visualization. Let’s see, what inferences can we make?</p><p>Let’s visualize these values by category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*sFli74bAkCNcciotu1RZHw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6qJjymd4bm0JyKa8vzzRgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*h2zIKANKIKfKmg1tCePtfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gBu1y4lkSgItZVRQcZGbpA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*_VYc4aHvCmuG_Pp39RQm1w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wibmGBgU72TcvtbqkbEoUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*5geYQwAR6t7jXV7u00dLRw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*egqQvdstEu4R5vrwSb_mGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*JBfw2_XiMiz_4yggzJyZeA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K07v8-Fvsidxx88aBMtUHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*f-WI8byuBlY02xPTcEbGnw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ekz5G9XXf6I5JGmvjw_ktA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*bwKD7loQxJf4XMlN1t6sZw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rElh1f0RHNONVoNMyVxKhA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*cXrN4GI4xYb5538Wgrm_Tw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWINcTPseYFvjWh5l88EPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*NZXlO1rgZW66lDx5zNv_tQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0-Yiq8qEZotUOOr7vTHYfw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*9ppndNfmpws0KmYkvI4AjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DEyFEpSp6V8uF4r8VxtFBg.png" /></figure><p>We created our images. We can see the distributions in all images. Here, let’s estimate the level of development of countries using machine learning.</p><p>First, let’s create the dependent and independent variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*zFKKV_olynhZOymG0F7xkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/1*4dRY-NdprXZZ6DtEcJzW5g.png" /></figure><p>Now let’s divide our data into training and testing parts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/729/1*6r9-aE1FJyuwc-x-2XPkfg.png" /></figure><p>After that, there will be machine learning processes.</p><p><strong>Algorithms</strong></p><ul><li>Random Forest</li><li>Decision Tree Classifier</li><li>Support Vector Machines (SVM)</li><li>GaussianNB</li><li>K-Neighbors Classifier (KNN)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*f8koI4rz3DrccyQvUu3rBQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*hKIlA6ENudjguFmKCmb18A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*dOugCYEyx8NJnGuMh3UA3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*-Gj8FEqaeoCibkSryzFI-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*Dj-CsV8OWB0fdEgNOCGMmA.png" /></figure><p>Kaggle : <a href="https://www.kaggle.com/code/muhammetmirayzakl/effect-of-cost-of-living-on-level-of-development">https://www.kaggle.com/code/muhammetmirayzakl/effect-of-cost-of-living-on-level-of-development</a></p><p>Linkedln : <a href="https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/">https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/</a></p><p>UpWork : <a href="https://www.upwork.com/freelancers/~0178f4cf3eb93b5f83">https://www.upwork.com/freelancers/~0178f4cf3eb93b5f83</a></p><p>Github : <a href="https://github.com/miracyuzakli">https://github.com/miracyuzakli</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=789101675491" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Scraping with Python | numbeo.com]]></title>
            <link>https://medium.com/@miracyuzakli/web-scraping-with-python-numbeo-com-22cea0c5077c?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/22cea0c5077c</guid>
            <category><![CDATA[data-processing]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[request]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Sat, 09 Jul 2022 16:31:44 GMT</pubDate>
            <atom:updated>2022-07-09T16:31:44.133Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lp50ySLWRLlgxBNNyOz5YQ.png" /></figure><p>Hello everyone, today at numbero.com I will tell you how to get countries living costs with web scraping using python.</p><p>First of all, thank you very much to numbero.com. Thank you for bringing this data together with us. The statistical information to share is invaluable. You can also visit and review numbero.com.</p><p>We import the libraries we will use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*VFcPAEwEY-0X83HtdG_pQw.png" /></figure><p>We create a class called “webscraping”. We create a public variable named “DataDict” in it. This variable will be of dictionary type and will contain the country’s cost of living values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*jLbgLetfCsPo9xfU7Tc6eA.png" /></figure><p>Now we can start the web scraping.</p><p>When we enter the <a href="https://www.numbeo.com/cost-of-living/">https://www.numbeo.com/cost-of-living/</a> address, we pull the lines containing the “country_result” value from the background of the site from the countries section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BWoh9t6uaVe_p3D5GHhbsA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*g3aumX_c29zUPYh1Oxed-g.png" /></figure><p>We will perform the pull process with the function called “getCountryNameList( )”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*u_UAndGYu87OGib6FyYIsw.png" /></figure><p>This function will return us a list of country names.</p><p>For example, we will take the Kosovo Disputed Territory country as “Kosovo+%28Disputed+Territory%29” , and then we will use a function we created and convert this value to “Kosovo Disputed Territory”.</p><p>With the function called “CountryNameOperation”, we convert country names to the string type we want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*u6OEIcdetlria2fT-lqZIg.png" /></figure><p>Now, the most important part of our code, which is to reduce the cost of living by country.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tMkSotaQg0ndUxvKmDLdaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*iOQqJF7rBvWcKQcq9VGM-Q.png" /></figure><p>Here we will pull the values in the “td” rows from the “tr” blocks from the “data_wide_table” table class.</p><p>We will do this with the function “getCountriesCostOfLiving(self, countryURL, countryName)”. This function transfers the information in the image below from within that page according to the country name and page link that it takes as a parameter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*pu6jcXvMIEpN4yimeBh-kA.png" /></figure><p>It pulls the data from here and adds it to the lists in the “DataDict” dictionary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*on-eZMkR_rXnzOPF5-0_YQ.png" /></figure><p>Now let’s do this for each country.</p><p>We will use the “dataMerge” function for this. This function assigns the link of the page with the information of each country to the “DataDict” by using the “CountryNameOperation” function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*-8XVieuZur4re6JfTgEkCw.png" /></figure><p>Thus, all data is captured. So far, we have kept the data in dictionary type. Now we will convert the data to “pd.DataFrame” type. At the same time, we will remove the missing data from the data set. We will use the “getDataFrame” function for this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*_JDyI1Lyzk7Nb1YpZ5dONw.png" /></figure><p>After this process, we run our code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*vAZq34BatuReDl4cudjPVQ.png" /></figure><p>And here’s the big moment.<br>We get our data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJ7-Mbw9jlRatUrgxAVrug.png" /></figure><p>Solution<br>Anyone working in the field of data science has worked on a piece of data. But to create your own data and produce new content. These processes are crucial to your and others’ development. The future is in this direction. Please contact me for any questions. Thank you for reading.</p><p>Github : <a href="https://github.com/miracyuzakli/Web-Scraping-with-Python-numbeo.com">https://github.com/miracyuzakli/Web-Scraping-with-Python-numbeo.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22cea0c5077c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PRINCIPAL COMPONENT ANALYSİS (PCA) | Theory and Python Code]]></title>
            <link>https://medium.com/@miracyuzakli/principal-component-analysi%CC%87s-pca-theory-and-python-code-f4a62a7c1dda?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4a62a7c1dda</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Sat, 09 Jul 2022 01:09:25 GMT</pubDate>
            <atom:updated>2022-07-09T01:09:25.970Z</atom:updated>
            <content:encoded><![CDATA[<p>Principal Component Analysis (PCA), also called principal component analysis or Karhunen-Loeve transform, is a subspace projection method widely used in pattern recognition studies.</p><p>Principal component analysis; It is a multivariate statistical method that provides dimension reduction and interpretation by explaining the variance-covariance structure of a data set consisting of variables with the help of linear combinations of these variables.</p><p>PCA is a vector-based approach. This method, the aim is to perform a dimension reduction that expresses large dimensional and interrelated vectors as small dimensional unrelated vectors. Its use in image recognition applications is realized by representing digital image data in vector format.</p><p>The analysis aims to determine the best transformation that can express the available data with fewer variables. The variables obtained after the transformation are called the principal components of the initial variables. The first principal component has the largest variance value and the other principal components are ordered in descending order of variance values. The principal components are perpendicular to each other. Low sensitivity to noise, reduced memory and capacity requirements, more efficient operation in small-dimensional spaces can be listed among the main advantages of PCA.</p><p>PCA is a common method used to describe a dataset with fewer variables. In this method, the basic components that make up a dataset are created and then they are used to try to understand the dataset.</p><p>The main purposes of size reduction are to get rid of unnecessary variables, reduce computation time, make data more understandable, and make visualization easier.</p><p>Some of the Usage Areas:<br>1) Noise Filtering<br>2) Visualization<br>3) Attribute Extraction (New Dimension)<br>4) Attribute Elimination (Size Reduction)</p><p>Let be a multivariate matrix of data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/383/1*h_kyCtE8vzkNX7sED2d-ew.png" /></figure><p>In probability theory and statistics, variance is a measure of the statistical spread for a sample as the mean of the squares of the distances of all possible values from a random variable, a probability distribution, or the expected value or mean. When trying to find the center point of a mean distribution, variance aims to describe at what scale or how widespread the values are.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*mGerdck8D8C0RmmLHuF6WQ.png" /></figure><p>In probability theory and statistics, covariance is a measure of how much two variables change together. Covariance is a statistic that examines the covariance of two random variables. (As a special case, if two variables are identical to each other, the covariance is the variance of that single identical variable.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*NcdhdwsP553uhyikAnMDJw.png" /></figure><p>COVARIANCE MATRIX</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*GMSp0Dh2cKRmiMC7GLCMsw.png" /></figure><ul><li>Here, the coefficients on the diagonal are the variance, the others are the covariance coefficients.</li><li>r. The variance gives information about the distribution of the data in only one dimension according to the mean value, independent of the other dimensions.</li><li>Covariance gives information about how a dimension changes depending on other dimensions. Always calculated between 2 dimensions</li><li>If the value of one of the variables increases as the value of the other increases, or if one decreases as the other decreases, the covariance value between the two variables will be positive. If the value of one of the variables increases while the value of the other decreases, or if the value of one decreases and the value of the other increases, the covariance value will be negative. If there is no significant relationship between the variables, the covariance will be close to zero.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*zxvGH3nzGIK7xsTnsS3mjg.png" /></figure><p>Thus, if ⋋1 &gt; ⋋2, it is seen that ⋋1 is the dominant eigenvalue of the covariance matrix. Therefore, the first principal component is a new variable that explains more variation than the other principal components. If a large percentage of the total variance for a data matrix with p large columns can be attributed to the first few principal components, the new variables can replace the original p variables without significant loss of information. Thus, a significant reduction in data can be achieved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*uK9oq8uIjcnM4M6GvBBZBw.png" /></figure><h3>Now let’s do these operations using python.</h3><p>First, let’s create a sample data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/1*09Q_vVLVUJJwY2VBWFmfjA.png" /></figure><p>We apply the standard scaling process to our dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/575/1*TJ-RhaSKrqfbn-V-gdkBZg.png" /></figure><p>We take the covariance of our data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/1*49gaLYjfcyxSY5OK5IYSCw.png" /></figure><p>We calculate eigenvalues and eigenvectors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/890/1*iZCYfvJfDXJiNuZhflUwfg.png" /></figure><p>After these operations, it reduces the size of the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*uN4Mz4azfiIWiRzNmW1cgw.png" /></figure><p>If we do it using a ready-made library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*-FYcPezVEeXeZnBfZYcA9Q.png" /></figure><p>So we get the same result.</p><p>Thank you for reading.</p><h3><strong>References</strong></h3><p>[1] Kolman, B. , Hill, D.R. (2011). Uygulamalı Lineer Cebir.(Çev. Akın Ö.).Ankara: Palme Yayıncılık.(Orijinal yayın tarihi, 2008)</p><p>[2] Arslan, İ. (2019). Python ile Veri Bilimi(1. Baskı). Pusula 20 Teknoloji ve Yayıncılık</p><p>[3] <a href="https://www.udemy.com/course/makine-ogrenmesi/">https://www.udemy.com/course/makine-ogrenmesi/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4a62a7c1dda" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[USA Real Estate Analysis and Machine Learning | Kaggle]]></title>
            <link>https://medium.com/@miracyuzakli/usa-real-estate-analysis-and-machine-learning-kaggle-1610a6ab530c?source=rss-be8bb9eee416------2</link>
            <guid isPermaLink="false">https://medium.com/p/1610a6ab530c</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[real-estate]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[matplotlib]]></category>
            <dc:creator><![CDATA[Muhammet miraç Yüzaklı]]></dc:creator>
            <pubDate>Tue, 05 Jul 2022 14:32:04 GMT</pubDate>
            <atom:updated>2023-08-07T04:59:14.369Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XbreW-rLViq3O48rtcYeLQ.jpeg" /></figure><p>Hello everyone.<br>Today I’m going to tell you about my work on Real Estate data on Kaggle.<br>Data includes US home sale status, price, number of bedrooms, number of bathrooms, arce lot, full address, street name, city name, state, zip code, and sale date of homes.</p><p>First of all, I import the necessary libraries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*CrkJBGcnC8DE6wivBVaclQ.png" /></figure><p>We define the dataset and print the number of missing data in each column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*tyAuUtrXk1MWeSjSaO8hQQ.png" /></figure><p>We remove the missing data from the dataset.</p><p>Then we drop the rows that have more than one same address in the dataset, except the first row.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*ULjzcEwehRUcZQ0lbDruHg.png" /></figure><p>This is the final version of the dataset after our actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2JCBmpYmahI_IfcZcjygig.png" /></figure><p>We will perform data visualization and analysis using the matplotlib and seaborn libraries that we imported earlier.</p><p>In this section, we first added the shape sizing and title value. Next, we visualize the frequency values and percentages of the number of bedrooms and bathrooms using a bar chart. Frequency values are evaluated as the sum of the numbers found for each value in that column. In order to make the graphics more understandable, we are doing axis naming and title assignment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B15hxS4Ekk-id1M01kmCGQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*khn_LBsxeVoRWFAgur-RqA.png" /></figure><p>We create a dot chart that visualizes the number of bedrooms on the x-axis, the number of bathrooms on the y-axis, and price values by color as another dimension. We add a color bar to our chart to make these colors meaningful. In this graph, we name the axis and title.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ql30BQ2UFP1p0JVMebzdtA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A5ywIeV_YhwQ3rIRtJlX0A.png" /></figure><p>In this section, we show the number and percentage of home listings by state in the form of a horizontal bar chart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*lErE19B-hEf0KjgoyR6kYA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EQ4FzlESxpbCjd9Ey17o9A.png" /></figure><p>Now we will add a new column named “year” to our dataset and create this column by taking the first four elements of each value in the column named “sold_date”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*U7xGP-KsuE9C2RA8iXKAiw.png" /></figure><p>After this process, the final state of the data set is like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dZ_QO_ZBox37kZiE3hv9Fw.png" /></figure><p>Then, we create the column named “year”, which is the price average and median according to the years, in the form of bar and line graphs. According to the data set we understand from this graph, the 70s were the years when housing prices were the highest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*26TCUL8f46mtlHNbueAipA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9GKjQHEKR6-v3wq0bjBqVw.png" /></figure><p>Correlation matrix of numerical data in the dataset. The correlation matrix allows us to see the similarity values of the numeric columns in the data with each other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*GsK2p3lNKncl0Kqq3YMymw.png" /></figure><p>Here, instead of the numerical values of the correlation matrix, we see the similarities of the columns with each other graphically. It allows us to have an idea about the similarities or differences between the columns according to which data set comes on the x and y axes in these graph sections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*UbAMyyZg7wLbI-FbIS71wQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FK8N35IFn_xrqjJLutgtXQ.png" /></figure><p>We have come to the end of the data visualization and analysis section. Many new operations can be added to the operations we have done in this section. These are the sample deductions I made. We can make much easier and more understandable inferences by visualizing the data set instead of just examining the data numerically. If you have similar inferences, you can let me know as a comment, I would like to thank everyone for their comments in advance.</p><p>After that, we will obtain predictions with machine learning algorithms. But before that, we need to label our data. Here, we will convert the “city” and “state” columns from categorical data to numbers with labeling method. For this we have to use these codes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aP8IHFSfdlWt_0KSVi96Bg.png" /></figure><p>After these operations, we add two new columns to the dataset. This is the final state of our data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*81qCEMn6-n7-XUuHmLjSlA.png" /></figure><p>Now we define the dependent and independent variables and assign them to variables named x and y respectively. Then we divide our dataset into training and test sections and determine the test size so that 1/3 of the dataset is random.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*bpqN_3oqPstCXPwWky2teg.png" /></figure><p>Our dataset is now suitable for using prediction algorithms. We train using Linear regression, Decision Tree Regressor, Random Forest Regressor estimation algorithms, respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/948/1*6QvZ8gYrV3FxpnHgHvVjVw.png" /></figure><p>By testing the algorithms we have trained, we obtain the success points they get numerically and graphically. Here we used the r-square score for the success score. Here the scores are low and they can be further increased by performing various actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*soOvwN5cZTC4Sxa0Gk28pQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*DsCa_8zZS2h4qHWHmmZQjg.png" /></figure><h3>Conclusion</h3><p>What I want to tell here is how to approach a data set, what inferences can be made, and to obtain predictive values by adapting the machine learning algorithm we will use the data set. Thank you for reading.</p><p><strong>GitHub : </strong><a href="https://github.com/miracyuzakli/US-Real-Estate-Analysis-and-Machine-Learning">https://github.com/miracyuzakli/US-Real-Estate-Analysis-and-Machine-Learning</a><strong><br>Kaggle : </strong><a href="https://www.kaggle.com/code/muhammetmirayzakl/us-real-estate-analysis-and-machine-learning">https://www.kaggle.com/code/muhammetmirayzakl/us-real-estate-analysis-and-machine-learning</a><strong><br>Linkedin : </strong><a href="https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/">https://www.linkedin.com/in/muhammet-mira%C3%A7-0564631a0/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1610a6ab530c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>