{"id":782,"date":"2018-11-25T18:38:18","date_gmt":"2018-11-26T00:38:18","guid":{"rendered":"http:\/\/www.jacobsoft.com.mx\/?p=782"},"modified":"2025-02-20T13:37:49","modified_gmt":"2025-02-20T19:37:49","slug":"k-nearest-neighbors","status":"publish","type":"post","link":"https:\/\/www.jacobsoft.com.mx\/en\/k-nearest-neighbors\/","title":{"rendered":"K-Nearest Neighbors"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Nearest K-Neighbors (KNN)<\/h2>\n\n\n\n<p>KNN is a method of <strong>supervised classification<\/strong> which serves to estimate the density function:<\/p>\n\n\n\n<p><strong>f (x \/ Cj)<\/strong><\/p>\n\n\n\n<p>Where <strong>x<\/strong> is the independent variable and <strong>Cj<\/strong> class j, so the function determines the a posteriori probability that the variable x belongs to class j.<\/p>\n\n\n\n<p>At <strong><a rel=\"noreferrer noopener\" aria-label=\"En el reconocimiento de patrones, el algoritmo KNN es utilizado como m\u00e9todo de clasificaci\u00f3n de objetos con un entrenamiento a trav\u00e9s de ejemplos cercanos en el espacio de diversos elementos. Cada elemento esta descrito en t\u00e9rminos de p atributos considerando q clases para la clasificaci\u00f3n. (opens in a new tab)\" href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=579862.462&amp;type=3&amp;subid=0&amp;LSNSUBSITE=LSNSUBSITE\" target=\"_blank\">pattern recognition<\/a><\/strong>, the KNN algorithm is used as a method of classifying objects with a <strong>training <\/strong>through close examples in the space of various elements. Each element is described in terms of <strong>p<\/strong> attributes considering <strong>q<\/strong> Classes for classification.<\/p>\n\n\n\n<p><strong>Ch\u00e9calo en video aqu\u00ed:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Los K Vecinos m\u00e1s Cercanos | K Nearest Neighbors | KNN Algoritmo con Python\" width=\"780\" height=\"439\" src=\"https:\/\/www.youtube.com\/embed\/RBw3hRJmX7I?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>The space of the values \u200b\u200bof the independent variable is <strong>partitioned <\/strong>in regions by locations and labels of the elements of <strong>training<\/strong>. In this way a point in space is assigned to the class<strong> C<\/strong>, if this is the class <strong>More frequently<\/strong> between the <strong>k<\/strong> closest elements.<\/p>\n\n\n\n<p>The Euclidean distance is commonly used to determine the proximity of the elements:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"309\" height=\"122\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/distancia_euclidiana.png\" alt=\"\" class=\"wp-image-784\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/distancia_euclidiana.png 309w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/distancia_euclidiana-300x118.png 300w\" sizes=\"auto, (max-width: 309px) 100vw, 309px\" \/><figcaption>Equation of the Euclidean distance<\/figcaption><\/figure><\/div>\n\n\n\n<p>The phase of <strong>training <\/strong>it consists of storing the characteristic vectors and the labels of the classes of said training elements.<\/p>\n\n\n\n<p>In the phase of <strong>classification <\/strong>the distance between the stored vectors and the new vector is calculated and the <strong>k<\/strong> closest elements.<\/p>\n\n\n\n<p>The <strong>new vector<\/strong> it is classified with the class that is most repeated in the selected vectors.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-2380084220870127\"\n     crossorigin=\"anonymous\"><\/script>\n<ins class=\"adsbygoogle\"\n     style=\"display:block; text-align:center;\"\n     data-ad-layout=\"in-article\"\n     data-ad-format=\"fluid\"\n     data-ad-client=\"ca-pub-2380084220870127\"\n     data-ad-slot=\"2437322509\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example<\/h3>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"543\" height=\"474\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn1.png\" alt=\"\" class=\"wp-image-785\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn1.png 543w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn1-300x262.png 300w\" sizes=\"auto, (max-width: 543px) 100vw, 543px\" \/><figcaption>Data set classified into two categories<\/figcaption><\/figure><\/div>\n\n\n\n<p>Considering a set of data classified in <strong>two categories<\/strong>, as shown in the previous graph, it is required to classify a new data vector that is in the region shown in the following graph.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"521\" height=\"474\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn2.png\" alt=\"\" class=\"wp-image-786\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn2.png 521w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn2-300x273.png 300w\" sizes=\"auto, (max-width: 521px) 100vw, 521px\" \/><figcaption>Classification of a new data vector<\/figcaption><\/figure><\/div>\n\n\n\n<p>The KNN algorithm follows the following steps to determine to which category the new data to be classified belongs:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Step 1<\/strong>: Select the number of neighboring K<\/li><li><strong>Step 2<\/strong>: Take the K nearest neighbors to the new element according to the Euclidean distance<\/li><li><strong>Step 3<\/strong>: Among the neighboring K, count the number of elements that belong to each category<\/li><li><strong>Step 4<\/strong>: Assign the new element to the category where more neighbors were counted<\/li><\/ul>\n\n\n\n<p>Taking for the example that K = 5, we mark the 5 closest neighbors to the new element<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"757\" height=\"474\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn3.png\" alt=\"\" class=\"wp-image-788\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn3.png 757w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn3-300x188.png 300w\" sizes=\"auto, (max-width: 757px) 100vw, 757px\" \/><figcaption>Selection of the K = 5 nearest neighbors to the new element<\/figcaption><\/figure><\/div>\n\n\n\n<p>We count that there are 3 elements of category 1 and two elements of category 2 of the 5 closest neighbors<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"858\" height=\"416\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn4.png\" alt=\"\" class=\"wp-image-789\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn4.png 858w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn4-300x145.png 300w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn4-768x372.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><figcaption>3 items from category 1 and 2 items from category 2<\/figcaption><\/figure><\/div>\n\n\n\n<p>Therefore, the category with the most elements counted is category 1, so the new element is assigned to the <strong>category 1<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"858\" height=\"422\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn5.png\" alt=\"\" class=\"wp-image-790\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn5.png 858w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn5-300x148.png 300w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn5-768x378.png 768w\" sizes=\"auto, (max-width: 858px) 100vw, 858px\" \/><figcaption>The new element was assigned to category 1, since for K = 5 there are more neighbors in that category<\/figcaption><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-2380084220870127\"\n     crossorigin=\"anonymous\"><\/script>\n<ins class=\"adsbygoogle\"\n     style=\"display:block; text-align:center;\"\n     data-ad-layout=\"in-article\"\n     data-ad-format=\"fluid\"\n     data-ad-client=\"ca-pub-2380084220870127\"\n     data-ad-slot=\"2437322509\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">KNN with Python<\/h2>\n\n\n\n<p>For the example with <strong><a rel=\"noreferrer noopener\" aria-label=\"Para el ejemplo con Python utilizaremos un conjunto de datos (opens in a new tab)\" href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=347188.10000502&amp;type=3&amp;subid=0\" target=\"_blank\">Python <\/a><\/strong>We will use a set of data with customer records that they bought and did not buy. So we have two categories: Bought = 1 and No Buy = 0.<\/p>\n\n\n\n<p>The independent variable is composed of data on gender, age and the estimated salary of the client, however for the graphic example we will use only age and estimated salary as independent variables:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"679\" height=\"538\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn6.png\" alt=\"\" class=\"wp-image-794\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn6.png 679w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn6-300x238.png 300w\" sizes=\"auto, (max-width: 679px) 100vw, 679px\" \/><figcaption>Data set for the example with python<\/figcaption><\/figure><\/div>\n\n\n\n<p>The first step is to load the necessary libraries for the machine learning model and load the data file by separating the independent variables in X and the dependent variable in Y<\/p>\n\n\n\n\n<pre><span class=\"com\">\n# K-Nearest Neighbors (K-NN) # Import libraries\n<\/span>\n<span class=\"key\">import<\/span> numpy <span class=\"key\">ace<\/span> np\n<span class=\"key\">import<\/span> matplotlib.pyplot <span class=\"key\">ace<\/span> plt\n<span class=\"key\">import<\/span> pandas <span class=\"key\">ace<\/span> P.S\n\n<span class=\"com\"># Import the dataset<\/span>\ndataset = pd.read_csv (&#039;<span class=\"tex\">Social_Network_Ads.csv<\/span>&#039;) X = dataset.iloc [:, [<span class=\"key\">2<\/span>, <span class=\"key\">3<\/span>]]. values \u200b\u200by = dataset.iloc [:, <span class=\"key\">4<\/span>] .values\n<\/pre>\n\n\n\n<p>When executing the previous code we have the following for the variable X and Y:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"541\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn7.png\" alt=\"\" class=\"wp-image-795\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn7.png 723w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn7-300x224.png 300w\" sizes=\"auto, (max-width: 723px) 100vw, 723px\" \/><figcaption>Independent variable X with age and salary, dependent variable Y (I buy 1, I do not buy 0)<\/figcaption><\/figure><\/div>\n\n\n\n<p>Now we separate the data into sub sets, training and testing, leaving 25% of the records for testing and 75% for training, then adjust the scales.<\/p>\n\n\n\n\n<pre><span class=\"com\"># We create the training set and # we separate it from the test set<\/span>\n<span class=\"key\">desde<\/span> sklearn.model_selection <span class=\"key\">import<\/span> train_test_split X_train, X_test, y_train, y_test = train_test_split (X, y, test_size = <span class=\"key\">0.25<\/span>, random_state = <span class=\"key\">0<\/span>)\n\n<span class=\"com\"># Scale adjustment<\/span>\n<span class=\"key\">desde<\/span> sklearn.preprocessing <span class=\"key\">import<\/span> StandardScaler sc = StandardScaler () X_train = sc.fit_transform (X_train) X_test = sc.transform (X_test)\n\n<\/pre>\n\n\n\n<p>After adjusting the scales we have the following for X_train and X_test:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"735\" height=\"543\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn8.png\" alt=\"\" class=\"wp-image-796\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn8.png 735w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn8-300x222.png 300w\" sizes=\"auto, (max-width: 735px) 100vw, 735px\" \/><figcaption>Training set and test set with scales adjustment<\/figcaption><\/figure><\/div>\n\n\n\n<p>Now we train the model and predict the X_test set. The model for the algorithm <strong>KNN <\/strong>we get it from the class <strong>KNeighborsClassifier <\/strong>from the bookstore <strong><a href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=347188.10000502&amp;type=3&amp;subid=0\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Ahora entrenamos el modelo y predecimos el conjunto X_test. El modelo para el algoritmo KNN lo obtenemos de la clase KNeighborsClassifier de la librer\u00eda sklearn (opens in a new tab)\">sklearn<\/a><\/strong><\/p>\n\n\n\n\n<pre><span class=\"com\"># Training of the KNN model<\/span>\n<span class=\"key\">desde<\/span> sklearn.neighbors <span class=\"key\">import<\/span> KNeighborsClassifier classifier = KNeighborsClassifier (n_neighbors = <span class=\"key\">5<\/span>, metric = &#039;minkowski&#039;, p = <span class=\"key\">2<\/span>) classifier.fit (X_train, y_train)\n\n<span class=\"com\"># Prediction of the test set<\/span>\ny_pred = classifier.predict (X_test)\n\n<span class=\"com\"># Matrix of confusion<\/span>\n<span class=\"key\">desde<\/span> sklearn.metrics <span class=\"key\">import<\/span> confusion_matrix cm = confusion_matrix (y_test, y_pred)\n<\/pre>\n\n\n\n<p>With the metric <strong>minkowski<\/strong> Y <strong>p = 2<\/strong> in the arguments of the class constructor <strong>KNeighborsClassifier <\/strong>we are telling you to use the <strong>Euclidean distance<\/strong> as a method to find the nearest neighbors.<\/p>\n\n\n\n<p>With the prediction of the test set <strong>X_test<\/strong> presents the result to us <strong>y_pred<\/strong> and we create the matrix of confusion <strong>cm<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"416\" height=\"338\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn9.png\" alt=\"\" class=\"wp-image-797\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn9.png 416w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn9-300x244.png 300w\" sizes=\"auto, (max-width: 416px) 100vw, 416px\" \/><figcaption>Confusion matrix for the test set and the prediction<\/figcaption><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-2380084220870127\"\n     crossorigin=\"anonymous\"><\/script>\n<ins class=\"adsbygoogle\"\n     style=\"display:block; text-align:center;\"\n     data-ad-layout=\"in-article\"\n     data-ad-format=\"fluid\"\n     data-ad-client=\"ca-pub-2380084220870127\"\n     data-ad-slot=\"2437322509\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p><\/p>\n\n\n\n<p>We observed that of 100 records of the test set, there were 4 false negatives and 3 false positives that give 7 errors, which represents a <strong>93% accuracy<\/strong> of the classification model for the closest K-neighbors.<\/p>\n\n\n\n<p>If we graph the prediction of the test set we obtain the following:<\/p>\n\n\n\n\n<pre><span class=\"com\"># Visualization of the test data<\/span>\n<span class=\"key\">desde<\/span> matplotlib.colors <span class=\"key\">import<\/span> ListedColormap X_set, y_set = X_test, y_test X1, X2 = np.meshgrid (np.arange (start = X_set [:, <span class=\"key\">0<\/span>] .min () - <span class=\"key\">1<\/span>, stop = X_set [:, <span class=\"key\">0<\/span>] .max () + <span class=\"key\">1<\/span>, step = <span class=\"key\">0.01<\/span>), np.arange (start = X_set [:, <span class=\"key\">1<\/span>] .min () - <span class=\"key\">1<\/span>, stop = X_set [:, <span class=\"key\">1<\/span>] .max () + <span class=\"key\">1<\/span>, step = <span class=\"key\">0.01<\/span>)) plt.contourf (X1, X2, classifier.predict (np.array ([X1.ravel (), X2.ravel ()]). T) .reshape (X1.shape), alpha = <span class=\"key\">0.75<\/span>, cmap = ListedColormap ((&#039;<span class=\"tex\">net<\/span>', '<span class=\"tex\">green<\/span>&#039;))) plt.xlim (X1.min (), X1.max ()) plt.ylim (X2.min (), X2.max ()) for i, j in enumerate (np.unique (y_set)) : plt.scatter (X_set [y_set == j, <span class=\"key\">0<\/span>], X_set [y_set == j, <span class=\"key\">1<\/span>], c = ListedColormap ((&#039;<span class=\"tex\">net<\/span>', '<span class=\"tex\">green<\/span>&#039;)) (i), label = j) plt.title (&#039;<span class=\"tex\">K-NN (Test)<\/span>&#039;) plt.xlabel (&#039;<span class=\"tex\">Age<\/span>&#039;) plt.ylabel (&#039;<span class=\"tex\">Estimated salary<\/span>&#039;) plt.legend () plt.show ()\n\n<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"533\" height=\"474\" src=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn10.png\" alt=\"\" class=\"wp-image-798\" srcset=\"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn10.png 533w, https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn10-300x267.png 300w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/><figcaption>Prediction plot of the test set<\/figcaption><\/figure><\/div>\n\n\n\n<p>In the graph we can see the 4 red dots on the green area and the 3 green dots on the red area that represent both the false negatives and the false positives respectively.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Final comments<\/h3>\n\n\n\n<p>For handling python, this <strong><a rel=\"noreferrer noopener\" aria-label=\"Para el manejo de python, este curso podr\u00eda ser el indicado para iniciar con python. Adicionalmente&nbsp; (opens in a new tab)\" href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=347188.10000502&amp;type=3&amp;subid=0\" target=\"_blank\">course could be the indicated<\/a><\/strong> to start with python. Additionally, if you are interested in running these models in the <strong><a rel=\"noreferrer noopener\" aria-label=\"Para el manejo de python, este curso podr\u00eda ser el indicado para iniciar con python. Adicionalmente, si te interesa ejecutar estos modelos en la nube,&nbsp;&nbsp; (opens in a new tab)\" href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=347188.10000384&amp;type=3&amp;subid=0\" target=\"_blank\">cloud<\/a><\/strong>, this free webinar of <strong><a rel=\"noreferrer noopener\" aria-label=\"Para el manejo de python, este curso podr\u00eda ser el indicado para iniciar con python. Adicionalmente, si te interesa ejecutar estos modelos en la nube,&nbsp; este webinar gratuito de Azure te podr\u00e1 servir para conocer&nbsp; (opens in a new tab)\" href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=579862.462&amp;type=3&amp;subid=0&amp;LSNSUBSITE=LSNSUBSITE\" target=\"_blank\">Azure <\/a><\/strong>You can use it to know the operation details of this platform, which, like <strong><a rel=\"noreferrer noopener\" aria-label=\"Para el manejo de python, este curso podr\u00eda ser el indicado para iniciar con python. Adicionalmente, si te interesa ejecutar estos modelos en la nube,&nbsp; este webinar gratuito de Azure te podr\u00e1 servir para conocer los detalles de operaci\u00f3n de dicha plataforma, que al igual que Amazon Web Service son&nbsp; (opens in a new tab)\" href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=579862.373&amp;type=3&amp;subid=0&amp;LSNSUBSITE=LSNSUBSITE\" target=\"_blank\">Amazon Web Service<\/a><\/strong> are processing schemes and cloud services for <strong><a href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=579862.372&amp;type=3&amp;subid=0&amp;LSNSUBSITE=LSNSUBSITE\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Para el manejo de python, este curso podr\u00eda ser el indicado para iniciar con python. Adicionalmente, si te interesa ejecutar estos modelos en la nube,&nbsp; este webinar gratuito de Azure te podr\u00e1 servir para conocer los detalles de operaci\u00f3n de dicha plataforma, que al igual que Amazon Web Service son esquemas de procesamiento y servicios en la nube para machine learning y otras soluciones. (opens in a new tab)\">machine learning<\/a><\/strong> and other solutions.<\/p>\n\n\n\n<p>Finally, for the management of databases we can start with these <strong><a rel=\"noreferrer noopener\" aria-label=\"Por \u00faltimo, para el manejo de bases de datos podemos iniciar con estos cursos tanto de dise\u00f1o como de pr\u00e1ctica de SQL. (opens in a new tab)\" href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=347188.10000671&amp;type=3&amp;subid=0\" target=\"_blank\">courses <\/a><\/strong>so much <strong><a rel=\"noreferrer noopener\" aria-label=\"Por \u00faltimo, para el manejo de bases de datos podemos iniciar con estos cursos tanto de dise\u00f1o como de pr\u00e1ctica de SQL. (opens in a new tab)\" href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=347188.10000671&amp;type=3&amp;subid=0\" target=\"_blank\">design <\/a><\/strong>like <strong><a href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=347188.10000506&amp;type=3&amp;subid=0\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Por \u00faltimo, para el manejo de bases de datos podemos iniciar con estos cursos tanto de dise\u00f1o como de pr\u00e1ctica de SQL. (opens in a new tab)\">SQL practice<\/a><\/strong>.<\/p>\n\n\n\n<a href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=579862.40&amp;subid=0&amp;type=4&amp;LSNSUBSITE=LSNSUBSITE\"><img decoding=\"async\" border=\"0\" alt=\"QuickStart\" src=\"https:\/\/ad.linksynergy.com\/fs-bin\/show?id=cTjR400Zjac&amp;bids=579862.40&amp;subid=0&amp;type=4&amp;gridnum=16\" data-lazy-src=\"https:\/\/ad.linksynergy.com\/fs-bin\/show?id=cTjR400Zjac&amp;is-pending-load=1#038;bids=579862.40&amp;subid=0&amp;type=4&amp;gridnum=16\" srcset=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" class=\"jetpack-lazy-image\"><noscript><img decoding=\"async\" border=\"0\" alt=\"QuickStart\" src=\"https:\/\/ad.linksynergy.com\/fs-bin\/show?id=cTjR400Zjac&amp;bids=579862.40&amp;subid=0&amp;type=4&amp;gridnum=16\"><\/noscript><\/a>\n\n\n\n<div style=\"height:50px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<a href=\"https:\/\/click.linksynergy.com\/fs-bin\/click?id=cTjR400Zjac&amp;offerid=584883.11&amp;subid=0&amp;type=4\"><img decoding=\"async\" border=\"0\" alt=\"Alibaba Cloud\" src=\"https:\/\/ad.linksynergy.com\/fs-bin\/show?id=cTjR400Zjac&amp;bids=584883.11&amp;subid=0&amp;type=4&amp;gridnum=16\" data-lazy-src=\"https:\/\/ad.linksynergy.com\/fs-bin\/show?id=cTjR400Zjac&amp;is-pending-load=1#038;bids=584883.11&amp;subid=0&amp;type=4&amp;gridnum=16\" srcset=\"data:image\/gif;base64,R0lGODlhAQABAIAAAAAAAP\/\/\/yH5BAEAAAAALAAAAAABAAEAAAIBRAA7\" class=\"jetpack-lazy-image\"><noscript><img decoding=\"async\" border=\"0\" alt=\"Alibaba Cloud\" src=\"https:\/\/ad.linksynergy.com\/fs-bin\/show?id=cTjR400Zjac&amp;bids=584883.11&amp;subid=0&amp;type=4&amp;gridnum=16\"><\/noscript><\/a>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<style class=\"advgb-styles-renderer\">\n.com{color:gray;}\n.key{color:blue;}\n.tex{color:green;}\n\n.com{color:gray;}\n.key{color:blue;}\n.tex{color:green;}\n\n.com{color:gray;}\n.key{color:blue;}\n.tex{color:green;}\n\n.com{color:gray;}\n.key{color:blue;}\n.tex{color:green;}\n<\/style>","protected":false},"excerpt":{"rendered":"<p>K-Vecinos m\u00e1s cercanos (KNN) KNN es un m\u00e9todo de clasificaci\u00f3n supervisada que sirve para estimar &hellip; <\/p>","protected":false},"author":2,"featured_media":783,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"advgb_blocks_editor_width":"","advgb_blocks_columns_visual_guide":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[25,35,46],"tags":[57,55,58,56,82,96,50,59],"class_list":["post-782","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-algoritmos","category-inteligencia-artificial","category-machine-learning","tag-ciencia-de-datos","tag-clasificacion","tag-data-mining","tag-data-science","tag-inteligencia-artificial","tag-knn","tag-machine-learning","tag-mineria-de-datos"],"aioseo_notices":[],"author_meta":{"display_name":"Jacob Avila Camacho","author_link":"https:\/\/www.jacobsoft.com.mx\/en\/author\/jacob-avila\/"},"featured_img":"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn-300x165.png","featured_image_src":"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn.png","featured_image_src_square":"https:\/\/www.jacobsoft.com.mx\/wp-content\/uploads\/2018\/11\/knn.png","author_info":{"display_name":"Jacob Avila Camacho","author_link":"https:\/\/www.jacobsoft.com.mx\/en\/author\/jacob-avila\/"},"coauthors":[],"tax_additional":{"categories":{"linked":["<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/algoritmos\/\" class=\"advgb-post-tax-term\">Algoritmos<\/a>","<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/\" class=\"advgb-post-tax-term\">Inteligencia Artificial<\/a>","<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/machine-learning\/\" class=\"advgb-post-tax-term\">Machine Learning<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">Algoritmos<\/span>","<span class=\"advgb-post-tax-term\">Inteligencia Artificial<\/span>","<span class=\"advgb-post-tax-term\">Machine Learning<\/span>"]},"tags":{"linked":["<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/machine-learning\/\" class=\"advgb-post-tax-term\">Ciencia de Datos<\/a>","<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/machine-learning\/\" class=\"advgb-post-tax-term\">clasificaci\u00f3n<\/a>","<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/machine-learning\/\" class=\"advgb-post-tax-term\">Data Mining<\/a>","<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/machine-learning\/\" class=\"advgb-post-tax-term\">Data Science<\/a>","<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/machine-learning\/\" class=\"advgb-post-tax-term\">Inteligencia Artificial<\/a>","<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/machine-learning\/\" class=\"advgb-post-tax-term\">knn<\/a>","<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/machine-learning\/\" class=\"advgb-post-tax-term\">machine learning<\/a>","<a href=\"https:\/\/www.jacobsoft.com.mx\/en\/category\/inteligencia-artificial\/machine-learning\/\" class=\"advgb-post-tax-term\">Miner\u00eda de Datos<\/a>"],"unlinked":["<span class=\"advgb-post-tax-term\">Ciencia de Datos<\/span>","<span class=\"advgb-post-tax-term\">clasificaci\u00f3n<\/span>","<span class=\"advgb-post-tax-term\">Data Mining<\/span>","<span class=\"advgb-post-tax-term\">Data Science<\/span>","<span class=\"advgb-post-tax-term\">Inteligencia Artificial<\/span>","<span class=\"advgb-post-tax-term\">knn<\/span>","<span class=\"advgb-post-tax-term\">machine learning<\/span>","<span class=\"advgb-post-tax-term\">Miner\u00eda de Datos<\/span>"]}},"comment_count":"10","relative_dates":{"created":"Posted 7 years ago","modified":"Updated 1 year ago"},"absolute_dates":{"created":"Posted on November 25, 2018","modified":"Updated on February 20, 2025"},"absolute_dates_time":{"created":"Posted on November 25, 2018 6:38 pm","modified":"Updated on February 20, 2025 1:37 pm"},"featured_img_caption":"","series_order":"","_links":{"self":[{"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/posts\/782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/comments?post=782"}],"version-history":[{"count":10,"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/posts\/782\/revisions"}],"predecessor-version":[{"id":1797,"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/posts\/782\/revisions\/1797"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/media\/783"}],"wp:attachment":[{"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/media?parent=782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/categories?post=782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jacobsoft.com.mx\/en\/wp-json\/wp\/v2\/tags?post=782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}