{"id":76087,"date":"2024-05-19T22:15:56","date_gmt":"2024-05-20T02:15:56","guid":{"rendered":"https:\/\/bangla.sitestree.com\/?p=76087"},"modified":"2024-05-19T22:15:56","modified_gmt":"2024-05-20T02:15:56","slug":"python-ml-correlation-coefficients","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=76087","title":{"rendered":"Python\/ML Correlation Coefficients"},"content":{"rendered":"<p>df_s_transpose_pearson = df_s_transpose.corr(method = &#8216;pearson&#8217;, numeric_only = True)<br \/>\ndf_s_transpose_pearson<\/p>\n<p><strong># Pearson Correlation Coefficient<\/strong><\/p>\n<p>df_s_transpose_pearson = df_s_transpose.corr(method = &#8216;pearson&#8217;, numeric_only = True)<br \/>\ndf_s_transpose_pearson<\/p>\n<h1>Pearson Correlation Coefficient based Adjacency Graph Matrix<\/h1>\n<p>df_s_transpose_pearson[df_s_transpose_pearson &gt;= 0.5] = 1<br \/>\ndf_s_transpose_pearson[df_s_transpose_pearson &lt; 0.5] = 0<br \/>\ndf_s_transpose_pearson<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-44.png\" rel=\"attachment wp-att-76088\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-44.png?resize=750%2C750\" alt=\"\" title=\"image-44-png\" width=\"750\" height=\"750\" class=\"alignnone size-full wp-image-76088\" \/><\/a><\/p>\n<h1>Create a Graph<\/h1>\n<p>import networkx as nx<br \/>\nGraph_pearson = nx.Graph(df_s_transpose_pearson)<\/p>\n<h1>before the above step do: make the diagonal element to be zero. No self loop\/edge<\/h1>\n<p>import numpy as np<br \/>\nnp.fill_diagonal(df_s_transpose_pearson.values, 0)<\/p>\n<h1>Draw the graph<\/h1>\n<p>nx.draw_networkx(Graph_pearson, pos = nx.circular_layout( Graph_pearson ), node_color = &#8216;r&#8217;, edge_color = &#8216;b&#8217;)<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-45.png\" rel=\"attachment wp-att-76089\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-45.png?resize=750%2C750\" alt=\"\" title=\"image-45-png\" width=\"750\" height=\"750\" class=\"alignnone size-full wp-image-76089\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>df_s_transpose_pearson = df_s_transpose.corr(method = &#8216;pearson&#8217;, numeric_only = True) df_s_transpose_pearson # Pearson Correlation Coefficient df_s_transpose_pearson = df_s_transpose.corr(method = &#8216;pearson&#8217;, numeric_only = True) df_s_transpose_pearson Pearson Correlation Coefficient based Adjacency Graph Matrix df_s_transpose_pearson[df_s_transpose_pearson &gt;= 0.5] = 1 df_s_transpose_pearson[df_s_transpose_pearson &lt; 0.5] = 0 df_s_transpose_pearson Create a Graph import networkx as nx Graph_pearson = nx.Graph(df_s_transpose_pearson) before the above step do: &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=76087\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[182],"tags":[],"class_list":["post-76087","post","type-post","status-publish","format-standard","hentry","category---blog","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":76091,"url":"http:\/\/bangla.sitestree.com\/?p=76091","url_meta":{"origin":76087,"position":0},"title":"Spearman Correlation Coefficient and Graph Mining","author":"Sayed","date":"May 19, 2024","format":false,"excerpt":"#!\/usr\/bin\/env python coding: utf-8 # 3rd Model: Deepgraph CNN: Stock Price Prediction using DeepGraphCNN Neural Networks. It includes GCN layers and CNN layers. I have added an MLP at the last layer to predict stock prices. # # Input graphs were created for spearman, Spearman, and Kendal Tau correlations\/coefficients from\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78291,"url":"http:\/\/bangla.sitestree.com\/?p=78291","url_meta":{"origin":76087,"position":1},"title":"Pearson vs Spearman Correlation","author":"Sayed","date":"June 1, 2025","format":false,"excerpt":"Pearson: Generally Linear relation Assumes Linearity. Correlation between height and weight Sensitive to outliers. Spearman: increasing or decreasing relationship, but may not be linear. Monotonic. Higher marks lead to lower ranks, but generally not linearly. Does not assume Linearity. It can be good for categorical variables and relationships. Less Sensitive\u2026","rel":"","context":"In &quot;Analytics and Machine Learning Project Development&quot;","block_context":{"text":"Analytics and Machine Learning Project Development","link":"http:\/\/bangla.sitestree.com\/?cat=1974"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78242,"url":"http:\/\/bangla.sitestree.com\/?p=78242","url_meta":{"origin":76087,"position":2},"title":"Statistics for Data Analytics and Machine Learning Projects","author":"Sayed","date":"May 22, 2025","format":false,"excerpt":"\u2022Null Hypothesis \u2022[2] \u2022Paired t-test \u2022Unpaired t-test \u2022Pearson Correlation \u2022One Way: Analysis of variance \u2022Spearman Correlation \u2022Spearman \u2022Kendal Tau Coef \u2022Wilcoxon Sum test \u2022Basic EDA \u2022Mcnaimer\u2019s test \u2022Friedman test \u2022Kruskal-Wallis Test \u2022Two Way Analysis of variance \u2022K-Fold Cross Validation paired t-test \u2022Wilcoxon Signed Rank Test Data Analytics, Machine Learning, Data\u2026","rel":"","context":"In &quot;Analytics and Machine Learning Project Development&quot;","block_context":{"text":"Analytics and Machine Learning Project Development","link":"http:\/\/bangla.sitestree.com\/?cat=1974"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/05\/image-37.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/05\/image-37.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2025\/05\/image-37.png?resize=525%2C300 1.5x"},"classes":[]},{"id":16536,"url":"http:\/\/bangla.sitestree.com\/?p=16536","url_meta":{"origin":76087,"position":3},"title":"Part 2: Some basic Math\/Statistics concepts that Data Scientists (the true ones) will usually know\/use","author":"Sayed","date":"December 29, 2019","format":false,"excerpt":"Part 2: Some basic Math\/Statistics concepts that Data Scientists (the true ones) will usually know\/use (came across, studied, learned, used) Covariance and Correlation \"Covariance is a measure of how two variables change together, but its magnitude is unbounded, so it is difficult to interpret. By dividing covariance by the product\u2026","rel":"","context":"In &quot;Math and Statistics for Data Science, and Engineering&quot;","block_context":{"text":"Math and Statistics for Data Science, and Engineering","link":"http:\/\/bangla.sitestree.com\/?cat=1908"},"img":{"alt_text":"[eq5]","src":"https:\/\/i0.wp.com\/www.statlect.com\/images\/covariance-formula__12.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":76086,"url":"http:\/\/bangla.sitestree.com\/?p=76086","url_meta":{"origin":76087,"position":4},"title":"Library Import in Python for ML\/Graph ML","author":"Sayed","date":"May 19, 2024","format":false,"excerpt":"import libraries import os import pandas as pd import math Import Libraries for Graph, GNN (Graph Neural Network), and GCN (Graph Convolutional Network) import stellargraph as sg from stellargraph import StellarGraph from stellargraph.layer import DeepGraphCNN from stellargraph.mapper import FullBatchNodeGenerator from stellargraph.mapper import PaddedGraphGenerator from stellargraph.layer import GCN Machine Learning related\u2026","rel":"","context":"In &quot;\u09ac\u09cd\u09b2\u0997 \u0964 Blog&quot;","block_context":{"text":"\u09ac\u09cd\u09b2\u0997 \u0964 Blog","link":"http:\/\/bangla.sitestree.com\/?cat=182"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":14811,"url":"http:\/\/bangla.sitestree.com\/?p=14811","url_meta":{"origin":76087,"position":5},"title":"Next Recession: How to Invest and Profit in the Next Recession","author":"Sayed","date":"June 17, 2019","format":false,"excerpt":"How to Invest and Profit in the Next Recession https:\/\/www.bloomberg.com\/opinion\/articles\/2019-06-17\/how-to-invest-and-profit-in-the-next-recession \" plan on deploying your cash in tranches: Buy a U.S. index fund when markets are down 20 to 25%; add a developed global index fund when markets fall by 30%. And if we are lucky enough to enjoy a\u2026","rel":"","context":"In &quot;AI ML DS RL DL NN NLP Data Mining Optimization&quot;","block_context":{"text":"AI ML DS RL DL NN NLP Data Mining Optimization","link":"http:\/\/bangla.sitestree.com\/?cat=1910"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76087","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=76087"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76087\/revisions"}],"predecessor-version":[{"id":76090,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76087\/revisions\/76090"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76087"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}