{"id":76086,"date":"2024-05-19T22:06:17","date_gmt":"2024-05-20T02:06:17","guid":{"rendered":"http:\/\/bangla.sitestree.com\/library-import-in-python-for-ml-graph-ml\/"},"modified":"2024-05-19T22:06:17","modified_gmt":"2024-05-20T02:06:17","slug":"library-import-in-python-for-ml-graph-ml","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=76086","title":{"rendered":"Library Import in Python for ML\/Graph ML"},"content":{"rendered":"<h1>import libraries<\/h1>\n<p>import os<br \/>\nimport pandas as pd<br \/>\nimport math<\/p>\n<h1>Import Libraries for Graph, GNN (Graph Neural Network), and GCN (Graph Convolutional Network)<\/h1>\n<p>import stellargraph as sg<br \/>\nfrom stellargraph import StellarGraph<br \/>\nfrom stellargraph.layer import DeepGraphCNN<br \/>\nfrom stellargraph.mapper import FullBatchNodeGenerator<br \/>\nfrom stellargraph.mapper import PaddedGraphGenerator<br \/>\nfrom stellargraph.layer import GCN<\/p>\n<h1>Machine Learning related library Imports (Tensorflow)<\/h1>\n<p>from tensorflow.keras import layers, optimizers, losses, metrics, Model<br \/>\nfrom sklearn import preprocessing, model_selection<br \/>\nfrom IPython.display import display, HTML<br \/>\nimport matplotlib.pyplot as plt<br \/>\n%matplotlib inline<br \/>\nfrom tensorflow.keras.layers import Dense, Conv1D, MaxPool1D, Dropout, Flatten<br \/>\nfrom tensorflow import keras<\/p>\n<p>#how to read data from csv files<br \/>\ndf_s = pd.read_csv(&quot;.\/data\/&quot; + data_file, low_memory = False);<br \/>\ndf_s.head()<\/p>\n<h1>Convert Data Type and Sort Data<\/h1>\n<h1>convert Date field to be a Date Type<\/h1>\n<p>df_s[&quot;Date&quot;] = df_s[&quot;Date&quot;].astype(&#8216;datetime64[ns]&#8217;)<\/p>\n<h1>Sort data by date although this is no longer needed as data already is sorted when I generated data<\/h1>\n<h1>df_s = df_s.sort_values( by = [&#39;Ticker&#39;,&#39;Date&#39;], ascending = True )<\/h1>\n<p>df_s = df_s.sort_values( by = &#8216;Date&#8217;, ascending = True )<br \/>\ndf_s.head()<\/p>\n<h1>drop not available data<\/h1>\n<p>df_s_transpose = df_s_transpose.dropna(axis = 1);<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 library Imports (Tensorflow) from tensorflow.keras &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=76086\">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-76086","post","type-post","status-publish","format-standard","hentry","category---blog","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":76436,"url":"http:\/\/bangla.sitestree.com\/?p=76436","url_meta":{"origin":76086,"position":0},"title":"1. Libraries used for the project: Predict Future Stock Price using Graph Theory, Machine Learning and Deep Learning)","author":"Sayed","date":"December 4, 2024","format":false,"excerpt":"#import libraries import osimport pandas as pdimport math #Import Libraries for Graph, GNN, and GCN import stellargraph as sgfrom stellargraph import StellarGraphfrom stellargraph.layer import DeepGraphCNNfrom stellargraph.mapper import FullBatchNodeGeneratorfrom stellargraph.mapper import PaddedGraphGeneratorfrom stellargraph.layer import GCN #Machine Learnig related library Imports from tensorflow.keras import layers, optimizers, losses, metrics, Modelfrom sklearn import preprocessing,\u2026","rel":"","context":"In &quot;Code: Predict Future Stock Price using Graph Theory, Machine Learning and Deep Learning)&quot;","block_context":{"text":"Code: Predict Future Stock Price using Graph Theory, Machine Learning and Deep Learning)","link":"http:\/\/bangla.sitestree.com\/?cat=1969"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":76091,"url":"http:\/\/bangla.sitestree.com\/?p=76091","url_meta":{"origin":76086,"position":1},"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":16923,"url":"http:\/\/bangla.sitestree.com\/?p=16923","url_meta":{"origin":76086,"position":2},"title":"Python Libraries for Data Science esp. for NLP &#8211; Natural Language Processing","author":"Sayed","date":"February 14, 2020","format":false,"excerpt":"For NLP tasks, either you will come across these libraries or you will have to use many of these Python libraries. import nltk # tokenizer nltk.download(\"punkt\") # stop words nltk.download(\"stopwords\") from nltk.tokenize import TreebankWordTokenizer from nltk.tokenize import WordPunctTokenizer from nltk.tokenize import RegexpTokenizer from nltk.tokenize import sent_tokenize from nltk.corpus import stopwords\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":76087,"url":"http:\/\/bangla.sitestree.com\/?p=76087","url_meta":{"origin":76086,"position":3},"title":"Python\/ML Correlation Coefficients","author":"Sayed","date":"May 19, 2024","format":false,"excerpt":"df_s_transpose_pearson = df_s_transpose.corr(method = 'pearson', numeric_only = True) df_s_transpose_pearson # Pearson Correlation Coefficient df_s_transpose_pearson = df_s_transpose.corr(method = 'pearson', numeric_only = True) df_s_transpose_pearson Pearson Correlation Coefficient based Adjacency Graph Matrix df_s_transpose_pearson[df_s_transpose_pearson >= 0.5] = 1 df_s_transpose_pearson[df_s_transpose_pearson < 0.5] = 0 df_s_transpose_pearson Create a Graph import networkx as nx Graph_pearson = nx.Graph(df_s_transpose_pearson)\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":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-44.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-44.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-44.png?resize=525%2C300 1.5x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-44.png?resize=700%2C400 2x"},"classes":[]},{"id":76075,"url":"http:\/\/bangla.sitestree.com\/?p=76075","url_meta":{"origin":76086,"position":4},"title":"K-Means Clustering","author":"Sayed","date":"May 18, 2024","format":false,"excerpt":"Click on the images to see them clearly #!\/usr\/bin\/env python coding: utf-8 In[1]: k-means clustering from numpy import unique from numpy import where from sklearn.datasets import make_classification from sklearn.cluster import KMeans from matplotlib import pyplot import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as\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":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-40.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-40.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/bangla.sitestree.com\/wp-content\/uploads\/2024\/05\/image-40.png?resize=525%2C300 1.5x"},"classes":[]},{"id":65938,"url":"http:\/\/bangla.sitestree.com\/?p=65938","url_meta":{"origin":76086,"position":5},"title":"EJB 3: Entity Bean Basic #Java Short Notes","author":"Author-Check- Article-or-Video","date":"July 18, 2021","format":false,"excerpt":"Plain Java objects with persistence storage. They are not remotable and must be accessed through the new javax.persistence.EntityManager service. An entity bean implementation is provided in the following three files\/classesBeansOrder.javaLineItem.javaEntity ManagerShoppingCartBean.java\/\/Order.javaimport javax.persistence.CascadeType;import javax.persistence.Entity;import javax.persistence.FetchType;import javax.persistence.GeneratedValue; import javax.persistence.GenerationType;import javax.persistence.Id;import javax.persistence.OneToMany;import javax.persistence.Table;import javax.persistence.Id;import javax.persistence.CascadeType;import javax.persistence.FetchType;import java.util.ArrayList;import java.util.Collection;@Entity@Table(name = \"PURCHASE_ORDER\")public class Order implements\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76086","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=76086"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/76086\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=76086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=76086"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=76086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}