{"id":36579,"date":"2024-11-01T09:49:43","date_gmt":"2024-11-01T09:49:43","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=36579"},"modified":"2024-11-01T11:52:38","modified_gmt":"2024-11-01T11:52:38","slug":"deep-learning-pytorch-course-unsupervised-learning","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/36579\/","title":{"rendered":"Deep Learning PyTorch Course, Unsupervised Learning"},"content":{"rendered":"<p><body><\/p>\n<p>\n    Deep learning is a field of machine learning that automatically learns patterns from data, aiming to create models that extract useful information from input data and make predictions and decisions based on it. Among them, unsupervised learning is a methodology that uses unlabeled data to understand the structure of the data and group similar items together. Today, we will look at the basic concepts of unsupervised learning using PyTorch and some application examples.\n<\/p>\n<h2>Concept of Unsupervised Learning<\/h2>\n<p>\n    Unsupervised learning finds patterns in data as it is not given labels for the data. It focuses on understanding the inherent characteristics and distribution of the data. The main use cases of unsupervised learning are clustering and dimensionality reduction.\n<\/p>\n<h2>Types of Unsupervised Learning<\/h2>\n<ul>\n<li><strong>Clustering:<\/strong> A method of grouping data points based on similarity.<\/li>\n<li><strong>Dimensionality Reduction:<\/strong> A method of reducing the dimensions of the data to retain only the most important information.<\/li>\n<li><strong>Anomaly Detection:<\/strong> A method of detecting outliers that are at a certain distance from the overall data.<\/li>\n<\/ul>\n<h2>Introduction to PyTorch<\/h2>\n<p>\n    PyTorch is an open-source machine learning library developed by Facebook, built on Python, and is very useful for tensor computation and dynamic neural network implementation. It allows for numerical operations using tensors and dynamically generates a compute graph to easily construct complex neural network architectures.\n<\/p>\n<h2>Examples of Unsupervised Learning<\/h2>\n<h3>1. K-Means Clustering<\/h3>\n<p>\n    K-Means is one of the most common clustering algorithms. It repeatedly divides data points into K clusters and updates the centroid of each cluster. Below is a Python code that implements K-Means clustering.\n<\/p>\n<pre>\n<code>\nimport torch\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom sklearn.datasets import make_blobs\n\n# Data generation\nnum_samples = 300\nnum_features = 2\nnum_clusters = 3\n\nX, y = make_blobs(n_samples=num_samples, centers=num_clusters, n_features=num_features, random_state=42)\n\n# K-Means algorithm implementation\ndef kmeans(X, num_clusters, num_iterations):\n    num_samples = X.shape[0]\n    centroids = X[np.random.choice(num_samples, num_clusters, replace=False)]\n    \n    for _ in range(num_iterations):\n        distances = torch.cdist(torch.tensor(X), torch.tensor(centroids))\n        labels = torch.argmin(distances, dim=1)\n\n        for i in range(num_clusters):\n            centroids[i] = X[labels == i].mean(axis=0)\n            \n    return labels, centroids\n\nlabels, centroids = kmeans(X, num_clusters, 10)\n\n# Result Visualization\nplt.scatter(X[:, 0], X[:, 1], c=labels, s=50)\nplt.scatter(centroids[:, 0], centroids[:, 1], c='red', s=200, alpha=0.75, marker='X')\nplt.title('K-Means Clustering')\nplt.show()\n<\/code>\n<\/pre>\n<p>\n    The code above uses the `make_blobs` function to generate 2D cluster data and then performs clustering using the K-Means algorithm. The results can be visually confirmed, with the centroids of the clusters marked by red X shapes.\n<\/p>\n<h3>2. PCA (Principal Component Analysis)<\/h3>\n<p>\n    Principal Component Analysis (PCA) is a method for transforming data into a lower dimension. It maximizes the variance of the data and reduces the dimensions while preserving the structure of the data, making it useful for improving visualization and learning speed.\n<\/p>\n<pre>\n<code>\nfrom sklearn.decomposition import PCA\n\n# Reduce dimensions to 2D using PCA\npca = PCA(n_components=2)\nX_reduced = pca.fit_transform(X)\n\n# Result Visualization\nplt.scatter(X_reduced[:, 0], X_reduced[:, 1], c=labels, s=50)\nplt.title('PCA Dimensionality Reduction')\nplt.xlabel('Principal Component 1')\nplt.ylabel('Principal Component 2')\nplt.show()\n<\/code>\n<\/pre>\n<p>\n    PCA allows for easy visualization of high-dimensional data that is widely used, making clustering tasks much easier.\n<\/p>\n<h2>Applications of Unsupervised Learning<\/h2>\n<p>\n    The methodologies of unsupervised learning are applied in various fields. For example, it can be used to find similar image groups in image classification or to cluster documents by topic in text analysis. It also plays a significant role in marketing fields such as customer segmentation.\n<\/p>\n<h2>Conclusion<\/h2>\n<p>\n    Unsupervised learning is an important technique for finding hidden patterns in data and providing new insights. Utilizing PyTorch makes it easy to implement these techniques, which can help solve complex problems. In the future, exploring more diverse unsupervised learning techniques using libraries like PyTorch will be a valuable experience.\n<\/p>\n<h2>Additional Resources<\/h2>\n<ul>\n<li><a href=\"https:\/\/pytorch.org\/docs\/stable\/index.html\">PyTorch Documentation<\/a><\/li>\n<li><a href=\"https:\/\/scikit-learn.org\/stable\/modules\/clustering.html\">Scikit-Learn Clustering<\/a><\/li>\n<li><a href=\"https:\/\/scikit-learn.org\/stable\/modules\/decomposition.html\">Scikit-Learn Decomposition<\/a><\/li>\n<\/ul>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Deep learning is a field of machine learning that automatically learns patterns from data, aiming to create models that extract useful information from input data and make predictions and decisions based on it. Among them, unsupervised learning is a methodology that uses unlabeled data to understand the structure of the data and group similar items &hellip; <a href=\"https:\/\/atmokpo.com\/w\/36579\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Deep Learning PyTorch Course, Unsupervised 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-36579","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, Unsupervised 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\/36579\/\" \/>\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, Unsupervised Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Deep learning is a field of machine learning that automatically learns patterns from data, aiming to create models that extract useful information from input data and make predictions and decisions based on it. Among them, unsupervised learning is a methodology that uses unlabeled data to understand the structure of the data and group similar items &hellip; \ub354 \ubcf4\uae30 &quot;Deep Learning PyTorch Course, Unsupervised Learning&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/36579\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:49:43+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:52:38+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=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/36579\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/36579\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Deep Learning PyTorch Course, Unsupervised Learning\",\"datePublished\":\"2024-11-01T09:49:43+00:00\",\"dateModified\":\"2024-11-01T11:52:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/36579\/\"},\"wordCount\":466,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"PyTorch Study\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/36579\/\",\"url\":\"https:\/\/atmokpo.com\/w\/36579\/\",\"name\":\"Deep Learning PyTorch Course, Unsupervised Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:49:43+00:00\",\"dateModified\":\"2024-11-01T11:52:38+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/36579\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/36579\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/36579\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Deep Learning PyTorch Course, Unsupervised 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, Unsupervised 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\/36579\/","og_locale":"ko_KR","og_type":"article","og_title":"Deep Learning PyTorch Course, Unsupervised Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Deep learning is a field of machine learning that automatically learns patterns from data, aiming to create models that extract useful information from input data and make predictions and decisions based on it. Among them, unsupervised learning is a methodology that uses unlabeled data to understand the structure of the data and group similar items &hellip; \ub354 \ubcf4\uae30 \"Deep Learning PyTorch Course, Unsupervised Learning\"","og_url":"https:\/\/atmokpo.com\/w\/36579\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:49:43+00:00","article_modified_time":"2024-11-01T11:52:38+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":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/36579\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/36579\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Deep Learning PyTorch Course, Unsupervised Learning","datePublished":"2024-11-01T09:49:43+00:00","dateModified":"2024-11-01T11:52:38+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/36579\/"},"wordCount":466,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["PyTorch Study"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/36579\/","url":"https:\/\/atmokpo.com\/w\/36579\/","name":"Deep Learning PyTorch Course, Unsupervised Learning - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:49:43+00:00","dateModified":"2024-11-01T11:52:38+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/36579\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/36579\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/36579\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Deep Learning PyTorch Course, Unsupervised 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\/36579","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=36579"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/36579\/revisions"}],"predecessor-version":[{"id":36580,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/36579\/revisions\/36580"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=36579"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=36579"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=36579"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}