{"id":36563,"date":"2024-11-01T09:49:35","date_gmt":"2024-11-01T09:49:35","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=36563"},"modified":"2024-11-01T11:52:42","modified_gmt":"2024-11-01T11:52:42","slug":"deep-learning-pytorch-course-what-is-machine-learning","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/36563\/","title":{"rendered":"Deep Learning PyTorch Course, What is Machine Learning"},"content":{"rendered":"<p><body><\/p>\n<h2>1. Definition of Machine Learning<\/h2>\n<p>Machine Learning is a subfield of artificial intelligence that enables computers to learn from data and perform specific tasks. Typically, machine learning is characterized by the use of algorithms that can learn without being explicitly programmed. This is very useful for recognizing patterns in data, making predictions, and automating decision-making.<\/p>\n<h2>2. Basic Principles of Machine Learning<\/h2>\n<p>Machine learning models generally operate through the following process:<\/p>\n<ol>\n<li>Data Collection: Collect the data to be used for learning.<\/li>\n<li>Data Preprocessing: Perform tasks such as handling missing values and normalization to improve the quality of the data.<\/li>\n<li>Model Selection: Choose a machine learning model that is suitable for the problem.<\/li>\n<li>Training: Train the selected model using the data.<\/li>\n<li>Evaluation: Assess the model&#8217;s performance and adjust it if necessary.<\/li>\n<li>Prediction: Use the trained model to make predictions on new data.<\/li>\n<\/ol>\n<h2>3. Types of Machine Learning<\/h2>\n<p>Machine learning can primarily be divided into three types:<\/p>\n<ul>\n<li><strong>Supervised Learning<\/strong>: Learns the relationship between input and output when given input and output data. This mainly includes regression and classification problems.<\/li>\n<li><strong>Unsupervised Learning<\/strong>: Focuses on finding the structure or patterns in data when there is no output data available. Clustering is a representative example.<\/li>\n<li><strong>Reinforcement Learning<\/strong>: An agent learns strategies to maximize rewards through interaction with the environment.<\/li>\n<\/ul>\n<h2>4. What is PyTorch?<\/h2>\n<p>PyTorch is an open-source machine learning library developed by Facebook, primarily used as a framework for deep learning. PyTorch provides dynamic computation graphs, enabling flexible and intuitive coding. This is one of the reasons it is popular among researchers and developers.<\/p>\n<h3>Main Features of PyTorch<\/h3>\n<ul>\n<li><strong>Dynamic Computation Graph:<\/strong> The computation graph is generated as soon as the code is executed, allowing easy modification of the model structure.<\/li>\n<li><strong>Diverse Tensor Operations:<\/strong> Enables tensor operations similar to NumPy, making it easy to preprocess training data.<\/li>\n<li><strong>GPU Support:<\/strong> Allows fast execution of large-scale operations by utilizing GPUs.<\/li>\n<li><strong>Scalability:<\/strong> Custom layers and models can be easily defined, making it applicable for various deep learning research.<\/li>\n<\/ul>\n<h2>5. Hands-on Machine Learning with PyTorch<\/h2>\n<p>Now we will build a simple machine learning model using PyTorch. We will be using the Iris dataset to create a model that classifies the types of flowers.<\/p>\n<h3>5.1. Loading the Dataset<\/h3>\n<p>First, we install the required libraries and load the data.<\/p>\n<pre>\n<code>\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nfrom sklearn import datasets\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.preprocessing import LabelEncoder\nimport numpy as np\n<\/code>\n    <\/pre>\n<h3>5.2. Data Preprocessing<\/h3>\n<p>After loading the Iris dataset, we separate the features and labels and carry out data preprocessing.<\/p>\n<pre>\n<code>\n# Load the Iris dataset\niris = datasets.load_iris()\nX = iris.data\ny = iris.target\n\n# Split the Data\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n# Normalize the Data\nscaler = StandardScaler()\nX_train = scaler.fit_transform(X_train)\nX_test = scaler.transform(X_test)\n\n# Convert to Tensors\nX_train_tensor = torch.FloatTensor(X_train)\ny_train_tensor = torch.LongTensor(y_train)\nX_test_tensor = torch.FloatTensor(X_test)\ny_test_tensor = torch.LongTensor(y_test)\n<\/code>\n    <\/pre>\n<h3>5.3. Defining the Model<\/h3>\n<p>We define a simple neural network model consisting of an input layer, a hidden layer, and an output layer.<\/p>\n<pre>\n<code>\nclass IrisModel(nn.Module):\n    def __init__(self):\n        super(IrisModel, self).__init__()\n        self.fc1 = nn.Linear(4, 10)  # 4 input features and 10 hidden nodes\n        self.fc2 = nn.Linear(10, 3)   # 10 hidden nodes and 3 output nodes (types of flowers)\n\n    def forward(self, x):\n        x = torch.relu(self.fc1(x))  # Using ReLU as the activation function\n        x = self.fc2(x)\n        return x\n\nmodel = IrisModel()\n<\/code>\n    <\/pre>\n<h3>5.4. Training the Model<\/h3>\n<p>After defining the loss function and optimization technique, we train the model.<\/p>\n<pre>\n<code>\n# Define Loss Function and Optimization Technique\ncriterion = nn.CrossEntropyLoss()\noptimizer = optim.Adam(model.parameters(), lr=0.01)\n\n# Train the Model\nnum_epochs = 100\nfor epoch in range(num_epochs):\n    model.train()\n    \n    # Forward Pass\n    outputs = model(X_train_tensor)\n    loss = criterion(outputs, y_train_tensor)\n    \n    # Backward Pass and Optimization\n    optimizer.zero_grad()\n    loss.backward()\n    optimizer.step()\n    \n    if (epoch+1) % 10 == 0:\n        print(f'Epoch [{epoch+1}\/{num_epochs}], Loss: {loss.item():.4f}')\n<\/code>\n    <\/pre>\n<h3>5.5. Evaluating the Model<\/h3>\n<p>Using the trained model, we perform predictions on the test data and evaluate the accuracy.<\/p>\n<pre>\n<code>\n# Evaluate the Model\nmodel.eval()\nwith torch.no_grad():\n    test_outputs = model(X_test_tensor)\n    _, predicted = torch.max(test_outputs.data, 1)\n    accuracy = (predicted == y_test_tensor).sum().item() \/ y_test_tensor.size(0)\n    print(f'Accuracy: {accuracy:.2f}')\n<\/code>\n    <\/pre>\n<h2>6. Conclusion<\/h2>\n<p>In this tutorial, we explored the basic concepts of machine learning and the process of building a simple machine learning model using PyTorch. Machine learning is utilized in various fields, and PyTorch serves as a powerful tool for this purpose. We hope you will conduct in-depth research on a wider range of topics in the future.<\/p>\n<p>We wish the advancements in deep learning and machine learning will aid your research!<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Definition of Machine Learning Machine Learning is a subfield of artificial intelligence that enables computers to learn from data and perform specific tasks. Typically, machine learning is characterized by the use of algorithms that can learn without being explicitly programmed. This is very useful for recognizing patterns in data, making predictions, and automating decision-making. &hellip; <a href=\"https:\/\/atmokpo.com\/w\/36563\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Deep Learning PyTorch Course, What is Machine Learning&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[149],"tags":[],"class_list":["post-36563","post","type-post","status-publish","format-standard","hentry","category-pytorch-study"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Deep Learning PyTorch Course, What is Machine Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/36563\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Deep Learning PyTorch Course, What is Machine Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"1. Definition of Machine Learning Machine Learning is a subfield of artificial intelligence that enables computers to learn from data and perform specific tasks. Typically, machine learning is characterized by the use of algorithms that can learn without being explicitly programmed. This is very useful for recognizing patterns in data, making predictions, and automating decision-making. &hellip; \ub354 \ubcf4\uae30 &quot;Deep Learning PyTorch Course, What is Machine Learning&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/36563\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:49:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:52:42+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"4\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/36563\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/36563\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Deep Learning PyTorch Course, What is Machine Learning\",\"datePublished\":\"2024-11-01T09:49:35+00:00\",\"dateModified\":\"2024-11-01T11:52:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/36563\/\"},\"wordCount\":523,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"PyTorch Study\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/36563\/\",\"url\":\"https:\/\/atmokpo.com\/w\/36563\/\",\"name\":\"Deep Learning PyTorch Course, What is Machine Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:49:35+00:00\",\"dateModified\":\"2024-11-01T11:52:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/36563\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/36563\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/36563\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deep Learning PyTorch Course, What is Machine Learning\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Deep Learning PyTorch Course, What is Machine Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/36563\/","og_locale":"ko_KR","og_type":"article","og_title":"Deep Learning PyTorch Course, What is Machine Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"1. Definition of Machine Learning Machine Learning is a subfield of artificial intelligence that enables computers to learn from data and perform specific tasks. Typically, machine learning is characterized by the use of algorithms that can learn without being explicitly programmed. This is very useful for recognizing patterns in data, making predictions, and automating decision-making. &hellip; \ub354 \ubcf4\uae30 \"Deep Learning PyTorch Course, What is Machine Learning\"","og_url":"https:\/\/atmokpo.com\/w\/36563\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:49:35+00:00","article_modified_time":"2024-11-01T11:52:42+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"4\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/36563\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/36563\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Deep Learning PyTorch Course, What is Machine Learning","datePublished":"2024-11-01T09:49:35+00:00","dateModified":"2024-11-01T11:52:42+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/36563\/"},"wordCount":523,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["PyTorch Study"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/36563\/","url":"https:\/\/atmokpo.com\/w\/36563\/","name":"Deep Learning PyTorch Course, What is Machine Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:49:35+00:00","dateModified":"2024-11-01T11:52:42+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/36563\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/36563\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/36563\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Deep Learning PyTorch Course, What is Machine Learning"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/36563","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=36563"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/36563\/revisions"}],"predecessor-version":[{"id":36564,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/36563\/revisions\/36564"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=36563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=36563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=36563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}