how to compress a variable size matrix into a fixed size one?
조회 수: 1 (최근 30일)
이전 댓글 표시
i need a function to convert variable size matrices into a fixed size of 25*25.
댓글 수: 0
답변 (2개)
ES
2013년 9월 26일
You want to truncate first 25 rows and columns?
[m,n]=size(VariableSizeMatrix)
if (m>=25 && n>=25)
FixedSizeMatrix=VariableSizeMatrix(1:25,1:25)
end
if the size of VariableSizeMatrix is less than (25, 25) pad zeros or process according to your needs.
댓글 수: 0
Jan
2013년 9월 26일
It depends on what kind of compression you want. It could be cutting out a part on the top or bottom, right, left or from the center. You could mean a linear or cubic interpolation, or a Lanzcos resampling using imresize.
댓글 수: 5
Walter Roberson
2013년 9월 27일
You cannot fit all unique 1*700 vectors into 25*25 without data loss, but if there are at least 75 duplicates you could do it.
What you probably want is something like to extract "features" from the sentences, in such a way that the 700 different sentences reduced down to a 25*25 matrix, with the mapping being by some kind of "essential similarity", with the NN so produced able to classify other sentences according to their essential similarities.
For example, if you were to classify each word independently by the possible parts of speech the word could be, then instead of the actual words, you could record the allowed parts of speech in sequence, and train the NN on those sequences. The resulting training should be able to predict what the actual parts of speech were for each word, because the same patterns occur repeatedly. You might find, for example, that ADJECTIVE-NOUN-NOUN seldom occurs, and so could deduce that the ADJECTIVE-(NOUN or ADJECTIVE)-NOUN pattern "big red box" is likely the ADJECTIVE-ADJECTIVE-NOUN pattern that occurs more often. Such as in the pattern "big heavy box".
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!