noshot 0.1.6__py3-none-any.whl → 0.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- noshot/data/ML TS XAI/ML/1. PCA - EDA/PCA-EDA.ipynb +207 -0
- noshot/data/ML TS XAI/ML/1. PCA - EDA/balance-scale.csv +626 -0
- noshot/data/ML TS XAI/ML/1. PCA - EDA/input.txt +625 -0
- noshot/data/ML TS XAI/ML/2. KNN Classifier/KNN.ipynb +287 -0
- noshot/data/ML TS XAI/ML/2. KNN Classifier/balance-scale.csv +626 -0
- noshot/data/ML TS XAI/ML/2. KNN Classifier/input.txt +625 -0
- noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/LDA.ipynb +83 -0
- noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/balance-scale.csv +626 -0
- noshot/data/ML TS XAI/ML/3. Linear Discriminant Analysis/input.txt +625 -0
- noshot/data/ML TS XAI/ML/4. Linear Regression/Linear-Regression.ipynb +117 -0
- noshot/data/ML TS XAI/ML/4. Linear Regression/machine-data.csv +210 -0
- noshot/data/ML TS XAI/ML/5. Logistic Regression/Logistic-Regression.ipynb +137 -0
- noshot/data/ML TS XAI/ML/5. Logistic Regression/wine-dataset.csv +179 -0
- noshot/data/ML TS XAI/ML/6. Bayesian Classifier/Bayesian.ipynb +129 -0
- noshot/data/ML TS XAI/ML/6. Bayesian Classifier/wine-dataset.csv +179 -0
- {noshot-0.1.6.dist-info → noshot-0.1.8.dist-info}/METADATA +2 -2
- noshot-0.1.8.dist-info/RECORD +24 -0
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(A) Breadth First Search.ipynb +0 -112
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(B) Depth First Search.ipynb +0 -111
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(C) Uniform Cost Search.ipynb +0 -134
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(D) Depth Limites Search.ipynb +0 -115
- noshot/data/ML TS XAI/AIDS/1. Implement Basic Search Strategies/(E) Iterative Deepening DFS.ipynb +0 -123
- noshot/data/ML TS XAI/AIDS/10. ANOVA/2_ANOVA.csv +0 -769
- noshot/data/ML TS XAI/AIDS/10. ANOVA/One Way ANOVA (Repeated Measure).ipynb +0 -126
- noshot/data/ML TS XAI/AIDS/10. ANOVA/One Way ANOVA.ipynb +0 -134
- noshot/data/ML TS XAI/AIDS/10. ANOVA/Sample 1 Way ANOVA Test.ipynb +0 -119
- noshot/data/ML TS XAI/AIDS/10. ANOVA/Two Way ANOVA.ipynb +0 -138
- noshot/data/ML TS XAI/AIDS/10. ANOVA/reaction_time.csv +0 -5
- noshot/data/ML TS XAI/AIDS/10. ANOVA/sample_data.csv +0 -16
- noshot/data/ML TS XAI/AIDS/10. ANOVA/sleep_deprivation.csv +0 -4
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/3_Linear.csv +0 -4802
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression LAB.ipynb +0 -113
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression New- sklearn.ipynb +0 -118
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/Linear Regression.ipynb +0 -148
- noshot/data/ML TS XAI/AIDS/11. Linear Regression/house_rate.csv +0 -22
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/Logistic Regression New- sklearn.ipynb +0 -128
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/Logistic Regression.ipynb +0 -145
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/default.csv +0 -1001
- noshot/data/ML TS XAI/AIDS/12. Logistic Regression/hours_scores_records.csv +0 -101
- noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(A) Astar.ipynb +0 -256
- noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(B) IDAstar.ipynb +0 -157
- noshot/data/ML TS XAI/AIDS/2. Implement A Star And MA Star/(C) SMAstar.ipynb +0 -178
- noshot/data/ML TS XAI/AIDS/3. Genetic Algorithm/Genetic.ipynb +0 -95
- noshot/data/ML TS XAI/AIDS/4. Simulated Annealing/Simulated Annealing.ipynb +0 -74
- noshot/data/ML TS XAI/AIDS/4. Simulated Annealing/Sudoku Simulated Annealing.ipynb +0 -103
- noshot/data/ML TS XAI/AIDS/5. Alpha Beta Pruning/AlphaBetaPruning.ipynb +0 -182
- noshot/data/ML TS XAI/AIDS/6. Consraint Satisfaction Problems (CSP)/(A) CSP House Allocation.ipynb +0 -120
- noshot/data/ML TS XAI/AIDS/6. Consraint Satisfaction Problems (CSP)/(B) CSP Map Coloring.ipynb +0 -125
- noshot/data/ML TS XAI/AIDS/7. Random Sampling/Random Sampling.ipynb +0 -73
- noshot/data/ML TS XAI/AIDS/7. Random Sampling/height_weight_bmi.csv +0 -8389
- noshot/data/ML TS XAI/AIDS/8. Z Test/Z Test Hash Function.ipynb +0 -141
- noshot/data/ML TS XAI/AIDS/8. Z Test/Z Test.ipynb +0 -151
- noshot/data/ML TS XAI/AIDS/8. Z Test/height_weight_bmi.csv +0 -8389
- noshot/data/ML TS XAI/AIDS/9. T Test/1_heart.csv +0 -304
- noshot/data/ML TS XAI/AIDS/9. T Test/Independent T Test.ipynb +0 -119
- noshot/data/ML TS XAI/AIDS/9. T Test/Paired T Test.ipynb +0 -118
- noshot/data/ML TS XAI/AIDS/9. T Test/T Test Hash Function.ipynb +0 -142
- noshot/data/ML TS XAI/AIDS/9. T Test/T Test.ipynb +0 -158
- noshot/data/ML TS XAI/AIDS/9. T Test/height_weight_bmi.csv +0 -8389
- noshot/data/ML TS XAI/AIDS/9. T Test/iq_test.csv +0 -0
- noshot/data/ML TS XAI/AIDS/Others (AllinOne)/All In One.ipynb +0 -4581
- noshot/data/ML TS XAI/CN/1. Chat Application/chat.java +0 -81
- noshot/data/ML TS XAI/CN/1. Chat Application/output.png +0 -0
- noshot/data/ML TS XAI/CN/1. Chat Application/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/LAN.tcl +0 -65
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/analysis.awk +0 -44
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/output.png +0 -0
- noshot/data/ML TS XAI/CN/10. Ethernet LAN IEEE 802.3/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/complexdcf.tcl +0 -229
- noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/output.png +0 -0
- noshot/data/ML TS XAI/CN/11. Wireless LAN IEEE 802.11/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/2. File Transfer/file_to_send.txt +0 -2
- noshot/data/ML TS XAI/CN/2. File Transfer/filetransfer.java +0 -119
- noshot/data/ML TS XAI/CN/2. File Transfer/output.png +0 -0
- noshot/data/ML TS XAI/CN/2. File Transfer/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/Client.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/MyServerImpl.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/MyServerIntf.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/Server.class +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/output.png +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/3. RMI (Remote Method Invocation)/rmi.java +0 -56
- noshot/data/ML TS XAI/CN/4. Wired Network/output.png +0 -0
- noshot/data/ML TS XAI/CN/4. Wired Network/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/4. Wired Network/wired.awk +0 -25
- noshot/data/ML TS XAI/CN/4. Wired Network/wired.tcl +0 -81
- noshot/data/ML TS XAI/CN/5. Wireless Network/output.png +0 -0
- noshot/data/ML TS XAI/CN/5. Wireless Network/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/5. Wireless Network/wireless.awk +0 -27
- noshot/data/ML TS XAI/CN/5. Wireless Network/wireless.tcl +0 -153
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/analysis.awk +0 -27
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/output.png +0 -0
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/sack.tcl +0 -86
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Sack And Vegas/vegas.tcl +0 -86
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/analysis.awk +0 -28
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/output.png +0 -0
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/reno.tcl +0 -78
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Congestion Control/Tahoe And Reno/tahoe.tcl +0 -79
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/analysis.awk +0 -27
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/flow.tcl +0 -163
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/TCP Flow Control/output.png +0 -0
- noshot/data/ML TS XAI/CN/6. TCP Flow And Congestion Control/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/DV.tcl +0 -111
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/LS.tcl +0 -106
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/analysis.awk +0 -36
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/output.png +0 -0
- noshot/data/ML TS XAI/CN/7. Link State And Distance Vector Routing/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/analysis.awk +0 -20
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/broadcast.tcl +0 -76
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/multicast.tcl +0 -103
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/output.png +0 -0
- noshot/data/ML TS XAI/CN/8. Multicast And Broadcast Routing/procedure.png +0 -0
- noshot/data/ML TS XAI/CN/9. DHCP/DHCP.java +0 -125
- noshot/data/ML TS XAI/CN/9. DHCP/output.png +0 -0
- noshot/data/ML TS XAI/CN/9. DHCP/procedure.png +0 -0
- noshot/data/ML TS XAI/NLP/NLP 1/1-Prereqs.py +0 -18
- noshot/data/ML TS XAI/NLP/NLP 1/2-Chi2test.py +0 -83
- noshot/data/ML TS XAI/NLP/NLP 1/2-T-test.py +0 -79
- noshot/data/ML TS XAI/NLP/NLP 1/3-WSD-nb.py +0 -53
- noshot/data/ML TS XAI/NLP/NLP 1/4-Hindle-Rooth.py +0 -53
- noshot/data/ML TS XAI/NLP/NLP 1/5-HMM-Trellis.py +0 -82
- noshot/data/ML TS XAI/NLP/NLP 1/6-HMM-Viterbi.py +0 -16
- noshot/data/ML TS XAI/NLP/NLP 1/7-PCFG-parsetree.py +0 -15
- noshot/data/ML TS XAI/NLP/NLP 1/Chi2test.ipynb +0 -285
- noshot/data/ML TS XAI/NLP/NLP 1/Hindle-Rooth.ipynb +0 -179
- noshot/data/ML TS XAI/NLP/NLP 1/Lab 10 - Text generator using LSTM.ipynb +0 -1461
- noshot/data/ML TS XAI/NLP/NLP 1/Lab 11 NMT.ipynb +0 -2307
- noshot/data/ML TS XAI/NLP/NLP 1/PCFG.ipynb +0 -134
- noshot/data/ML TS XAI/NLP/NLP 1/Prereqs.ipynb +0 -131
- noshot/data/ML TS XAI/NLP/NLP 1/T test.ipynb +0 -252
- noshot/data/ML TS XAI/NLP/NLP 1/TFIDF BOW.ipynb +0 -171
- noshot/data/ML TS XAI/NLP/NLP 1/Trellis.ipynb +0 -244
- noshot/data/ML TS XAI/NLP/NLP 1/WSD.ipynb +0 -645
- noshot/data/ML TS XAI/NLP/NLP 1/Word2Vec.ipynb +0 -93
- noshot/data/ML TS XAI/NLP/NLP 2/Lab01(tokenizer)/tokenizer.ipynb +0 -370
- noshot/data/ML TS XAI/NLP/NLP 2/Lab01(tokenizer)/training_tokenizer.txt +0 -6
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/exp0.ipynb +0 -274
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/lab2.ipynb +0 -905
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/test.txt +0 -1
- noshot/data/ML TS XAI/NLP/NLP 2/Lab02(stemming)/tokenizing.ipynb +0 -272
- noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/collocation.ipynb +0 -332
- noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/lab3.ipynb +0 -549
- noshot/data/ML TS XAI/NLP/NLP 2/Lab03(parse-tree)/nlp.txt +0 -1
- noshot/data/ML TS XAI/NLP/NLP 2/Lab04(collocation)/Lab4-NLP-Exp-2.ipynb +0 -817
- noshot/data/ML TS XAI/NLP/NLP 2/Lab04(collocation)/collocation.ipynb +0 -332
- noshot/data/ML TS XAI/NLP/NLP 2/Lab05(WSD)/NLP-Lab-5-Exp3.ipynb +0 -231
- noshot/data/ML TS XAI/NLP/NLP 2/Lab05(WSD)/word-sense-disambiguation.ipynb +0 -507
- noshot/data/ML TS XAI/NLP/NLP 2/Lab06(additional-exercise)/lab6.ipynb +0 -134
- noshot/data/ML TS XAI/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP Exp 4.ipynb +0 -255
- noshot/data/ML TS XAI/NLP/NLP 2/Lab07(HMM,Viterbi)/NLP_Exp_5.ipynb +0 -159
- noshot/data/ML TS XAI/NLP/NLP 2/Lab08(PCFG)/PCFG.ipynb +0 -282
- noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/Lab 9 - MLP classifier.ipynb +0 -670
- noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/MLP-alternative-code.ipynb +0 -613
- noshot/data/ML TS XAI/NLP/NLP 2/Lab09-Hindle-rooth&MLP/hindle-rooth-algorithm.ipynb +0 -74
- noshot/data/ML TS XAI/NLP/NLP 2/Lab10(LSTM)/Lab_10_Text_generator_using_LSTM.ipynb +0 -480
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Machine-translation.ipynb +0 -445
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/Viterbi-PCFG.ipynb +0 -105
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/corpora_tools.py +0 -87
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/data_utils.py +0 -11
- noshot/data/ML TS XAI/NLP/NLP 2/Lab11(Viterbi-PCFG,Machine-translation)/train_translator.py +0 -83
- noshot/data/ML TS XAI/NLP/NLP 2/Lab12(Information-Extraction)/Information_Extraction.ipynb +0 -201
- noshot/data/ML TS XAI/NLP/NLP 3/Backtrack-without-Verbitri.ipynb +0 -185
- noshot/data/ML TS XAI/NLP/NLP 3/Backward-Procedure.ipynb +0 -597
- noshot/data/ML TS XAI/NLP/NLP 3/Bag_of.ipynb +0 -1422
- noshot/data/ML TS XAI/NLP/NLP 3/CYK-algorithm.ipynb +0 -1067
- noshot/data/ML TS XAI/NLP/NLP 3/Forward-Procedure.ipynb +0 -477
- noshot/data/ML TS XAI/NLP/NLP 3/LSTM.ipynb +0 -1290
- noshot/data/ML TS XAI/NLP/NLP 3/Lab 10 - Text generator using LSTM.ipynb +0 -1461
- noshot/data/ML TS XAI/NLP/NLP 3/Lab 11 NMT.ipynb +0 -2307
- noshot/data/ML TS XAI/NLP/NLP 3/NLP-LAB-4.ipynb +0 -216
- noshot/data/ML TS XAI/NLP/NLP 3/NLP-LAB-5.ipynb +0 -216
- noshot/data/ML TS XAI/NLP/NLP 3/abc.txt +0 -6
- noshot/data/ML TS XAI/NLP/NLP 3/ex-1-nltk.ipynb +0 -711
- noshot/data/ML TS XAI/NLP/NLP 3/ex-2-nlp.ipynb +0 -267
- noshot/data/ML TS XAI/NLP/NLP 3/exp8&9.ipynb +0 -305
- noshot/data/ML TS XAI/NLP/NLP 3/hind.ipynb +0 -287
- noshot/data/ML TS XAI/NLP/NLP 3/lab66.ipynb +0 -752
- noshot/data/ML TS XAI/NLP/NLP 3/leb_3.ipynb +0 -612
- noshot/data/ML TS XAI/NLP/NLP 3/naive_bayes_classifier.pkl +0 -0
- noshot/data/ML TS XAI/NLP/NLP 3/nlp_leb_1.ipynb +0 -3008
- noshot/data/ML TS XAI/NLP/NLP 3/nlp_leb_2.ipynb +0 -3095
- noshot/data/ML TS XAI/NLP/NLP 3/nlplab-9.ipynb +0 -295
- noshot/data/ML TS XAI/NLP/NLP 3/nltk-ex-4.ipynb +0 -506
- noshot/data/ML TS XAI/NLP/NLP 3/text1.txt +0 -48
- noshot/data/ML TS XAI/NLP/NLP 3/text2.txt +0 -8
- noshot/data/ML TS XAI/NLP/NLP 3/text3.txt +0 -48
- noshot/data/ML TS XAI/NLP/NLP 3/translation-rnn.ipynb +0 -812
- noshot/data/ML TS XAI/NLP/NLP 3/word2vector.ipynb +0 -173
- noshot/data/ML TS XAI/NLP/NLP 4/Backward Procedure Algorithm.ipynb +0 -179
- noshot/data/ML TS XAI/NLP/NLP 4/Chi Square Collocation.ipynb +0 -208
- noshot/data/ML TS XAI/NLP/NLP 4/Collocation (T test).ipynb +0 -188
- noshot/data/ML TS XAI/NLP/NLP 4/Experiment 1.ipynb +0 -437
- noshot/data/ML TS XAI/NLP/NLP 4/Forward Procedure Algorithm.ipynb +0 -132
- noshot/data/ML TS XAI/NLP/NLP 4/Hindle Rooth.ipynb +0 -414
- noshot/data/ML TS XAI/NLP/NLP 4/MachineTranslation.ipynb +0 -368
- noshot/data/ML TS XAI/NLP/NLP 4/Multi Layer Perceptron using MLPClassifier.ipynb +0 -86
- noshot/data/ML TS XAI/NLP/NLP 4/Multi Layer Perceptron using Tensorflow.ipynb +0 -112
- noshot/data/ML TS XAI/NLP/NLP 4/PCFG Inside Probability.ipynb +0 -451
- noshot/data/ML TS XAI/NLP/NLP 4/Text Generation using LSTM.ipynb +0 -297
- noshot/data/ML TS XAI/NLP/NLP 4/Viterbi.ipynb +0 -310
- noshot/data/ML TS XAI/NLP/NLP 4/Word Sense Disambiguation.ipynb +0 -335
- noshot/data/ML TS XAI/NLP/NLP 5/10.Text Generation using LSTM.ipynb +0 -316
- noshot/data/ML TS XAI/NLP/NLP 5/11.Machine Translation.ipynb +0 -868
- noshot/data/ML TS XAI/NLP/NLP 5/2.T and Chi2 Test.ipynb +0 -204
- noshot/data/ML TS XAI/NLP/NLP 5/3.Word Sense Diambiguation.ipynb +0 -234
- noshot/data/ML TS XAI/NLP/NLP 5/4.Hinddle and Rooth.ipynb +0 -128
- noshot/data/ML TS XAI/NLP/NLP 5/5.Forward and Backward.ipynb +0 -149
- noshot/data/ML TS XAI/NLP/NLP 5/6.Viterbi.ipynb +0 -111
- noshot/data/ML TS XAI/NLP/NLP 5/7.PCFG Parse Tree.ipynb +0 -134
- noshot/data/ML TS XAI/NLP/NLP 5/7.PCFG using cyk.ipynb +0 -101
- noshot/data/ML TS XAI/NLP/NLP 5/8.Bag of words and TF-IDF.ipynb +0 -310
- noshot/data/ML TS XAI/NLP/NLP 5/9.Word2Vector.ipynb +0 -78
- noshot/data/ML TS XAI/NLP/NLP 5/NLP ALL In One.ipynb +0 -2619
- noshot/data/ML TS XAI/NLP/NLP 5/sample1.txt +0 -15
- noshot/data/ML TS XAI/NLP/NLP 5/sample2.txt +0 -4
- noshot/data/ML TS XAI/NLP/NLP 5/word2vec_model.bin +0 -0
- noshot/data/ML TS XAI/NLP/NLP 6/1. Tokenize, Tagging, NER, Parse Tree.ipynb +0 -312
- noshot/data/ML TS XAI/NLP/NLP 6/2. T Test and Chi2 Test.ipynb +0 -185
- noshot/data/ML TS XAI/NLP/NLP 6/3. Naive Bayes WSD.ipynb +0 -199
- noshot/data/ML TS XAI/NLP/NLP 6/4. Hinddle and Rooth.ipynb +0 -151
- noshot/data/ML TS XAI/NLP/NLP 6/5 and 6 FWD, BWD, Viterbi.ipynb +0 -164
- noshot/data/ML TS XAI/NLP/NLP 6/7. PCFG using CYK.ipynb +0 -383
- noshot/data/ML TS XAI/NLP/NLP 6/8. BOW and TF-IDF.ipynb +0 -252
- noshot/data/ML TS XAI/Ubuntu CN Lab.iso +0 -0
- noshot-0.1.6.dist-info/RECORD +0 -216
- {noshot-0.1.6.dist-info → noshot-0.1.8.dist-info}/LICENSE.txt +0 -0
- {noshot-0.1.6.dist-info → noshot-0.1.8.dist-info}/WHEEL +0 -0
- {noshot-0.1.6.dist-info → noshot-0.1.8.dist-info}/top_level.txt +0 -0
@@ -1,134 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "markdown",
|
5
|
-
"metadata": {},
|
6
|
-
"source": [
|
7
|
-
"LHS `->` RHS \n",
|
8
|
-
"Element1 `|` Element2 `|` Element3 \n",
|
9
|
-
"`NP PP [0.4]` -- non-terminal symbol \n",
|
10
|
-
"`'he' [0.6]` -- terminal symbol "
|
11
|
-
]
|
12
|
-
},
|
13
|
-
{
|
14
|
-
"cell_type": "code",
|
15
|
-
"execution_count": 1,
|
16
|
-
"metadata": {},
|
17
|
-
"outputs": [],
|
18
|
-
"source": [
|
19
|
-
"grammarstring = \"\"\"\n",
|
20
|
-
"S -> NP VP [1.0]\n",
|
21
|
-
"NP -> NP PP [0.4] | 'he' [0.1] | 'dessert' [0.3] | 'lunch' [0.1] | 'saw' [0.1]\n",
|
22
|
-
"PP -> Pre NP [1.0]\n",
|
23
|
-
"VP -> Verb NP [0.3] | VP PP [0.7]\n",
|
24
|
-
"Pre -> 'with' [0.6] | 'in' [0.4]\n",
|
25
|
-
"Verb -> 'ate' [0.7] | 'saw' [0.3]\n",
|
26
|
-
"\"\"\""
|
27
|
-
]
|
28
|
-
},
|
29
|
-
{
|
30
|
-
"cell_type": "code",
|
31
|
-
"execution_count": 2,
|
32
|
-
"metadata": {},
|
33
|
-
"outputs": [],
|
34
|
-
"source": [
|
35
|
-
"from nltk import PCFG, InsideChartParser \n",
|
36
|
-
"# Remember InsideChartParser\n",
|
37
|
-
"\n",
|
38
|
-
"grammar = PCFG.fromstring(grammarstring)\n",
|
39
|
-
"\n",
|
40
|
-
"parser = InsideChartParser(grammar=grammar)"
|
41
|
-
]
|
42
|
-
},
|
43
|
-
{
|
44
|
-
"cell_type": "code",
|
45
|
-
"execution_count": 3,
|
46
|
-
"metadata": {},
|
47
|
-
"outputs": [
|
48
|
-
{
|
49
|
-
"data": {
|
50
|
-
"text/plain": [
|
51
|
-
"['he', 'saw', 'lunch', 'with', 'dessert']"
|
52
|
-
]
|
53
|
-
},
|
54
|
-
"execution_count": 3,
|
55
|
-
"metadata": {},
|
56
|
-
"output_type": "execute_result"
|
57
|
-
}
|
58
|
-
],
|
59
|
-
"source": [
|
60
|
-
"from nltk.tokenize import word_tokenize\n",
|
61
|
-
"\n",
|
62
|
-
"sentence = \"he saw lunch with dessert\"\n",
|
63
|
-
"\n",
|
64
|
-
"tokens = word_tokenize(sentence)\n",
|
65
|
-
"tokens"
|
66
|
-
]
|
67
|
-
},
|
68
|
-
{
|
69
|
-
"cell_type": "code",
|
70
|
-
"execution_count": 4,
|
71
|
-
"metadata": {},
|
72
|
-
"outputs": [
|
73
|
-
{
|
74
|
-
"name": "stdout",
|
75
|
-
"output_type": "stream",
|
76
|
-
"text": [
|
77
|
-
" S \n",
|
78
|
-
" _____________|____ \n",
|
79
|
-
" | VP \n",
|
80
|
-
" | _________|________ \n",
|
81
|
-
" | VP PP \n",
|
82
|
-
" | ____|____ ____|_____ \n",
|
83
|
-
" NP Verb NP Pre NP \n",
|
84
|
-
" | | | | | \n",
|
85
|
-
" he saw lunch with dessert\n",
|
86
|
-
"\n",
|
87
|
-
"Prob: 0.00011339999999999999\n",
|
88
|
-
" S \n",
|
89
|
-
" _________|____ \n",
|
90
|
-
" | VP \n",
|
91
|
-
" | __________|___ \n",
|
92
|
-
" | | NP \n",
|
93
|
-
" | | ________|____ \n",
|
94
|
-
" | | | PP \n",
|
95
|
-
" | | | ____|_____ \n",
|
96
|
-
" NP Verb NP Pre NP \n",
|
97
|
-
" | | | | | \n",
|
98
|
-
" he saw lunch with dessert\n",
|
99
|
-
"\n",
|
100
|
-
"Prob: 6.480000000000002e-05\n"
|
101
|
-
]
|
102
|
-
}
|
103
|
-
],
|
104
|
-
"source": [
|
105
|
-
"trees = parser.parse(tokens)\n",
|
106
|
-
"\n",
|
107
|
-
"for tree in trees:\n",
|
108
|
-
" tree.pretty_print() # Remember this\n",
|
109
|
-
" print(\"Prob: \", tree.prob())# .prob"
|
110
|
-
]
|
111
|
-
}
|
112
|
-
],
|
113
|
-
"metadata": {
|
114
|
-
"kernelspec": {
|
115
|
-
"display_name": "Python 3",
|
116
|
-
"language": "python",
|
117
|
-
"name": "python3"
|
118
|
-
},
|
119
|
-
"language_info": {
|
120
|
-
"codemirror_mode": {
|
121
|
-
"name": "ipython",
|
122
|
-
"version": 3
|
123
|
-
},
|
124
|
-
"file_extension": ".py",
|
125
|
-
"mimetype": "text/x-python",
|
126
|
-
"name": "python",
|
127
|
-
"nbconvert_exporter": "python",
|
128
|
-
"pygments_lexer": "ipython3",
|
129
|
-
"version": "3.12.7"
|
130
|
-
}
|
131
|
-
},
|
132
|
-
"nbformat": 4,
|
133
|
-
"nbformat_minor": 2
|
134
|
-
}
|
@@ -1,131 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": 54,
|
6
|
-
"metadata": {},
|
7
|
-
"outputs": [],
|
8
|
-
"source": [
|
9
|
-
"from nltk.tokenize import word_tokenize\n",
|
10
|
-
"from nltk.corpus import stopwords\n",
|
11
|
-
"from nltk.util import bigrams\n",
|
12
|
-
"import string"
|
13
|
-
]
|
14
|
-
},
|
15
|
-
{
|
16
|
-
"cell_type": "code",
|
17
|
-
"execution_count": 31,
|
18
|
-
"metadata": {},
|
19
|
-
"outputs": [],
|
20
|
-
"source": [
|
21
|
-
"sentences = [\n",
|
22
|
-
" \"I love studying data science.\",\n",
|
23
|
-
" \"Data science is an interesting field.\",\n",
|
24
|
-
" \"Science requires data for analysis.\",\n",
|
25
|
-
" \"Data is key in modern science.\",\n",
|
26
|
-
" \"Data science helps in business decision-making.\"\n",
|
27
|
-
"]"
|
28
|
-
]
|
29
|
-
},
|
30
|
-
{
|
31
|
-
"cell_type": "code",
|
32
|
-
"execution_count": 32,
|
33
|
-
"metadata": {},
|
34
|
-
"outputs": [],
|
35
|
-
"source": [
|
36
|
-
"def process(line):\n",
|
37
|
-
" line = line.lower()\n",
|
38
|
-
" tokens = word_tokenize(line)\n",
|
39
|
-
"\n",
|
40
|
-
" # stopwords\n",
|
41
|
-
" stops = set(stopwords.words('english'))\n",
|
42
|
-
" tokens = [i for i in tokens if i not in stops and i not in string.punctuation]\n",
|
43
|
-
" return tokens"
|
44
|
-
]
|
45
|
-
},
|
46
|
-
{
|
47
|
-
"cell_type": "code",
|
48
|
-
"execution_count": 36,
|
49
|
-
"metadata": {},
|
50
|
-
"outputs": [
|
51
|
-
{
|
52
|
-
"data": {
|
53
|
-
"text/plain": [
|
54
|
-
"[['love', 'studying', 'data', 'science'],\n",
|
55
|
-
" ['data', 'science', 'interesting', 'field'],\n",
|
56
|
-
" ['science', 'requires', 'data', 'analysis'],\n",
|
57
|
-
" ['data', 'key', 'modern', 'science'],\n",
|
58
|
-
" ['data', 'science', 'helps', 'business', 'decision-making']]"
|
59
|
-
]
|
60
|
-
},
|
61
|
-
"execution_count": 36,
|
62
|
-
"metadata": {},
|
63
|
-
"output_type": "execute_result"
|
64
|
-
}
|
65
|
-
],
|
66
|
-
"source": [
|
67
|
-
"tokens = [process(i) for i in sentences]\n",
|
68
|
-
"tokens"
|
69
|
-
]
|
70
|
-
},
|
71
|
-
{
|
72
|
-
"cell_type": "code",
|
73
|
-
"execution_count": 55,
|
74
|
-
"metadata": {},
|
75
|
-
"outputs": [],
|
76
|
-
"source": [
|
77
|
-
"def bgrm(l):\n",
|
78
|
-
" return bigrams(l)"
|
79
|
-
]
|
80
|
-
},
|
81
|
-
{
|
82
|
-
"cell_type": "code",
|
83
|
-
"execution_count": 59,
|
84
|
-
"metadata": {},
|
85
|
-
"outputs": [
|
86
|
-
{
|
87
|
-
"data": {
|
88
|
-
"text/plain": [
|
89
|
-
"[('love', 'studying'), ('studying', 'data'), ('data', 'science')]"
|
90
|
-
]
|
91
|
-
},
|
92
|
-
"execution_count": 59,
|
93
|
-
"metadata": {},
|
94
|
-
"output_type": "execute_result"
|
95
|
-
}
|
96
|
-
],
|
97
|
-
"source": [
|
98
|
-
"bigrams_all = list(bgrm(tokens[0]))\n",
|
99
|
-
"bigrams_all"
|
100
|
-
]
|
101
|
-
},
|
102
|
-
{
|
103
|
-
"cell_type": "code",
|
104
|
-
"execution_count": null,
|
105
|
-
"metadata": {},
|
106
|
-
"outputs": [],
|
107
|
-
"source": []
|
108
|
-
}
|
109
|
-
],
|
110
|
-
"metadata": {
|
111
|
-
"kernelspec": {
|
112
|
-
"display_name": "Python 3",
|
113
|
-
"language": "python",
|
114
|
-
"name": "python3"
|
115
|
-
},
|
116
|
-
"language_info": {
|
117
|
-
"codemirror_mode": {
|
118
|
-
"name": "ipython",
|
119
|
-
"version": 3
|
120
|
-
},
|
121
|
-
"file_extension": ".py",
|
122
|
-
"mimetype": "text/x-python",
|
123
|
-
"name": "python",
|
124
|
-
"nbconvert_exporter": "python",
|
125
|
-
"pygments_lexer": "ipython3",
|
126
|
-
"version": "3.12.7"
|
127
|
-
}
|
128
|
-
},
|
129
|
-
"nbformat": 4,
|
130
|
-
"nbformat_minor": 2
|
131
|
-
}
|
@@ -1,252 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "markdown",
|
5
|
-
"metadata": {},
|
6
|
-
"source": [
|
7
|
-
"1. List out the sentences from the dataframe"
|
8
|
-
]
|
9
|
-
},
|
10
|
-
{
|
11
|
-
"cell_type": "code",
|
12
|
-
"execution_count": 1,
|
13
|
-
"metadata": {},
|
14
|
-
"outputs": [],
|
15
|
-
"source": [
|
16
|
-
"import pandas as pd\n",
|
17
|
-
"import numpy as np\n",
|
18
|
-
"from nltk.util import bigrams\n",
|
19
|
-
"from nltk.corpus import stopwords \n",
|
20
|
-
"from nltk.tokenize import word_tokenize\n",
|
21
|
-
"import string\n",
|
22
|
-
"from collections import defaultdict"
|
23
|
-
]
|
24
|
-
},
|
25
|
-
{
|
26
|
-
"cell_type": "code",
|
27
|
-
"execution_count": 2,
|
28
|
-
"metadata": {},
|
29
|
-
"outputs": [
|
30
|
-
{
|
31
|
-
"data": {
|
32
|
-
"text/html": [
|
33
|
-
"<div>\n",
|
34
|
-
"<style scoped>\n",
|
35
|
-
" .dataframe tbody tr th:only-of-type {\n",
|
36
|
-
" vertical-align: middle;\n",
|
37
|
-
" }\n",
|
38
|
-
"\n",
|
39
|
-
" .dataframe tbody tr th {\n",
|
40
|
-
" vertical-align: top;\n",
|
41
|
-
" }\n",
|
42
|
-
"\n",
|
43
|
-
" .dataframe thead th {\n",
|
44
|
-
" text-align: right;\n",
|
45
|
-
" }\n",
|
46
|
-
"</style>\n",
|
47
|
-
"<table border=\"1\" class=\"dataframe\">\n",
|
48
|
-
" <thead>\n",
|
49
|
-
" <tr style=\"text-align: right;\">\n",
|
50
|
-
" <th></th>\n",
|
51
|
-
" <th>Sastra University is located in Tamil Nadu.</th>\n",
|
52
|
-
" </tr>\n",
|
53
|
-
" </thead>\n",
|
54
|
-
" <tbody>\n",
|
55
|
-
" <tr>\n",
|
56
|
-
" <th>0</th>\n",
|
57
|
-
" <td>Students at Sastra University engage in rigoro...</td>\n",
|
58
|
-
" </tr>\n",
|
59
|
-
" <tr>\n",
|
60
|
-
" <th>1</th>\n",
|
61
|
-
" <td>The university's main campus, Sastra Tanjore, ...</td>\n",
|
62
|
-
" </tr>\n",
|
63
|
-
" <tr>\n",
|
64
|
-
" <th>2</th>\n",
|
65
|
-
" <td>Sastra University offers undergraduate and pos...</td>\n",
|
66
|
-
" </tr>\n",
|
67
|
-
" <tr>\n",
|
68
|
-
" <th>3</th>\n",
|
69
|
-
" <td>Sastra University's commitment to quality educ...</td>\n",
|
70
|
-
" </tr>\n",
|
71
|
-
" <tr>\n",
|
72
|
-
" <th>4</th>\n",
|
73
|
-
" <td>The university's reputation for excellence ext...</td>\n",
|
74
|
-
" </tr>\n",
|
75
|
-
" </tbody>\n",
|
76
|
-
"</table>\n",
|
77
|
-
"</div>"
|
78
|
-
],
|
79
|
-
"text/plain": [
|
80
|
-
" Sastra University is located in Tamil Nadu.\n",
|
81
|
-
"0 Students at Sastra University engage in rigoro...\n",
|
82
|
-
"1 The university's main campus, Sastra Tanjore, ...\n",
|
83
|
-
"2 Sastra University offers undergraduate and pos...\n",
|
84
|
-
"3 Sastra University's commitment to quality educ...\n",
|
85
|
-
"4 The university's reputation for excellence ext..."
|
86
|
-
]
|
87
|
-
},
|
88
|
-
"execution_count": 2,
|
89
|
-
"metadata": {},
|
90
|
-
"output_type": "execute_result"
|
91
|
-
}
|
92
|
-
],
|
93
|
-
"source": [
|
94
|
-
"df = pd.read_csv(\"../sastralines.csv\")\n",
|
95
|
-
"df.head()"
|
96
|
-
]
|
97
|
-
},
|
98
|
-
{
|
99
|
-
"cell_type": "code",
|
100
|
-
"execution_count": 3,
|
101
|
-
"metadata": {},
|
102
|
-
"outputs": [
|
103
|
-
{
|
104
|
-
"data": {
|
105
|
-
"text/plain": [
|
106
|
-
"['Students at Sastra University engage in rigorous academic pursuits.',\n",
|
107
|
-
" \"The university's main campus, Sastra Tanjore, is known for its scenic beauty.\",\n",
|
108
|
-
" 'Sastra University offers undergraduate and postgraduate programs in diverse disciplines.',\n",
|
109
|
-
" \"Sastra University's commitment to quality education is evident in its faculty.\",\n",
|
110
|
-
" \"The university's reputation for excellence extends beyond national borders.\"]"
|
111
|
-
]
|
112
|
-
},
|
113
|
-
"execution_count": 3,
|
114
|
-
"metadata": {},
|
115
|
-
"output_type": "execute_result"
|
116
|
-
}
|
117
|
-
],
|
118
|
-
"source": [
|
119
|
-
"lines = df.iloc[:,0].tolist() #pandas series\n",
|
120
|
-
"lines[:5]\n"
|
121
|
-
]
|
122
|
-
},
|
123
|
-
{
|
124
|
-
"cell_type": "code",
|
125
|
-
"execution_count": 4,
|
126
|
-
"metadata": {},
|
127
|
-
"outputs": [],
|
128
|
-
"source": [
|
129
|
-
"unigramD = defaultdict(int)\n",
|
130
|
-
"bigramD = defaultdict(int)\n",
|
131
|
-
"\n",
|
132
|
-
"N = 0 # Wordcount\n",
|
133
|
-
"for line in lines:\n",
|
134
|
-
" \n",
|
135
|
-
" tokens = [i for i in word_tokenize(line.lower()) if i not in set(stopwords.words(\"english\")) and i not in string.punctuation]\n",
|
136
|
-
" \n",
|
137
|
-
" for j in tokens:\n",
|
138
|
-
" unigramD[j] += 1\n",
|
139
|
-
" N+= 1\n",
|
140
|
-
" for j in list(bigrams(tokens)):\n",
|
141
|
-
" bigramD[j] += 1\n"
|
142
|
-
]
|
143
|
-
},
|
144
|
-
{
|
145
|
-
"cell_type": "code",
|
146
|
-
"execution_count": null,
|
147
|
-
"metadata": {},
|
148
|
-
"outputs": [],
|
149
|
-
"source": []
|
150
|
-
},
|
151
|
-
{
|
152
|
-
"cell_type": "markdown",
|
153
|
-
"metadata": {},
|
154
|
-
"source": [
|
155
|
-
"4. Input words, critical value"
|
156
|
-
]
|
157
|
-
},
|
158
|
-
{
|
159
|
-
"cell_type": "code",
|
160
|
-
"execution_count": 5,
|
161
|
-
"metadata": {},
|
162
|
-
"outputs": [],
|
163
|
-
"source": [
|
164
|
-
"w1 = \"sastra\"\n",
|
165
|
-
"w2 = \"university\"\n",
|
166
|
-
"c = 2.0"
|
167
|
-
]
|
168
|
-
},
|
169
|
-
{
|
170
|
-
"cell_type": "markdown",
|
171
|
-
"metadata": {},
|
172
|
-
"source": [
|
173
|
-
"5. O,E"
|
174
|
-
]
|
175
|
-
},
|
176
|
-
{
|
177
|
-
"cell_type": "code",
|
178
|
-
"execution_count": 6,
|
179
|
-
"metadata": {},
|
180
|
-
"outputs": [],
|
181
|
-
"source": [
|
182
|
-
"import math"
|
183
|
-
]
|
184
|
-
},
|
185
|
-
{
|
186
|
-
"cell_type": "code",
|
187
|
-
"execution_count": 7,
|
188
|
-
"metadata": {},
|
189
|
-
"outputs": [
|
190
|
-
{
|
191
|
-
"data": {
|
192
|
-
"text/plain": [
|
193
|
-
"(0.08401084010840108, 0.011875647211756669, 12.715450067040848)"
|
194
|
-
]
|
195
|
-
},
|
196
|
-
"execution_count": 7,
|
197
|
-
"metadata": {},
|
198
|
-
"output_type": "execute_result"
|
199
|
-
}
|
200
|
-
],
|
201
|
-
"source": [
|
202
|
-
"O = bigramD[(w1,w2)]/N \n",
|
203
|
-
"E = unigramD[(w1)]/N * unigramD[(w2)]/N \n",
|
204
|
-
"variance = E\n",
|
205
|
-
"\n",
|
206
|
-
"score = (O-E)/math.sqrt(variance/N)\n",
|
207
|
-
"O,E,score"
|
208
|
-
]
|
209
|
-
},
|
210
|
-
{
|
211
|
-
"cell_type": "code",
|
212
|
-
"execution_count": 8,
|
213
|
-
"metadata": {},
|
214
|
-
"outputs": [
|
215
|
-
{
|
216
|
-
"name": "stdout",
|
217
|
-
"output_type": "stream",
|
218
|
-
"text": [
|
219
|
-
"Reject Ho\n"
|
220
|
-
]
|
221
|
-
}
|
222
|
-
],
|
223
|
-
"source": [
|
224
|
-
"if score > c:\n",
|
225
|
-
" print(\"Reject Ho\")\n",
|
226
|
-
"else:\n",
|
227
|
-
" print(\"Accept Ho\")"
|
228
|
-
]
|
229
|
-
}
|
230
|
-
],
|
231
|
-
"metadata": {
|
232
|
-
"kernelspec": {
|
233
|
-
"display_name": "Python 3",
|
234
|
-
"language": "python",
|
235
|
-
"name": "python3"
|
236
|
-
},
|
237
|
-
"language_info": {
|
238
|
-
"codemirror_mode": {
|
239
|
-
"name": "ipython",
|
240
|
-
"version": 3
|
241
|
-
},
|
242
|
-
"file_extension": ".py",
|
243
|
-
"mimetype": "text/x-python",
|
244
|
-
"name": "python",
|
245
|
-
"nbconvert_exporter": "python",
|
246
|
-
"pygments_lexer": "ipython3",
|
247
|
-
"version": "3.12.7"
|
248
|
-
}
|
249
|
-
},
|
250
|
-
"nbformat": 4,
|
251
|
-
"nbformat_minor": 2
|
252
|
-
}
|
@@ -1,171 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": 1,
|
6
|
-
"metadata": {
|
7
|
-
"colab": {
|
8
|
-
"base_uri": "https://localhost:8080/"
|
9
|
-
},
|
10
|
-
"id": "n1DJ41rw1B0J",
|
11
|
-
"outputId": "ba654967-ee56-4040-e68f-4a54e3bb8dbb"
|
12
|
-
},
|
13
|
-
"outputs": [
|
14
|
-
{
|
15
|
-
"name": "stdout",
|
16
|
-
"output_type": "stream",
|
17
|
-
"text": [
|
18
|
-
"Training with Bag of Words (BoW)...\n"
|
19
|
-
]
|
20
|
-
},
|
21
|
-
{
|
22
|
-
"name": "stderr",
|
23
|
-
"output_type": "stream",
|
24
|
-
"text": [
|
25
|
-
"/usr/local/lib/python3.10/dist-packages/keras/src/layers/core/dense.py:87: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.\n",
|
26
|
-
" super().__init__(activity_regularizer=activity_regularizer, **kwargs)\n"
|
27
|
-
]
|
28
|
-
},
|
29
|
-
{
|
30
|
-
"name": "stdout",
|
31
|
-
"output_type": "stream",
|
32
|
-
"text": [
|
33
|
-
"Epoch 1/10\n",
|
34
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m3s\u001b[0m 16ms/step - accuracy: 0.6667 - loss: 0.6975\n",
|
35
|
-
"Epoch 2/10\n",
|
36
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 10ms/step - accuracy: 0.8333 - loss: 0.6899\n",
|
37
|
-
"Epoch 3/10\n",
|
38
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.8333 - loss: 0.6867 \n",
|
39
|
-
"Epoch 4/10\n",
|
40
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 9ms/step - accuracy: 0.6667 - loss: 0.7099 \n",
|
41
|
-
"Epoch 5/10\n",
|
42
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.6667 - loss: 0.7057 \n",
|
43
|
-
"Epoch 6/10\n",
|
44
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.6667 - loss: 0.6741 \n",
|
45
|
-
"Epoch 7/10\n",
|
46
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.6667 - loss: 0.6983 \n",
|
47
|
-
"Epoch 8/10\n",
|
48
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 6ms/step - accuracy: 0.6667 - loss: 0.6652 \n",
|
49
|
-
"Epoch 9/10\n",
|
50
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 8ms/step - accuracy: 0.8333 - loss: 0.6382 \n",
|
51
|
-
"Epoch 10/10\n",
|
52
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.8333 - loss: 0.6347 \n",
|
53
|
-
"\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 292ms/step - accuracy: 1.0000 - loss: 0.6350\n",
|
54
|
-
"BoW Model Accuracy: 1.00\n",
|
55
|
-
"Training with TF-IDF...\n",
|
56
|
-
"Epoch 1/10\n",
|
57
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 8ms/step - accuracy: 0.3333 - loss: 0.7130\n",
|
58
|
-
"Epoch 2/10\n",
|
59
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.3333 - loss: 0.7099 \n",
|
60
|
-
"Epoch 3/10\n",
|
61
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.3333 - loss: 0.7071 \n",
|
62
|
-
"Epoch 4/10\n",
|
63
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.1667 - loss: 0.7102 \n",
|
64
|
-
"Epoch 5/10\n",
|
65
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 6ms/step - accuracy: 0.3333 - loss: 0.7016 \n",
|
66
|
-
"Epoch 6/10\n",
|
67
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.3333 - loss: 0.7002 \n",
|
68
|
-
"Epoch 7/10\n",
|
69
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.5000 - loss: 0.6964 \n",
|
70
|
-
"Epoch 8/10\n",
|
71
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 6ms/step - accuracy: 0.6667 - loss: 0.6923 \n",
|
72
|
-
"Epoch 9/10\n",
|
73
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 7ms/step - accuracy: 0.6667 - loss: 0.6900 \n",
|
74
|
-
"Epoch 10/10\n",
|
75
|
-
"\u001b[1m2/2\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 6ms/step - accuracy: 0.6667 - loss: 0.6914 \n",
|
76
|
-
"\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 283ms/step - accuracy: 0.0000e+00 - loss: 0.7002\n",
|
77
|
-
"TF-IDF Model Accuracy: 0.00\n"
|
78
|
-
]
|
79
|
-
}
|
80
|
-
],
|
81
|
-
"source": [
|
82
|
-
"#Text Classification using Bag of Words and TF-IDF with TensorFlow.\n",
|
83
|
-
"\n",
|
84
|
-
"import numpy as np\n",
|
85
|
-
"import pandas as pd\n",
|
86
|
-
"from sklearn.model_selection import train_test_split\n",
|
87
|
-
"from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer\n",
|
88
|
-
"from sklearn.preprocessing import LabelEncoder\n",
|
89
|
-
"import tensorflow as tf\n",
|
90
|
-
"from tensorflow.keras import Sequential\n",
|
91
|
-
"from tensorflow.keras.layers import Dense\n",
|
92
|
-
"\n",
|
93
|
-
"data = {'text': ['I love programming', 'Python is great', 'I enjoy machine learning',\n",
|
94
|
-
" 'TensorFlow is a powerful tool', 'AI is the future'],\n",
|
95
|
-
" 'label': ['positive', 'positive', 'positive', 'positive', 'neutral']}\n",
|
96
|
-
"\n",
|
97
|
-
"df = pd.DataFrame(data)\n",
|
98
|
-
"label_encoder = LabelEncoder()\n",
|
99
|
-
"df['label'] = label_encoder.fit_transform(df['label'])\n",
|
100
|
-
"X_train, X_test, y_train, y_test = train_test_split(df['text'], df['label'], test_size=0.2, random_state=42)\n",
|
101
|
-
"\n",
|
102
|
-
"# Option 1: Bag of Words (BoW)\n",
|
103
|
-
"vectorizer_bow = CountVectorizer()\n",
|
104
|
-
"X_train_bow = vectorizer_bow.fit_transform(X_train).toarray()\n",
|
105
|
-
"X_test_bow = vectorizer_bow.transform(X_test).toarray()\n",
|
106
|
-
"\n",
|
107
|
-
"# Option 2: TF-IDF\n",
|
108
|
-
"vectorizer_tfidf = TfidfVectorizer()\n",
|
109
|
-
"X_train_tfidf = vectorizer_tfidf.fit_transform(X_train).toarray()\n",
|
110
|
-
"X_test_tfidf = vectorizer_tfidf.transform(X_test).toarray()\n",
|
111
|
-
"\n",
|
112
|
-
"# Build a simple neural network with TensorFlow\n",
|
113
|
-
"def build_model(input_dim):\n",
|
114
|
-
" model = Sequential()\n",
|
115
|
-
" model.add(Dense(16, activation='relu', input_dim=input_dim))\n",
|
116
|
-
" model.add(Dense(8, activation='relu'))\n",
|
117
|
-
" model.add(Dense(1, activation='sigmoid')) # Binary classification (positive or neutral)\n",
|
118
|
-
" model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])\n",
|
119
|
-
" return model\n",
|
120
|
-
"\n",
|
121
|
-
"\n",
|
122
|
-
"print(\"Training with Bag of Words (BoW)...\")\n",
|
123
|
-
"model_bow = build_model(X_train_bow.shape[1])\n",
|
124
|
-
"model_bow.fit(X_train_bow, y_train, epochs=10, batch_size=2, verbose=1)\n",
|
125
|
-
"\n",
|
126
|
-
"loss, accuracy = model_bow.evaluate(X_test_bow, y_test)\n",
|
127
|
-
"print(f'BoW Model Accuracy: {accuracy:.2f}')\n",
|
128
|
-
"\n",
|
129
|
-
"print(\"Training with TF-IDF...\")\n",
|
130
|
-
"model_tfidf = build_model(X_train_tfidf.shape[1])\n",
|
131
|
-
"model_tfidf.fit(X_train_tfidf, y_train, epochs=10, batch_size=2, verbose=1)\n",
|
132
|
-
"\n",
|
133
|
-
"\n",
|
134
|
-
"loss, accuracy = model_tfidf.evaluate(X_test_tfidf, y_test)\n",
|
135
|
-
"print(f'TF-IDF Model Accuracy: {accuracy:.2f}')\n"
|
136
|
-
]
|
137
|
-
},
|
138
|
-
{
|
139
|
-
"cell_type": "markdown",
|
140
|
-
"metadata": {
|
141
|
-
"id": "0aZKJeRc2JQz"
|
142
|
-
},
|
143
|
-
"source": []
|
144
|
-
},
|
145
|
-
{
|
146
|
-
"cell_type": "code",
|
147
|
-
"execution_count": null,
|
148
|
-
"metadata": {
|
149
|
-
"id": "ZjkrZu5411-K"
|
150
|
-
},
|
151
|
-
"outputs": [],
|
152
|
-
"source": []
|
153
|
-
}
|
154
|
-
],
|
155
|
-
"metadata": {
|
156
|
-
"accelerator": "GPU",
|
157
|
-
"colab": {
|
158
|
-
"gpuType": "T4",
|
159
|
-
"provenance": []
|
160
|
-
},
|
161
|
-
"kernelspec": {
|
162
|
-
"display_name": "Python 3",
|
163
|
-
"name": "python3"
|
164
|
-
},
|
165
|
-
"language_info": {
|
166
|
-
"name": "python"
|
167
|
-
}
|
168
|
-
},
|
169
|
-
"nbformat": 4,
|
170
|
-
"nbformat_minor": 0
|
171
|
-
}
|