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,101 +0,0 @@
|
|
1
|
-
Hours,Scores
|
2
|
-
2.5,21.0
|
3
|
-
5.1,47.0
|
4
|
-
3.2,27.0
|
5
|
-
8.5,74.0
|
6
|
-
3.5,30.0
|
7
|
-
5.8,60.0
|
8
|
-
4.4,44.0
|
9
|
-
6.1,63.0
|
10
|
-
3.7,37.0
|
11
|
-
8.0,84.0
|
12
|
-
8.5,41.0
|
13
|
-
5.8,73.0
|
14
|
-
7.0,53.0
|
15
|
-
9.4,68.0
|
16
|
-
8.7,56.0
|
17
|
-
3.2,63.0
|
18
|
-
6.9,49.0
|
19
|
-
4.8,84.0
|
20
|
-
4.9,51.0
|
21
|
-
5.9,57.0
|
22
|
-
5.4,86.0
|
23
|
-
7.9,22.0
|
24
|
-
6.5,23.0
|
25
|
-
5.3,68.0
|
26
|
-
5.9,25.0
|
27
|
-
5.7,87.0
|
28
|
-
7.9,40.0
|
29
|
-
4.7,34.0
|
30
|
-
5.7,87.0
|
31
|
-
3.4,78.0
|
32
|
-
0.2,86.0
|
33
|
-
6.3,67.0
|
34
|
-
6.7,32.0
|
35
|
-
3.7,87.0
|
36
|
-
9.4,43.0
|
37
|
-
2.3,65.0
|
38
|
-
5.2,68.0
|
39
|
-
4.7,46.0
|
40
|
-
8.0,61.0
|
41
|
-
7.9,67.0
|
42
|
-
5.4,56.0
|
43
|
-
5.8,27.0
|
44
|
-
3.4,55.0
|
45
|
-
1.3,75.0
|
46
|
-
4.4,35.0
|
47
|
-
5.4,46.0
|
48
|
-
7.4,40.0
|
49
|
-
7.4,86.0
|
50
|
-
4.3,62.0
|
51
|
-
4.5,57.0
|
52
|
-
3.1,33.0
|
53
|
-
2.4,59.0
|
54
|
-
1.8,35.0
|
55
|
-
8.8,49.0
|
56
|
-
4.1,36.0
|
57
|
-
4.2,62.0
|
58
|
-
2.7,60.0
|
59
|
-
6.6,45.0
|
60
|
-
2.0,57.0
|
61
|
-
4.7,27.0
|
62
|
-
3.4,19.0
|
63
|
-
5.8,57.0
|
64
|
-
4.1,52.0
|
65
|
-
2.8,61.0
|
66
|
-
5.0,96.0
|
67
|
-
5.9,68.0
|
68
|
-
5.2,31.0
|
69
|
-
5.7,71.0
|
70
|
-
3.9,22.0
|
71
|
-
4.4,40.0
|
72
|
-
3.8,47.0
|
73
|
-
4.4,83.0
|
74
|
-
3.5,34.0
|
75
|
-
1.8,32.0
|
76
|
-
5.4,47.0
|
77
|
-
4.3,35.0
|
78
|
-
2.0,71.0
|
79
|
-
6.0,27.0
|
80
|
-
3.3,26.0
|
81
|
-
5.2,40.0
|
82
|
-
6.5,39.0
|
83
|
-
5.3,87.0
|
84
|
-
7.3,68.0
|
85
|
-
2.7,50.0
|
86
|
-
5.9,24.0
|
87
|
-
3.8,66.0
|
88
|
-
3.4,29.0
|
89
|
-
4.0,18.0
|
90
|
-
4.5,72.0
|
91
|
-
5.2,55.0
|
92
|
-
2.8,67.0
|
93
|
-
6.8,55.0
|
94
|
-
6.0,66.0
|
95
|
-
2.1,36.0
|
96
|
-
7.9,28.0
|
97
|
-
8.7,62.0
|
98
|
-
7.3,33.0
|
99
|
-
4.7,35.0
|
100
|
-
3.0,40.0
|
101
|
-
7.1,49.0
|
@@ -1,256 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "ca1dd424-64c5-4d61-875e-a6f8a9265b3a",
|
7
|
-
"metadata": {},
|
8
|
-
"outputs": [],
|
9
|
-
"source": [
|
10
|
-
"import networkx as nx\n",
|
11
|
-
"import matplotlib.pyplot as plt\n",
|
12
|
-
"def display(graph, h, directed = False):\n",
|
13
|
-
" graph = {u+\" \"+str(h[u]) : {v+\" \"+str(h[v]) : {'weight' : graph[u][v]} for v in graph[u]} for u in graph}\n",
|
14
|
-
" g = nx.from_dict_of_dicts(graph)\n",
|
15
|
-
" pos = nx.circular_layout(g)\n",
|
16
|
-
" nx.draw(g, pos, with_labels = True)\n",
|
17
|
-
" nx.draw_networkx_edge_labels(g, pos, edge_labels = nx.get_edge_attributes(g, 'weight'))\n",
|
18
|
-
" plt.suptitle(\"AStar Search\")\n",
|
19
|
-
" plt.show()\n",
|
20
|
-
" plt.clf()\n",
|
21
|
-
"def print_path(node, parent):\n",
|
22
|
-
" if node != None:\n",
|
23
|
-
" return print_path(parent[node], parent) + [node]\n",
|
24
|
-
" return []\n",
|
25
|
-
"def AStar(graph, start, goal, h):\n",
|
26
|
-
" queue = [start]\n",
|
27
|
-
" visited = []\n",
|
28
|
-
" parent = {start : None}\n",
|
29
|
-
" g = {start : 0}\n",
|
30
|
-
" f = {start : h[start]}\n",
|
31
|
-
" while queue:\n",
|
32
|
-
" queue.sort(key = lambda x : f[x])\n",
|
33
|
-
" node = queue.pop(0)\n",
|
34
|
-
" visited.append(node)\n",
|
35
|
-
" if node == goal:\n",
|
36
|
-
" print(f\"Result(AStar {start} to {goal}):\",print_path(node, parent),\"Path cost =\",g[node])\n",
|
37
|
-
" return True\n",
|
38
|
-
" for adj in graph[node]:\n",
|
39
|
-
" if adj not in visited:\n",
|
40
|
-
" gcost = g[node] + graph[node][adj]\n",
|
41
|
-
" fcost = gcost + h[adj]\n",
|
42
|
-
" if adj not in queue:\n",
|
43
|
-
" queue.append(adj)\n",
|
44
|
-
" elif fcost > f[adj]:\n",
|
45
|
-
" continue\n",
|
46
|
-
" g[adj] = gcost\n",
|
47
|
-
" f[adj] = fcost\n",
|
48
|
-
" parent[adj] = node\n",
|
49
|
-
" print(f\"Result(AStar {start} to {goal}): No Solution\")\n",
|
50
|
-
" return False\n",
|
51
|
-
"def get_graph(directed = False):\n",
|
52
|
-
" graph = {}\n",
|
53
|
-
" heuristic = {}\n",
|
54
|
-
" print(\"Enter Node Adjacency Pair\")\n",
|
55
|
-
" print(\"[PRESS ENTER TO STOP]\")\n",
|
56
|
-
" x = input()\n",
|
57
|
-
" while x:\n",
|
58
|
-
" x = x.split(maxsplit = 2)\n",
|
59
|
-
" u, heuristic[u] = x[0], int(x[1])\n",
|
60
|
-
" adj = [v.strip(' ()') for v in x[2].strip('[]').split(',') if v] if len(x) == 3 else [] \n",
|
61
|
-
" adj = {v : int(w) for v, w in zip(adj[::2],adj[1::2])}\n",
|
62
|
-
" graph[u] = graph.get(u, {}) | adj\n",
|
63
|
-
" for v, w in adj.items():\n",
|
64
|
-
" graph[v] = graph.get(v, {}) | ({u : w} if not directed else {})\n",
|
65
|
-
" x = input()\n",
|
66
|
-
" return graph, heuristic\n",
|
67
|
-
"def example():\n",
|
68
|
-
" graph = {\"A\" : {\"B\":9,\"C\":4,\"D\":7},\n",
|
69
|
-
" \"B\" : {\"A\":9,\"E\":11},\n",
|
70
|
-
" \"C\" : {\"A\":4,\"E\":17,\"F\":12},\n",
|
71
|
-
" \"D\" : {\"A\":7,\"F\":14},\n",
|
72
|
-
" \"E\" : {\"B\":11,\"G\":5,\"C\":17},\n",
|
73
|
-
" \"F\" : {\"D\":14,\"C\":12,\"G\":9},\n",
|
74
|
-
" \"G\" : {\"E\":5,\"F\":9}}\n",
|
75
|
-
" heuristic = {\"A\":21,\"B\":14,\"C\":18,\"D\":18,\"E\":5,\"F\":8,\"G\":0}\n",
|
76
|
-
" print(\"Heuristic: \",heuristic)\n",
|
77
|
-
" print(graph)\n",
|
78
|
-
" display(graph, heuristic)\n",
|
79
|
-
" AStar(graph, \"A\", \"G\", heuristic)\n",
|
80
|
-
"\n",
|
81
|
-
"def main():\n",
|
82
|
-
" #example();return #Uncomment to run the example\n",
|
83
|
-
" graph, h = get_graph(directed = False)#undirected graph\n",
|
84
|
-
" source, goal = input(\"Enter source and goal: \").split()\n",
|
85
|
-
" display(graph, h, directed = False)\n",
|
86
|
-
" print(\"Heuristic: \",h)\n",
|
87
|
-
" print(graph)\n",
|
88
|
-
" AStar(graph, source, goal, h)\n",
|
89
|
-
"\n",
|
90
|
-
" #Sample output (Square brackets [] are optional)\n",
|
91
|
-
" #Enter Node Adjacency Pair\n",
|
92
|
-
" #PRESS ENTER TO STOP]\n",
|
93
|
-
" #A 21 [(B,9),(C,4),(D,7)]\n",
|
94
|
-
" #B 14 [(E,11)]\n",
|
95
|
-
" #C 18 [(E,17),(F,12)]\n",
|
96
|
-
" #D 18 [(F,14)]\n",
|
97
|
-
" #E 5 [(G,5)]\n",
|
98
|
-
" #F 8 [(G,9)]\n",
|
99
|
-
" #G 0 []\n",
|
100
|
-
" \n",
|
101
|
-
" #Enter source and goal: A G\n",
|
102
|
-
" #Result(AStar A to G): ['A', 'B', 'E', 'G'] Path cost = 25\n",
|
103
|
-
"main()"
|
104
|
-
]
|
105
|
-
},
|
106
|
-
{
|
107
|
-
"cell_type": "code",
|
108
|
-
"execution_count": null,
|
109
|
-
"id": "81ac2a79-e388-4cab-9b48-0ec4ebcf4591",
|
110
|
-
"metadata": {},
|
111
|
-
"outputs": [],
|
112
|
-
"source": [
|
113
|
-
"import networkx as nx\n",
|
114
|
-
"import matplotlib.pyplot as plt\n",
|
115
|
-
"def display(graph, h, directed = False):\n",
|
116
|
-
" graph = {u+\" \"+str(h[u]) : {v+\" \"+str(h[v]) : {'weight' : graph[u][v]} for v in graph[u]} for u in graph}\n",
|
117
|
-
" g = nx.from_dict_of_dicts(graph)\n",
|
118
|
-
" pos = nx.circular_layout(g)\n",
|
119
|
-
" nx.draw(g, pos, with_labels = True)\n",
|
120
|
-
" nx.draw_networkx_edge_labels(g, pos, edge_labels = nx.get_edge_attributes(g, 'weight'))\n",
|
121
|
-
" plt.suptitle(\"AStar Search\")\n",
|
122
|
-
" plt.show()\n",
|
123
|
-
" plt.clf()\n",
|
124
|
-
"def print_path(node, parent):\n",
|
125
|
-
" if node != None:\n",
|
126
|
-
" return print_path(parent[node], parent) + [node]\n",
|
127
|
-
" return []\n",
|
128
|
-
"def AStar(graph, start, goal, h):\n",
|
129
|
-
" queue = [start]\n",
|
130
|
-
" visited = []\n",
|
131
|
-
" parent = {start : None}\n",
|
132
|
-
" g = {start : 0}\n",
|
133
|
-
" f = {start : h[start]}\n",
|
134
|
-
" while queue:\n",
|
135
|
-
" queue.sort(key = lambda x : f[x])\n",
|
136
|
-
" node = queue.pop(0)\n",
|
137
|
-
" visited.append(node)\n",
|
138
|
-
" if node == goal:\n",
|
139
|
-
" print(f\"Result(AStar {start} to {goal}):\",print_path(node, parent),\"Path cost =\",g[node])\n",
|
140
|
-
" return True\n",
|
141
|
-
" for adj in graph[node]:\n",
|
142
|
-
" if adj not in visited:\n",
|
143
|
-
" gcost = g[node] + graph[node][adj]\n",
|
144
|
-
" fcost = gcost + h[adj]\n",
|
145
|
-
" if adj not in queue:\n",
|
146
|
-
" queue.append(adj)\n",
|
147
|
-
" elif fcost > f[adj]:\n",
|
148
|
-
" continue\n",
|
149
|
-
" g[adj] = gcost\n",
|
150
|
-
" f[adj] = fcost\n",
|
151
|
-
" parent[adj] = node\n",
|
152
|
-
" print(f\"Result(AStar {start} to {goal}): No Solution\")\n",
|
153
|
-
" return False\n",
|
154
|
-
"def get_graph(directed = False):\n",
|
155
|
-
" graph = {}\n",
|
156
|
-
" heuristic = {}\n",
|
157
|
-
" \n",
|
158
|
-
" print(\"Enter (node, heuristic)\")\n",
|
159
|
-
" print(\"[PRESS ENTER TO STOP]\")\n",
|
160
|
-
" x = input()\n",
|
161
|
-
" while x:\n",
|
162
|
-
" x = x.split()\n",
|
163
|
-
" u, heuristic[u] = x[0], int(x[1])\n",
|
164
|
-
" graph[u] = graph.get(u, {})\n",
|
165
|
-
" x = input()\n",
|
166
|
-
" \n",
|
167
|
-
" print(\"Enter edge (u, v, weight)\")\n",
|
168
|
-
" print(\"[PRESS ENTER TO STOP]\")\n",
|
169
|
-
" x = input()\n",
|
170
|
-
" while x:\n",
|
171
|
-
" x = x.split(maxsplit = 1)\n",
|
172
|
-
" u, adj = x[0], [v.strip(' ()') for v in x[1].strip('[]').split(',') if v] \n",
|
173
|
-
" if len(adj) == 1:\n",
|
174
|
-
" v, w = adj[0].split()\n",
|
175
|
-
" adj = {v : int(w)}\n",
|
176
|
-
" else:\n",
|
177
|
-
" adj = {v : int(w) for v, w in zip(adj[::2],adj[1::2])}\n",
|
178
|
-
" graph[u] = graph.get(u, {}) | adj\n",
|
179
|
-
" for v, w in adj.items():\n",
|
180
|
-
" graph[v] = graph.get(v, {}) | ({u : w} if not directed else {})\n",
|
181
|
-
" x = input()\n",
|
182
|
-
" return graph, heuristic\n",
|
183
|
-
"def example():\n",
|
184
|
-
" graph = {\"A\" : {\"B\":9,\"C\":4,\"D\":7},\n",
|
185
|
-
" \"B\" : {\"A\":9,\"E\":11},\n",
|
186
|
-
" \"C\" : {\"A\":4,\"E\":17,\"F\":12},\n",
|
187
|
-
" \"D\" : {\"A\":7,\"F\":14},\n",
|
188
|
-
" \"E\" : {\"B\":11,\"G\":5,\"C\":17},\n",
|
189
|
-
" \"F\" : {\"D\":14,\"C\":12,\"G\":9},\n",
|
190
|
-
" \"G\" : {\"E\":5,\"F\":9}}\n",
|
191
|
-
" heuristic = {\"A\":21,\"B\":14,\"C\":18,\"D\":18,\"E\":5,\"F\":8,\"G\":0}\n",
|
192
|
-
" print(\"Heuristic: \",heuristic)\n",
|
193
|
-
" print(graph)\n",
|
194
|
-
" display(graph, heuristic)\n",
|
195
|
-
" AStar(graph, \"A\", \"G\", heuristic)\n",
|
196
|
-
"\n",
|
197
|
-
"def main():\n",
|
198
|
-
" #example();return #Uncomment to run the example\n",
|
199
|
-
" graph, h = get_graph(directed = False)#undirected graph\n",
|
200
|
-
" source, goal = input(\"Enter source and goal: \").split()\n",
|
201
|
-
" display(graph, h, directed = False)\n",
|
202
|
-
" print(\"Heuristic: \",h)\n",
|
203
|
-
" print(graph)\n",
|
204
|
-
" AStar(graph, source, goal, h)\n",
|
205
|
-
"\n",
|
206
|
-
" #Sample output\n",
|
207
|
-
" #Enter (node, heuristic)\n",
|
208
|
-
" #[PRESS ENTER TO STOP]\n",
|
209
|
-
" #A 21\n",
|
210
|
-
" #B 14\n",
|
211
|
-
" #C 18\n",
|
212
|
-
" #D 18\n",
|
213
|
-
" #E 5\n",
|
214
|
-
" #F 8\n",
|
215
|
-
" #G 0\n",
|
216
|
-
" \n",
|
217
|
-
" #Enter edge (u, v, weight)\n",
|
218
|
-
" #[PRESS ENTER TO STOP]\n",
|
219
|
-
" #A B 9\n",
|
220
|
-
" #A C 4\n",
|
221
|
-
" #A D 7\n",
|
222
|
-
" #B E 11\n",
|
223
|
-
" #C E 17\n",
|
224
|
-
" #C F 12\n",
|
225
|
-
" #D F 14\n",
|
226
|
-
" #E G 5\n",
|
227
|
-
" #F G 9\n",
|
228
|
-
" \n",
|
229
|
-
" #Enter source and goal: A G\n",
|
230
|
-
" #Result(AStar A to G): ['A', 'B', 'E', 'G'] Path cost = 25\n",
|
231
|
-
"main()"
|
232
|
-
]
|
233
|
-
}
|
234
|
-
],
|
235
|
-
"metadata": {
|
236
|
-
"kernelspec": {
|
237
|
-
"display_name": "Python 3 (ipykernel)",
|
238
|
-
"language": "python",
|
239
|
-
"name": "python3"
|
240
|
-
},
|
241
|
-
"language_info": {
|
242
|
-
"codemirror_mode": {
|
243
|
-
"name": "ipython",
|
244
|
-
"version": 3
|
245
|
-
},
|
246
|
-
"file_extension": ".py",
|
247
|
-
"mimetype": "text/x-python",
|
248
|
-
"name": "python",
|
249
|
-
"nbconvert_exporter": "python",
|
250
|
-
"pygments_lexer": "ipython3",
|
251
|
-
"version": "3.12.4"
|
252
|
-
}
|
253
|
-
},
|
254
|
-
"nbformat": 4,
|
255
|
-
"nbformat_minor": 5
|
256
|
-
}
|
@@ -1,157 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "e9bef27c-59b6-431a-b88b-ceafb10c9680",
|
7
|
-
"metadata": {},
|
8
|
-
"outputs": [],
|
9
|
-
"source": [
|
10
|
-
"import networkx as nx\n",
|
11
|
-
"import matplotlib.pyplot as plt\n",
|
12
|
-
"def display(graph, h, directed = False):\n",
|
13
|
-
" graph = {u+\" \"+str(h[u]) : {v+\" \"+str(h[v]) : {'weight' : graph[u][v]} for v in graph[u]} for u in graph}\n",
|
14
|
-
" g = nx.from_dict_of_dicts(graph)\n",
|
15
|
-
" pos = nx.circular_layout(g)\n",
|
16
|
-
" nx.draw(g, pos, with_labels = True)\n",
|
17
|
-
" nx.draw_networkx_edge_labels(g, pos, edge_labels = nx.get_edge_attributes(g, 'weight'))\n",
|
18
|
-
" plt.suptitle(\"IDAStar Search\")\n",
|
19
|
-
" plt.show()\n",
|
20
|
-
" plt.clf()\n",
|
21
|
-
"def print_path(node, parent):\n",
|
22
|
-
" if node != None:\n",
|
23
|
-
" return print_path(parent[node], parent) + [node]\n",
|
24
|
-
" return []\n",
|
25
|
-
"INF = float('inf')\n",
|
26
|
-
"def IDAStar(graph, start, goal, h): \n",
|
27
|
-
" parent = {start : None} \n",
|
28
|
-
" th = h[start]\n",
|
29
|
-
" while True:\n",
|
30
|
-
" result, new_th = recursive_dfs(graph, parent, start, goal, 0, h, th)\n",
|
31
|
-
" if result is not None:\n",
|
32
|
-
" result = print_path(result, parent)\n",
|
33
|
-
" cost = sum([graph[n1][n2] for n1, n2 in zip(result,result[1:])])\n",
|
34
|
-
" print(f\"Result(IDAStar {start} to {goal}):\",result,\"Path cost =\",cost)\n",
|
35
|
-
" return\n",
|
36
|
-
" elif new_th == INF:\n",
|
37
|
-
" print(f\"Result(IDAStar {start} to {goal}): failure\")\n",
|
38
|
-
" return\n",
|
39
|
-
" th = new_th\n",
|
40
|
-
"def recursive_dfs(graph, parent, node, goal, g, h, th):\n",
|
41
|
-
" f = g + h[node]\n",
|
42
|
-
" if f > th:\n",
|
43
|
-
" return None, f\n",
|
44
|
-
" if node == goal:\n",
|
45
|
-
" return node, f\n",
|
46
|
-
" min_th = INF\n",
|
47
|
-
" for adj in graph[node]:\n",
|
48
|
-
" result, temp_th = recursive_dfs(graph, parent, adj, goal, g + graph[node][adj], h, th)\n",
|
49
|
-
" if result is not None:\n",
|
50
|
-
" parent[adj] = node\n",
|
51
|
-
" return result, temp_th\n",
|
52
|
-
" elif temp_th < min_th:\n",
|
53
|
-
" min_th = temp_th\n",
|
54
|
-
" return None, min_th\n",
|
55
|
-
"def get_graph(directed = False):\n",
|
56
|
-
" graph = {}\n",
|
57
|
-
" heuristic = {}\n",
|
58
|
-
" \n",
|
59
|
-
" print(\"Enter (node, heuristic)\")\n",
|
60
|
-
" print(\"[PRESS ENTER TO STOP]\")\n",
|
61
|
-
" x = input()\n",
|
62
|
-
" while x:\n",
|
63
|
-
" x = x.split()\n",
|
64
|
-
" u, heuristic[u] = x[0], int(x[1])\n",
|
65
|
-
" graph[u] = graph.get(u, {})\n",
|
66
|
-
" x = input()\n",
|
67
|
-
" \n",
|
68
|
-
" print(\"Enter edge (u, v, weight)\")\n",
|
69
|
-
" print(\"[PRESS ENTER TO STOP]\")\n",
|
70
|
-
" x = input()\n",
|
71
|
-
" while x:\n",
|
72
|
-
" x = x.split(maxsplit = 1)\n",
|
73
|
-
" u, adj = x[0], [v.strip(' ()') for v in x[1].strip('[]').split(',') if v] \n",
|
74
|
-
" if len(adj) == 1:\n",
|
75
|
-
" v, w = adj[0].split()\n",
|
76
|
-
" adj = {v : int(w)}\n",
|
77
|
-
" else:\n",
|
78
|
-
" adj = {v : int(w) for v, w in zip(adj[::2],adj[1::2])}\n",
|
79
|
-
" graph[u] = graph.get(u, {}) | adj\n",
|
80
|
-
" for v, w in adj.items():\n",
|
81
|
-
" graph[v] = graph.get(v, {}) | ({u : w} if not directed else {})\n",
|
82
|
-
" x = input()\n",
|
83
|
-
" return graph, heuristic\n",
|
84
|
-
"def example():\n",
|
85
|
-
" graph = {\"A\" : {\"B\":9,\"C\":4,\"D\":7},\n",
|
86
|
-
" \"B\" : {\"A\":9,\"E\":11},\n",
|
87
|
-
" \"C\" : {\"A\":4,\"E\":17,\"F\":12},\n",
|
88
|
-
" \"D\" : {\"A\":7,\"F\":14},\n",
|
89
|
-
" \"E\" : {\"B\":11,\"G\":5,\"C\":17},\n",
|
90
|
-
" \"F\" : {\"D\":14,\"C\":12,\"G\":9},\n",
|
91
|
-
" \"G\" : {\"E\":5,\"F\":9}}\n",
|
92
|
-
" heuristic = {\"A\":21,\"B\":14,\"C\":18,\"D\":18,\"E\":5,\"F\":8,\"G\":0}\n",
|
93
|
-
" print(\"Heuristic: \",heuristic)\n",
|
94
|
-
" print(graph)\n",
|
95
|
-
" display(graph, heuristic)\n",
|
96
|
-
" IDAStar(graph, \"A\", \"G\", heuristic)\n",
|
97
|
-
"\n",
|
98
|
-
"def main():\n",
|
99
|
-
" #example();return #Uncomment to run the example\n",
|
100
|
-
" graph, h = get_graph(directed = False)#undirected graph\n",
|
101
|
-
" source, goal = input(\"Enter source and goal: \").split()\n",
|
102
|
-
" display(graph, h, directed = False)\n",
|
103
|
-
" print(\"Heuristic: \",h)\n",
|
104
|
-
" print(graph)\n",
|
105
|
-
" IDAStar(graph, source, goal, h)\n",
|
106
|
-
"\n",
|
107
|
-
" #Sample output\n",
|
108
|
-
" #Enter (node, heuristic)\n",
|
109
|
-
" #[PRESS ENTER TO STOP]\n",
|
110
|
-
" #A 21\n",
|
111
|
-
" #B 14\n",
|
112
|
-
" #C 18\n",
|
113
|
-
" #D 18\n",
|
114
|
-
" #E 5\n",
|
115
|
-
" #F 8\n",
|
116
|
-
" #G 0\n",
|
117
|
-
" \n",
|
118
|
-
" #Enter edge (u, v, weight)\n",
|
119
|
-
" #[PRESS ENTER TO STOP]\n",
|
120
|
-
" #A B 9\n",
|
121
|
-
" #A C 4\n",
|
122
|
-
" #A D 7\n",
|
123
|
-
" #B E 11\n",
|
124
|
-
" #C E 17\n",
|
125
|
-
" #C F 12\n",
|
126
|
-
" #D F 14\n",
|
127
|
-
" #E G 5\n",
|
128
|
-
" #F G 9\n",
|
129
|
-
" \n",
|
130
|
-
" #Enter source and goal: A G\n",
|
131
|
-
" #Result(IDAStar A to G): ['A', 'B', 'E', 'G'] Path cost = 25\n",
|
132
|
-
"main()"
|
133
|
-
]
|
134
|
-
}
|
135
|
-
],
|
136
|
-
"metadata": {
|
137
|
-
"kernelspec": {
|
138
|
-
"display_name": "Python 3 (ipykernel)",
|
139
|
-
"language": "python",
|
140
|
-
"name": "python3"
|
141
|
-
},
|
142
|
-
"language_info": {
|
143
|
-
"codemirror_mode": {
|
144
|
-
"name": "ipython",
|
145
|
-
"version": 3
|
146
|
-
},
|
147
|
-
"file_extension": ".py",
|
148
|
-
"mimetype": "text/x-python",
|
149
|
-
"name": "python",
|
150
|
-
"nbconvert_exporter": "python",
|
151
|
-
"pygments_lexer": "ipython3",
|
152
|
-
"version": "3.12.4"
|
153
|
-
}
|
154
|
-
},
|
155
|
-
"nbformat": 4,
|
156
|
-
"nbformat_minor": 5
|
157
|
-
}
|
@@ -1,178 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"cells": [
|
3
|
-
{
|
4
|
-
"cell_type": "code",
|
5
|
-
"execution_count": null,
|
6
|
-
"id": "f9d6ed77-2aeb-4e73-ba88-388457f5332c",
|
7
|
-
"metadata": {},
|
8
|
-
"outputs": [],
|
9
|
-
"source": [
|
10
|
-
"import networkx as nx\n",
|
11
|
-
"import matplotlib.pyplot as plt\n",
|
12
|
-
"def display(graph, h, directed = False):\n",
|
13
|
-
" graph = {u+\" \"+str(h[u]) : {v+\" \"+str(h[v]) : {'weight' : graph[u][v]} for v in graph[u]} for u in graph}\n",
|
14
|
-
" g = nx.from_dict_of_dicts(graph)\n",
|
15
|
-
" pos = nx.circular_layout(g)\n",
|
16
|
-
" nx.draw(g, pos, with_labels = True)\n",
|
17
|
-
" nx.draw_networkx_edge_labels(g, pos, edge_labels = nx.get_edge_attributes(g, 'weight'))\n",
|
18
|
-
" plt.suptitle(\"SMAStar Search\")\n",
|
19
|
-
" plt.show()\n",
|
20
|
-
" plt.clf()\n",
|
21
|
-
"def print_path(node, parent):\n",
|
22
|
-
" if node != None:\n",
|
23
|
-
" return print_path(parent[node], parent) + [node]\n",
|
24
|
-
" return []\n",
|
25
|
-
"def SMAStar(graph, start, goal, h, bound):\n",
|
26
|
-
" queue = [start]\n",
|
27
|
-
" visited = []\n",
|
28
|
-
" parent = {start : None}\n",
|
29
|
-
" g = {start : 0}\n",
|
30
|
-
" f = {start : h[start]}\n",
|
31
|
-
" backup = {}\n",
|
32
|
-
" while queue:\n",
|
33
|
-
" queue.sort(key = lambda x : f[x])\n",
|
34
|
-
" node = queue.pop(0)\n",
|
35
|
-
" visited.append(node)\n",
|
36
|
-
" if node == goal:\n",
|
37
|
-
" print(f\"Result(SMAStar {start} to {goal}):\",print_path(node, parent),\"Path cost =\",g[node],\"Bound =\",bound)\n",
|
38
|
-
" return True\n",
|
39
|
-
" successors = []\n",
|
40
|
-
" for adj in graph[node]:\n",
|
41
|
-
" if adj in visited:\n",
|
42
|
-
" continue\n",
|
43
|
-
" gcost = g[node] + graph[node][adj]\n",
|
44
|
-
" fcost = gcost + h[adj]\n",
|
45
|
-
" if adj in queue:\n",
|
46
|
-
" if fcost >= f[adj]:\n",
|
47
|
-
" continue\n",
|
48
|
-
" elif len(queue) < bound:\n",
|
49
|
-
" queue.append(adj)\n",
|
50
|
-
" else:\n",
|
51
|
-
" worst = max(queue, key = lambda x : f[x])\n",
|
52
|
-
" if fcost < f[worst]:\n",
|
53
|
-
" backup[worst] = f[worst]\n",
|
54
|
-
" queue.remove(worst)\n",
|
55
|
-
" queue.append(adj)\n",
|
56
|
-
" else:\n",
|
57
|
-
" continue\n",
|
58
|
-
" g[adj] = gcost\n",
|
59
|
-
" f[adj] = fcost\n",
|
60
|
-
" parent[adj] = node\n",
|
61
|
-
" successors.append(adj)\n",
|
62
|
-
" if not successors and node in backup:\n",
|
63
|
-
" f[node] = backup[node]\n",
|
64
|
-
" elif not successors:\n",
|
65
|
-
" f[node] = float('inf')\n",
|
66
|
-
" print(f\"Result(SMAStar {start} to {goal}): No Solution Bound = \",bound)\n",
|
67
|
-
" return False\n",
|
68
|
-
"def get_graph(directed = False):\n",
|
69
|
-
" graph = {}\n",
|
70
|
-
" heuristic = {}\n",
|
71
|
-
" \n",
|
72
|
-
" print(\"Enter (node, heuristic)\")\n",
|
73
|
-
" print(\"[PRESS ENTER TO STOP]\")\n",
|
74
|
-
" x = input()\n",
|
75
|
-
" while x:\n",
|
76
|
-
" x = x.split()\n",
|
77
|
-
" u, heuristic[u] = x[0], int(x[1])\n",
|
78
|
-
" graph[u] = graph.get(u, {})\n",
|
79
|
-
" x = input()\n",
|
80
|
-
" \n",
|
81
|
-
" print(\"Enter edge (u, v, weight)\")\n",
|
82
|
-
" print(\"[PRESS ENTER TO STOP]\")\n",
|
83
|
-
" x = input()\n",
|
84
|
-
" while x:\n",
|
85
|
-
" x = x.split(maxsplit = 1)\n",
|
86
|
-
" u, adj = x[0], [v.strip(' ()') for v in x[1].strip('[]').split(',') if v] \n",
|
87
|
-
" if len(adj) == 1:\n",
|
88
|
-
" v, w = adj[0].split()\n",
|
89
|
-
" adj = {v : int(w)}\n",
|
90
|
-
" else:\n",
|
91
|
-
" adj = {v : int(w) for v, w in zip(adj[::2],adj[1::2])}\n",
|
92
|
-
" graph[u] = graph.get(u, {}) | adj\n",
|
93
|
-
" for v, w in adj.items():\n",
|
94
|
-
" graph[v] = graph.get(v, {}) | ({u : w} if not directed else {})\n",
|
95
|
-
" x = input()\n",
|
96
|
-
" return graph, heuristic\n",
|
97
|
-
"def example():\n",
|
98
|
-
" graph = {\"A\" : {\"B\":9,\"C\":4,\"D\":7},\n",
|
99
|
-
" \"B\" : {\"A\":9,\"E\":11},\n",
|
100
|
-
" \"C\" : {\"A\":4,\"E\":17,\"F\":12},\n",
|
101
|
-
" \"D\" : {\"A\":7,\"F\":14},\n",
|
102
|
-
" \"E\" : {\"B\":11,\"G\":5,\"C\":17},\n",
|
103
|
-
" \"F\" : {\"D\":14,\"C\":12,\"G\":9},\n",
|
104
|
-
" \"G\" : {\"E\":5,\"F\":9}}\n",
|
105
|
-
" heuristic = {\"A\":21,\"B\":14,\"C\":18,\"D\":18,\"E\":5,\"F\":8,\"G\":0}\n",
|
106
|
-
" print(\"Heuristic: \",heuristic)\n",
|
107
|
-
" print(graph)\n",
|
108
|
-
" display(graph, heuristic)\n",
|
109
|
-
" SMAStar(graph, \"A\", \"G\", heuristic, 4)\n",
|
110
|
-
"\n",
|
111
|
-
"def main():\n",
|
112
|
-
" #example();return #Uncomment to run the example\n",
|
113
|
-
" graph, h = get_graph(directed = False)#undirected graph\n",
|
114
|
-
" source, goal, bound = input(\"Enter source and goal and bound: \").split()\n",
|
115
|
-
" display(graph, h, directed = False)\n",
|
116
|
-
" print(\"Heuristic: \",h)\n",
|
117
|
-
" print(graph)\n",
|
118
|
-
" SMAStar(graph, source, goal, h, int(bound))\n",
|
119
|
-
"\n",
|
120
|
-
" #Sample output\n",
|
121
|
-
" #Enter (node, heuristic)\n",
|
122
|
-
" #[PRESS ENTER TO STOP]\n",
|
123
|
-
" #A 21\n",
|
124
|
-
" #B 14\n",
|
125
|
-
" #C 18\n",
|
126
|
-
" #D 18\n",
|
127
|
-
" #E 5\n",
|
128
|
-
" #F 8\n",
|
129
|
-
" #G 0\n",
|
130
|
-
" \n",
|
131
|
-
" #Enter edge (u, v, weight)\n",
|
132
|
-
" #[PRESS ENTER TO STOP]\n",
|
133
|
-
" #A B 9\n",
|
134
|
-
" #A C 4\n",
|
135
|
-
" #A D 7\n",
|
136
|
-
" #B E 11\n",
|
137
|
-
" #C E 17\n",
|
138
|
-
" #C F 12\n",
|
139
|
-
" #D F 14\n",
|
140
|
-
" #E G 5\n",
|
141
|
-
" #F G 9\n",
|
142
|
-
" \n",
|
143
|
-
" #Enter source and goal: A G 4\n",
|
144
|
-
" #Result(SMAStar A to G): ['A', 'C', 'F', 'G'] Path cost = 25 Bound = 4\n",
|
145
|
-
"main()"
|
146
|
-
]
|
147
|
-
},
|
148
|
-
{
|
149
|
-
"cell_type": "code",
|
150
|
-
"execution_count": null,
|
151
|
-
"id": "c9058a95-e899-457a-aff4-a5bed47bca86",
|
152
|
-
"metadata": {},
|
153
|
-
"outputs": [],
|
154
|
-
"source": []
|
155
|
-
}
|
156
|
-
],
|
157
|
-
"metadata": {
|
158
|
-
"kernelspec": {
|
159
|
-
"display_name": "Python 3 (ipykernel)",
|
160
|
-
"language": "python",
|
161
|
-
"name": "python3"
|
162
|
-
},
|
163
|
-
"language_info": {
|
164
|
-
"codemirror_mode": {
|
165
|
-
"name": "ipython",
|
166
|
-
"version": 3
|
167
|
-
},
|
168
|
-
"file_extension": ".py",
|
169
|
-
"mimetype": "text/x-python",
|
170
|
-
"name": "python",
|
171
|
-
"nbconvert_exporter": "python",
|
172
|
-
"pygments_lexer": "ipython3",
|
173
|
-
"version": "3.12.4"
|
174
|
-
}
|
175
|
-
},
|
176
|
-
"nbformat": 4,
|
177
|
-
"nbformat_minor": 5
|
178
|
-
}
|