Skip to content
Snippets Groups Projects
Commit f19f8363 authored by bjje's avatar bjje
Browse files

minor bug fixes updates

parent bf5a1b1c
Branches
No related tags found
No related merge requests found
%% exercise 1.6.3
cdir = fileparts(mfilename('fullpath'));
print cdir
TMGOpts.stoplist = fullfile(cdir,'../Data/stopWords.txt');
[A, D] = tmg(fullfile(cdir,'../Data/textDocs.txt'), TMGOpts);
X = full(A)';
......
......@@ -2402,3 +2402,167 @@ Filtering of input files ended at 03-May-2023 14:31:17...
Estimated time of parsing documents: 0.039420 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 06:05:54...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 06:05:54...
Estimated time of parsing documents: 0.132857 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 06:06:00...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 06:06:00...
Estimated time of parsing documents: 0.067723 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 06:06:26...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 06:06:26...
Estimated time of parsing documents: 0.027121 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 06:06:30...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 06:06:30...
Estimated time of parsing documents: 0.027886 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 06:07:09...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 06:07:09...
Estimated time of parsing documents: 0.043797 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 06:07:18...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 06:07:18...
Estimated time of parsing documents: 0.027370 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on ..\Data\textDocs.txt file in 01-Feb-2025 06:08:05...
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 06:10:01...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 06:10:01...
Estimated time of parsing documents: 0.023193 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 06:10:20...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 06:10:20...
Estimated time of parsing documents: 0.034251 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 06:10:46...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 06:10:46...
Estimated time of parsing documents: 0.022991 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 17:04:10...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 17:04:10...
Estimated time of parsing documents: 0.057242 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 17:04:14...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 17:04:14...
Estimated time of parsing documents: 0.023574 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on ..\Data\textDocs.txt file in 01-Feb-2025 17:04:33...
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 17:07:56...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 17:07:56...
Estimated time of parsing documents: 0.030590 seconds
==================================================================================================================================================================
==================================================================================================================================================================
Running TMG...
Converting Results on C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 01-Feb-2025 17:08:01...
==================================================================================================================================================================
-File textDocs.txt did not need conversion...
==================================================================================================================================================================
Filtering of input files ended at 01-Feb-2025 17:08:01...
Estimated time of parsing documents: 0.030105 seconds
==================================================================================================================================================================
......@@ -5696,3 +5696,159 @@ Removed 0 elements using the local thresholds...
Removed 0 empty terms...
Removed 0 empty documents...
=================================================================================
==================================================================================================================================================================
Running tmg (tmg_p.m) on 01-Feb-2025 06:05:55...
Using the Perl implementation...
Input File/Directory: C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt
Delimiter: emptyline
Line Delimiter: Yes
Stoplist Filename: -nostoplist
Update Step: 10000
Minimum Length: 3
Maximum Length: 30
Minimum Local Frequency: 1
Maximum Local Frequency: Inf
Minimum Global Frequency: 1
Maximum Global Frequency: Inf
Local Term Weighting Function: term frequency
Global Term Weighting Function: none
Using Normalization: no
Using Stemming: no
Removing Numbers: no
Removing Alphanumerics: no
=================================================================================
Results:
=================================================================================
Number of documents = 5
Number of terms = 25
Average number of terms per document (before the normalization) = 11
Average number of indexing terms per document = 6.8
Sparsity = 25.6%
Estimated time for parsing and converting the files: 0.132857 seconds
Estimated time for constructing tdm and the other workspace parts: 0.769623 seconds
Removed 12 terms using the term-length thresholds...
Removed 0 terms using the global thresholds...
Removed 0 elements using the local thresholds...
Removed 0 empty terms...
Removed 0 empty documents...
=================================================================================
==================================================================================================================================================================
Running tmg (tmg_p.m) on 01-Feb-2025 06:06:26...
Using the Perl implementation...
Input File/Directory: C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt
Delimiter: emptyline
Line Delimiter: Yes
Stoplist Filename: -nostoplist
Update Step: 10000
Minimum Length: 3
Maximum Length: 30
Minimum Local Frequency: 1
Maximum Local Frequency: Inf
Minimum Global Frequency: 1
Maximum Global Frequency: Inf
Local Term Weighting Function: term frequency
Global Term Weighting Function: none
Using Normalization: no
Using Stemming: no
Removing Numbers: no
Removing Alphanumerics: no
=================================================================================
Results:
=================================================================================
Number of documents = 5
Number of terms = 25
Average number of terms per document (before the normalization) = 11
Average number of indexing terms per document = 6.8
Sparsity = 25.6%
Estimated time for parsing and converting the files: 0.027121 seconds
Estimated time for constructing tdm and the other workspace parts: 0.403465 seconds
Removed 12 terms using the term-length thresholds...
Removed 0 terms using the global thresholds...
Removed 0 elements using the local thresholds...
Removed 0 empty terms...
Removed 0 empty documents...
=================================================================================
==================================================================================================================================================================
Running tmg (tmg_p.m) on 01-Feb-2025 06:07:10...
Using the Perl implementation...
Input File/Directory: C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt
Delimiter: emptyline
Line Delimiter: Yes
Stoplist Filename: -nostoplist
Update Step: 10000
Minimum Length: 3
Maximum Length: 30
Minimum Local Frequency: 1
Maximum Local Frequency: Inf
Minimum Global Frequency: 1
Maximum Global Frequency: Inf
Local Term Weighting Function: term frequency
Global Term Weighting Function: none
Using Normalization: no
Using Stemming: no
Removing Numbers: no
Removing Alphanumerics: no
=================================================================================
Results:
=================================================================================
Number of documents = 5
Number of terms = 25
Average number of terms per document (before the normalization) = 11
Average number of indexing terms per document = 6.8
Sparsity = 25.6%
Estimated time for parsing and converting the files: 0.043797 seconds
Estimated time for constructing tdm and the other workspace parts: 0.641746 seconds
Removed 12 terms using the term-length thresholds...
Removed 0 terms using the global thresholds...
Removed 0 elements using the local thresholds...
Removed 0 empty terms...
Removed 0 empty documents...
=================================================================================
==================================================================================================================================================================
Running tmg (tmg_p.m) on 01-Feb-2025 17:04:11...
Using the Perl implementation...
Input File/Directory: C:\Users\bjje\02450spring2025\02450students\exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt
Delimiter: emptyline
Line Delimiter: Yes
Stoplist Filename: -nostoplist
Update Step: 10000
Minimum Length: 3
Maximum Length: 30
Minimum Local Frequency: 1
Maximum Local Frequency: Inf
Minimum Global Frequency: 1
Maximum Global Frequency: Inf
Local Term Weighting Function: term frequency
Global Term Weighting Function: none
Using Normalization: no
Using Stemming: no
Removing Numbers: no
Removing Alphanumerics: no
=================================================================================
Results:
=================================================================================
Number of documents = 5
Number of terms = 25
Average number of terms per document (before the normalization) = 11
Average number of indexing terms per document = 6.8
Sparsity = 25.6%
Estimated time for parsing and converting the files: 0.057242 seconds
Estimated time for constructing tdm and the other workspace parts: 0.585559 seconds
Removed 12 terms using the term-length thresholds...
Removed 0 terms using the global thresholds...
Removed 0 elements using the local thresholds...
Removed 0 empty terms...
Removed 0 empty documents...
=================================================================================
......@@ -51,4 +51,4 @@ print()
print("Document-term matrix:")
print(X.toarray())
print()
print("Ran Exercise 3.1.2")
......@@ -37,4 +37,4 @@ print()
print("Document-term matrix:")
print(X.toarray())
print()
print("Ran Exercise 1.6.3")
......@@ -35,4 +35,3 @@ sim = similarity(X, q, "cos")
print("Query vector:\n {0}\n".format(q))
print("Similarity results:\n {0}".format(sim))
print("Ran Exercise 1.6.5")
......@@ -34,7 +34,7 @@ attributeNames = [
# Attribute values
X = np.asarray(
np.mat(
np.asmatrix(
"""
1 1 1 0 0 1 0;
0 2 0 0 0 0 1;
......@@ -55,7 +55,7 @@ X = np.asarray(
)
# Class indices
y = np.asarray(np.mat("3 4 2 3 0 4 3 1 3 2 4 1 3 2 0").T).squeeze()
y = np.asarray(np.asmatrix("3 4 2 3 0 4 3 1 3 2 4 1 3 2 0").T).squeeze()
# Class names
classNames = ["Amphibian", "Bird", "Fish", "Mammal", "Reptile"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment