diff --git a/README.md b/README.md index 934c39dae883eb5a224f86c506a13ef518db1179..2c866edd665ea504f4c4157f1345a4df5011ce60 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,20 @@ -# 02450students +# 02450 Introduction to Machine Learning and Data Mining +## Purpose +The content of this repository is intended for students enrolled on course 02450 Introduction to machine learning and data mining at +the Technical University of Denmark (DTU). +Official course description: https://kurser.dtu.dk/course/02450 -## Getting started +Public webpage for 02450: https://www2.imm.dtu.dk/courses/02450/ -To make it easy for you to get started with GitLab, here's a list of recommended next steps. -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! +## Content +- [ ] Exercise toolbox/scripts: The toolbox is available in this repository in R, Matlab and Python. Follow the installation instructions in the individual folder and the exercise instructions (available via DTU Learn). +- [ ] Exercise instructions: The instructions for the exercises are only available via DTU Learn available to enrolled students. +- [ ] Book: The book is currenlty only available in pdf format for enrolled students via DTU Learn. A hardcopy can be purchased via the Polyteknisk bookstore at DTU. -## Add your files +## Licensing +See individual foldes/files. The content is not for redistrbution. -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: -``` -cd existing_repo -git remote add origin https://lab.compute.dtu.dk/02450/02450students.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](https://lab.compute.dtu.dk/02450/02450students/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README - -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/book/README.md b/book/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5bcc72a0eebcd71aa366f19eb1691380165df340 --- /dev/null +++ b/book/README.md @@ -0,0 +1,3 @@ +# 02450 Book + +The book is currently only available for student enrolled on the course via DTU Learn. \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Data/body.mat b/exercises/02450Toolbox_Matlab/Data/body.mat new file mode 100644 index 0000000000000000000000000000000000000000..813ae289c6d502ff0a9241334017cbc43ee29bab Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/body.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/courses.txt b/exercises/02450Toolbox_Matlab/Data/courses.txt new file mode 100644 index 0000000000000000000000000000000000000000..da22d2b8fb121647f4dbeda6edc3a3f4cae2f366 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/courses.txt @@ -0,0 +1,6 @@ +2,5,6,7,8 +1,2,3,6,7,8 +2,4,6,8 +3,6,7 +2,6,7 +2,3,6,7,8 diff --git a/exercises/02450Toolbox_Matlab/Data/digits.mat b/exercises/02450Toolbox_Matlab/Data/digits.mat new file mode 100644 index 0000000000000000000000000000000000000000..434cf47348fd6709f94ee19381b428904d7d0530 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/digits.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/faithful.mat b/exercises/02450Toolbox_Matlab/Data/faithful.mat new file mode 100644 index 0000000000000000000000000000000000000000..e41906ed4794d8c6991c6985ebaa69f4dc45f2b5 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/faithful.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/faithful.txt b/exercises/02450Toolbox_Matlab/Data/faithful.txt new file mode 100644 index 0000000000000000000000000000000000000000..d31bbd2a0c0dfeda95ca878b54fb502db0d9aa57 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/faithful.txt @@ -0,0 +1,272 @@ +3.600000 79.000000 +1.800000 54.000000 +3.333000 74.000000 +2.283000 62.000000 +4.533000 85.000000 +2.883000 55.000000 +4.700000 88.000000 +3.600000 85.000000 +1.950000 51.000000 +4.350000 85.000000 +1.833000 54.000000 +3.917000 84.000000 +4.200000 78.000000 +1.750000 47.000000 +4.700000 83.000000 +2.167000 52.000000 +1.750000 62.000000 +4.800000 84.000000 +1.600000 52.000000 +4.250000 79.000000 +1.800000 51.000000 +1.750000 47.000000 +3.450000 78.000000 +3.067000 69.000000 +4.533000 74.000000 +3.600000 83.000000 +1.967000 55.000000 +4.083000 76.000000 +3.850000 78.000000 +4.433000 79.000000 +4.300000 73.000000 +4.467000 77.000000 +3.367000 66.000000 +4.033000 80.000000 +3.833000 74.000000 +2.017000 52.000000 +1.867000 48.000000 +4.833000 80.000000 +1.833000 59.000000 +4.783000 90.000000 +4.350000 80.000000 +1.883000 58.000000 +4.567000 84.000000 +1.750000 58.000000 +4.533000 73.000000 +3.317000 83.000000 +3.833000 64.000000 +2.100000 53.000000 +4.633000 82.000000 +2.000000 59.000000 +4.800000 75.000000 +4.716000 90.000000 +1.833000 54.000000 +4.833000 80.000000 +1.733000 54.000000 +4.883000 83.000000 +3.717000 71.000000 +1.667000 64.000000 +4.567000 77.000000 +4.317000 81.000000 +2.233000 59.000000 +4.500000 84.000000 +1.750000 48.000000 +4.800000 82.000000 +1.817000 60.000000 +4.400000 92.000000 +4.167000 78.000000 +4.700000 78.000000 +2.067000 65.000000 +4.700000 73.000000 +4.033000 82.000000 +1.967000 56.000000 +4.500000 79.000000 +4.000000 71.000000 +1.983000 62.000000 +5.067000 76.000000 +2.017000 60.000000 +4.567000 78.000000 +3.883000 76.000000 +3.600000 83.000000 +4.133000 75.000000 +4.333000 82.000000 +4.100000 70.000000 +2.633000 65.000000 +4.067000 73.000000 +4.933000 88.000000 +3.950000 76.000000 +4.517000 80.000000 +2.167000 48.000000 +4.000000 86.000000 +2.200000 60.000000 +4.333000 90.000000 +1.867000 50.000000 +4.817000 78.000000 +1.833000 63.000000 +4.300000 72.000000 +4.667000 84.000000 +3.750000 75.000000 +1.867000 51.000000 +4.900000 82.000000 +2.483000 62.000000 +4.367000 88.000000 +2.100000 49.000000 +4.500000 83.000000 +4.050000 81.000000 +1.867000 47.000000 +4.700000 84.000000 +1.783000 52.000000 +4.850000 86.000000 +3.683000 81.000000 +4.733000 75.000000 +2.300000 59.000000 +4.900000 89.000000 +4.417000 79.000000 +1.700000 59.000000 +4.633000 81.000000 +2.317000 50.000000 +4.600000 85.000000 +1.817000 59.000000 +4.417000 87.000000 +2.617000 53.000000 +4.067000 69.000000 +4.250000 77.000000 +1.967000 56.000000 +4.600000 88.000000 +3.767000 81.000000 +1.917000 45.000000 +4.500000 82.000000 +2.267000 55.000000 +4.650000 90.000000 +1.867000 45.000000 +4.167000 83.000000 +2.800000 56.000000 +4.333000 89.000000 +1.833000 46.000000 +4.383000 82.000000 +1.883000 51.000000 +4.933000 86.000000 +2.033000 53.000000 +3.733000 79.000000 +4.233000 81.000000 +2.233000 60.000000 +4.533000 82.000000 +4.817000 77.000000 +4.333000 76.000000 +1.983000 59.000000 +4.633000 80.000000 +2.017000 49.000000 +5.100000 96.000000 +1.800000 53.000000 +5.033000 77.000000 +4.000000 77.000000 +2.400000 65.000000 +4.600000 81.000000 +3.567000 71.000000 +4.000000 70.000000 +4.500000 81.000000 +4.083000 93.000000 +1.800000 53.000000 +3.967000 89.000000 +2.200000 45.000000 +4.150000 86.000000 +2.000000 58.000000 +3.833000 78.000000 +3.500000 66.000000 +4.583000 76.000000 +2.367000 63.000000 +5.000000 88.000000 +1.933000 52.000000 +4.617000 93.000000 +1.917000 49.000000 +2.083000 57.000000 +4.583000 77.000000 +3.333000 68.000000 +4.167000 81.000000 +4.333000 81.000000 +4.500000 73.000000 +2.417000 50.000000 +4.000000 85.000000 +4.167000 74.000000 +1.883000 55.000000 +4.583000 77.000000 +4.250000 83.000000 +3.767000 83.000000 +2.033000 51.000000 +4.433000 78.000000 +4.083000 84.000000 +1.833000 46.000000 +4.417000 83.000000 +2.183000 55.000000 +4.800000 81.000000 +1.833000 57.000000 +4.800000 76.000000 +4.100000 84.000000 +3.966000 77.000000 +4.233000 81.000000 +3.500000 87.000000 +4.366000 77.000000 +2.250000 51.000000 +4.667000 78.000000 +2.100000 60.000000 +4.350000 82.000000 +4.133000 91.000000 +1.867000 53.000000 +4.600000 78.000000 +1.783000 46.000000 +4.367000 77.000000 +3.850000 84.000000 +1.933000 49.000000 +4.500000 83.000000 +2.383000 71.000000 +4.700000 80.000000 +1.867000 49.000000 +3.833000 75.000000 +3.417000 64.000000 +4.233000 76.000000 +2.400000 53.000000 +4.800000 94.000000 +2.000000 55.000000 +4.150000 76.000000 +1.867000 50.000000 +4.267000 82.000000 +1.750000 54.000000 +4.483000 75.000000 +4.000000 78.000000 +4.117000 79.000000 +4.083000 78.000000 +4.267000 78.000000 +3.917000 70.000000 +4.550000 79.000000 +4.083000 70.000000 +2.417000 54.000000 +4.183000 86.000000 +2.217000 50.000000 +4.450000 90.000000 +1.883000 54.000000 +1.850000 54.000000 +4.283000 77.000000 +3.950000 79.000000 +2.333000 64.000000 +4.150000 75.000000 +2.350000 47.000000 +4.933000 86.000000 +2.900000 63.000000 +4.583000 85.000000 +3.833000 82.000000 +2.083000 57.000000 +4.367000 82.000000 +2.133000 67.000000 +4.350000 74.000000 +2.200000 54.000000 +4.450000 83.000000 +3.567000 73.000000 +4.500000 73.000000 +4.150000 88.000000 +3.817000 80.000000 +3.917000 71.000000 +4.450000 83.000000 +2.000000 56.000000 +4.283000 79.000000 +4.767000 78.000000 +4.533000 84.000000 +1.850000 58.000000 +4.250000 83.000000 +1.983000 43.000000 +2.250000 60.000000 +4.750000 75.000000 +4.117000 81.000000 +2.150000 46.000000 +4.417000 90.000000 +1.817000 46.000000 +4.467000 74.000000 diff --git a/exercises/02450Toolbox_Matlab/Data/female.txt b/exercises/02450Toolbox_Matlab/Data/female.txt new file mode 100644 index 0000000000000000000000000000000000000000..03a0f10d30373cd4d5d1ac1613028885c23dce77 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/female.txt @@ -0,0 +1,4999 @@ +Abagael +Abagail +Abbe +Abbey +Abbi +Abbie +Abby +Abigael +Abigail +Abigale +Abra +Acacia +Ada +Adah +Adaline +Adara +Addie +Addis +Adel +Adela +Adelaide +Adele +Adelice +Adelina +Adelind +Adeline +Adella +Adelle +Adena +Adey +Adi +Adiana +Adina +Adora +Adore +Adoree +Adorne +Adrea +Adria +Adriaens +Adrian +Adriana +Adriane +Adrianna +Adrianne +Adrien +Adriena +Adrienne +Aeriel +Aeriela +Aeriell +Ag +Agace +Agata +Agatha +Agathe +Aggi +Aggie +Aggy +Agna +Agnella +Agnes +Agnese +Agnesse +Agneta +Agnola +Agretha +Aida +Aidan +Aigneis +Aila +Aile +Ailee +Aileen +Ailene +Ailey +Aili +Ailina +Ailyn +Aime +Aimee +Aimil +Aina +Aindrea +Ainslee +Ainsley +Ainslie +Ajay +Alaine +Alameda +Alana +Alanah +Alane +Alanna +Alayne +Alberta +Albertina +Albertine +Albina +Alecia +Aleda +Aleece +Aleecia +Aleen +Alejandra +Alejandrina +Alena +Alene +Alessandra +Aleta +Alethea +Alex +Alexa +Alexandra +Alexandrina +Alexi +Alexia +Alexina +Alexine +Alexis +Alfie +Alfreda +Ali +Alia +Alica +Alice +Alicea +Alicia +Alida +Alidia +Alina +Aline +Alis +Alisa +Alisha +Alison +Alissa +Alisun +Alix +Aliza +Alla +Alleen +Allegra +Allene +Alli +Allianora +Allie +Allina +Allis +Allison +Allissa +Allsun +Ally +Allyce +Allyn +Allys +Allyson +Alma +Almeda +Almeria +Almeta +Almira +Almire +Aloise +Aloisia +Aloysia +Alpa +Alta +Althea +Alvera +Alvina +Alvinia +Alvira +Alyce +Alyda +Alys +Alysa +Alyse +Alysia +Alyson +Alyss +Alyssa +Amabel +Amabelle +Amalea +Amalee +Amaleta +Amalia +Amalie +Amalita +Amalle +Amanda +Amandi +Amandie +Amandy +Amara +Amargo +Amata +Amber +Amberly +Ambrosia +Ambur +Ame +Amelia +Amelie +Amelina +Ameline +Amelita +Ami +Amie +Amity +Ammamaria +Amy +Ana +Anabel +Anabella +Anabelle +Anais +Analiese +Analise +Anallese +Anallise +Anastasia +Anastasie +Anastassia +Anatola +Andee +Andi +Andie +Andra +Andrea +Andreana +Andree +Andrei +Andria +Andriana +Andriette +Andromache +Andromeda +Andy +Anestassia +Anet +Anett +Anetta +Anette +Ange +Angel +Angela +Angele +Angelia +Angelica +Angelika +Angelina +Angeline +Angelique +Angelita +Angelle +Angie +Angil +Angy +Ania +Anica +Anissa +Anita +Anitra +Anja +Anjanette +Anjela +Ann +Ann-Mari +Ann-Marie +Anna +Anna-Diana +Anna-Diane +Anna-Maria +Annabal +Annabel +Annabela +Annabell +Annabella +Annabelle +Annadiana +Annadiane +Annalee +Annalena +Annaliese +Annalisa +Annalise +Annalyse +Annamari +Annamaria +Annamarie +Anne +Anne-Corinne +Anne-Mar +Anne-Marie +Annecorinne +Anneliese +Annelise +Annemarie +Annetta +Annette +Anni +Annice +Annie +Annissa +Annmaria +Annmarie +Annnora +Annora +Anny +Anselma +Ansley +Anstice +Anthe +Anthea +Anthia +Antoinette +Antonella +Antonetta +Antonia +Antonie +Antonietta +Antonina +Anya +Aphrodite +Appolonia +April +Aprilette +Ara +Arabel +Arabela +Arabele +Arabella +Arabelle +Arda +Ardath +Ardeen +Ardelia +Ardelis +Ardella +Ardelle +Arden +Ardene +Ardenia +Ardine +Ardis +Ardith +Ardra +Ardyce +Ardys +Ardyth +Aretha +Ariadne +Ariana +Arianne +Aridatha +Ariel +Ariela +Ariella +Arielle +Arlana +Arlee +Arleen +Arlen +Arlena +Arlene +Arleta +Arlette +Arleyne +Arlie +Arliene +Arlina +Arlinda +Arline +Arly +Arlyn +Arlyne +Aryn +Ashely +Ashlee +Ashleigh +Ashlen +Ashley +Ashli +Ashlie +Ashly +Asia +Astra +Astrid +Astrix +Atalanta +Athena +Athene +Atlanta +Atlante +Auberta +Aubine +Aubree +Aubrette +Aubrey +Aubrie +Aubry +Audi +Audie +Audra +Audre +Audrey +Audrie +Audry +Audrye +Audy +Augusta +Auguste +Augustina +Augustine +Aura +Aurea +Aurel +Aurelea +Aurelia +Aurelie +Auria +Aurie +Aurilia +Aurlie +Auroora +Aurora +Aurore +Austin +Austina +Austine +Ava +Aveline +Averil +Averyl +Avie +Avis +Aviva +Avivah +Avril +Avrit +Ayn +Bab +Babara +Babette +Babita +Babs +Bambi +Bambie +Bamby +Barb +Barbabra +Barbara +Barbara-Anne +Barbaraanne +Barbe +Barbee +Barbette +Barbey +Barbi +Barbie +Barbra +Barby +Bari +Barrie +Barry +Basia +Bathsheba +Batsheva +Bea +Beatrice +Beatrisa +Beatrix +Beatriz +Beau +Bebe +Becca +Becka +Becki +Beckie +Becky +Bee +Beilul +Beitris +Bekki +Bel +Belia +Belicia +Belinda +Belita +Bell +Bella +Bellamy +Bellanca +Belle +Bellina +Belva +Belvia +Bendite +Benedetta +Benedicta +Benedikta +Benetta +Benita +Benni +Bennie +Benny +Benoite +Berenice +Beret +Berget +Berna +Bernadene +Bernadette +Bernadina +Bernadine +Bernardina +Bernardine +Bernelle +Bernete +Bernetta +Bernette +Berni +Bernice +Bernie +Bernita +Berny +Berri +Berrie +Berry +Bert +Berta +Berte +Bertha +Berthe +Berti +Bertie +Bertina +Bertine +Berty +Beryl +Beryle +Bess +Bessie +Bessy +Beth +Bethanne +Bethany +Bethena +Bethina +Betsey +Betsy +Betta +Bette +Bette-Ann +Betteann +Betteanne +Betti +Bettie +Bettina +Bettine +Betty +Bettye +Beulah +Bev +Beverie +Beverlee +Beverlie +Beverly +Bevvy +Bianca +Bianka +Biddy +Bidget +Bill +Billi +Billie +Billy +Binni +Binnie +Binny +Bird +Birdie +Birgit +Birgitta +Blair +Blaire +Blake +Blakelee +Blakeley +Blanca +Blanch +Blancha +Blanche +Blinni +Blinnie +Blinny +Bliss +Blisse +Blithe +Blondell +Blondelle +Blondie +Blondy +Blythe +Bo +Bobbette +Bobbi +Bobbie +Bobby +Bobette +Bobina +Bobine +Bobinette +Bonita +Bonnee +Bonni +Bonnie +Bonny +Brana +Brandais +Brande +Brandea +Brandi +Brandice +Brandie +Brandise +Brandy +Brea +Breanne +Brear +Bree +Breena +Bren +Brena +Brenda +Brenn +Brenna +Brett +Bria +Briana +Brianna +Brianne +Bride +Bridget +Bridgett +Bridgette +Bridie +Brier +Brietta +Brigid +Brigida +Brigit +Brigitta +Brigitte +Brina +Briney +Briny +Brit +Brita +Britaney +Britani +Briteny +Britney +Britni +Britt +Britta +Brittan +Brittany +Britte +Brittney +Brook +Brooke +Brooks +Brunella +Brunhilda +Brunhilde +Bryana +Bryn +Bryna +Brynn +Brynna +Brynne +Buffy +Bunni +Bunnie +Bunny +Burta +Cabrina +Cacilia +Cacilie +Caitlin +Caitrin +Cal +Calida +Calla +Calley +Calli +Callida +Callie +Cally +Calypso +Cam +Camala +Camel +Camella +Camellia +Cameo +Cami +Camila +Camile +Camilla +Camille +Cammi +Cammie +Cammy +Canada +Candace +Candi +Candice +Candida +Candide +Candie +Candis +Candra +Candy +Cappella +Caprice +Cara +Caralie +Caren +Carena +Caresa +Caressa +Caresse +Carey +Cari +Caria +Carie +Caril +Carilyn +Carin +Carina +Carine +Cariotta +Carissa +Carita +Caritta +Carla +Carlee +Carleen +Carlen +Carlena +Carlene +Carley +Carli +Carlie +Carlin +Carlina +Carline +Carlisle +Carlita +Carlota +Carlotta +Carly +Carlye +Carlyn +Carlynn +Carlynne +Carma +Carmel +Carmela +Carmelia +Carmelina +Carmelita +Carmella +Carmelle +Carmen +Carmina +Carmine +Carmita +Carmon +Caro +Carol +Carol-Jean +Carola +Carolan +Carolann +Carole +Carolee +Caroleen +Carolie +Carolin +Carolina +Caroline +Caroljean +Carolyn +Carolyne +Carolynn +Caron +Carree +Carri +Carrie +Carrissa +Carrol +Carroll +Carry +Cary +Caryl +Caryn +Casandra +Casey +Casi +Casia +Casie +Cass +Cassandra +Cassandre +Cassandry +Cassaundra +Cassey +Cassi +Cassie +Cassondra +Cassy +Cat +Catarina +Cate +Caterina +Catha +Catharina +Catharine +Cathe +Cathee +Catherin +Catherina +Catherine +Cathi +Cathie +Cathleen +Cathlene +Cathrin +Cathrine +Cathryn +Cathy +Cathyleen +Cati +Catie +Catina +Catlaina +Catlee +Catlin +Catrina +Catriona +Caty +Cayla +Cecelia +Cecil +Cecile +Ceciley +Cecilia +Cecilla +Cecily +Ceil +Cele +Celene +Celesta +Celeste +Celestia +Celestina +Celestine +Celestyn +Celestyna +Celia +Celie +Celina +Celinda +Celine +Celinka +Celisse +Celle +Cesya +Chad +Chanda +Chandal +Chandra +Channa +Chantal +Chantalle +Charil +Charin +Charis +Charissa +Charisse +Charita +Charity +Charla +Charlean +Charleen +Charlena +Charlene +Charline +Charlot +Charlott +Charlotta +Charlotte +Charmain +Charmaine +Charmane +Charmian +Charmine +Charmion +Charo +Charyl +Chastity +Chelsae +Chelsea +Chelsey +Chelsie +Chelsy +Cher +Chere +Cherey +Cheri +Cherianne +Cherice +Cherida +Cherie +Cherilyn +Cherilynn +Cherin +Cherise +Cherish +Cherlyn +Cherri +Cherrita +Cherry +Chery +Cherye +Cheryl +Cheslie +Chiarra +Chickie +Chicky +Chiquita +Chloe +Chloette +Chloris +Chris +Chriss +Chrissa +Chrissie +Chrissy +Christa +Christabel +Christabella +Christabelle +Christal +Christalle +Christan +Christean +Christel +Christen +Christi +Christian +Christiana +Christiane +Christie +Christin +Christina +Christine +Christy +Christyna +Chrysa +Chrysler +Chrystal +Chryste +Chrystel +Ciara +Cicely +Cicily +Ciel +Cilka +Cinda +Cindee +Cindelyn +Cinderella +Cindi +Cindie +Cindra +Cindy +Cinnamon +Cissie +Cissy +Clair +Claire +Clara +Clarabelle +Clare +Claresta +Clareta +Claretta +Clarette +Clarey +Clari +Claribel +Clarice +Clarie +Clarinda +Clarine +Clarisa +Clarissa +Clarisse +Clarita +Clary +Claude +Claudelle +Claudetta +Claudette +Claudia +Claudie +Claudina +Claudine +Clea +Clem +Clemence +Clementia +Clementina +Clementine +Clemmie +Clemmy +Cleo +Cleopatra +Clerissa +Cleva +Clio +Clo +Cloe +Cloris +Clotilda +Clovis +Codee +Codi +Codie +Cody +Coleen +Colene +Coletta +Colette +Colleen +Collete +Collette +Collie +Colline +Colly +Con +Concettina +Conchita +Concordia +Conney +Conni +Connie +Conny +Consolata +Constance +Constancia +Constancy +Constanta +Constantia +Constantina +Constantine +Consuela +Consuelo +Cookie +Cora +Corabel +Corabella +Corabelle +Coral +Coralie +Coraline +Coralyn +Cordelia +Cordelie +Cordey +Cordie +Cordula +Cordy +Coreen +Corella +Corena +Corenda +Corene +Coretta +Corette +Corey +Cori +Corie +Corilla +Corina +Corine +Corinna +Corinne +Coriss +Corissa +Corliss +Corly +Cornela +Cornelia +Cornelle +Cornie +Corny +Correna +Correy +Corri +Corrianne +Corrie +Corrina +Corrine +Corrinne +Corry +Cortney +Cory +Cosetta +Cosette +Courtenay +Courtney +Cresa +Cris +Crissie +Crissy +Crista +Cristabel +Cristal +Cristen +Cristi +Cristie +Cristin +Cristina +Cristine +Cristionna +Cristy +Crysta +Crystal +Crystie +Cyb +Cybal +Cybel +Cybelle +Cybil +Cybill +Cyndi +Cyndy +Cynthea +Cynthia +Cynthie +Cynthy +Dacey +Dacia +Dacie +Dacy +Dael +Daffi +Daffie +Daffy +Dafna +Dagmar +Dahlia +Daile +Daisey +Daisi +Daisie +Daisy +Dale +Dalenna +Dalia +Dalila +Dallas +Daloris +Damara +Damaris +Damita +Dana +Danell +Danella +Danelle +Danette +Dani +Dania +Danica +Danice +Daniel +Daniela +Daniele +Daniella +Danielle +Danika +Danila +Danit +Danita +Danna +Danni +Dannie +Danny +Dannye +Danya +Danyelle +Danyette +Daphene +Daphna +Daphne +Dara +Darb +Darbie +Darby +Darcee +Darcey +Darci +Darcie +Darcy +Darda +Dareen +Darell +Darelle +Dari +Daria +Darice +Darla +Darleen +Darlene +Darline +Darryl +Darsey +Darsie +Darya +Daryl +Daryn +Dasha +Dasi +Dasie +Dasya +Datha +Daune +Daveen +Daveta +Davida +Davina +Davine +Davita +Dawn +Dawna +Dayle +Dayna +Dea +Deana +Deane +Deanna +Deanne +Deb +Debbi +Debbie +Debbra +Debby +Debee +Debera +Debi +Debor +Debora +Deborah +Debra +Dede +Dedie +Dedra +Dee +Dee Dee +Deeann +Deeanne +Deedee +Deena +Deerdre +Dehlia +Deidre +Deina +Deirdre +Del +Dela +Delaney +Delcina +Delcine +Delia +Delila +Delilah +Delinda +Dell +Della +Delly +Delora +Delores +Deloria +Deloris +Delphina +Delphine +Delphinia +Demeter +Demetra +Demetria +Demetris +Dena +Deni +Denice +Denise +Denna +Denni +Dennie +Denny +Deny +Denys +Denyse +Deonne +Desaree +Desdemona +Desirae +Desiree +Desiri +Deva +Devan +Devi +Devin +Devina +Devinne +Devon +Devondra +Devonna +Devonne +Devora +Dew +Di +Diahann +Diamond +Dian +Diana +Diandra +Diane +Diane-Marie +Dianemarie +Diann +Dianna +Dianne +Diannne +Didi +Dido +Diena +Dierdre +Dina +Dinah +Dinnie +Dinny +Dion +Dione +Dionis +Dionne +Dita +Dix +Dixie +Dode +Dodi +Dodie +Dody +Doe +Doll +Dolley +Dolli +Dollie +Dolly +Dolora +Dolores +Dolorita +Doloritas +Dominica +Dominique +Dona +Donella +Donelle +Donetta +Donia +Donica +Donielle +Donna +Donnajean +Donnamarie +Donni +Donnie +Donny +Dora +Doralia +Doralin +Doralyn +Doralynn +Doralynne +Dorcas +Dore +Doreen +Dorelia +Dorella +Dorelle +Dorena +Dorene +Doretta +Dorette +Dorey +Dori +Doria +Dorian +Dorice +Dorie +Dorine +Doris +Dorisa +Dorise +Dorit +Dorita +Doro +Dorolice +Dorolisa +Dorotea +Doroteya +Dorothea +Dorothee +Dorothy +Dorree +Dorri +Dorrie +Dorris +Dorry +Dorthea +Dorthy +Dory +Dosi +Dot +Doti +Dotti +Dottie +Dotty +Dove +Drea +Drew +Dulce +Dulcea +Dulci +Dulcia +Dulciana +Dulcie +Dulcine +Dulcinea +Dulcy +Dulsea +Dusty +Dyan +Dyana +Dyane +Dyann +Dyanna +Dyanne +Dyna +Dynah +Eada +Eadie +Eadith +Ealasaid +Eartha +Easter +Eba +Ebba +Ebonee +Ebony +Eda +Eddi +Eddie +Eddy +Ede +Edee +Edeline +Eden +Edi +Edie +Edin +Edita +Edith +Editha +Edithe +Ediva +Edna +Edwina +Edy +Edyth +Edythe +Effie +Eileen +Eilis +Eimile +Eirena +Ekaterina +Elaina +Elaine +Elana +Elane +Elayne +Elberta +Elbertina +Elbertine +Eleanor +Eleanora +Eleanore +Electra +Elena +Elene +Eleni +Elenore +Eleonora +Eleonore +Elfie +Elfreda +Elfrida +Elfrieda +Elga +Elianora +Elianore +Elicia +Elie +Elinor +Elinore +Elisa +Elisabet +Elisabeth +Elisabetta +Elise +Elisha +Elissa +Elita +Eliza +Elizabet +Elizabeth +Elka +Elke +Ella +Elladine +Elle +Ellen +Ellene +Ellette +Elli +Ellie +Ellissa +Elly +Ellyn +Ellynn +Elmira +Elna +Elnora +Elnore +Eloisa +Eloise +Elonore +Elora +Elsa +Elsbeth +Else +Elsey +Elsi +Elsie +Elsinore +Elspeth +Elsy +Elva +Elvera +Elvina +Elvira +Elwina +Elwira +Elyn +Elyse +Elysee +Elysha +Elysia +Elyssa +Em +Ema +Emalee +Emalia +Emanuela +Emelda +Emelia +Emelina +Emeline +Emelita +Emelyne +Emera +Emilee +Emili +Emilia +Emilie +Emiline +Emily +Emlyn +Emlynn +Emlynne +Emma +Emmalee +Emmaline +Emmalyn +Emmalynn +Emmalynne +Emmeline +Emmey +Emmi +Emmie +Emmy +Emmye +Emogene +Emyle +Emylee +Endora +Engracia +Enid +Enrica +Enrichetta +Enrika +Enriqueta +Enya +Eolanda +Eolande +Eran +Erda +Erena +Erica +Ericha +Ericka +Erika +Erin +Erina +Erinn +Erinna +Erma +Ermengarde +Ermentrude +Ermina +Erminia +Erminie +Erna +Ernaline +Ernesta +Ernestine +Ertha +Eryn +Esma +Esmaria +Esme +Esmeralda +Esmerelda +Essa +Essie +Essy +Esta +Estel +Estele +Estell +Estella +Estelle +Ester +Esther +Estrella +Estrellita +Ethel +Ethelda +Ethelin +Ethelind +Etheline +Ethelyn +Ethyl +Etta +Etti +Ettie +Etty +Eudora +Eugenia +Eugenie +Eugine +Eula +Eulalie +Eunice +Euphemia +Eustacia +Eva +Evaleen +Evangelia +Evangelin +Evangelina +Evangeline +Evania +Evanne +Eve +Eveleen +Evelina +Eveline +Evelyn +Evette +Evey +Evie +Evita +Evonne +Evvie +Evvy +Evy +Eyde +Eydie +Fabrianne +Fabrice +Fae +Faina +Faith +Fallon +Fan +Fanchette +Fanchon +Fancie +Fancy +Fanechka +Fania +Fanni +Fannie +Fanny +Fanya +Fara +Farah +Farand +Farica +Farra +Farrah +Farrand +Fatima +Faun +Faunie +Faustina +Faustine +Fawn +Fawna +Fawne +Fawnia +Fay +Faydra +Faye +Fayette +Fayina +Fayre +Fayth +Faythe +Federica +Fedora +Felecia +Felicdad +Felice +Felicia +Felicity +Felicle +Felipa +Felisha +Felita +Feliza +Fenelia +Feodora +Ferdinanda +Ferdinande +Fern +Fernanda +Fernande +Fernandina +Ferne +Fey +Fiann +Fianna +Fidela +Fidelia +Fidelity +Fifi +Fifine +Filia +Filide +Filippa +Fina +Fiona +Fionna +Fionnula +Fiorenze +Fleur +Fleurette +Flo +Flor +Flora +Florance +Flore +Florella +Florence +Florencia +Florentia +Florenza +Florette +Flori +Floria +Florice +Florida +Florie +Florina +Florinda +Floris +Florri +Florrie +Florry +Flory +Flossi +Flossie +Flossy +Flower +Fortuna +Fortune +Fran +France +Francene +Frances +Francesca +Francesmary +Francine +Francis +Francisca +Franciska +Francoise +Francyne +Frank +Frankie +Franky +Franni +Frannie +Franny +Frayda +Fred +Freda +Freddi +Freddie +Freddy +Fredelia +Frederica +Fredericka +Fredi +Fredia +Fredra +Fredrika +Freida +Frieda +Friederike +Fulvia +Gabbey +Gabbi +Gabbie +Gabey +Gabi +Gabie +Gabriel +Gabriela +Gabriell +Gabriella +Gabrielle +Gabriellia +Gabrila +Gaby +Gae +Gael +Gail +Gale +Galina +Garland +Garnet +Garnette +Gates +Gavra +Gavrielle +Gay +Gayla +Gayle +Gayleen +Gaylene +Gaynor +Geeta +Gelya +Gen +Gena +Gene +Geneva +Genevieve +Genevra +Genia +Genna +Genni +Gennie +Gennifer +Genny +Genovera +Genvieve +George +Georgeanna +Georgeanne +Georgena +Georgeta +Georgetta +Georgette +Georgia +Georgiamay +Georgiana +Georgianna +Georgianne +Georgie +Georgina +Georgine +Gera +Geralda +Geraldina +Geraldine +Gerda +Gerhardine +Geri +Gerianna +Gerianne +Gerladina +Germain +Germaine +Germana +Gerri +Gerrie +Gerrilee +Gerry +Gert +Gerta +Gerti +Gertie +Gertrud +Gertruda +Gertrude +Gertrudis +Gerty +Giacinta +Giana +Gianina +Gianna +Gigi +Gilberta +Gilberte +Gilbertina +Gilbertine +Gilda +Gill +Gillan +Gilli +Gillian +Gillie +Gilligan +Gilly +Gina +Ginelle +Ginevra +Ginger +Ginni +Ginnie +Ginnifer +Ginny +Giorgia +Giovanna +Gipsy +Giralda +Gisela +Gisele +Gisella +Giselle +Gita +Gizela +Glad +Gladi +Gladis +Gladys +Gleda +Glen +Glenda +Glenine +Glenn +Glenna +Glennie +Glennis +Glori +Gloria +Gloriana +Gloriane +Glorianna +Glory +Glyn +Glynda +Glynis +Glynnis +Godiva +Golda +Goldarina +Goldi +Goldia +Goldie +Goldina +Goldy +Grace +Gracia +Gracie +Grata +Gratia +Gratiana +Gray +Grayce +Grazia +Gredel +Greer +Greta +Gretal +Gretchen +Grete +Gretel +Grethel +Gretna +Gretta +Grier +Griselda +Grissel +Guendolen +Guenevere +Guenna +Guglielma +Gui +Guillema +Guillemette +Guinevere +Guinna +Gunilla +Gunvor +Gus +Gusella +Gussi +Gussie +Gussy +Gusta +Gusti +Gustie +Gusty +Gwen +Gwendolen +Gwendolin +Gwendolyn +Gweneth +Gwenette +Gwenn +Gwenneth +Gwenni +Gwennie +Gwenny +Gwenora +Gwenore +Gwyn +Gwyneth +Gwynne +Gypsy +Hadria +Hailee +Haily +Haleigh +Halette +Haley +Hali +Halie +Halimeda +Halley +Halli +Hallie +Hally +Hana +Hanna +Hannah +Hanni +Hannibal +Hannie +Hannis +Hanny +Happy +Harlene +Harley +Harli +Harlie +Harmonia +Harmonie +Harmony +Harri +Harrie +Harriet +Harriett +Harrietta +Harriette +Harriot +Harriott +Hatti +Hattie +Hatty +Havivah +Hayley +Hazel +Heath +Heather +Heda +Hedda +Heddi +Heddie +Hedi +Hedvig +Hedwig +Hedy +Heida +Heide +Heidi +Heidie +Helaina +Helaine +Helen +Helen-Elizabeth +Helena +Helene +Helga +Helge +Helise +Hellene +Helli +Heloise +Helsa +Helyn +Hendrika +Henka +Henrie +Henrieta +Henrietta +Henriette +Henryetta +Hephzibah +Hermia +Hermina +Hermine +Herminia +Hermione +Herta +Hertha +Hester +Hesther +Hestia +Hetti +Hettie +Hetty +Hilarie +Hilary +Hilda +Hildagard +Hildagarde +Hilde +Hildegaard +Hildegarde +Hildy +Hillary +Hilliary +Hinda +Holley +Holli +Hollie +Holly +Holly-Anne +Hollyanne +Honey +Honor +Honoria +Hope +Horatia +Hortense +Hortensia +Hulda +Hyacinth +Hyacintha +Hyacinthe +Hyacinthia +Hyacinthie +Hynda +Ianthe +Ibbie +Ibby +Ida +Idalia +Idalina +Idaline +Idell +Idelle +Idette +Ike +Ikey +Ilana +Ileana +Ileane +Ilene +Ilise +Ilka +Illa +Ilona +Ilsa +Ilse +Ilysa +Ilyse +Ilyssa +Imelda +Imogen +Imogene +Imojean +Ina +Inci +Indira +Ines +Inesita +Inessa +Inez +Inga +Ingaberg +Ingaborg +Inge +Ingeberg +Ingeborg +Inger +Ingrid +Ingunna +Inna +Ioana +Iolande +Iolanthe +Iona +Iormina +Ira +Irena +Irene +Irina +Iris +Irita +Irma +Isa +Isabeau +Isabel +Isabelita +Isabella +Isabelle +Isador +Isadora +Isadore +Isahella +Iseabal +Isidora +Isis +Isobel +Issi +Issie +Issy +Ivett +Ivette +Ivie +Ivonne +Ivory +Ivy +Izabel +Izzi +Jacenta +Jacinda +Jacinta +Jacintha +Jacinthe +Jackelyn +Jacki +Jackie +Jacklin +Jacklyn +Jackquelin +Jackqueline +Jacky +Jaclin +Jaclyn +Jacquelin +Jacqueline +Jacquelyn +Jacquelynn +Jacquenetta +Jacquenette +Jacquetta +Jacquette +Jacqui +Jacquie +Jacynth +Jada +Jade +Jaime +Jaimie +Jaine +Jaleh +Jami +Jamie +Jamima +Jammie +Jan +Jana +Janaya +Janaye +Jandy +Jane +Janean +Janeczka +Janeen +Janel +Janela +Janella +Janelle +Janene +Janenna +Janessa +Janet +Janeta +Janetta +Janette +Janeva +Janey +Jania +Janice +Janie +Janifer +Janina +Janine +Janis +Janith +Janka +Janna +Jannel +Jannelle +Janot +Jany +Jaquelin +Jaquelyn +Jaquenetta +Jaquenette +Jaquith +Jasmin +Jasmina +Jasmine +Jayme +Jaymee +Jayne +Jaynell +Jazmin +Jean +Jeana +Jeane +Jeanelle +Jeanette +Jeanie +Jeanine +Jeanna +Jeanne +Jeannette +Jeannie +Jeannine +Jehanna +Jelene +Jemie +Jemima +Jemimah +Jemmie +Jemmy +Jen +Jena +Jenda +Jenelle +Jenette +Jeni +Jenica +Jeniece +Jenifer +Jeniffer +Jenilee +Jenine +Jenn +Jenna +Jennee +Jennette +Jenni +Jennica +Jennie +Jennifer +Jennilee +Jennine +Jenny +Jeraldine +Jeralee +Jere +Jeri +Jermaine +Jerrie +Jerrilee +Jerrilyn +Jerrine +Jerry +Jerrylee +Jess +Jessa +Jessalin +Jessalyn +Jessamine +Jessamyn +Jesse +Jesselyn +Jessi +Jessica +Jessie +Jessika +Jessy +Jewel +Jewell +Jewelle +Jill +Jillana +Jillane +Jillayne +Jilleen +Jillene +Jilli +Jillian +Jillie +Jilly +Jinny +Jo +Jo Ann +Jo-Ann +JoAnn +Jo-Anne +JoAnne +Joan +Joana +Joane +Joanie +Joann +Joanna +Joanne +Joannes +Jobey +Jobi +Jobie +Jobina +Joby +Jobye +Jobyna +Jocelin +Joceline +Jocelyn +Jocelyne +Jodee +Jodi +Jodie +Jody +Joela +Joelie +Joell +Joella +Joelle +Joellen +Joelly +Joellyn +Joelynn +Joete +Joey +Johanna +Johannah +Johnette +Johnna +Joice +Jojo +Jolee +Joleen +Jolene +Joletta +Joli +Jolie +Joline +Joly +Jolyn +Jolynn +Jonell +Joni +Jonie +Jonis +Jordain +Jordan +Jordana +Jordanna +Jorey +Jori +Jorie +Jorrie +Jorry +Joscelin +Josee +Josefa +Josefina +Joselyn +Josepha +Josephina +Josephine +Josey +Josi +Josie +Joslyn +Josselyn +Josy +Jourdan +Joy +Joya +Joyan +Joyann +Joyce +Joycelin +Joye +Joyous +Juana +Juanita +Jude +Judi +Judie +Judith +Juditha +Judy +Judye +Julee +Juli +Julia +Juliana +Juliane +Juliann +Julianna +Julianne +Julie +Julienne +Juliet +Julieta +Julietta +Juliette +Julina +Juline +Julissa +Julita +June +Junette +Junia +Junie +Junina +Justin +Justina +Justine +Jyoti +Kaari +Kacey +Kacie +Kacy +Kai +Kaia +Kaila +Kaile +Kailey +Kaitlin +Kaitlyn +Kaitlynn +Kaja +Kakalina +Kala +Kaleena +Kali +Kalie +Kalila +Kalina +Kalinda +Kalindi +Kalli +Kally +Kameko +Kamila +Kamilah +Kamillah +Kandace +Kandy +Kania +Kanya +Kara +Kara-Lynn +Karalee +Karalynn +Kare +Karee +Karel +Karen +Karena +Kari +Karia +Karie +Karil +Karilynn +Karin +Karina +Karine +Kariotta +Karisa +Karissa +Karita +Karla +Karlee +Karleen +Karlen +Karlene +Karlie +Karlotta +Karlotte +Karly +Karlyn +Karmen +Karna +Karol +Karola +Karole +Karolina +Karoline +Karoly +Karon +Karrah +Karrie +Karry +Kary +Karyl +Karylin +Karyn +Kasey +Kass +Kassandra +Kassey +Kassi +Kassia +Kassie +Kaster +Kat +Kata +Katalin +Kate +Katee +Katerina +Katerine +Katey +Kath +Katha +Katharina +Katharine +Katharyn +Kathe +Katheleen +Katherina +Katherine +Katheryn +Kathi +Kathie +Kathleen +Kathlene +Kathlin +Kathrine +Kathryn +Kathryne +Kathy +Kathye +Kati +Katie +Katina +Katine +Katinka +Katleen +Katlin +Katrina +Katrine +Katrinka +Katti +Kattie +Katuscha +Katusha +Katy +Katya +Kay +Kaycee +Kaye +Kayla +Kayle +Kaylee +Kayley +Kaylil +Kaylyn +Kee +Keeley +Keelia +Keely +Kelcey +Kelci +Kelcie +Kelcy +Kelila +Kellen +Kelley +Kelli +Kellia +Kellie +Kellina +Kellsie +Kelly +Kellyann +Kelsey +Kelsi +Kelsy +Kendra +Kendre +Kenna +Keren +Keri +Keriann +Kerianne +Kerri +Kerrie +Kerrill +Kerrin +Kerry +Kerstin +Kesley +Keslie +Kessia +Kessiah +Ketti +Kettie +Ketty +Kevina +Kevyn +Ki +Kia +Kiah +Kial +Kiele +Kiersten +Kikelia +Kiley +Kim +Kimberlee +Kimberley +Kimberli +Kimberly +Kimberlyn +Kimbra +Kimmi +Kimmie +Kimmy +Kinna +Kip +Kipp +Kippie +Kippy +Kira +Kirbee +Kirbie +Kirby +Kiri +Kirsten +Kirsteni +Kirsti +Kirstie +Kirstin +Kirstyn +Kissee +Kissiah +Kissie +Kit +Kitti +Kittie +Kitty +Kizzee +Kizzie +Klara +Klarika +Klarrisa +Konstance +Konstanze +Koo +Kora +Koral +Koralle +Kordula +Kore +Korella +Koren +Koressa +Kori +Korie +Korney +Korrie +Korry +Kourtney +Kris +Krissie +Krissy +Krista +Kristal +Kristan +Kriste +Kristel +Kristen +Kristi +Kristien +Kristin +Kristina +Kristine +Kristy +Kristyn +Krysta +Krystal +Krystalle +Krystle +Krystyna +Kyla +Kyle +Kylen +Kylie +Kylila +Kylynn +Kym +Kynthia +Kyrstin +La +Lacee +Lacey +Lacie +Lacy +Ladonna +Laetitia +Laila +Laina +Lainey +Lamb +Lana +Lane +Lanette +Laney +Lani +Lanie +Lanita +Lanna +Lanni +Lanny +Lara +Laraine +Lari +Larina +Larine +Larisa +Larissa +Lark +Laryssa +Latashia +Latia +Latisha +Latrena +Latrina +Laura +Lauraine +Laural +Lauralee +Laure +Lauree +Laureen +Laurel +Laurella +Lauren +Laurena +Laurene +Lauretta +Laurette +Lauri +Laurianne +Laurice +Laurie +Lauryn +Lavena +Laverna +Laverne +Lavina +Lavinia +Lavinie +Layla +Layne +Layney +Lea +Leah +Leandra +Leann +Leanna +Leanne +Leanor +Leanora +Lebbie +Leda +Lee +LeeAnn +Leeann +Leeanne +Leela +Leelah +Leena +Leesa +Leese +Legra +Leia +Leiah +Leigh +Leigha +Leila +Leilah +Leisha +Lela +Lelah +Leland +Lelia +Lena +Lenee +Lenette +Lenka +Lenna +Lenora +Lenore +Leodora +Leoine +Leola +Leoline +Leona +Leonanie +Leone +Leonelle +Leonie +Leonora +Leonore +Leontine +Leontyne +Leora +Leorah +Leshia +Lesley +Lesli +Leslie +Lesly +Lesya +Leta +Lethia +Leticia +Letisha +Letitia +Letta +Letti +Lettie +Letty +Leyla +Lezlie +Lia +Lian +Liana +Liane +Lianna +Lianne +Lib +Libbey +Libbi +Libbie +Libby +Licha +Lida +Lidia +Lil +Lila +Lilah +Lilas +Lilia +Lilian +Liliane +Lilias +Lilith +Lilla +Lilli +Lillian +Lillis +Lilllie +Lilly +Lily +Lilyan +Lin +Lina +Lind +Linda +Lindi +Lindie +Lindsay +Lindsey +Lindsy +Lindy +Linea +Linell +Linet +Linette +Linn +Linnea +Linnell +Linnet +Linnie +Linzy +Liora +Liorah +Lira +Lisa +Lisabeth +Lisandra +Lisbeth +Lise +Lisetta +Lisette +Lisha +Lishe +Lissa +Lissi +Lissie +Lissy +Lita +Liuka +Livia +Liz +Liza +Lizabeth +Lizbeth +Lizette +Lizzie +Lizzy +Loella +Lois +Loise +Lola +Lolande +Loleta +Lolita +Lolly +Lona +Lonee +Loni +Lonna +Lonni +Lonnie +Lora +Lorain +Loraine +Loralee +Loralie +Loralyn +Loree +Loreen +Lorelei +Lorelle +Loren +Lorena +Lorene +Lorenza +Loretta +Lorettalorna +Lorette +Lori +Loria +Lorianna +Lorianne +Lorie +Lorilee +Lorilyn +Lorinda +Lorine +Lorita +Lorna +Lorne +Lorraine +Lorrayne +Lorri +Lorrie +Lorrin +Lorry +Lory +Lotta +Lotte +Lotti +Lottie +Lotty +Lou +Louella +Louisa +Louise +Louisette +Love +Luana +Luanna +Luce +Luci +Lucia +Luciana +Lucie +Lucienne +Lucila +Lucilia +Lucille +Lucina +Lucinda +Lucine +Lucita +Lucky +Lucretia +Lucy +Luella +Luelle +Luisa +Luise +Lula +Lulita +Lulu +Luna +Lura +Lurette +Lurleen +Lurlene +Lurline +Lusa +Lust +Lyda +Lydia +Lydie +Lyn +Lynda +Lynde +Lyndel +Lyndell +Lyndsay +Lyndsey +Lyndsie +Lyndy +Lynea +Lynelle +Lynett +Lynette +Lynn +Lynna +Lynne +Lynnea +Lynnell +Lynnelle +Lynnet +Lynnett +Lynnette +Lynsey +Lysandra +Lyssa +Mab +Mabel +Mabelle +Mable +Mada +Madalena +Madalyn +Maddalena +Maddi +Maddie +Maddy +Madel +Madelaine +Madeleine +Madelena +Madelene +Madelin +Madelina +Madeline +Madella +Madelle +Madelon +Madelyn +Madge +Madlen +Madlin +Madona +Madonna +Mady +Mae +Maegan +Mag +Magda +Magdaia +Magdalen +Magdalena +Magdalene +Maggee +Maggi +Maggie +Maggy +Magna +Mahala +Mahalia +Maia +Maible +Maiga +Mair +Maire +Mairead +Maisey +Maisie +Mala +Malanie +Malcah +Malena +Malia +Malina +Malinda +Malinde +Malissa +Malissia +Malka +Malkah +Mallissa +Mallorie +Mallory +Malorie +Malory +Malva +Malvina +Malynda +Mame +Mamie +Manda +Mandi +Mandie +Mandy +Manon +Manya +Mara +Marabel +Marcela +Marcelia +Marcella +Marcelle +Marcellina +Marcelline +Marchelle +Marci +Marcia +Marcie +Marcile +Marcille +Marcy +Mareah +Maren +Marena +Maressa +Marga +Margalit +Margalo +Margaret +Margareta +Margarete +Margaretha +Margarethe +Margaretta +Margarette +Margarita +Margaux +Marge +Margeaux +Margery +Marget +Margette +Margi +Margie +Margit +Marglerite +Margo +Margot +Margret +Marguerite +Margurite +Margy +Mari +Maria +Mariam +Marian +Mariana +Mariann +Marianna +Marianne +Maribel +Maribelle +Maribeth +Marice +Maridel +Marie +Marie-Ann +Marie-Jeanne +Marieann +Mariejeanne +Mariel +Mariele +Marielle +Mariellen +Marietta +Mariette +Marigold +Marijo +Marika +Marilee +Marilin +Marillin +Marilyn +Marin +Marina +Marinna +Marion +Mariquilla +Maris +Marisa +Mariska +Marissa +Marit +Marita +Maritsa +Mariya +Marj +Marja +Marje +Marji +Marjie +Marjorie +Marjory +Marjy +Marketa +Marla +Marlane +Marleah +Marlee +Marleen +Marlena +Marlene +Marley +Marlie +Marline +Marlo +Marlyn +Marna +Marne +Marney +Marni +Marnia +Marnie +Marquita +Marrilee +Marris +Marrissa +Marry +Marsha +Marsiella +Marta +Martelle +Martguerita +Martha +Marthe +Marthena +Marti +Martica +Martie +Martina +Martita +Marty +Martynne +Mary +Marya +Maryangelyn +Maryann +Maryanna +Maryanne +Marybelle +Marybeth +Maryellen +Maryjane +Maryjo +Maryl +Marylee +Marylin +Marylinda +Marylou +Marylynne +Maryrose +Marys +Marysa +Masha +Matelda +Mathilda +Mathilde +Matilda +Matilde +Matti +Mattie +Matty +Maud +Maude +Maudie +Maura +Maure +Maureen +Maureene +Maurene +Maurine +Maurise +Maurita +Mavis +Mavra +Max +Maxi +Maxie +Maxine +Maxy +May +Maya +Maybelle +Mayda +Maye +Mead +Meade +Meagan +Meaghan +Meara +Mechelle +Meg +Megan +Megen +Meggan +Meggi +Meggie +Meggy +Meghan +Meghann +Mehetabel +Mei +Meira +Mel +Mela +Melamie +Melania +Melanie +Melantha +Melany +Melba +Melesa +Melessa +Melicent +Melina +Melinda +Melinde +Melisa +Melisande +Melisandra +Melisenda +Melisent +Melissa +Melisse +Melita +Melitta +Mella +Melli +Mellicent +Mellie +Mellisa +Mellisent +Mellissa +Melloney +Melly +Melodee +Melodie +Melody +Melonie +Melony +Melosa +Melva +Mercedes +Merci +Mercie +Mercy +Meredith +Meredithe +Meridel +Meridith +Meriel +Merilee +Merilyn +Meris +Merissa +Merl +Merla +Merle +Merlina +Merline +Merna +Merola +Merralee +Merridie +Merrie +Merrielle +Merrile +Merrilee +Merrili +Merrill +Merrily +Merry +Mersey +Meryl +Meta +Mia +Micaela +Michaela +Michaelina +Michaeline +Michaella +Michal +Michel +Michele +Michelina +Micheline +Michell +Michelle +Micki +Mickie +Micky +Midge +Mignon +Mignonne +Miguela +Miguelita +Mikako +Mildred +Mildrid +Milena +Milicent +Milissent +Milka +Milli +Millicent +Millie +Millisent +Milly +Milzie +Mimi +Min +Mina +Minda +Mindy +Minerva +Minetta +Minette +Minna +Minni +Minnie +Minny +Minta +Miquela +Mira +Mirabel +Mirabella +Mirabelle +Miran +Miranda +Mireielle +Mireille +Mirella +Mirelle +Miriam +Mirilla +Mirna +Misha +Missie +Missy +Misti +Misty +Mitra +Mitzi +Mmarianne +Modesta +Modestia +Modestine +Modesty +Moina +Moira +Moll +Mollee +Molli +Mollie +Molly +Mommy +Mona +Monah +Monica +Monika +Monique +Mora +Moreen +Morena +Morgan +Morgana +Morganica +Morganne +Morgen +Moria +Morissa +Morlee +Morna +Moselle +Moya +Moyna +Moyra +Mozelle +Muffin +Mufi +Mufinella +Muire +Mureil +Murial +Muriel +Murielle +Myna +Myra +Myrah +Myranda +Myriam +Myrilla +Myrle +Myrlene +Myrna +Myrta +Myrtia +Myrtice +Myrtie +Myrtle +Nada +Nadean +Nadeen +Nadia +Nadine +Nadiya +Nady +Nadya +Nalani +Nan +Nana +Nananne +Nance +Nancee +Nancey +Nanci +Nancie +Nancy +Nanete +Nanette +Nani +Nanice +Nanine +Nannette +Nanni +Nannie +Nanny +Nanon +Naoma +Naomi +Nara +Nari +Nariko +Nat +Nata +Natala +Natalee +Natalia +Natalie +Natalina +Nataline +Natalya +Natasha +Natassia +Nathalia +Nathalie +Natka +Natty +Neala +Neda +Nedda +Nedi +Neely +Neila +Neile +Neilla +Neille +Nela +Nelia +Nelie +Nell +Nelle +Nelli +Nellie +Nelly +Nena +Nerissa +Nerita +Nert +Nerta +Nerte +Nerti +Nertie +Nerty +Nessa +Nessi +Nessie +Nessy +Nesta +Netta +Netti +Nettie +Nettle +Netty +Nevsa +Neysa +Nichol +Nichole +Nicholle +Nicki +Nickie +Nicky +Nicol +Nicola +Nicole +Nicolea +Nicolette +Nicoli +Nicolina +Nicoline +Nicolle +Nidia +Nike +Niki +Nikki +Nikkie +Nikoletta +Nikolia +Nil +Nina +Ninetta +Ninette +Ninnetta +Ninnette +Ninon +Nisa +Nissa +Nisse +Nissie +Nissy +Nita +Nitin +Nixie +Noami +Noel +Noelani +Noell +Noella +Noelle +Noellyn +Noelyn +Noemi +Nola +Nolana +Nolie +Nollie +Nomi +Nona +Nonah +Noni +Nonie +Nonna +Nonnah +Nora +Norah +Norean +Noreen +Norene +Norina +Norine +Norma +Norri +Norrie +Norry +Nova +Novelia +Nydia +Nyssa +Octavia +Odele +Odelia +Odelinda +Odella +Odelle +Odessa +Odetta +Odette +Odilia +Odille +Ofelia +Ofella +Ofilia +Ola +Olenka +Olga +Olia +Olimpia +Olive +Olivette +Olivia +Olivie +Oliy +Ollie +Olly +Olva +Olwen +Olympe +Olympia +Olympie +Ondrea +Oneida +Onida +Onlea +Oona +Opal +Opalina +Opaline +Ophelia +Ophelie +Oprah +Ora +Oralee +Oralia +Oralie +Oralla +Oralle +Orel +Orelee +Orelia +Orelie +Orella +Orelle +Oreste +Oriana +Orly +Orsa +Orsola +Ortensia +Otha +Othelia +Othella +Othilia +Othilie +Ottilie +Pacifica +Page +Paige +Paloma +Pam +Pamela +Pamelina +Pamella +Pammi +Pammie +Pammy +Pandora +Pansie +Pansy +Paola +Paolina +Parwane +Pat +Patience +Patrica +Patrice +Patricia +Patrizia +Patsy +Patti +Pattie +Patty +Paula +Paula-Grace +Paule +Pauletta +Paulette +Pauli +Paulie +Paulina +Pauline +Paulita +Pauly +Pavia +Pavla +Pearl +Pearla +Pearle +Pearline +Peg +Pegeen +Peggi +Peggie +Peggy +Pen +Penelopa +Penelope +Penni +Pennie +Penny +Pepi +Pepita +Peri +Peria +Perl +Perla +Perle +Perri +Perrine +Perry +Persis +Pet +Peta +Petra +Petrina +Petronella +Petronia +Petronilla +Petronille +Petunia +Phaedra +Phaidra +Phebe +Phedra +Phelia +Phil +Philipa +Philippa +Philippe +Philippine +Philis +Phillida +Phillie +Phillis +Philly +Philomena +Phoebe +Phylis +Phyllida +Phyllis +Phyllys +Phylys +Pia +Pier +Pierette +Pierrette +Pietra +Piper +Pippa +Pippy +Polly +Pollyanna +Pooh +Poppy +Portia +Pris +Prisca +Priscella +Priscilla +Prissie +Pru +Prudence +Prudi +Prudy +Prue +Prunella +Queada +Queenie +Quentin +Querida +Quinn +Quinta +Quintana +Quintilla +Quintina +Rachael +Rachel +Rachele +Rachelle +Rae +Raf +Rafa +Rafaela +Rafaelia +Rafaelita +Ragnhild +Rahal +Rahel +Raina +Raine +Rakel +Ralina +Ramona +Ramonda +Rana +Randa +Randee +Randene +Randi +Randie +Randy +Ranee +Rani +Rania +Ranice +Ranique +Ranna +Raphaela +Raquel +Raquela +Rasia +Rasla +Raven +Ray +Raychel +Raye +Rayna +Raynell +Rayshell +Rea +Reba +Rebbecca +Rebe +Rebeca +Rebecca +Rebecka +Rebeka +Rebekah +Rebekkah +Ree +Reeba +Reena +Reeta +Reeva +Regan +Reggi +Reggie +Regina +Regine +Reiko +Reina +Reine +Remy +Rena +Renae +Renata +Renate +Rene +Renee +Renel +Renell +Renelle +Renie +Rennie +Reta +Retha +Revkah +Rey +Reyna +Rhea +Rheba +Rheta +Rhetta +Rhiamon +Rhianna +Rhianon +Rhoda +Rhodia +Rhodie +Rhody +Rhona +Rhonda +Riane +Riannon +Rianon +Rica +Ricca +Rici +Ricki +Rickie +Ricky +Riki +Rikki +Rina +Risa +Rissa +Rita +Riva +Rivalee +Rivi +Rivkah +Rivy +Roana +Roanna +Roanne +Robbi +Robbie +Robbin +Robby +Robbyn +Robena +Robenia +Roberta +Robin +Robina +Robinet +Robinett +Robinetta +Robinette +Robinia +Roby +Robyn +Roch +Rochell +Rochella +Rochelle +Rochette +Roda +Rodi +Rodie +Rodina +Romola +Romona +Romonda +Romy +Rona +Ronalda +Ronda +Ronica +Ronna +Ronni +Ronnica +Ronnie +Ronny +Roobbie +Rora +Rori +Rorie +Rory +Ros +Rosa +Rosabel +Rosabella +Rosabelle +Rosaleen +Rosalia +Rosalie +Rosalind +Rosalinda +Rosalinde +Rosaline +Rosalyn +Rosalynd +Rosamond +Rosamund +Rosana +Rosanna +Rosanne +Rosario +Rose +Roseann +Roseanna +Roseanne +Roselia +Roselin +Roseline +Rosella +Roselle +Roselyn +Rosemaria +Rosemarie +Rosemary +Rosemonde +Rosene +Rosetta +Rosette +Roshelle +Rosie +Rosina +Rosita +Roslyn +Rosmunda +Rosy +Row +Rowe +Rowena +Roxana +Roxane +Roxanna +Roxanne +Roxi +Roxie +Roxine +Roxy +Roz +Rozalie +Rozalin +Rozamond +Rozanna +Rozanne +Roze +Rozele +Rozella +Rozelle +Rozina +Rubetta +Rubi +Rubia +Rubie +Rubina +Ruby +Ruella +Ruperta +Ruth +Ruthann +Ruthanne +Ruthe +Ruthi +Ruthie +Ruthy +Ryann +Rycca +Saba +Sabina +Sabine +Sabra +Sabrina +Sacha +Sada +Sadella +Sadie +Sal +Sallee +Salli +Sallie +Sally +Sallyann +Sallyanne +Salome +Sam +Samantha +Samara +Samaria +Sammy +Samuela +Samuella +Sande +Sandi +Sandie +Sandra +Sandy +Sandye +Sapphira +Sapphire +Sara +Sara-Ann +Saraann +Sarah +Sarajane +Saree +Sarena +Sarene +Sarette +Sari +Sarina +Sarine +Sarita +Sascha +Sasha +Sashenka +Saudra +Saundra +Savina +Sayre +Scarlet +Scarlett +Scotty +Sean +Seana +Secunda +Seka +Sela +Selena +Selene +Selestina +Selia +Selie +Selina +Selinda +Seline +Sella +Selle +Selma +Sena +Sephira +Serena +Serene +Shaina +Shaine +Shalna +Shalne +Shamit +Shana +Shanda +Shandee +Shandie +Shandra +Shandy +Shane +Shani +Shanie +Shanna +Shannah +Shannen +Shannon +Shanon +Shanta +Shantee +Shara +Sharai +Shari +Sharia +Sharie +Sharity +Sharl +Sharla +Sharleen +Sharlene +Sharline +Sharna +Sharon +Sharona +Sharra +Sharron +Sharyl +Shaun +Shauna +Shawn +Shawna +Shawnee +Shay +Shayla +Shaylah +Shaylyn +Shaylynn +Shayna +Shayne +Shea +Sheba +Sheela +Sheelagh +Sheelah +Sheena +Sheeree +Sheila +Sheila-Kathryn +Sheilah +Sheilakathryn +Shel +Shela +Shelagh +Shelba +Shelbi +Shelby +Shelia +Shell +Shelley +Shelli +Shellie +Shelly +Shena +Sher +Sheree +Sheri +Sherie +Sheril +Sherill +Sherilyn +Sherline +Sherri +Sherrie +Sherry +Sherye +Sheryl +Shilpa +Shina +Shir +Shira +Shirah +Shirl +Shirlee +Shirleen +Shirlene +Shirley +Shirline +Shoshana +Shoshanna +Shoshie +Siana +Sianna +Sib +Sibbie +Sibby +Sibeal +Sibel +Sibella +Sibelle +Sibilla +Sibley +Sibyl +Sibylla +Sibylle +Sidoney +Sidonia +Sidonnie +Sigrid +Sile +Sileas +Silva +Silvana +Silvia +Silvie +Simona +Simone +Simonette +Simonne +Sindee +Sinead +Siobhan +Sioux +Siouxie +Sisely +Sisile +Sissie +Sissy +Sofia +Sofie +Solange +Sondra +Sonia +Sonja +Sonni +Sonnie +Sonnnie +Sonny +Sonya +Sophey +Sophi +Sophia +Sophie +Sophronia +Sorcha +Sosanna +Stace +Stacee +Stacey +Staci +Stacia +Stacie +Stacy +Stafani +Star +Starla +Starlene +Starlin +Starr +Stefa +Stefania +Stefanie +Steffane +Steffi +Steffie +Stella +Stepha +Stephana +Stephani +Stephanie +Stephannie +Stephenie +Stephi +Stephie +Stephine +Stesha +Stevana +Stevena +Stoddard +Storey +Storm +Stormi +Stormie +Stormy +Sue +Sue-elle +Suellen +Sukey +Suki +Sula +Sunny +Sunshine +Susan +Susana +Susanetta +Susann +Susanna +Susannah +Susanne +Susette +Susi +Susie +Sussi +Susy +Suzan +Suzann +Suzanna +Suzanne +Suzetta +Suzette +Suzi +Suzie +Suzy +Suzzy +Sybil +Sybila +Sybilla +Sybille +Sybyl +Sydel +Sydelle +Sydney +Sylvia +Sylvie +Tabatha +Tabbatha +Tabbi +Tabbie +Tabbitha +Tabby +Tabina +Tabitha +Taffy +Talia +Tallia +Tallie +Tally +Talya +Talyah +Tamar +Tamara +Tamarah +Tamarra +Tamera +Tami +Tamiko +Tamma +Tammara +Tammi +Tammie +Tammy +Tamra +Tana +Tandi +Tandie +Tandy +Tani +Tania +Tansy +Tanya +Tara +Tarah +Tarra +Tarrah +Taryn +Tasha +Tasia +Tate +Tatiana +Tatiania +Tatum +Tawnya +Tawsha +Teane +Ted +Tedda +Teddi +Teddie +Teddy +Tedi +Tedra +Teena +Tella +Teodora +Tera +Teresa +TeresaAnne +Terese +Teresina +Teresita +Teressa +Teri +Teriann +Terina +Terra +Terri +Terri-Jo +Terrianne +Terrie +Terry +Terrye +Tersina +Teryl +Terza +Tess +Tessa +Tessi +Tessie +Tessy +Thalia +Thea +Theada +Theadora +Theda +Thekla +Thelma +Theo +Theodora +Theodosia +Theresa +Theresa-Marie +Therese +Theresina +Theresita +Theressa +Therine +Thia +Thomasa +Thomasin +Thomasina +Thomasine +Tia +Tiana +Tiena +Tierney +Tiertza +Tiff +Tiffani +Tiffanie +Tiffany +Tiffi +Tiffie +Tiffy +Tilda +Tildi +Tildie +Tildy +Tillie +Tilly +Tim +Timi +Timmi +Timmie +Timmy +Timothea +Tina +Tine +Tiphani +Tiphanie +Tiphany +Tish +Tisha +Tobe +Tobey +Tobi +Tobie +Toby +Tobye +Toinette +Toma +Tomasina +Tomasine +Tomi +Tomiko +Tommi +Tommie +Tommy +Toni +Tonia +Tonie +Tony +Tonya +Tootsie +Torey +Tori +Torie +Torrie +Tory +Tova +Tove +Trace +Tracee +Tracey +Traci +Tracie +Tracy +Trenna +Tresa +Trescha +Tressa +Tricia +Trina +Trish +Trisha +Trista +Trix +Trixi +Trixie +Trixy +Truda +Trude +Trudey +Trudi +Trudie +Trudy +Trula +Tuesday +Twila +Twyla +Tybi +Tybie +Tyne +Ula +Ulla +Ulrica +Ulrika +Ulrike +Umeko +Una +Ursa +Ursala +Ursola +Ursula +Ursulina +Ursuline +Uta +Val +Valaree +Valaria +Vale +Valeda +Valencia +Valene +Valenka +Valentia +Valentina +Valentine +Valera +Valeria +Valerie +Valery +Valerye +Valida +Valina +Valli +Vallie +Vally +Valma +Valry +Van +Vanda +Vanessa +Vania +Vanna +Vanni +Vannie +Vanny +Vanya +Veda +Velma +Velvet +Vena +Venita +Ventura +Venus +Vera +Veradis +Vere +Verena +Verene +Veriee +Verile +Verina +Verine +Verla +Verna +Vernice +Veronica +Veronika +Veronike +Veronique +Vi +Vicki +Vickie +Vicky +Victoria +Vida +Viki +Vikki +Vikkie +Vikky +Vilhelmina +Vilma +Vin +Vina +Vinita +Vinni +Vinnie +Vinny +Viola +Violante +Viole +Violet +Violetta +Violette +Virgie +Virgina +Virginia +Virginie +Vita +Vitia +Vitoria +Vittoria +Viv +Viva +Vivi +Vivia +Vivian +Viviana +Vivianna +Vivianne +Vivie +Vivien +Viviene +Vivienne +Viviyan +Vivyan +Vivyanne +Vonni +Vonnie +Vonny +Wallie +Wallis +Wally +Waly +Wanda +Wandie +Wandis +Waneta +Wenda +Wendeline +Wendi +Wendie +Wendy +Wenona +Wenonah +Whitney +Wileen +Wilhelmina +Wilhelmine +Wilie +Willa +Willabella +Willamina +Willetta +Willette +Willi +Willie +Willow +Willy +Willyt +Wilma +Wilmette +Wilona +Wilone +Wilow +Windy +Wini +Winifred +Winna +Winnah +Winne +Winni +Winnie +Winnifred +Winny +Winona +Winonah +Wren +Wrennie +Wylma +Wynn +Wynne +Wynnie +Wynny +Xaviera +Xena +Xenia +Xylia +Xylina +Yalonda +Yehudit +Yelena +Yetta +Yettie +Yetty +Yevette +Yoko +Yolanda +Yolande +Yolane +Yolanthe +Yonina +Yoshi +Yoshiko +Yovonnda +Yvette +Yvonne +Zabrina +Zahara +Zandra +Zaneta +Zara +Zarah +Zaria +Zarla +Zea +Zelda +Zelma +Zena +Zenia +Zia +Zilvia +Zita +Zitella +Zoe +Zola +Zonda +Zondra +Zonnya +Zora +Zorah +Zorana +Zorina +Zorine +Zsa Zsa +Zsazsa +Zulema +Zuzana diff --git a/exercises/02450Toolbox_Matlab/Data/iris.csv b/exercises/02450Toolbox_Matlab/Data/iris.csv new file mode 100644 index 0000000000000000000000000000000000000000..f984b2bf7779ea99e49697b02ae92f533c448ba6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/iris.csv @@ -0,0 +1,151 @@ +"Sepal Length","Sepal Width","Petal Length","Petal Width","Type" +5.1,3.5,1.4,0.2,"Iris-setosa" +4.9,3,1.4,0.2,"Iris-setosa" +4.7,3.2,1.3,0.2,"Iris-setosa" +4.6,3.1,1.5,0.2,"Iris-setosa" +5,3.6,1.4,0.2,"Iris-setosa" +5.4,3.9,1.7,0.4,"Iris-setosa" +4.6,3.4,1.4,0.3,"Iris-setosa" +5,3.4,1.5,0.2,"Iris-setosa" +4.4,2.9,1.4,0.2,"Iris-setosa" +4.9,3.1,1.5,0.1,"Iris-setosa" +5.4,3.7,1.5,0.2,"Iris-setosa" +4.8,3.4,1.6,0.2,"Iris-setosa" +4.8,3,1.4,0.1,"Iris-setosa" +4.3,3,1.1,0.1,"Iris-setosa" +5.8,4,1.2,0.2,"Iris-setosa" +5.7,4.4,1.5,0.4,"Iris-setosa" +5.4,3.9,1.3,0.4,"Iris-setosa" +5.1,3.5,1.4,0.3,"Iris-setosa" +5.7,3.8,1.7,0.3,"Iris-setosa" +5.1,3.8,1.5,0.3,"Iris-setosa" +5.4,3.4,1.7,0.2,"Iris-setosa" +5.1,3.7,1.5,0.4,"Iris-setosa" +4.6,3.6,1,0.2,"Iris-setosa" +5.1,3.3,1.7,0.5,"Iris-setosa" +4.8,3.4,1.9,0.2,"Iris-setosa" +5,3,1.6,0.2,"Iris-setosa" +5,3.4,1.6,0.4,"Iris-setosa" +5.2,3.5,1.5,0.2,"Iris-setosa" +5.2,3.4,1.4,0.2,"Iris-setosa" +4.7,3.2,1.6,0.2,"Iris-setosa" +4.8,3.1,1.6,0.2,"Iris-setosa" +5.4,3.4,1.5,0.4,"Iris-setosa" +5.2,4.1,1.5,0.1,"Iris-setosa" +5.5,4.2,1.4,0.2,"Iris-setosa" +4.9,3.1,1.5,0.1,"Iris-setosa" +5,3.2,1.2,0.2,"Iris-setosa" +5.5,3.5,1.3,0.2,"Iris-setosa" +4.9,3.1,1.5,0.1,"Iris-setosa" +4.4,3,1.3,0.2,"Iris-setosa" +5.1,3.4,1.5,0.2,"Iris-setosa" +5,3.5,1.3,0.3,"Iris-setosa" +4.5,2.3,1.3,0.3,"Iris-setosa" +4.4,3.2,1.3,0.2,"Iris-setosa" +5,3.5,1.6,0.6,"Iris-setosa" +5.1,3.8,1.9,0.4,"Iris-setosa" +4.8,3,1.4,0.3,"Iris-setosa" +5.1,3.8,1.6,0.2,"Iris-setosa" +4.6,3.2,1.4,0.2,"Iris-setosa" +5.3,3.7,1.5,0.2,"Iris-setosa" +5,3.3,1.4,0.2,"Iris-setosa" +7,3.2,4.7,1.4,"Iris-versicolor" +6.4,3.2,4.5,1.5,"Iris-versicolor" +6.9,3.1,4.9,1.5,"Iris-versicolor" +5.5,2.3,4,1.3,"Iris-versicolor" +6.5,2.8,4.6,1.5,"Iris-versicolor" +5.7,2.8,4.5,1.3,"Iris-versicolor" +6.3,3.3,4.7,1.6,"Iris-versicolor" +4.9,2.4,3.3,1,"Iris-versicolor" +6.6,2.9,4.6,1.3,"Iris-versicolor" +5.2,2.7,3.9,1.4,"Iris-versicolor" +5,2,3.5,1,"Iris-versicolor" +5.9,3,4.2,1.5,"Iris-versicolor" +6,2.2,4,1,"Iris-versicolor" +6.1,2.9,4.7,1.4,"Iris-versicolor" +5.6,2.9,3.6,1.3,"Iris-versicolor" +6.7,3.1,4.4,1.4,"Iris-versicolor" +5.6,3,4.5,1.5,"Iris-versicolor" +5.8,2.7,4.1,1,"Iris-versicolor" +6.2,2.2,4.5,1.5,"Iris-versicolor" +5.6,2.5,3.9,1.1,"Iris-versicolor" +5.9,3.2,4.8,1.8,"Iris-versicolor" +6.1,2.8,4,1.3,"Iris-versicolor" +6.3,2.5,4.9,1.5,"Iris-versicolor" +6.1,2.8,4.7,1.2,"Iris-versicolor" +6.4,2.9,4.3,1.3,"Iris-versicolor" +6.6,3,4.4,1.4,"Iris-versicolor" +6.8,2.8,4.8,1.4,"Iris-versicolor" +6.7,3,5,1.7,"Iris-versicolor" +6,2.9,4.5,1.5,"Iris-versicolor" +5.7,2.6,3.5,1,"Iris-versicolor" +5.5,2.4,3.8,1.1,"Iris-versicolor" +5.5,2.4,3.7,1,"Iris-versicolor" +5.8,2.7,3.9,1.2,"Iris-versicolor" +6,2.7,5.1,1.6,"Iris-versicolor" +5.4,3,4.5,1.5,"Iris-versicolor" +6,3.4,4.5,1.6,"Iris-versicolor" +6.7,3.1,4.7,1.5,"Iris-versicolor" +6.3,2.3,4.4,1.3,"Iris-versicolor" +5.6,3,4.1,1.3,"Iris-versicolor" +5.5,2.5,4,1.3,"Iris-versicolor" +5.5,2.6,4.4,1.2,"Iris-versicolor" +6.1,3,4.6,1.4,"Iris-versicolor" +5.8,2.6,4,1.2,"Iris-versicolor" +5,2.3,3.3,1,"Iris-versicolor" +5.6,2.7,4.2,1.3,"Iris-versicolor" +5.7,3,4.2,1.2,"Iris-versicolor" +5.7,2.9,4.2,1.3,"Iris-versicolor" +6.2,2.9,4.3,1.3,"Iris-versicolor" +5.1,2.5,3,1.1,"Iris-versicolor" +5.7,2.8,4.1,1.3,"Iris-versicolor" +6.3,3.3,6,2.5,"Iris-virginica" +5.8,2.7,5.1,1.9,"Iris-virginica" +7.1,3,5.9,2.1,"Iris-virginica" +6.3,2.9,5.6,1.8,"Iris-virginica" +6.5,3,5.8,2.2,"Iris-virginica" +7.6,3,6.6,2.1,"Iris-virginica" +4.9,2.5,4.5,1.7,"Iris-virginica" +7.3,2.9,6.3,1.8,"Iris-virginica" +6.7,2.5,5.8,1.8,"Iris-virginica" +7.2,3.6,6.1,2.5,"Iris-virginica" +6.5,3.2,5.1,2,"Iris-virginica" +6.4,2.7,5.3,1.9,"Iris-virginica" +6.8,3,5.5,2.1,"Iris-virginica" +5.7,2.5,5,2,"Iris-virginica" +5.8,2.8,5.1,2.4,"Iris-virginica" +6.4,3.2,5.3,2.3,"Iris-virginica" +6.5,3,5.5,1.8,"Iris-virginica" +7.7,3.8,6.7,2.2,"Iris-virginica" +7.7,2.6,6.9,2.3,"Iris-virginica" +6,2.2,5,1.5,"Iris-virginica" +6.9,3.2,5.7,2.3,"Iris-virginica" +5.6,2.8,4.9,2,"Iris-virginica" +7.7,2.8,6.7,2,"Iris-virginica" +6.3,2.7,4.9,1.8,"Iris-virginica" +6.7,3.3,5.7,2.1,"Iris-virginica" +7.2,3.2,6,1.8,"Iris-virginica" +6.2,2.8,4.8,1.8,"Iris-virginica" +6.1,3,4.9,1.8,"Iris-virginica" +6.4,2.8,5.6,2.1,"Iris-virginica" +7.2,3,5.8,1.6,"Iris-virginica" +7.4,2.8,6.1,1.9,"Iris-virginica" +7.9,3.8,6.4,2,"Iris-virginica" +6.4,2.8,5.6,2.2,"Iris-virginica" +6.3,2.8,5.1,1.5,"Iris-virginica" +6.1,2.6,5.6,1.4,"Iris-virginica" +7.7,3,6.1,2.3,"Iris-virginica" +6.3,3.4,5.6,2.4,"Iris-virginica" +6.4,3.1,5.5,1.8,"Iris-virginica" +6,3,4.8,1.8,"Iris-virginica" +6.9,3.1,5.4,2.1,"Iris-virginica" +6.7,3.1,5.6,2.4,"Iris-virginica" +6.9,3.1,5.1,2.3,"Iris-virginica" +5.8,2.7,5.1,1.9,"Iris-virginica" +6.8,3.2,5.9,2.3,"Iris-virginica" +6.7,3.3,5.7,2.5,"Iris-virginica" +6.7,3,5.2,2.3,"Iris-virginica" +6.3,2.5,5,1.9,"Iris-virginica" +6.5,3,5.2,2,"Iris-virginica" +6.2,3.4,5.4,2.3,"Iris-virginica" +5.9,3,5.1,1.8,"Iris-virginica" diff --git a/exercises/02450Toolbox_Matlab/Data/iris.mat b/exercises/02450Toolbox_Matlab/Data/iris.mat new file mode 100644 index 0000000000000000000000000000000000000000..74e82775918656aea727494d56c5ef7c0c36ccf8 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/iris.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/iris.xls b/exercises/02450Toolbox_Matlab/Data/iris.xls new file mode 100644 index 0000000000000000000000000000000000000000..0a3950140b342d9ee3de3bb285be5f2bb0625953 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/iris.xls differ diff --git a/exercises/02450Toolbox_Matlab/Data/male.txt b/exercises/02450Toolbox_Matlab/Data/male.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacce977f4f80fe6df231891486daa62acaeded5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/male.txt @@ -0,0 +1,2943 @@ +Aamir +Aaron +Abbey +Abbie +Abbot +Abbott +Abby +Abdel +Abdul +Abdulkarim +Abdullah +Abe +Abel +Abelard +Abner +Abraham +Abram +Ace +Adair +Adam +Adams +Addie +Adger +Aditya +Adlai +Adnan +Adolf +Adolfo +Adolph +Adolphe +Adolpho +Adolphus +Adrian +Adrick +Adrien +Agamemnon +Aguinaldo +Aguste +Agustin +Aharon +Ahmad +Ahmed +Ahmet +Ajai +Ajay +Al +Alaa +Alain +Alan +Alasdair +Alastair +Albatros +Albert +Alberto +Albrecht +Alden +Aldis +Aldo +Aldric +Aldrich +Aldus +Aldwin +Alec +Aleck +Alejandro +Aleks +Aleksandrs +Alessandro +Alex +Alexander +Alexei +Alexis +Alf +Alfie +Alfonse +Alfonso +Alfonzo +Alford +Alfred +Alfredo +Algernon +Ali +Alic +Alister +Alix +Allah +Allan +Allen +Alley +Allie +Allin +Allyn +Alonso +Alonzo +Aloysius +Alphonse +Alphonso +Alston +Alton +Alvin +Alwin +Amadeus +Ambros +Ambrose +Ambrosi +Ambrosio +Ambrosius +Amery +Amory +Amos +Anatol +Anatole +Anatollo +Anatoly +Anders +Andie +Andonis +Andre +Andrea +Andreas +Andrej +Andres +Andrew +Andrey +Andri +Andros +Andrus +Andrzej +Andy +Angel +Angelico +Angelo +Angie +Angus +Ansel +Ansell +Anselm +Anson +Anthony +Antin +Antoine +Anton +Antone +Antoni +Antonin +Antonino +Antonio +Antonius +Antony +Anurag +Apollo +Apostolos +Aram +Archibald +Archibold +Archie +Archon +Archy +Arel +Ari +Arie +Ariel +Aristotle +Arlo +Armand +Armando +Armond +Armstrong +Arne +Arnie +Arnold +Arnoldo +Aron +Arron +Art +Arther +Arthur +Artie +Artur +Arturo +Arvie +Arvin +Arvind +Arvy +Ash +Ashby +Ashish +Ashley +Ashton +Aub +Aube +Aubert +Aubrey +Augie +August +Augustin +Augustine +Augusto +Augustus +Austen +Austin +Ave +Averell +Averil +Averill +Avery +Avi +Avraham +Avram +Avrom +Axel +Aylmer +Aziz +Bailey +Bailie +Baillie +Baily +Baird +Baldwin +Bancroft +Barbabas +Barclay +Bard +Barde +Barn +Barnabas +Barnabe +Barnaby +Barnard +Barnebas +Barnett +Barney +Barnie +Barny +Baron +Barr +Barret +Barrett +Barri +Barrie +Barris +Barron +Barry +Bart +Bartel +Barth +Barthel +Bartholemy +Bartholomeo +Bartholomeus +Bartholomew +Bartie +Bartlet +Bartlett +Bartolemo +Bartolomei +Bartolomeo +Barton +Barty +Bary +Basil +Batholomew +Baxter +Bay +Bayard +Beale +Bealle +Bear +Bearnard +Beau +Beaufort +Beauregard +Beck +Bela +Ben +Benedict +Bengt +Benito +Benjamen +Benjamin +Benji +Benjie +Benjy +Benn +Bennet +Bennett +Bennie +Benny +Benson +Bentley +Benton +Beowulf +Berchtold +Berk +Berke +Berkeley +Berkie +Berkley +Bernard +Bernardo +Bernd +Bernhard +Bernie +Bert +Bertie +Bertram +Bertrand +Bharat +Biff +Bill +Billie +Billy +Bing +Binky +Bishop +Bjorn +Bjorne +Blaine +Blair +Blake +Blare +Blayne +Bo +Bob +Bobbie +Bobby +Bogart +Bogdan +Boniface +Boris +Boyce +Boyd +Brad +Braden +Bradford +Bradley +Bradly +Brady +Brandon +Brandy +Brant +Brendan +Brent +Bret +Brett +Brewer +Brewster +Brian +Brice +Briggs +Brinkley +Britt +Brock +Broddie +Broddy +Broderic +Broderick +Brodie +Brody +Bronson +Brook +Brooke +Brooks +Bruce +Bruno +Bryan +Bryant +Bryce +Bryn +Bryon +Bubba +Buck +Bucky +Bud +Buddy +Burgess +Burke +Burl +Burnaby +Burt +Burton +Buster +Butch +Butler +Byram +Byron +Caesar +Cain +Cal +Caldwell +Caleb +Calhoun +Calvin +Cam +Cameron +Cammy +Carey +Carl +Carleigh +Carlie +Carlin +Carlo +Carlos +Carlton +Carlyle +Carmine +Carroll +Carson +Carsten +Carter +Cary +Caryl +Case +Casey +Caspar +Casper +Cass +Cat +Cecil +Cesar +Chad +Chadd +Chaddie +Chaddy +Chadwick +Chaim +Chalmers +Chan +Chance +Chancey +Chanderjit +Chandler +Chane +Chariot +Charles +Charleton +Charley +Charlie +Charlton +Chas +Chase +Chaunce +Chauncey +Che +Chelton +Chen +Chester +Cheston +Chet +Chev +Chevalier +Chevy +Chip +Chris +Chrissy +Christ +Christian +Christiano +Christie +Christof +Christofer +Christoph +Christophe +Christopher +Christorpher +Christos +Christy +Chrisy +Chuck +Churchill +Clair +Claire +Clancy +Clarance +Clare +Clarence +Clark +Clarke +Claude +Claudio +Claudius +Claus +Clay +Clayborn +Clayborne +Claybourne +Clayton +Cleland +Clem +Clemens +Clement +Clemente +Clemmie +Cletus +Cleveland +Cliff +Clifford +Clifton +Clint +Clinten +Clinton +Clive +Clyde +Cob +Cobb +Cobbie +Cobby +Cody +Colbert +Cole +Coleman +Colin +Collin +Collins +Conan +Connie +Connolly +Connor +Conrad +Conroy +Constantin +Constantine +Constantinos +Conway +Cooper +Corbin +Corby +Corey +Corky +Cornelius +Cornellis +Corrie +Cortese +Corwin +Cory +Cosmo +Costa +Courtney +Craig +Crawford +Creighton +Cris +Cristopher +Curt +Curtice +Curtis +Cy +Cyril +Cyrill +Cyrille +Cyrillus +Cyrus +Dabney +Daffy +Dale +Dallas +Dalton +Damian +Damien +Damon +Dan +Dana +Dane +Dani +Danie +Daniel +Dannie +Danny +Dante +Darby +Darcy +Daren +Darian +Darien +Darin +Dario +Darius +Darrel +Darrell +Darren +Darrick +Darrin +Darryl +Darth +Darwin +Daryl +Daryle +Dave +Davey +David +Davidde +Davide +Davidson +Davie +Davin +Davis +Davon +Davoud +Davy +Dawson +Dean +Deane +Del +Delbert +Dell +Delmar +Demetre +Demetri +Demetris +Demetrius +Demosthenis +Denis +Dennie +Dennis +Denny +Derby +Derek +Derick +Derk +Derrek +Derrick +Derrin +Derrol +Derron +Deryl +Desmond +Desmund +Devin +Devon +Dewey +Dewitt +Dexter +Dick +Dickey +Dickie +Diego +Dieter +Dietrich +Dillon +Dimitri +Dimitrios +Dimitris +Dimitrou +Dimitry +Dino +Dion +Dionis +Dionysus +Dirk +Dmitri +Dom +Domenic +Domenico +Dominic +Dominick +Dominique +Don +Donal +Donald +Donn +Donnie +Donny +Donovan +Dorian +Dory +Doug +Douggie +Dougie +Douglas +Douglass +Douglis +Dov +Doyle +Drake +Drew +Dru +Dryke +Duane +Dudley +Duffie +Duffy +Dugan +Duke +Dunc +Duncan +Dunstan +Durand +Durant +Durante +Durward +Dustin +Dwain +Dwaine +Dwane +Dwayne +Dwight +Dylan +Dyson +Earl +Earle +Easton +Eben +Ebeneser +Ebenezer +Eberhard +Ed +Eddie +Eddy +Edgar +Edgardo +Edie +Edmond +Edmund +Edouard +Edsel +Eduard +Eduardo +Edward +Edwin +Efram +Egbert +Ehud +Elbert +Elden +Eldon +Eli +Elias +Elihu +Elijah +Eliot +Eliott +Elisha +Elliot +Elliott +Ellis +Ellsworth +Ellwood +Elmer +Elmore +Elnar +Elric +Elroy +Elton +Elvin +Elvis +Elwin +Elwood +Elwyn +Ely +Emanuel +Emerson +Emery +Emil +Emile +Emilio +Emmanuel +Emmery +Emmet +Emmett +Emmit +Emmott +Emmy +Emory +Ender +Engelbart +Engelbert +Englebart +Englebert +Enoch +Enrico +Enrique +Ephraim +Ephram +Ephrayim +Ephrem +Er +Erasmus +Erastus +Erek +Erhard +Erhart +Eric +Erich +Erick +Erik +Erin +Erl +Ernest +Ernesto +Ernie +Ernst +Erny +Errol +Ervin +Erwin +Esau +Esme +Esteban +Ethan +Ethelbert +Ethelred +Etienne +Euclid +Eugen +Eugene +Eustace +Ev +Evan +Evelyn +Everard +Everett +Ewan +Ewart +Ez +Ezechiel +Ezekiel +Ezra +Fabian +Fabio +Fairfax +Farley +Fazeel +Federico +Felice +Felicio +Felipe +Felix +Ferd +Ferdie +Ferdinand +Ferdy +Fergus +Ferguson +Ferinand +Fernando +Fidel +Filbert +Filip +Filipe +Filmore +Finley +Finn +Fitz +Fitzgerald +Flem +Fleming +Flemming +Fletch +Fletcher +Flin +Flinn +Flint +Flipper +Florian +Floyd +Flynn +Fons +Fonsie +Fonz +Fonzie +Forbes +Ford +Forest +Forester +Forrest +Forrester +Forster +Foster +Fowler +Fox +Fran +Francesco +Francis +Francisco +Francois +Frank +Frankie +Franklin +Franklyn +Franky +Frans +Franz +Fraser +Frazier +Fred +Freddie +Freddy +Frederic +Frederich +Frederick +Frederico +Frederik +Fredric +Fredrick +Freeman +Freemon +Fremont +French +Friedric +Friedrich +Friedrick +Fritz +Fulton +Fyodor +Gabe +Gabriel +Gabriele +Gabriell +Gabriello +Gail +Gale +Galen +Gallagher +Gamaliel +Garcia +Garcon +Gardener +Gardiner +Gardner +Garey +Garfield +Garfinkel +Garold +Garp +Garret +Garrett +Garrot +Garrott +Garry +Garth +Garv +Garvey +Garvin +Garvy +Garwin +Garwood +Gary +Gaspar +Gasper +Gaston +Gav +Gaven +Gavin +Gavriel +Gay +Gayle +Gearard +Gene +Geo +Geof +Geoff +Geoffrey +Geoffry +Georg +George +Georges +Georgia +Georgie +Georgy +Gerald +Geraldo +Gerard +Gere +Gerhard +Gerhardt +Geri +Germaine +Gerold +Gerome +Gerrard +Gerri +Gerrit +Gerry +Gershom +Gershon +Giacomo +Gian +Giancarlo +Giavani +Gibb +Gideon +Giff +Giffard +Giffer +Giffie +Gifford +Giffy +Gil +Gilbert +Gilberto +Gilburt +Giles +Gill +Gilles +Ginger +Gino +Giordano +Giorgi +Giorgio +Giovanne +Giovanni +Giraldo +Giraud +Giuseppe +Glen +Glenn +Glynn +Godard +Godart +Goddard +Goddart +Godfree +Godfrey +Godfry +Godwin +Gomer +Gonzales +Gonzalo +Goober +Goose +Gordan +Gordie +Gordon +Grace +Grady +Graehme +Graeme +Graham +Graig +Grant +Granville +Greg +Gregg +Greggory +Gregor +Gregorio +Gregory +Gretchen +Griff +Griffin +Griffith +Griswold +Grove +Grover +Guido +Guillaume +Guillermo +Gunner +Gunter +Gunther +Gus +Gustaf +Gustav +Gustave +Gustavo +Gustavus +Guthrey +Guthrie +Guthry +Guy +Hadleigh +Hadley +Hadrian +Hagan +Hagen +Hailey +Hakeem +Hakim +Hal +Hale +Haleigh +Haley +Hall +Hallam +Halvard +Ham +Hamel +Hamid +Hamil +Hamilton +Hamish +Hamlen +Hamlet +Hamlin +Hammad +Hamnet +Han +Hanan +Hanford +Hank +Hannibal +Hans +Hans-Peter +Hansel +Hanson +Harald +Harcourt +Hari +Harlan +Harland +Harley +Harlin +Harman +Harmon +Harold +Harris +Harrison +Harrold +Harry +Hart +Hartley +Hartwell +Harv +Harvard +Harvey +Harvie +Harwell +Hasheem +Hashim +Haskel +Haskell +Hassan +Hastings +Hasty +Haven +Hayden +Haydon +Hayes +Hayward +Haywood +Hazel +Heath +Heathcliff +Hebert +Hector +Heinrich +Heinz +Helmuth +Henderson +Hendrick +Hendrik +Henri +Henrie +Henrik +Henrique +Henry +Herb +Herbert +Herbie +Herby +Hercule +Hercules +Herculie +Herman +Hermann +Hermon +Hermy +Hernando +Herold +Herrick +Herrmann +Hersch +Herschel +Hersh +Hershel +Herve +Hervey +Hew +Hewe +Hewet +Hewett +Hewie +Hewitt +Heywood +Hezekiah +Higgins +Hilary +Hilbert +Hill +Hillard +Hillary +Hillel +Hillery +Hilliard +Hilton +Hiralal +Hiram +Hiro +Hirsch +Hobart +Hodge +Hogan +Hollis +Holly +Homer +Horace +Horacio +Horatio +Horatius +Horst +Howard +Howie +Hoyt +Hubert +Hudson +Huey +Hugh +Hugo +Humbert +Humphrey +Hunt +Hunter +Huntington +Huntlee +Huntley +Hurley +Husain +Husein +Hussein +Hy +Hyatt +Hyman +Hymie +Iago +Iain +Ian +Ibrahim +Ichabod +Iggie +Iggy +Ignace +Ignacio +Ignacius +Ignatius +Ignaz +Ignazio +Igor +Ike +Ikey +Immanuel +Ingamar +Ingelbert +Ingemar +Inglebert +Ingmar +Ingram +Inigo +Ira +Irvin +Irvine +Irving +Irwin +Isa +Isaac +Isaak +Isador +Isadore +Isaiah +Ishmael +Isidore +Ismail +Israel +Istvan +Ivan +Ivor +Izaak +Izak +Izzy +Jabez +Jack +Jackie +Jackson +Jacob +Jacques +Jae +Jaime +Jake +Jakob +James +Jameson +Jamey +Jamie +Jan +Janos +Janus +Jared +Jarrett +Jarvis +Jason +Jasper +Javier +Jay +Jean +Jean-Christophe +Jean-Francois +Jean-Lou +Jean-Luc +Jean-Marc +Jean-Paul +Jean-Pierre +Jeb +Jed +Jedediah +Jef +Jeff +Jefferey +Jefferson +Jeffery +Jeffie +Jeffrey +Jeffry +Jefry +Jehu +Jennings +Jens +Jephthah +Jerald +Jeramie +Jere +Jereme +Jeremiah +Jeremias +Jeremie +Jeremy +Jermain +Jermaine +Jermayne +Jerold +Jerome +Jeromy +Jerri +Jerrie +Jerrold +Jerrome +Jerry +Jervis +Jerzy +Jess +Jesse +Jessee +Jessey +Jessie +Jesus +Jeth +Jethro +Jim +Jimbo +Jimmie +Jimmy +Jo +Joab +Joachim +Joao +Joaquin +Job +Jock +Jodi +Jodie +Jody +Joe +Joel +Joey +Johan +Johann +Johannes +John +John-David +John-Patrick +Johnathan +Johnathon +Johnnie +Johnny +Johny +Jon +Jonah +Jonas +Jonathan +Jonathon +Jonny +Jordan +Jordon +Jordy +Jorge +Jory +Jose +Josef +Joseph +Josephus +Josh +Joshua +Joshuah +Josiah +Jotham +Juan +Juanita +Jud +Judah +Judas +Judd +Jude +Judith +Judson +Judy +Juergen +Jule +Jules +Julian +Julie +Julio +Julius +Justin +Justis +Kaiser +Kaleb +Kalil +Kalle +Kalman +Kalvin +Kam +Kane +Kareem +Karel +Karim +Karl +Karsten +Kaspar +Keefe +Keenan +Keene +Keil +Keith +Kellen +Kelley +Kelly +Kelsey +Kelvin +Kelwin +Ken +Kendal +Kendall +Kendrick +Kenn +Kennedy +Kenneth +Kenny +Kent +Kenton +Kenyon +Kermie +Kermit +Kerry +Kevan +Kevin +Kim +Kimball +Kimmo +Kin +Kincaid +King +Kingsley +Kingsly +Kingston +Kip +Kirby +Kirk +Kit +Klaus +Klee +Knox +Konrad +Konstantin +Kory +Kostas +Kraig +Kris +Krishna +Kristian +Kristopher +Kristos +Kurt +Kurtis +Kyle +Laird +Lamar +Lambert +Lamont +Lance +Lancelot +Lane +Langston +Lanny +Larry +Lars +Laurance +Lauren +Laurence +Laurens +Laurent +Laurie +Lawerence +Lawrence +Lawson +Lawton +Lay +Layton +Lazar +Lazare +Lazaro +Lazarus +Lazlo +Lee +Lefty +Leif +Leigh +Leighton +Leland +Lem +Lemar +Lemmie +Lemmy +Lemuel +Len +Lenard +Lennie +Lenny +Leo +Leon +Leonard +Leonardo +Leonerd +Leonhard +Leonid +Leonidas +Leopold +Leroy +Les +Lesley +Leslie +Lester +Lev +Levi +Levin +Levon +Levy +Lew +Lewis +Lex +Liam +Lin +Lincoln +Lind +Lindsay +Lindsey +Lindy +Linoel +Linus +Lion +Lionel +Lionello +Llewellyn +Lloyd +Locke +Lockwood +Logan +Lon +Lonnie +Lonny +Loren +Lorenzo +Lorne +Lorrie +Lothar +Lou +Louie +Louis +Lovell +Lowell +Lucas +Luce +Lucian +Luciano +Lucien +Lucio +Lucius +Ludvig +Ludwig +Luigi +Luis +Lukas +Luke +Luther +Lyle +Lyn +Lyndon +Lynn +Mac +Mace +Mack +Mackenzie +Maddie +Maddy +Madison +Magnum +Magnus +Mahesh +Mahmoud +Mahmud +Maison +Major +Malcolm +Manfred +Manish +Manny +Manuel +Marc +Marcel +Marcello +Marcellus +Marcelo +Marchall +Marcio +Marco +Marcos +Marcus +Marietta +Marilu +Mario +Marion +Marius +Mark +Marko +Markos +Markus +Marlin +Marlo +Marlon +Marlow +Marlowe +Marmaduke +Marsh +Marshal +Marshall +Mart +Martainn +Marten +Martie +Martin +Martino +Marty +Martyn +Marv +Marve +Marven +Marvin +Marwin +Mason +Mateo +Mathew +Mathias +Matias +Matt +Matteo +Matthaeus +Mattheus +Matthew +Matthias +Matthieu +Matthiew +Matthus +Mattias +Mattie +Matty +Maurice +Mauricio +Maurie +Maurise +Maurits +Mauritz +Maury +Max +Maxfield +Maxie +Maxim +Maximilian +Maximilien +Maxwell +Mayer +Maynard +Maynord +Mayor +Mead +Meade +Meier +Meir +Mel +Melvin +Melvyn +Menard +Mendel +Mendie +Meredeth +Meredith +Merell +Merill +Merle +Merlin +Merrel +Merrick +Merril +Merrill +Merry +Merv +Mervin +Merwin +Meryl +Meyer +Mic +Micah +Michael +Michail +Michal +Michale +Micheal +Micheil +Michel +Michele +Mick +Mickey +Mickie +Micky +Miguel +Mika +Mikael +Mike +Mikel +Mikey +Mikhail +Miles +Millicent +Milo +Milt +Milton +Mischa +Mitch +Mitchael +Mitchel +Mitchell +Moe +Mohamad +Mohamed +Mohammad +Mohammed +Mohan +Moise +Moises +Moishe +Monroe +Montague +Monte +Montgomery +Monty +Moore +Mordecai +Morgan +Morlee +Morley +Morly +Morrie +Morris +Morry +Morse +Mort +Morten +Mortie +Mortimer +Morton +Morty +Mose +Moses +Moshe +Moss +Muffin +Mugsy +Muhammad +Munmro +Munroe +Murdoch +Murdock +Murphy +Murray +Mustafa +Myke +Myles +Mylo +Myron +Nahum +Napoleon +Nat +Natale +Nate +Nathan +Nathanael +Nathanial +Nathaniel +Nathanil +Neal +Neale +Neall +Nealon +Nealson +Nealy +Ned +Neddie +Neddy +Neel +Neil +Nels +Nelsen +Nelson +Nero +Neron +Nester +Nestor +Nev +Nevil +Nevile +Neville +Nevin +Nevins +Newton +Niall +Niccolo +Nicholas +Nichole +Nichols +Nick +Nickey +Nickie +Nickolas +Nicky +Nico +Nicolas +Niels +Nigel +Niki +Nikita +Nikki +Nikolai +Nikos +Niles +Nils +Nilson +Niven +Noach +Noah +Noam +Noble +Noe +Noel +Nolan +Noland +Norbert +Norm +Norman +Normand +Normie +Norris +Northrop +Northrup +Norton +Norwood +Nunzio +Obadiah +Obadias +Oberon +Obie +Octavius +Odell +Odie +Odin +Odysseus +Olaf +Olag +Ole +Oleg +Olin +Oliver +Olivier +Olle +Ollie +Omar +Oral +Oran +Orazio +Orbadiah +Oren +Orin +Orion +Orlando +Orren +Orrin +Orson +Orton +Orville +Osbert +Osborn +Osborne +Osbourn +Osbourne +Oscar +Osgood +Osmond +Osmund +Ossie +Oswald +Oswell +Otes +Othello +Otho +Otis +Otto +Owen +Ozzie +Ozzy +Pablo +Pace +Paco +Paddie +Paddy +Padraig +Page +Paige +Pail +Palmer +Paolo +Park +Parke +Parker +Parnell +Parrnell +Parry +Parsifal +Partha +Pascal +Pascale +Pasquale +Pat +Pate +Patel +Paten +Patin +Paton +Patric +Patrice +Patricio +Patrick +Patrik +Patsy +Pattie +Patty +Paul +Paulo +Pavel +Pearce +Pedro +Peirce +Pembroke +Pen +Penn +Pennie +Penny +Penrod +Pepe +Pepillo +Pepito +Perceval +Percival +Percy +Perry +Pete +Peter +Petey +Petr +Peyter +Peyton +Phil +Philbert +Philip +Phillip +Phillipe +Phillipp +Phineas +Phip +Pierce +Pierre +Pierson +Piet +Pieter +Pietro +Piggy +Pincas +Pinchas +Pincus +Piotr +Pip +Plato +Pooh +Porter +Poul +Powell +Praneetf +Prasad +Prasun +Prent +Prentice +Prentiss +Prescott +Preston +Price +Prince +Pryce +Puff +Purcell +Putnam +Pyotr +Quent +Quentin +Quiggly +Quigly +Quigman +Quill +Quillan +Quincey +Quincy +Quinlan +Quinn +Quint +Quintin +Quinton +Quintus +Rab +Rabbi +Rabi +Rad +Radcliffe +Rafael +Rafe +Ragnar +Rahul +Raimund +Rainer +Raj +Rajeev +Raleigh +Ralf +Ralph +Ram +Ramesh +Ramon +Ramsay +Ramsey +Rand +Randal +Randall +Randell +Randi +Randie +Randolf +Randolph +Randy +Ransell +Ransom +Raoul +Raphael +Raul +Ravi +Ravil +Rawley +Ray +Raymond +Raymund +Raymundo +Raynard +Rayner +Raynor +Reagan +Red +Redford +Redmond +Reece +Reed +Rees +Reese +Reg +Regan +Regen +Reggie +Reggis +Reggy +Reginald +Reginauld +Reid +Reilly +Reinhard +Reinhold +Rem +Remington +Remus +Renado +Renaldo +Renard +Renato +Renaud +Renault +Rene +Reube +Reuben +Reuven +Rex +Rey +Reynard +Reynold +Reynolds +Reza +Rhett +Ric +Ricard +Ricardo +Riccardo +Rice +Rich +Richard +Richardo +Richie +Richmond +Richy +Rick +Rickard +Rickey +Ricki +Rickie +Ricky +Rik +Rikki +Riley +Rinaldo +Ripley +Ritch +Ritchie +Roarke +Rob +Robb +Robbert +Robbie +Robert +Roberto +Robin +Robinson +Rochester +Rock +Rockwell +Rocky +Rod +Rodd +Roddie +Roddy +Roderic +Roderich +Roderick +Roderigo +Rodge +Rodger +Rodney +Rodolfo +Rodolph +Rodolphe +Rodrick +Rodrigo +Rodrique +Rog +Roger +Rogers +Roice +Roland +Rolando +Rolf +Rolfe +Rolland +Rollin +Rollins +Rollo +Rolph +Romain +Roman +Romeo +Ron +Ronald +Ronen +Roni +Ronnie +Ronny +Roosevelt +Rory +Roscoe +Ross +Roth +Rourke +Rowland +Roy +Royal +Royce +Rube +Ruben +Rubin +Ruby +Rudd +Ruddie +Ruddy +Rudie +Rudiger +Rudolf +Rudolfo +Rudolph +Rudy +Rudyard +Rufe +Rufus +Rupert +Ruperto +Russ +Russel +Russell +Rustie +Rustin +Rusty +Rutger +Rutherford +Rutledge +Rutter +Ryan +Sal +Salem +Salim +Salman +Salmon +Salomo +Salomon +Salomone +Salvador +Salvatore +Salvidor +Sam +Sammie +Sammy +Sampson +Samson +Samuel +Samuele +Sancho +Sander +Sanders +Sanderson +Sandor +Sandro +Sandy +Sanford +Sanson +Sansone +Sarge +Sargent +Sascha +Sasha +Saul +Sauncho +Saunder +Saunders +Saunderson +Saundra +Saw +Sawyer +Sawyere +Sax +Saxe +Saxon +Say +Sayer +Sayers +Sayre +Sayres +Scarface +Schroeder +Schuyler +Scot +Scott +Scotti +Scottie +Scotty +Seamus +Sean +Sebastian +Sebastiano +Sebastien +See +Selby +Selig +Serge +Sergeant +Sergei +Sergent +Sergio +Seth +Seymour +Shadow +Shaine +Shalom +Shamus +Shanan +Shane +Shannan +Shannon +Shaughn +Shaun +Shaw +Shawn +Shay +Shayne +Shea +Sheff +Sheffie +Sheffield +Sheffy +Shelby +Shelden +Sheldon +Shell +Shelley +Shelton +Shem +Shep +Shepard +Shepherd +Sheppard +Shepperd +Sheridan +Sherlock +Sherlocke +Sherman +Sherwin +Sherwood +Sherwynd +Shimon +Shlomo +Sholom +Shorty +Shumeet +Shurlock +Shurlocke +Shurwood +Si +Sibyl +Sid +Siddhartha +Sidnee +Sidney +Siegfried +Siffre +Sig +Sigfrid +Sigfried +Sigmund +Silas +Silvain +Silvan +Silvano +Silvanus +Silvester +Silvio +Sim +Simeon +Simmonds +Simon +Simone +Sinclair +Sinclare +Sivert +Siward +Skell +Skelly +Skip +Skipp +Skipper +Skippie +Skippy +Skipton +Sky +Skye +Skylar +Skyler +Slade +Slim +Sloan +Sloane +Sly +Smith +Smitty +Socrates +Sol +Sollie +Solly +Solomon +Somerset +Son +Sonnie +Sonny +Sparky +Spence +Spencer +Spense +Spenser +Spike +Spiro +Spiros +Spud +Srinivas +Stacy +Staffard +Stafford +Staford +Stan +Standford +Stanfield +Stanford +Stanislaw +Stanleigh +Stanley +Stanly +Stanton +Stanwood +Stavros +Stearn +Stearne +Stefan +Stefano +Steffen +Stephan +Stephanus +Stephen +Sterling +Stern +Sterne +Steve +Steven +Stevie +Stevy +Stew +Steward +Stewart +Stig +Stillman +Stillmann +Sting +Stinky +Stirling +Stu +Stuart +Sturgis +Sullivan +Sully +Sumner +Sunny +Sutherland +Sutton +Sven +Swen +Syd +Sydney +Sylvan +Sylvester +Tab +Tabb +Tabbie +Tabby +Taber +Tabor +Tad +Tadd +Taddeo +Taddeus +Tadeas +Tailor +Tait +Taite +Talbert +Talbot +Tallie +Tally +Tam +Tamas +Tammie +Tammy +Tan +Tann +Tanner +Tanney +Tannie +Tanny +Tarrance +Tarrant +Tarzan +Tate +Taylor +Teador +Ted +Tedd +Teddie +Teddy +Tedie +Tedman +Tedmund +Tedrick +Temp +Temple +Templeton +Teodoor +Teodor +Teodorico +Teodoro +Terence +Terencio +Terrance +Terrel +Terrell +Terrence +Terri +Terrill +Terry +Thacher +Thad +Thaddeus +Thaddius +Thaddus +Thadeus +Thain +Thaine +Thane +Tharen +Thatch +Thatcher +Thaxter +Thayne +Thebault +Thedric +Thedrick +Theo +Theobald +Theodor +Theodore +Theodoric +Theophyllus +Thibaud +Thibaut +Thom +Thomas +Thor +Thorn +Thorndike +Thornie +Thornton +Thorny +Thorpe +Thorstein +Thorsten +Thorvald +Thurstan +Thurston +Tibold +Tiebold +Tiebout +Tiler +Tim +Timmie +Timmy +Timothee +Timotheus +Timothy +Tirrell +Tito +Titos +Titus +Tobe +Tobiah +Tobias +Tobie +Tobin +Tobit +Toby +Tod +Todd +Toddie +Toddy +Tom +Tomas +Tome +Tomkin +Tomlin +Tommie +Tommy +Tonnie +Tony +Tore +Torey +Torin +Torr +Torrance +Torre +Torrence +Torrey +Torrin +Torry +Town +Towney +Townie +Townsend +Towny +Trace +Tracey +Tracie +Tracy +Traver +Travers +Travis +Tray +Tre +Tremain +Tremaine +Tremayne +Trent +Trenton +Trev +Trevar +Trever +Trevor +Trey +Trip +Tristan +Troy +Truman +Tuck +Tucker +Tuckie +Tucky +Tudor +Tull +Tulley +Tully +Turner +Ty +Tybalt +Tye +Tyler +Tymon +Tymothy +Tynan +Tyrone +Tyrus +Tyson +Udale +Udall +Udell +Ugo +Ulberto +Uli +Ulick +Ulises +Ulric +Ulrich +Ulrick +Ulysses +Umberto +Upton +Urbain +Urban +Urbano +Urbanus +Uri +Uriah +Uriel +Urson +Vachel +Vaclav +Vail +Val +Valdemar +Vale +Valentin +Valentine +Van +Vance +Vasili +Vasilis +Vasily +Vassili +Vassily +Vaughan +Vaughn +Venkat +Verge +Vergil +Vern +Verne +Vernen +Verney +Vernon +Vernor +Vibhu +Vic +Vick +Victor +Vijay +Vilhelm +Vin +Vince +Vincent +Vincents +Vinnie +Vinny +Vinod +Virge +Virgie +Virgil +Virgilio +Vite +Vito +Vlad +Vladamir +Vladimir +Voltaire +Von +Wade +Wadsworth +Wain +Waine +Wainwright +Wait +Waite +Waiter +Wake +Wakefield +Wald +Waldemar +Walden +Waldo +Waldon +Waleed +Walker +Wallace +Wallache +Wallas +Wallie +Wallis +Wally +Walsh +Walt +Walter +Walther +Walton +Wang +Ward +Warde +Warden +Ware +Waring +Warner +Warren +Wash +Washington +Wat +Waverley +Waverly +Way +Waylan +Wayland +Waylen +Waylin +Waylon +Wayne +Web +Webb +Weber +Webster +Weidar +Weider +Welbie +Welby +Welch +Wells +Welsh +Wendall +Wendel +Wendell +Werner +Wes +Wesley +Weslie +West +Westbrook +Westbrooke +Westleigh +Westley +Weston +Weylin +Wheeler +Whit +Whitaker +Whitby +Whitman +Whitney +Whittaker +Wiatt +Wilber +Wilbert +Wilbur +Wilburn +Wilburt +Wilden +Wildon +Wilek +Wiley +Wilfred +Wilfrid +Wilhelm +Will +Willard +Willdon +Willem +Willey +Willi +William +Willie +Willis +Willmott +Willy +Wilmar +Wilmer +Wilson +Wilt +Wilton +Win +Windham +Winfield +Winford +Winfred +Winifield +Winn +Winnie +Winny +Winslow +Winston +Winthrop +Winton +Wit +Witold +Wittie +Witty +Wojciech +Wolf +Wolfgang +Wolfie +Wolfram +Wolfy +Woochang +Wood +Woodie +Woodman +Woodrow +Woody +Worden +Worth +Worthington +Worthy +Wright +Wyatan +Wyatt +Wye +Wylie +Wyn +Wyndham +Wynn +Wynton +Xavier +Xenos +Xerxes +Xever +Ximenes +Ximenez +Xymenes +Yaakov +Yacov +Yale +Yanaton +Yance +Yancey +Yancy +Yank +Yankee +Yard +Yardley +Yehudi +Yigal +Yule +Yuri +Yves +Zach +Zacharia +Zachariah +Zacharias +Zacharie +Zachary +Zacherie +Zachery +Zack +Zackariah +Zak +Zalman +Zane +Zared +Zary +Zeb +Zebadiah +Zebedee +Zebulen +Zebulon +Zechariah +Zed +Zedekiah +Zeke +Zelig +Zerk +Zeus +Zippy +Zollie +Zolly +Zorro diff --git a/exercises/02450Toolbox_Matlab/Data/market.txt b/exercises/02450Toolbox_Matlab/Data/market.txt new file mode 100644 index 0000000000000000000000000000000000000000..f210fae375d7e0b47c0651798ad26310d183c0fd --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/market.txt @@ -0,0 +1,5 @@ +Bread,Soda,Milk +Beer,Bread +Beer,Soda,Diaper,Milk +Beer,Bread,Diaper,Milk +Soda,Diaper,Milk diff --git a/exercises/02450Toolbox_Matlab/Data/messy_data/README.txt b/exercises/02450Toolbox_Matlab/Data/messy_data/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5e842207f409b4e9e16496eaaf9ff590964932c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/messy_data/README.txt @@ -0,0 +1,70 @@ +*************************************************************************** +*************************************************************************** +*** messy_data *** +*************************************************************************** +*************************************************************************** +This dataset is an adaption of an existing dataset to highlight some common +issues (or variants of them) that one might face across various datasets. +This is not real data, but is based on values from the Auto-Mpg Data. +The original data was obtained from: + https://archive.ics.uci.edu/ml/datasets/auto+mpg +but was modified to include some formatting issues as well as removing some +values. +Missing values in the original dataset were sometimes denoted +with a question mark. Some missing values were introduced, too. +Specifically zeroes in the attributes mpg and displacement can be +considered missing values. + +For reference, the description of the original dataset is provided below. + +*************************************************************************** +*************************************************************************** +*** Original dataset description *** +*************************************************************************** +*************************************************************************** +1. Title: Auto-Mpg Data + +2. Sources: + (a) Origin: This dataset was taken from the StatLib library which is + maintained at Carnegie Mellon University. The dataset was + used in the 1983 American Statistical Association Exposition. + (c) Date: July 7, 1993 + +3. Past Usage: + - See 2b (above) + - Quinlan,R. (1993). Combining Instance-Based and Model-Based Learning. + In Proceedings on the Tenth International Conference of Machine + Learning, 236-243, University of Massachusetts, Amherst. Morgan + Kaufmann. + +4. Relevant Information: + + This dataset is a slightly modified version of the dataset provided in + the StatLib library. In line with the use by Ross Quinlan (1993) in + predicting the attribute "mpg", 8 of the original instances were removed + because they had unknown values for the "mpg" attribute. The original + dataset is available in the file "auto-mpg.data-original". + + "The data concerns city-cycle fuel consumption in miles per gallon, + to be predicted in terms of 3 multivalued discrete and 5 continuous + attributes." (Quinlan, 1993) + +5. Number of Instances: 398 + +6. Number of Attributes: 9 including the class attribute + +7. Attribute Information: + + 1. mpg: continuous + 2. cylinders: multi-valued discrete + 3. displacement: continuous + 4. horsepower: continuous + 5. weight: continuous + 6. acceleration: continuous + 7. model year: multi-valued discrete + 8. origin: multi-valued discrete + 9. car name: string (unique for each instance) + +8. Missing Attribute Values: horsepower has 6 missing values + + diff --git a/exercises/02450Toolbox_Matlab/Data/messy_data/messy_data.csv b/exercises/02450Toolbox_Matlab/Data/messy_data/messy_data.csv new file mode 100644 index 0000000000000000000000000000000000000000..f62d8f48d5f6682e03b68e209c73ce99b0b4bf13 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/messy_data/messy_data.csv @@ -0,0 +1,33 @@ +messy_data +mpg cylinders displacement horsepower weight acceleration modelyear origin carname +mpg cyl disp hp w acc yr org name +18 8 ? 130 3'504 12.0 70 1 chevrolet chevelle malibu +15 8 350 165 3'693 11,5 70 1 buick skylark 320 +18 8 ? 150 3'436 11.0 70 1 plymouth satellite +16 8 ? 150 3'433 12.0 70 1 amc rebel sst +17 8 0 140 3'449 10,5 70 1 ford torino +15 8 429 198 4'341 10.0 70 1 ford galaxie 500 +14 8 454 220 4'354 9.0 70 1 chevrolet impala +14 8 ? 215 4312 8,5 70 1 plymouth fury iii +14 8 455 225 4425 10.0 70 1 pontiac catalina +15 8 390 190 3'850 8,5 70 1 amc ambassador dpl +15 8 0 170 3'563 10.0 70 1 dodge challenger se +14 8 ? 160 3'609 8.0 70 1 plymouth 'cuda 340 +99 8 ? 150 3'761 9,5 70 1 chevrolet monte carlo +14 8 ? 225 3'086 10.0 70 1 buick estate wagon (sw) +24 4 113 95 2'372 15.0 70 3 toyota corona mark ii +22 6 95 2'833 15,5 70 1 plymouth duster +0 6 199 97 2'774 15,5 70 1 amc hornet +21 6 ? 85 2'587 16.0 70 1 ford maverick +27 4 97 88 2'130 14,5 70 3 datsun pl510 +26 4 46 1'835 20,5 70 2 volkswagen 1131 deluxe sedan +33 4 105 74 2190 14.2 81 2 volkswagen jetta +33.7 4 107 75 2210 14.4 81 3 honda prelude +32.4 4 108 75 2350 16.8 81 3 toyota corolla +32.9 4 119 100 2615 14.8 81 3 datsun 200sx +31.6 4 120 74 2635 18.3 81 3 mazda 626 +28.1 4 141 80 3'230 20.4 81 2 peugeot 505s turbo diesel +30.7 6 145 76 3'160 19.6 81 2 volvo diesel +0 6 168 116 2'900 12.6 81 3 toyota cressida +24.2 6 146 120 2'930 13.8 81 3 datsun 810 maxima + diff --git a/exercises/02450Toolbox_Matlab/Data/nanonose.xls b/exercises/02450Toolbox_Matlab/Data/nanonose.xls new file mode 100644 index 0000000000000000000000000000000000000000..363480eda943539efa036dbeb1ffeb6ffcaa757d Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/nanonose.xls differ diff --git a/exercises/02450Toolbox_Matlab/Data/readme_male_female_data.txt b/exercises/02450Toolbox_Matlab/Data/readme_male_female_data.txt new file mode 100644 index 0000000000000000000000000000000000000000..19518acc6c787f993164f4e4254069f90c1cd637 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/readme_male_female_data.txt @@ -0,0 +1,12 @@ +You may use the lists of names for any purpose, so long as credit is given +in any published work. You may also redistribute the list if you +provide the recipients with a copy of this README file. The lists are +not in the public domain (I retain the copyright on the lists) but are +freely redistributable. + +If you have any additions to the lists of names, I would appreciate +receiving them. + +My email address is mkant+@cs.cmu.edu. + +Mark Kantrowitz diff --git a/exercises/02450Toolbox_Matlab/Data/stopWords.txt b/exercises/02450Toolbox_Matlab/Data/stopWords.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d40fc0238119eaf8c9d2b86c3e7cb9f5e920c1e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/stopWords.txt @@ -0,0 +1,439 @@ +a +about +above +accordingly +across +after +afterwards +again +against +all +allows +almost +alone +along +already +also +although +always +am +among +amongst +an +and +another +any +anybody +anyhow +anyone +anything +anywhere +apart +appear +appropriate +are +around +as +aside +associated +at +available +away +awfully +b +back +be +became +because +become +becomes +becoming +been +before +beforehand +behind +being +below +beside +besides +best +better +between +beyond +both +brief +but +by +c +came +can +cannot +cant +cause +causes +certain +changes +co +come +consequently +contain +containing +contains +corresponding +could +currently +d +day +described +did +different +do +does +doing +done +down +downwards +during +e +each +eg +eight +either +else +elsewhere +enough +et +etc +even +ever +every +everybody +everyone +everything +everywhere +ex +example +except +f +far +few +fifth +first +five +followed +following +for +former +formerly +forth +four +from +further +furthermore +g +get +gets +given +gives +go +gone +good +got +great +h +had +hardly +has +have +having +he +hence +her +here +hereafter +hereby +herein +hereupon +hers +herself +him +himself +his +hither +how +howbeit +however +i +ie +if +ignored +immediate +in +inasmuch +inc +indeed +indicate +indicated +indicates +inner +insofar +instead +into +inward +is +it +its +itself +j +just +k +keep +kept +know +l +last +latter +latterly +least +less +lest +life +like +little +long +ltd +m +made +make +man +many +may +me +meanwhile +men +might +more +moreover +most +mostly +mr +much +must +my +myself +n +name +namely +near +necessary +neither +never +nevertheless +new +next +nine +no +nobody +none +noone +nor +normally +not +nothing +novel +now +nowhere +o +of +off +often +oh +old +on +once +one +ones +only +onto +or +other +others +otherwise +ought +our +ours +ourselves +out +outside +over +overall +own +p +particular +particularly +people +per +perhaps +placed +please +plus +possible +probably +provides +q +que +quite +r +rather +really +relatively +respectively +right +s +said +same +second +secondly +see +seem +seemed +seeming +seems +self +selves +sensible +sent +serious +seven +several +shall +she +should +since +six +so +some +somebody +somehow +someone +something +sometime +sometimes +somewhat +somewhere +specified +specify +specifying +state +still +sub +such +sup +t +take +taken +than +that +the +their +theirs +them +themselves +then +thence +there +thereafter +thereby +therefore +therein +thereupon +these +they +third +this +thorough +thoroughly +those +though +three +through +throughout +thru +thus +time +to +together +too +toward +towards +twice +two +u +under +unless +until +unto +up +upon +us +use +used +useful +uses +using +usually +v +value +various +very +via +viz +vs +w +was +way +we +well +went +were +what +whatever +when +whence +whenever +where +whereafter +whereas +whereby +wherein +whereupon +wherever +whether +which +while +whither +who +whoever +whole +whom +whose +why +will +with +within +without +work +world +would +x +y +year +years +yet +you +your +yours +yourself +yourselves +z +zero \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Data/synth1.mat b/exercises/02450Toolbox_Matlab/Data/synth1.mat new file mode 100644 index 0000000000000000000000000000000000000000..4eb623f831660cf7dbb0a655fc03ebb023b11442 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/synth1.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/synth2.mat b/exercises/02450Toolbox_Matlab/Data/synth2.mat new file mode 100644 index 0000000000000000000000000000000000000000..99838d2eb7e3a60799dbb54dfc5a98db5b6fc8aa Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/synth2.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/synth3.mat b/exercises/02450Toolbox_Matlab/Data/synth3.mat new file mode 100644 index 0000000000000000000000000000000000000000..adefbcfc4075497a710c1e90fa65e4933fc02f9e Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/synth3.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/synth4.mat b/exercises/02450Toolbox_Matlab/Data/synth4.mat new file mode 100644 index 0000000000000000000000000000000000000000..8a445f9c8fe5bb16f82b4312d2cb5e8051022c29 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/synth4.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/synth5.mat b/exercises/02450Toolbox_Matlab/Data/synth5.mat new file mode 100644 index 0000000000000000000000000000000000000000..e36f9391ba3707db3773a38ee5057fbaf3807424 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/synth5.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/synth6.mat b/exercises/02450Toolbox_Matlab/Data/synth6.mat new file mode 100644 index 0000000000000000000000000000000000000000..3857ca1a9eff1a851e14746d63ea0b6522d961c6 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/synth6.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/synth7.mat b/exercises/02450Toolbox_Matlab/Data/synth7.mat new file mode 100644 index 0000000000000000000000000000000000000000..1b421f60e9099fa77dcb3b9431f91a0587af016e Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/synth7.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/textDocs.txt b/exercises/02450Toolbox_Matlab/Data/textDocs.txt new file mode 100644 index 0000000000000000000000000000000000000000..21cc2920b6b7259dda2ddc402858d510060e2398 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Data/textDocs.txt @@ -0,0 +1,10 @@ +The Google matrix P is a model of the internet. + +P_ij is nonzero if there is a link from webpage i to j. + +The Google matrix is used to rank all Web pages. + +The ranking is done by solving a matrix eigenvalue problem. + +England dropped out of the top 10 in the FIFA ranking. + diff --git a/exercises/02450Toolbox_Matlab/Data/wildfaces.mat b/exercises/02450Toolbox_Matlab/Data/wildfaces.mat new file mode 100644 index 0000000000000000000000000000000000000000..1f5894a43da3a0b7c7549d8937968a6488f8ca92 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/wildfaces.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/wildfaces_grayscale.mat b/exercises/02450Toolbox_Matlab/Data/wildfaces_grayscale.mat new file mode 100644 index 0000000000000000000000000000000000000000..bcab41e4da0ed2d6b988ed73eff4eb15b6408c2f Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/wildfaces_grayscale.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/wine.mat b/exercises/02450Toolbox_Matlab/Data/wine.mat new file mode 100644 index 0000000000000000000000000000000000000000..c684ae249f7c9d5154c5b7112f12f927490c5878 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/wine.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/wine2.mat b/exercises/02450Toolbox_Matlab/Data/wine2.mat new file mode 100644 index 0000000000000000000000000000000000000000..c6851a61390f2cdc3c694654aededa5761d78cd2 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/wine2.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/xor.mat b/exercises/02450Toolbox_Matlab/Data/xor.mat new file mode 100644 index 0000000000000000000000000000000000000000..ffef7df14ee096007810041e7efa42ea0f7f98da Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/xor.mat differ diff --git a/exercises/02450Toolbox_Matlab/Data/zipdata.mat b/exercises/02450Toolbox_Matlab/Data/zipdata.mat new file mode 100644 index 0000000000000000000000000000000000000000..a98e79614d23893b45b1bb554f82db03b59a98ad Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Data/zipdata.mat differ diff --git a/exercises/02450Toolbox_Matlab/LICENSE b/exercises/02450Toolbox_Matlab/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..541b6ff48a6ee683c5d5cf3f93a478430c63405e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/LICENSE @@ -0,0 +1,16 @@ +LICENCE + +This repository contains code for the course 02450 Introduction to Machine Learning and Data Mining at the Technical University of Denmark (DTU). + +Some of the code, data and functions used in this repository comes from other sources and the licensing terms are as indicated in the relevant files or referenced packages. + +All material including software are intended for research and educational purpose. Any sale or commercial distribution is strictly forbidden, +unless the Department of Applied Mathematics and Computer Science, the Technical University of Denmark (DTU Compute) has given explicit written permission. + +The material including software is provided "as-is". Support is generally not available. No warranties of any kind, express or implied, +are made as to it or any medium it may be on. No remedy will be provided for indirect, consequential, punitive or incidental damages arising from it, +including such from negligence, strict liability, or breach of warranty or contract, even after notice of the possibility of such damages. + +Inquiries about licensing can be made to the Cognitive System Section, DTU Compute, http://cogsys.compute.dtu.dk + +The material is not for redistribution. diff --git a/exercises/02450Toolbox_Matlab/README.md b/exercises/02450Toolbox_Matlab/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f5c99365a3533bee4c5b5e70b2013088f9f7fa93 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/README.md @@ -0,0 +1,51 @@ +# 02450 Toolbox + +Description of the datasets in the Data folder: + +body.mat +This is a subset of the dataset on body dimenstions available at http://www.sci.usq.edu.au/courses/STA3301/resources/Data/ +and described in +G. Heinz, L. J. Peterson, R. W. Johnson, and C. J. Kerk, “Exploring relationships in body dimensions,” Journal of Statistics Education, vol. 11, no. 2, 2003. + +faithful.mat and faithful.txt +Dataset on eruption of the Old Faithful geyser described in +A. Azzalini and A. Bowman, “A look at some data on the old faithful geyser,” Applied Statistics, pp. 357–365, 1990. +W. Härdle, Smoothing techniques: with implementation in S. Springer, 1991 + +female.txt and male.txt +Data is taken from http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/areas/nlp/corpora/names/, +Please consult the accompanying readme_male_female.txt file in the Data folder. + +iris.xls +Fisher's Iris data, for a description see also http://en.wikipedia.org/wiki/Iris_flower_data_set. The data has been downloaded from http://archive.ics.uci.edu/ml/datasets/Iris. + +nanonose.xls +This data has been taken from the nanonose project, see also http://www.nanonose.dk, it is described in +T. S. Alstrøm, J. Larsen, C. H. Nielsen, and N. B. Larsen, “Data-driven modeling of nano-nose gas sensor arrays,” in SPIE Defense, Security, and Sensing. International Society for Optics and Photonics, 2010, pp. 76 970U–76 970U. + +StopWords +A txt file of list of common words provided in the TMG toolbox. + +textDocs.txt +This example of documents for a term-document matrix is taken from +L. Eldén, Matrix Methods in Data Mining and Pattern Recognition. Philadelphia, PA, USA: Society for Industrial and Applied Mathematics, 2007. + +Wine.mat and Wine2.mat +P. Cortez, A. Cerdeira, F. Almeida, T. Matos, and J. Reis. Modeling wine preferences by data mining from physicochemical properties. In Decision Support Systems, Elsevier, 47(4):547–553, 2009. +downloaded from http://archive.ics.uci.edu/ml/datasets/Wine+Quality +Wine2 is same as Wine but with some outliers removed. + +zipdata.mat and digits.mat +USPS handwritten digits availabe at http://www.cad.zju.edu.cn/home/dengcai/Data/MLData.html, see also +J. J. Hull, “A database for handwritten text recognition research,” Pattern Analysis and Machine Intelligence, IEEE Transactions on, vol. 16, no. 5, pp. 550–554, +1994. + +wildfaces.mat and wildfaces_grayscale.mat +Taken from http://tamaraberg.com/faceDataset/ and described in Tamara L. Berg, Alexander C. Berg, Jaety Edwards, David A. Forsyth +Neural Information Processing Systems (NIPS), 2004. +The wildfaces.mat is an extract with 1000 examples of the original dataset and wildfaces_grayscale a gray scale converted version of these 1000 examples taken from the original data. + +messy_data.data +This dataset is an excerpt of the Auto MPG Data Set which has been heavily formatted to introduce comming data preprocessing isusues. +Revised from CMU StatLib library, data concerns city-cycle fuel consumption https://archive.ics.uci.edu/ml/datasets/auto+mpg +This dataset was taken from the StatLib library which is maintained at Carnegie Mellon University. The dataset was used in the 1983 American Statistical Association Exposition. diff --git a/exercises/02450Toolbox_Matlab/Scripts/default.txt b/exercises/02450Toolbox_Matlab/Scripts/default.txt new file mode 100644 index 0000000000000000000000000000000000000000..065eaa168a1aeeee91a3c6d1427c257895e4cf79 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/default.txt @@ -0,0 +1,101 @@ +Rule (Support, Confidence) +11 -> 13 (39.3242%, 74.9395%) +13 -> 11 (39.3242%, 78.1033%) +15 -> 22 (38.1187%, 75.2348%) +22 -> 15 (38.1187%, 76.4556%) +16 -> 21 (37.5952%, 76.2058%) +21 -> 16 (37.5952%, 74.9763%) +9 -> 15 (37.2621%, 72.366%) +15 -> 9 (37.2621%, 73.5441%) +12 -> 14 (36.5006%, 76.8024%) +14 -> 12 (36.5006%, 73.5144%) +7 -> 13 (35.2951%, 70.0346%) +13 -> 7 (35.2951%, 70.1008%) +10 -> 16 (35.1047%, 72.3676%) +16 -> 10 (35.1047%, 71.1576%) +7 -> 11 (34.7874%, 69.0274%) +11 -> 7 (34.7874%, 66.2938%) +8 -> 14 (34.5495%, 69.6514%) +14 -> 8 (34.5495%, 69.5847%) +1 -> 15 (34.1529%, 63.0454%) +15 -> 1 (34.1529%, 67.4076%) +1 -> 9 (33.915%, 62.6061%) +9 -> 1 (33.915%, 65.8657%) +9 -> 22 (33.677%, 65.4036%) +22 -> 9 (33.677%, 67.5469%) +3 -> 9 (33.566%, 66.0012%) +9 -> 3 (33.566%, 65.1879%) +4 -> 11 (32.9156%, 66.9787%) +11 -> 4 (32.9156%, 62.7267%) +5 -> 1 (32.5032%, 61.8286%) +10 -> 21 (32.3287%, 66.6449%) +21 -> 10 (32.3287%, 64.4733%) +8 -> 12 (31.9162%, 64.3428%) +12 -> 8 (31.9162%, 67.1562%) +9 -> 19 (31.71%, 61.5835%) +19 -> 9 (31.71%, 63.1197%) +7 -> 15 (31.5038%, 62.5118%) +15 -> 7 (31.5038%, 62.1791%) +3 -> 12 (31.2976%, 61.5409%) +12 -> 3 (31.2976%, 65.8545%) +17 -> 19 (31.2341%, 60.7716%) +19 -> 17 (31.2341%, 62.1724%) +4 -> 10 (31.2183%, 63.5249%) +10 -> 4 (31.2183%, 64.3558%) +3 -> 19 (31.0596%, 61.073%) +19 -> 3 (31.0596%, 61.8251%) +8 -> 17 (31.0596%, 62.6159%) +17 -> 8 (31.0596%, 60.4321%) +7 -> 20 (30.8852%, 61.2842%) +20 -> 7 (30.8852%, 62.0657%) +3 -> 1 (30.8693%, 60.6987%) +3 -> 15 (30.8376%, 60.6363%) +15 -> 3 (30.8376%, 60.8641%) +20 -> 11 (30.7582%, 61.8106%) +8 -> 19 (30.7265%, 61.9444%) +19 -> 8 (30.7265%, 61.162%) +8 -> 1 (30.5838%, 61.6565%) +19 -> 1 (30.5679%, 60.8462%) +13 -> 22 (30.4727%, 60.523%) +22 -> 13 (30.4727%, 61.1199%) +14 -> 3 (30.4569%, 61.3419%) +8 -> 16 (30.441%, 61.3687%) +16 -> 8 (30.441%, 61.7042%) +14 -> 1 (30.3775%, 61.1821%) +14 -> 21 (30.2665%, 60.9585%) +21 -> 14 (30.2665%, 60.3606%) +10 -> 11 (30.2189%, 62.2956%) +19 -> 15 (30.1713%, 60.0568%) +14 -> 17 (30.1396%, 60.7029%) +18 -> 7 (30.0603%, 61.8473%) +4 -> 5 (30.0127%, 61.0717%) +20 -> 13 (30.0127%, 60.3124%) +10 -> 20 (29.981%, 61.8051%) +20 -> 10 (29.981%, 60.2486%) +18 -> 1 (29.9651%, 61.6514%) +4 -> 20 (29.9651%, 60.9748%) +20 -> 4 (29.9651%, 60.2168%) +4 -> 13 (29.9492%, 60.9425%) +14 -> 19 (29.9016%, 60.2236%) +12 -> 1 (29.8541%, 62.8171%) +18 -> 20 (29.6003%, 60.9008%) +2 -> 16 (29.3147%, 63.9668%) +18 -> 5 (29.2513%, 60.1828%) +12 -> 9 (29.2354%, 61.5154%) +12 -> 19 (28.5216%, 60.0134%) +2 -> 10 (28.2519%, 61.6476%) +2 -> 11 (28.1567%, 61.4399%) +1,3 -> 9 (21.9543%, 71.1202%) +1,9 -> 3 (21.9543%, 64.7334%) +3,9 -> 1 (21.9543%, 65.4064%) +1,3 -> 12 (20.3363%, 65.8787%) +1,12 -> 3 (20.3363%, 68.119%) +3,12 -> 1 (20.3363%, 64.9772%) +1,5 -> 15 (20.2887%, 62.4207%) +5,15 -> 1 (20.2887%, 76.2217%) +1,7 -> 15 (20.2411%, 85.8104%) +7,15 -> 1 (20.2411%, 64.2497%) +1,3 -> 15 (20.0666%, 65.0051%) +3,15 -> 1 (20.0666%, 65.072%) +1,8 -> 12 (20.0666%, 65.612%) +1,12 -> 8 (20.0666%, 67.2157%) diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex0_4_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex0_4_3.m new file mode 100644 index 0000000000000000000000000000000000000000..ac0931c159ad7434eaeaeff1599367da161ab492 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex0_4_3.m @@ -0,0 +1,19 @@ +%% exercise 0.4.3 +% Remember you can mark a part of the code and press F9 +% to run that part alone. + +% The colon notation is very important in MATLAB as it avoids +% loops, which run very slowly in MATLAB. Type help colon in +% the MATLAB command prompt for help on the colon notation. +% Generating vectors in MATLAB is easy when using the colon +% notation. + +% define variable a with numbers in the range from 0 to 6 (inclusive) +a = 0:6 + +% define variable b with numbers in the range from 2 to 17 in steps of 4 +b = 2:4:17 + +c = 100:-1:95 +d = 1.2:0.1:1.9 +e = pi*[0:0.5:2] \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex0_4_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex0_4_4.m new file mode 100644 index 0000000000000000000000000000000000000000..920755e88dc1fd7df8e34a7c4f0f58bbc2b25f7e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex0_4_4.m @@ -0,0 +1,27 @@ +%% exercise 0.4.4 + +% Extracting the elements from vectors is easy. Consider the +% following definition of x and the echoed results +x = [zeros(1,2),linspace(0,3,6),ones(1,3)] +x(2:5) % take out elements 2 through 5 (inclusive) +size(x) % return the size of x (not equivalent to length(x)) +length(x) % return the length of x + +% Try typing 'help length' and 'help size' + +x(end) % take the last element of x +x(2:2:end) % return every other element of x starting from the 2nd + +% Inserting numbers into vectors is also easy. Using the same +% definition of x and observe the results when typing +y = x; +y(2:2:end) = pi + +% Notice that we're inserting the same scalar value "pi" into all elements +% that we index y with + +% You can also try: +%y(2:2:end) = 2:2:10 + +%Observe the results when indexing the vector y with +%y(1) and y(0). Is y(0) defined? \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex0_4_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex0_4_5.m new file mode 100644 index 0000000000000000000000000000000000000000..fd3105dc436fe2a8b4cc02b11a6927fb02177910 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex0_4_5.m @@ -0,0 +1,79 @@ +%% exercise 0.4.5 +% Setup two matrices +x = 1:5 +y = 2:2:10 +% Have a look at them by typing 'x' and 'y' in the console. + +% There's a difference between matrix multiplication and elementwise +% multiplication: +y' % transposition/transpose of y +transpose(y) % also transpose + +x.*y % element-wise multiplication +times(x,y) % also element-wise multiplication + +x*y' % matrix multiplication +mtimes(x,y') % also matrix multiplication + +% In general, the . operator (as in .*) means element-wise operations + +% There are various ways to make certain type of matrices. +a1 = [1, 2, 3; 4, 5, 6] % define explicitly +a2 = reshape(1:6, [2,3]) % reshape range of numbers +a3 = zeros(3,3) % zeros array +a4 = eye(3) % diagonal array +a5 = rand(2,3) % random array (uniformly random from [0,1]) +a6 = a1 % copy (changing a1 wont change a6) + + +% It is easy to extract and/or modify selected items from matrices. +% Here is how you can index matrix elements: +m = [1, 2, 3; 4, 5, 6; 7, 8, 9] +m(1,1) % first element +m(end,end) % last element +m(1,:) % first row +m(:,2) % second column +m(2:3, end) % specific rows in specific + + +% Similarly, you can selectively assign values to matrix elements or columns: +m(end, end) = 10000 +m(1:2,end) = [100,1000] +m(:,1) = 0 + +% Logical indexing can be used to change or take only elements that +% fulfil a certain constraint, e.g. +a5(a5>0.5) % display values in m2 that are larger than 0.5 +a5(a5<0.5) = 0 % set all elements that are less than 0.5 to 0 + +% Below, several examples of common matrix operations, +% most of which we will use in the following weeks. +% First, define two matrices: +m1 = 10 * ones(3,3) +m2 = rand(3,3) + +m1+m2 % matrix summation +m1*m2 % matrix product +m1.*m2 % element-wise multiplication +m1>m2 % element-wise comparison +m3 = [m1,m2] % combine/concatenate matrices horizontally (also horzcat) +m4 = [m1;m2] % combine/concatenate matrices vertically (also vertcat) +size(m3) % shape of matrix +mean(m3(:)) % mean value of all elements +mean(m3, 1) % mean values of the columns +mean(m3, 2) % mean values of the rows +m3' % transpose +inv(m2) % inverse matrix + + +% MATLAB also has linear indexing, such that e.g. these are the same: +m(1,2) +m(4) +% here the index 4 means that the element (1,2) in the matrix is the same +% as the fourth element when counting by starting in the first column +% going through all the rows, and then starting at the next column +% For more info, try to understand what i and k are in: +% [i,k] = ind2sub(size(m), 4) + + + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex0_5_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex0_5_1.m new file mode 100644 index 0000000000000000000000000000000000000000..cb46891b2dce61a5271b368005696492e5eca1af --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex0_5_1.m @@ -0,0 +1,9 @@ +%% exercise 0.5.1 +x = 0:0.1:1; +f = exp(x); + +figure(1) + plot(x,f); + xlabel('x') + ylabel('f(x)=exp(x)') + title('The exponential function') \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex0_5_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex0_5_2.m new file mode 100644 index 0000000000000000000000000000000000000000..817b44f82704c2e9a45b29f67a01460f3f4572e2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex0_5_2.m @@ -0,0 +1,52 @@ +%% exercise 0.5.2 +% We simulate measurements every 100 ms for a period of 10 seconds +t = 0:0.1:10; + +%The data from the sensors are generated as either a sine or a cosine +%with some Gaussian noise added. +sensor1 = 3*sin(t)+0.5*randn(size(t)); +sensor2 = 3*cos(t)+0.5*randn(size(t)); + + % Change the font size to make axis and title readable +font_size = 15; + +% Define the name of the curves +legend_strings = {'Sensor 1', 'Sensor 2'}; + +% Start plotting the simulated measurements +figure(1); clf; + % Plot the sensor 1 output as a function of time, and + % make the curve red and fully drawn + plot(t,sensor1,'r-'); + + % Hold (dont remove) the first plot when plotting the second + hold on + + % Plot the sensor 2 output as a function of time, and + % make the curve blue and dashed + plot(t,sensor2,'b--'); + + % Notice that these two curves will still be distinguisable even + % if the plot is made black and white. + + % Ensure that the limits on the axis fit the data + axis tight + + % Add a grid in the background + grid + + % Add a legend describing each curve, place it at the "best" location + % so as to minimize the amount of curve it covers + legend(legend_strings,'Location','best'); + + % Add labels to the axes + xlabel('Time [s]') + ylabel('Voltage [mV]') + + % Add a title to the plot + title('Sensor outputs') + + % Set the font size + set(gca,'FontSize',font_size) +% Export the figure +saveas(gcf,'ex1_5_2.png') \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex10_1_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex10_1_1.m new file mode 100644 index 0000000000000000000000000000000000000000..4779108e506fae0825d4bd821cc8f16a17b74925 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex10_1_1.m @@ -0,0 +1,19 @@ +% exercise 10.1.1 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth1')); + +%% K-means clustering + +% Number of clusters +K = 4; + +% Run k-means +[i, Xc] = kmeans(X, K); + +%% Plot results + +% Plot data +mfig('K-means'); clf; +clusterplot(X, y, i, Xc); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex10_1_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex10_1_3.m new file mode 100644 index 0000000000000000000000000000000000000000..f2a843709898af102b653a14d92f5fa00e40f253 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex10_1_3.m @@ -0,0 +1,31 @@ +% exercise 10.1.3 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth1')); + +%% K-means clustering + +% Maximum number of clusters +K = 10; + +% Allocate variables +Rand = nan(K,1); +Jaccard = nan(K,1); +NMI = nan(K,1); + +for k = 1:K + % Run k-means + [i, Xc] = kmeans(X, k); + + % Compute cluster validities + [Rand(k), Jaccard(k), NMI(k)] = clusterval(y, i); +end +%% Plot results + +mfig('Cluster validity'); clf; hold all; +plot(1:K, Rand); +plot(1:K, Jaccard); +plot(1:K, NMI); + +legend({'Rand', 'Jaccard','NMI'}); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex10_1_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex10_1_5.m new file mode 100644 index 0000000000000000000000000000000000000000..6cd937c406c932569e89fc000dac612d5e875c3d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex10_1_5.m @@ -0,0 +1,51 @@ +% exercise 10.1.5 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wildfaces')) + +[N,M] = size(X); + +% Image resolution and number of colors +x = 40; +y = 40; +c = 3; + +%% K-means clustering + +% Maximum number of clusters +K = 10; + +% Run k-means (This will take a while to run on a large data set) +[i, Xc] = kmeans(X, K, 'Display', 'iter', 'OnlinePhase', 'off'); + + +%% Plot results + +% Number of images to plot +L = 5; + +% Get some random image indices +j = randi(N,L,1); + +% Plot centroids +mfig('Centroids'); clf; +n1 = ceil(sqrt(K/2)); n2 = ceil(K/n1); +for k = 1:K + subplot(n1,n2,k); + imagesc(reshape(Xc(k,:),x,y,c)); + axis image off; + colormap(1-gray); +end + +% Plot random images and corresponding centroids +mfig('Images'); clf; +for l = 1:L + subplot(2,L,l); + imagesc(reshape(X(j(l),:),x,y,c)); + axis image off; + subplot(2,L,l+L); + imagesc(reshape(Xc(i(j(l)),:),x,y,c)); + axis image off; + colormap(1-gray); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex10_2_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex10_2_1.m new file mode 100644 index 0000000000000000000000000000000000000000..f33668e610cc1105454eb492ba6194f8e7b37f10 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex10_2_1.m @@ -0,0 +1,26 @@ +% exercise 10.2.1 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth1')); + +%% Hierarchical clustering + +% Maximum number of clusters +Maxclust = 4; + +% Compute hierarchical clustering +Z = linkage(X, 'single', 'euclidean'); + +% Compute clustering by thresholding the dendrogram +i = cluster(Z, 'Maxclust', Maxclust); + +%% Plot results + +% Plot dendrogram +mfig('Dendrogram'); clf; +dendrogram(Z); + +% Plot data +mfig('Hierarchical'); clf; +clusterplot(X, y, i); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex11_1_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex11_1_1.m new file mode 100644 index 0000000000000000000000000000000000000000..9934d99e553d63c5f3fb2fc4195e897ac4a04e0d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex11_1_1.m @@ -0,0 +1,25 @@ +% exercise 11.1.1 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth1')); + +%% Gaussian mixture model + +% Number of clusters +K = 4; + +% Fit model +G = gmdistribution.fit(X, K,'Regularize',10e-9); + +% Compute clustering +i = cluster(G, X); + +%% Extract cluster centers +X_c = G.mu; +Sigma_c=G.Sigma; +%% Plot results + +% Plot clustering +mfig('GMM: Clustering'); clf; +clusterplot(X, y, i, X_c, Sigma_c); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex11_1_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex11_1_5.m new file mode 100644 index 0000000000000000000000000000000000000000..6f23b960d7fea11add2a1325d33e87d1246c11e7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex11_1_5.m @@ -0,0 +1,60 @@ +% exercise 11.1.5 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth1')); + +%% Gaussian mixture model + +% Range of K's to try +KRange = 1:10; +T = length(KRange); + +% Allocate variables +BIC = nan(T,1); +AIC = nan(T,1); +CVE = zeros(T,1); + +% Create crossvalidation partition for evaluation +CV = cvpartition(N, 'Kfold', 10); + +% For each model order +for t = 1:T + % Get the current K + K = KRange(t); + + % Display information + fprintf('Fitting model for K=%d\n', K); + + % Fit model + reg = 0.01; + G = fitgmdist(X,K,'RegularizationValue',0.01); % Add a little regularization to avoid errors. + + % Get BIC and AIC + BIC(t) = G.BIC; + AIC(t) = G.AIC; + + % For each crossvalidation fold + for k = 1:CV.NumTestSets + % Extract the training and test set + X_train = X(CV.training(k), :); + X_test = X(CV.test(k), :); + + % Fit model to training set + G = fitgmdist(X_train,K,'RegularizationValue',0.01); + + % Evaluation crossvalidation error + [~, NLOGL] = posterior(G, X_test); + CVE(t) = CVE(t)+NLOGL; + end +end + + +%% Plot results + +mfig('GMM: Number of clusters'); clf; hold all +plot(KRange, BIC); +plot(KRange, AIC); +plot(KRange, 2*CVE); +legend('BIC', 'AIC', 'Crossvalidation'); +xlabel('K'); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex11_2_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex11_2_1.m new file mode 100644 index 0000000000000000000000000000000000000000..42c4696e7fed111b83e062045f923c4cc3ffe26c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex11_2_1.m @@ -0,0 +1,28 @@ +% exercise 11.2.1 + +% Number of data objects +N = 1000; + +% x-values to evaluate the histogram +x = linspace(-10, 10, 50)'; + +% Number of attributes +M = 1; + +% Allocate variable for data +X = nan(N,M); + +% Mean and covariances +m = [1 3 6]; +s = [1 .5 2]; + +% For each data object +for n = 1:N + k = discreternd([1/3 1/3 1/3]); + X(n,1) = normrnd(m(k), sqrt(s(k))); +end + +% Plot histogram +mfig('Histogram'); clf; +hist(X, x); + \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex11_2_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex11_2_2.m new file mode 100644 index 0000000000000000000000000000000000000000..1e2850741990ccd24537a2ee2bf57bde90009993 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex11_2_2.m @@ -0,0 +1,12 @@ +% exercise 11.2.2 + +% x-values to evaluate the KDE +x = linspace(-10, 10, 100)'; + +% Compute kernel density estimate +f = ksdensity(X, x, 'width', 1); + +% Plot kernel density estimate +mfig('Kernel density estimate'); clf; +plot(x, f); + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex11_2_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex11_2_3.m new file mode 100644 index 0000000000000000000000000000000000000000..5944f3b8dde3145e8ca9c7662694bf7bba410e46 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex11_2_3.m @@ -0,0 +1,26 @@ +% exercise 11.2.3 + +% Number of neighbors +K = 200; + +% x-values to evaluate the GMM +x = linspace(-10, 10, 100)'; + +% Find the k nearest neighbors +[i,D] = knnsearch(X, x, 'K', K); + +% Compute the density +density = 1./(sum(D,2)/K); + +% Compute the average relative density +[iX,DX] = knnsearch(X, X, 'K', K+1); +densityX= 1./(sum(DX(:,2:end),2)/K); +avg_rel_density=density./(sum(densityX(i(:,2:end)),2)/K); + +% Plot KNN estimate of density +mfig('KNN density'); clf; +plot(x, density); + +% Plot KNN estimate of density +mfig('KNN average relative density'); clf; +plot(x, avg_rel_density); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex11_3_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex11_3_1.m new file mode 100644 index 0000000000000000000000000000000000000000..50e490866663f37b4aaee57cee9be52f17bda111 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex11_3_1.m @@ -0,0 +1,21 @@ +% exercise 11.3.1 + +% Kernel width +w = 5; + +% Outlier scores +% Compute kernel density estimate +f = ksdensity(X, X, 'width', w); + +% Sort the densities +[y,i] = sort(f); + +% Display the index of the lowest density data object +% The outlier should have index 1001 +disp(i(1)); + +% Plot density estimate outlier scores +mfig('Outlier score'); clf; +bar(y(1:20)); + + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex11_3_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex11_3_2.m new file mode 100644 index 0000000000000000000000000000000000000000..3d33a8d4772744b7c4fb50dd75d7624a375f43bb --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex11_3_2.m @@ -0,0 +1,29 @@ +% exercise 11.3.2 + +% Kernel width +w = 5; + +% Estimate optimal kernel density width by leave-one-out cross-validation +widths=2.^[-10:10]; +for w=1:length(widths) + [f, log_f] = gausKernelDensity(X, widths(w)); + logP(w)=sum(log_f); +end +[val,ind]=max(logP); +width=widths(ind); +disp(['Optimal estimated width is ' num2str(width)]) + +% Estimate density for each observation not including the observation +% itself in the density estimate +f = gausKernelDensity(X, width); + +% Sort the densities +[y,i] = sort(f); + +% Display the index of the lowest density data object +% The outlier should have index 1001 +disp(i(1)); + +% Plot density estimate outlier scores +mfig('Outlier score'); clf; +bar(y(1:20)); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex11_3_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex11_3_4.m new file mode 100644 index 0000000000000000000000000000000000000000..8a7760b037d788cf6d7e3be2118326420ed12349 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex11_3_4.m @@ -0,0 +1,24 @@ +% exercise 11.3.4 + +% Neighbor to use +K = 5; + +% Find the k nearest neighbors +[i, D] = knnsearch(X, X, 'K', K+1); + +% Outlier score +f = D(:,K+1); + +% Sort the outlier scores +[y,i] = sort(f, 'descend'); + +% Display the index of the lowest density data object +% The outlier should have index 1001 +disp(i(1)); + +% Plot kernel density estimate outlier scores +mfig('Distance: Outlier score'); clf; +bar(y(1:20)); + + + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex11_4_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex11_4_1.m new file mode 100644 index 0000000000000000000000000000000000000000..9434a03746e1230c7f17ecffb8fb99453cd74424 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex11_4_1.m @@ -0,0 +1,133 @@ +% exercise 11.4.1 +clear all; + +% Load hand written digits data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/digits')); + +% Restrict the data to images of "2" +X = X(y==2,:); +[N,M] = size(X); + +%% Gausian Kernel density estimator +% cross-validate kernel width by leave-one-out-cross-validation +% automatically implemented in the script gausKernelDensity +widths=max(var(X))*(2.^[-10:2]); % evaluate for a range of kernel widths +for w=1:length(widths) + [density,log_density]=gausKernelDensity(X,widths(w)); + logP(w)=sum(log_density); +end +[val,ind]=max(logP); +width=widths(ind); +display(['Optimal kernel width is ' num2str(width)]) +% evaluate density for estimated width +density=gausKernelDensity(X,width); + +% Sort the densities +[y,i] = sort(density); + +% Plot outlier scores +mfig('Gaussian Kernel Density: outlier score'); clf; +bar(y(1:20)); + +% Plot possible outliers +mfig('Gaussian Kernel Density: Possible outliers'); clf; +for k = 1:20 + subplot(4,5,k); + imagesc(reshape(X(i(k),:), 16, 16)); + title(k); + colormap(1-gray); + axis image off; +end + + +%% K-nearest neighbor density estimator + +% Number of neighbors +K = 5; + +% Find the k nearest neighbors +[idx, D] = knnsearch(X, X, 'K', K+1); + +% Compute the density +density = 1./(sum(D(:,2:end),2)/K); + +% Sort the densities +[y,i] = sort(density); + +% Plot outlier scores +mfig('KNN density: outlier score'); clf; +bar(y(1:20)); + +% Plot possible outliers +mfig('KNN density: Possible outliers'); clf; +for k = 1:20 + subplot(4,5,k); + imagesc(reshape(X(i(k),:), 16, 16)); + title(k); + colormap(1-gray); + axis image off; +end + +%% K-nearest neigbor average relative density +% Compute the average relative density +avg_rel_density=density./(sum(density(idx(:,2:end)),2)/K); + +% Sort the densities +[y,i] = sort(avg_rel_density); + +% Plot outlier scores +mfig('KNN average relative density: outlier score'); clf; +bar(y(1:20)); + +% Plot possible outliers +mfig('KNN average relative density: Possible outliers'); clf; +for k = 1:20 + subplot(4,5,k); + imagesc(reshape(X(i(k),:), 16, 16)); + title(k); + colormap(1-gray); + axis image off; +end + + +%% Distance to 5'th nearest neighbor outlier score + +% Neighbor to use +K = 5; + +% Find the k nearest neighbors +[i, D] = knnsearch(X, X, 'K', K+1); + +% Outlier score +f = D(:,K+1); + +% Sort the outlier scores +[y,i] = sort(f, 'descend'); + +% Plot kernel density estimate outlier scores +mfig('Distance: Outlier score'); clf; +bar(y(1:20)); + +% Plot possible outliers +mfig('Distance: Possible outliers'); clf; +for k = 1:20 + subplot(4,5,k); + imagesc(reshape(X(i(k),:), 16, 16)); + title(k); + colormap(1-gray); + axis image off; +end + + +%% Plot of random "normal" digits for comparison + +% Plot random digits (the first 20 in the data set) +mfig('Digits'); clf; +for k = 1:20 + subplot(4,5,k); + imagesc(reshape(X(k,:), 16, 16)); + title(k); + colormap(1-gray); + axis image off; +end diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex12_1_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex12_1_3.m new file mode 100644 index 0000000000000000000000000000000000000000..f75902e84afd795d3ac36b23c3ff0bc13f2d21ea --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex12_1_3.m @@ -0,0 +1,11 @@ +cdir = fileparts(mfilename('fullpath')); +d = csvread(fullfile(cdir,'../Data/courses.txt')); +M = max(d(:)); +N = size(d,1); +X = zeros(N,M); +disp(d) +% Binary encode the dataset +for i=1:N + X(i,d(i, d(i,:) >0) ) = 1; +end +disp(X); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex12_1_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex12_1_4.m new file mode 100644 index 0000000000000000000000000000000000000000..ec82208651229955b723636dd88e5be6bd294736 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex12_1_4.m @@ -0,0 +1,16 @@ +ex12_1_3; % load data +minSup = .8; % minimum support +minConf = 1; % minmum confidence +nRules = 100; % Max rules +sortFlag = 1; % sorting of found rules (see doc) +[Rules, ~] = findRules(X, minSup, minConf, nRules, sortFlag); +% Inspect rules and note output is of the form Rules{1}(i) -> Rules{2}{i} +% We can also pretty-print the found rules using this function (see +% definition below) +disp('Rules found:'); +print_apriori_rules(Rules) + +labels = {'02322', '02450', '02451', '02453', '02454', '02457', '02459', '02582'}; +disp('The same rules but with labels:') +print_apriori_rules(Rules,labels) + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex12_1_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex12_1_5.m new file mode 100644 index 0000000000000000000000000000000000000000..16e63034e911ca24a4d3efc42a29c1aea4baf23d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex12_1_5.m @@ -0,0 +1,6 @@ +%% ex12_1_5 +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wine2')); +% Try changing the 2 to a 3 and notice what happens to the output (see +% attributeNamesBin) +[Xbin,attributeNamesBin] = binarize(X, 2*ones(1,M), attributeNames); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex12_1_6.m b/exercises/02450Toolbox_Matlab/Scripts/ex12_1_6.m new file mode 100644 index 0000000000000000000000000000000000000000..853cdbf2b5b1f3b9b51291ce74880dd6c2297f73 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex12_1_6.m @@ -0,0 +1,9 @@ +%% ex12_1_6 +ex12_1_5; % load data +minSup = .2; % minimum support +minConf = .6; % minmum confidence +nRules = 100; % Max rules +sortFlag = 1; % sorting of found rules (see doc) +[rules, ~] = findRules(Xbin, minSup, minConf, nRules, sortFlag); +disp('Rules found:') +print_apriori_rules(rules,attributeNamesBin) \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex1_5_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_1.m new file mode 100644 index 0000000000000000000000000000000000000000..23765e86153e661f81cd32ef0b6e8238d3d7d6eb --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_1.m @@ -0,0 +1,56 @@ +%% exercise 1.5.1 +% We start by determing the path to the data that we want to load. +% We can do this relative to the current script, by determining the +% path to the current script first: +cdir = fileparts(mfilename('fullpath')); +% Next, we know that the data is stored in the Data folder within the +% 02450Toolbox_Matlab. Since this script is within a folder called Scripts +% within the toolbox, we first go up one level (using '..'), and then enter +% the Data-folder: +file_path = fullfile(cdir,'../Data/iris.csv'); + +% >>Notice!<< +% If you try to tun this command using e.g. F9 or CTRL/CMD+Enter, +% the cdir will not be the folder where the scripts are stored, and the +% file_path will be incorrect. For this to work, run the script using 'Run' +% (or using F5). + +% Load the data into matlab using readtable. Type 'help readtable' to see +% more on how the function works. +iris_table = readtable(file_path); +% iris_table is in table format, which could be used for working with the +% data, but we will use a slightly different format in this course. +% Therefore, we need to extract the various informations we need to store +% in the variables X, y, M, N, C, attributeNames, and classNames (see the +% standard representation as described in the exercise document). +% We get a warning because the header contains spaces - which isn't really +% an issue. + +% Extract the rows and columns corresponding to the flower dimensions: +X = table2array(iris_table(:, 1:4)); + +% Extract attribute names from the loaded table +attributeNames = iris_table.Properties.VariableNames(1:4)'; + +% Extract unique class names from the first row +classLabels = table2cell(iris_table(:,5)); +classNames = unique(classLabels); + +% Extract class labels that match the class names +[~,y] = ismember(classLabels, classNames); +% Using '~' ignores an output. Try writing 'help ismember'. Here, we use +% the output that the doc calls LOCB to determine to which class name each +% class label in classLabels corresponds. Since classLabels(75) is an +% 'Iris-versicolor', we could call: +%[~, b] = ismember(classLabels(75), classNames) +% to see that classLabels(1) corresponds to b=2, and therefore the second +% class name in classNames. +% Since we want to assign numerical values to the classes starting from a +% zero and not a one, we subtract one to the get final y: +y = y-1; + +% Lastly, we determine the number of attributes M, the number of +% observations N and the number of classes C: +[M, N] = size(X); +C = length(classNames); + \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex1_5_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_2.m new file mode 100644 index 0000000000000000000000000000000000000000..63684014293b746e1e27f1765d1b5e1e64a0d863 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_2.m @@ -0,0 +1,36 @@ +%% exercise 1.5.2 +cdir = fileparts(mfilename('fullpath')); + +% Load the data into Matlab +% Type 'help xlsread' to learn how to use the function for reading Excel files into Matlab. +[NUMERIC, TXT, RAW] = xlsread(fullfile(cdir,'../Data/iris.xls')); + +% By default 'xlsread' only reads numeric cells. +% Using the syntax [NUMERIC,TXT,RAW]=xlsread(FILE) you can get both +% the numeric data, text data, and raw data as a cell array. + +% Extract the rows and columns corresponding to the data +X = NUMERIC(1:end,1:4); +% You can use indexing to get submatrices of the returned matrices, +% here we ignore the header row of the file (which is NaNs in NUMERIC), +% which we do by starting from row number 2, and we extract the attributes +% that we not are stored in columns 1 to 4. + +% Extract attribute names from the first row +attributeNames = RAW(1,1:4)'; +% We transpose to have it fit the standard representation +% that you saw in the exercise description (size M x 1) + +% Extract unique class names from the last column +classLabels = RAW(2:end,end); +classNames = unique(classLabels); + +% Extract class labels that match the class names +[~,y] = ismember(classLabels, classNames); y = y-1; + +[N, M] = size(X); +C = length(classNames); + +% Clean up the workspace +clearvars cdir NUMERIC RAW TXT + \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex1_5_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_3.m new file mode 100644 index 0000000000000000000000000000000000000000..5e1a209acbe88bd042fb34c7d7bceca4810f1b58 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_3.m @@ -0,0 +1,9 @@ +%% exercise 1.5.3 +% Load the data into Matlab +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/iris.mat')); + +% Since the .mat file already contained the correct formats of the +% variables, we don't need to do further work. This is of course likely not +% the case for your own dataset. The iris.mat file was made by running the +% script ex1_5_2.m and then saving the workspace using save('iris.mat'). diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex1_5_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_4.m new file mode 100644 index 0000000000000000000000000000000000000000..f1e586cc44de6eaa6b2672b16af9d0940bfd1e7c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_4.m @@ -0,0 +1,91 @@ +%% exercise 1.5.4 +% Start by running the exercise 1.5.3 to load the Iris data in +% "classification format": +run([pwd(), '/ex1_5_3.m']) +% remember to set your working direction to the Scripts folder + +%% Classification problem +% The current variables X and y represent a classification problem, in +% which a machine learning model will use the sepal and petal dimesions +% (stored in the matrix X) to predict the class (species of Iris, stored in +% the variable y). A relevant figure for this classification problem could +% for instance be one that shows how the classes are distributed based on +% two attributes in matrix X: +X_c = X; +y_c = y; +attributeNames_classification = attributeNames; +i = 1; j = 2; +mfig('Iris classification problem') +% If you get an error: "Undefined function or variable 'mfig', you have to +% remember to run the setup.m file in the root of the toolbox! +gscatter(X_c(:,i), X_c(:,j), ... + classNames(y_c+1)); +axis equal; +xlabel(attributeNames_classification{i}); +ylabel(attributeNames_classification{j}); +% Consider, for instance, if it would be possible to make a single line in +% the plot to delineate any two groups? Say, can you draw a line between +% the Setosas and the Versicolors? The Versicolors and the Virginicas? + +%% Regression problem +% Since the variable we wish to predict is petal length, +% petal length cannot any longer be in the data matrix X. +% The first thing we do is store all the information we have in the +% other format in one data matrix: +data = [X_c, y_c]; + +% We know that the petal length corresponds to the third column in the data +% matrix (see attributeNames), and therefore our new y variable is: +y_r = data(:, 3); + +% Similarly, our new X matrix is all the other information but without the +% petal length (since it's now the y variable): +X_r = data(:, [1, 2, 4, 5]); + +% Since the iris class information (which is now the last column in X) is a +% categorical variable, we will do a one-out-of-K encoding of the variable: +species = X_r(:, end); +species_encoding = bsxfun(@eq, species, 0:max(species)); +% The encoded information is now a 150x3 matrix. This corresponds to 150 +% observations, and 3 possible species. For each observation, the matrix +% has a row, and each row has two 0s and a single 1. The placement of the 1 +% specifies which of the three Iris species the observations was. +% The way the bsxfun works is that it applies the operation '@eq' to each +% element in the two matrices that follow in the call. Here we use the +% logical equal comparison to see whether the value of species is equal to +% each element in 0:max(species), which is just the vector [0, 1, 2]. +% Therefore, the bsxfun for e.g. species(75), which is a 1, will return +% the row [false, true, false], or [0, 1, 0]. + +% We need to replace the last column in X (which was the not encoded +% version of the species data) with the encoded version: +X_r = [X_r(:, [1:end-1]), species_encoding]; + +% Now, X is of size 150x6 corresponding to the three measurements of the +% Iris that are not the petal length as well as the three variables that +% specifies whether or not a given observations is or isn't a certain type. +% We need to update the attribute names and store the petal length name +% as the name of the target variable for a regression: +targetName_regression = attributeNames_classification(3); +attributeNames_regression = ... + vertcat(attributeNames_classification([1, 2, 4]), classNames); + +% Lastly, we update M, since we now have more attributes: +[N,M] = size(X_r); + +% A relevant figure for this regression problem could +% for instance be one that shows how the target, that is the petal length, +% changes with one of the predictors in X: +i = 3; +mfig('Iris regression problem') +plot(X_r(:,i), y_r, 'o') +xlabel(attributeNames_regression{i}); +ylabel(targetName_regression); +% Consider if you see a relationship between the predictor variable on the +% x-axis (the variable from X) and the target variable on the y-axis (the +% variable y). Could you draw a straight line through the data points for +% any of the attributes (choose different i)? +% Note that, when i is 4, 5, or 6, the x-axis is based on a binary +% variable, in which case a scatter plot is not as such the best option for +% visulizing the information. + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex1_5_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_5.m new file mode 100644 index 0000000000000000000000000000000000000000..4fc18d68dbd10fa1332d44c0dc8a9f86afde1847 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex1_5_5.m @@ -0,0 +1,182 @@ +%% exercise 1.5.5 +% We start by defining the path to the file that we're we need to load. +% Upon inspection, we saw that the messy_data.data was infact a file in the +% format of a CSV-file with a ".data" extention instead. So we renamed the +% file to be a .csv-file. If you haven't done this, go ahead and make a +% copy of the .data-file which has the extension .csv instead. +file_path = fullfile(pwd(),'../Data/messy_data/messy_data.csv'); +% Once again, here we assume your pwd is the Scripts-folder (you can +% right-click on the tab in the editor and change it to its placement). + +% First of we simply read the file in using readtable +messy_data = readtable(file_path); + +%% +% Inspection of messy_data at this point shows that readtable correctly +% identifies a header with the variable names. It fails to identify a +% headerline of short forms of the variable names that was included in the +% data, so we skip the first row of the loaded data: +messy_data = messy_data(2:end, :); + +% We extract the attribute names: +attributeNames = messy_data.Properties.VariableNames; + +% Data-processing functions in matlab changed around version 2019b. I think +% this check will ensure the right behavior, but you get errors try to +% change the version string to e.g. 9.6, 9.7 or 9.9 in case I misread time +% where the code changed. +if verLessThan('matlab','9.8') % check versions < 9.8 = 2019b + % Run old matlab processing code. + %% As we progress through this script,messy_data we might change which attributes are + % stored where. For simplicity in presenting the processing steps, we wont + % keep track of those changes in attributeNames in this example script. + + % We convert the table to an array of cells for making some operations + % easier to follow: + messy_data = table2array(messy_data); + + %% + % The last column is a unique string for each observation defining the + % car make and model. We decide to extract this in a variable for itself + % for now, and then remove it from the array: + car_names = messy_data(:,end); + messy_data = messy_data(:, 1:end-1); + + %% + % If we inspect messy_data we see that some formatting issues needs to be + % handled. We can do this programatically using cellfun and the function + % regexprep. The cellfun applies the function to each element in a supplied + % array, and regexprep simply replaces a certain expression in a given + % string with another expression. + + % First off, we remove the question marks in the third column and replace + % them with the MATLAB naming convention for not a number, NaN: + messy_data(:,3) = cellfun(@(x) regexprep(x, "?", "NaN"), messy_data(:,3), ... + 'UniformOutput', false); + % Similarly, we remove the formatting for a thousand seperator that is + % present in column five: + messy_data(:,5) = cellfun(@(x) regexprep(x, "'", ""), messy_data(:,5), ... + 'UniformOutput', false); + % And lastly, we replace all the commas that were used as decimal seperatos + % in column 6 with dots: + messy_data(:,6) = cellfun(@(x) regexprep(x, ",", "."), messy_data(:,6), ... + 'UniformOutput', false); + + % We also see that some parts of the messy_data simply has nothing in them, + % but the creators of the dataset did not include a question mark to + % highlight it. For these, we find the empty cells and replace their values + % with a NaN: + idx = cellfun(@isempty, messy_data(:,3)); + messy_data(idx, 3) = {'NaN'}; + + % Now we use cellfun again, but this time - instead of regexprep - we use + % the funtion str2num which converts a string (or text) to a number: + data = cellfun(@str2num, messy_data); +else + %messy_data = table2array(messy_data); + % weight is given as strings like 3'234, this has to be fixed by + % conversion: + messy_data.weight = cellfun(@(s)double(string(s).replace("'", "")), messy_data.weight); + messy_data.carname = []; + data = table2array(messy_data); + + %% +end + + +% data has some zero values that the README.txt tolds us were missing +% values - this was specifically for the attributes mpg and displacement, +% so we're careful only to replace the zeros in these attributes, since a +% zero might be correct for some other variables: +data(data(:,1) == 0, 1) = NaN; +data(data(:,3) == 0, 3) = NaN; + + +% We later on find out that a value of 99 for the mpg is not value that is +% within reason for the MPG of the cars in this dataset. The observations +% that has this value of MPG is therefore incorrect, and we should treat +% the value as missing. How would you add a line of code to this data +% cleanup script to account for this information? + +%% X,y-format +% If the modelling problem of interest was a classification problem where +% we wanted to classify the origin attribute, we could now identify obtain +% the data in the X,y-format as so: +X_c = data(:, 1:end-1); +y_c = data(:, end); + +% However, if the problem of interest was to model the MPG based on the +% other attributes (a regression problem), then the X,y-format is +% obtained as: +X_r = data(:, 2:end); +y_r = data(:, 1); +% Since origin is categorical variable, we can do as in previos exercises +% and do a one-out-of-K encoding: +origin = X_r(:, end) - 1;% subtract so the numbering starts from 0 +origin_encoding = bsxfun(@eq, origin, 0:max(origin)); +X_r = [X_r(:, [1:end-1]), origin_encoding]; +% Since the README.txt doesn't supply a lot of information about what the +% levels in the origin variable mean, you'd have to either make an educated +% guess based on the values in the context, or preferably obtain the +% information from any papers that might be references in the README. +% In this case, you can inspect origin and car_names, to see that (north) +% american makes are all value 0 (try looking at car_names(origin == 0), +% whereas origin value 1 is European, and value 2 is Asian. + +%% Missing values +% In the above X,y-matrices, we still have the missing values. In the +% following we will go through how you could go about handling the missing +% values before making your X,y-matrices. + +% Once we have identified all the missing data, we have to handle it +% some way. Various apporaches can be used, but it is important +% to keep it mind to never do any of them blindly. Keep a record of what +% you do, and consider/discuss how it might affect your modelling. + +% The simplest way of handling missing values is to drop any records +% that display them, we do this by first determining where there are +% missing values: +missing_idx = isnan(data); +% Observations with missing values have a row-sum in missing_idx +% which is greater than zero: +obs_w_missing = sum(missing_idx, 2) > 0; +data_drop_missing_obs = data(~obs_w_missing, :); +% This reduces us to 15 observations of the original 29. + +% Another approach is to first investigate where the missing values are. +% A quick way to do this is to visually look at the missing_idx: +mfig('Visual inspection of missing values'); +imagesc(missing_idx); ylabel('Observations'); xlabel('Attributes'); + +% From such a plot, we can see that the issue is the third column, the +% displacement attribute. This can be confirmed by e.g. doing: +%sum(missing_idx, 1) +% which shows that 12 observations are missing a value in the third column. +% Therefore, another way to move forward is to disregard displacement +% (for now) and remove the attribute. We then remove the few +% remaining observations with missing values: +cols = logical(ones(1, size(data, 2))); +cols(3) = false; +data_wo_displacement = data(:, cols); +obs_w_missing_wo_displacement = sum(isnan(data_wo_displacement),2)>0; +data_drop_disp_then_missing = data(~obs_w_missing_wo_displacement, :); +% Now we have kept all but two of the observations. This however, doesn't +% necesarrily mean that this approach is superior to the previous one, +% since we have now also lost any and all information that we could have +% gotten from the displacement attribute. + +% One could impute the missing values - "guess them", in some +% sense - while trying to minimize the impact of the guess. +% A simply way of imputing them is to replace the missing values +% with the median of the attribute. We would have to do this for the +% missing values for attribute 1 and 3: +data_imputed = data; +for att = [1:3] + % We use nanmedian to ignore the nan values + impute_val = nanmedian(data(:, att)); + idx = missing_idx(:, att); + data_imputed(idx, att) = impute_val; +end + +% Note, you can change the format between 'format long' and 'format bank' +% to change how the Command Window displays numerical values. diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex2_1_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_1.m new file mode 100644 index 0000000000000000000000000000000000000000..c5f1186acedaa71f6829e0072e5bdd871453be96 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_1.m @@ -0,0 +1,19 @@ +%% exercise 2.1.1 +% Load the data into Matlab +cdir = fileparts(mfilename('fullpath')); +[NUMERIC, TXT, RAW] = xlsread(fullfile(cdir,'../Data/nanonose.xls')); + +% Extract the rows and columns corresponding to the sensor data, and +% transpose the matrix to have rows correspond to data items +X = NUMERIC(:,3:10); + +% Extract attribute names from the first column +attributeNames = RAW(1,4:end); + +% Extract unique class names from the first row +classLabels = RAW(3:end,1); +classNames = unique(classLabels); + +% Extract class labels that match the class names +[y_,y] = ismember(classLabels, classNames); y = y-1; + \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex2_1_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_2.m new file mode 100644 index 0000000000000000000000000000000000000000..5b6eee846e1397ed2ed1b2a9ea795cd92523e84c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_2.m @@ -0,0 +1,31 @@ +%% exercise 2.1.2 +% Data attributes to be plotted +i = 1; +j = 2; + +% Make a simple plot of the i'th attribute against the j'th attribute +mfig('NanoNose: Data'); clf; +plot(X(:,i), X(:,j),'o'); +axis tight + +% Make another more fancy plot that includes legend, class labels, +% attribute names, and a title +mfig('NanoNose: Classes'); clf; hold all; +C = length(classNames); +% Use a specific color for each class (easy to reuse across plots!): +colors = get(gca, 'colororder'); +% Here we the standard colours from MATLAB, but you could define you own. +for c = 0:C-1 + h = scatter(X(y==c,i), X(y==c,j), 50, 'o', ... + 'MarkerFaceColor', colors(c+1,:), ... + 'MarkerEdgeAlpha', 0, ... + 'MarkerFaceAlpha', .5); +end +% You can also avoid the loop by using e.g.: (but in this case, do not call legend(classNames) as it will overwrite the legend with wrong entries) +% gscatter(X(:,i), X(:,j), classLabels) +legend(classNames); +axis tight +xlabel(attributeNames{i}); +ylabel(attributeNames{j}); +title('NanoNose data'); +a = 234 diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex2_1_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_3.m new file mode 100644 index 0000000000000000000000000000000000000000..145ff5c7cdaf768b4b14906bc2c1bc014f08a37a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_3.m @@ -0,0 +1,28 @@ + +%% exercise 2.1.3 + +% Subtract the mean from the data +Y = bsxfun(@minus, X, mean(X)); + +% Obtain the PCA solution by calculate the SVD of Y +[U, S, V] = svd(Y); + +% Compute variance explained +rho = diag(S).^2./sum(diag(S).^2); +threshold = 0.90; + +% Plot variance explained +mfig('NanoNose: Var. explained'); clf; +hold on +plot(rho, 'x-'); +plot(cumsum(rho), 'o-'); +plot([0,length(rho)], [threshold, threshold], 'k--'); +legend({'Individual','Cumulative','Threshold'}, ... + 'Location','best'); +ylim([0, 1]); +xlim([1, length(rho)]); +grid minor +xlabel('Principal component'); +ylabel('Variance explained value'); +title('Variance explained by principal components'); + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex2_1_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_4.m new file mode 100644 index 0000000000000000000000000000000000000000..cf767df44e4c6129faff311e92485815c1278a45 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_4.m @@ -0,0 +1,24 @@ +%% exercise 2.1.4 + +% Index of the principal components +i = 1; +j = 2; + +% Compute the projection onto the principal components +Z = U*S; + +% Plot PCA of data +mfig('NanoNose: PCA Projection'); clf; hold all; +C = length(classNames); +colors = get(gca,'colororder'); +for c = 0:C-1 + scatter(Z(y==c,i), Z(y==c,j), 50, 'o', ... + 'MarkerFaceColor', colors(c+1,:), ... + 'MarkerEdgeAlpha', 0, ... + 'MarkerFaceAlpha', .5); +end +legend(classNames); +axis tight +xlabel(sprintf('PC %d', i)); +ylabel(sprintf('PC %d', j)); +title('PCA Projection of NanoNose data'); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex2_1_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_5.m new file mode 100644 index 0000000000000000000000000000000000000000..2475302c15fab8118605b132c2c4efd285b512eb --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_5.m @@ -0,0 +1,40 @@ +%% exercise 2.1.5 +% We saw in 2.1.3 that the first 3 components explaiend more than 90 +% percent of the variance. Let's look at their coefficients: +pcs = 1:3; % change this to look at more/fewer, or compare e.g. [2,5] +mfig('NanoNose: PCA Component Coefficients'); +h = bar(V(:,pcs)); +legendCell = cellstr(num2str(pcs', 'PC%-d')); +legend(legendCell, 'location','best'); +xticklabels(attributeNames); +grid +xlabel('Attributes'); +ylabel('Component coefficients'); +title('NanoNose: PCA Component Coefficients'); + +% Inspecting the plot, we see that the 2nd principal component has large +% (in magnitude) coefficients for attributes A, E and H. We can confirm +% this by looking at it's numerical values directly, too: +disp('PC2:') +disp(V(:,2)') % notice the transpose for display in console + +% How does this translate to the actual data and its projections? +% Looking at the data for water: + +% Projection of water class onto the 2nd principal component. +all_water_data = Y(y==4,:); + +disp('First water observation:') +disp(all_water_data(1,:)) + +% Based on the coefficients and the attribute values for the observation +% displayed, would you expect the projection onto PC2 to be positive or +% negative - why? Consider *both* the magnitude and sign of *both* the +% coefficient and the attribute! + +% You can determine the projection by (remove comments): +disp('...and its projection onto PC2:') +disp(all_water_data(1,:) * V(:,2)) +% Try to explain why? + + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex2_1_6.m b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_6.m new file mode 100644 index 0000000000000000000000000000000000000000..2c3daad688cf0af37190e2c1d9c7d952bda0bf5c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex2_1_6.m @@ -0,0 +1,100 @@ +%% exercise 2.1.6 +mfig('NanoNose: Attribute standard deviations'); clf; hold all; +bar(1:size(X,2), std(X)); +xticks(1:size(X,2)) +xticklabels(attributeNames); +ylabel('Standard deviation') +xlabel('Attributes') +title('NanoNose: attribute standard deviations') + +%% Investigate how standardization affects PCA +% Try this *later*, and explain the effect: +%X(:,3) = 100*X(:,3); % Multiply C with a factor 100 + +% Subtract the mean from the data +Y1 = bsxfun(@minus, X, mean(X)); + +% Subtract the mean from the data and divide by the attribute standard +% deviation to obtain a standardized dataset: +Y2 = bsxfun(@minus, X, mean(X)); +Y2 = bsxfun(@times, Y2, 1./std(X)); +% The formula in the exercise description corresponds to: +%Y2 = (X - ones(size(X,1),1)*mean(X) ) * diag(1./std(X)) +% But using bsxfun is a bit cleaner and works better for large X. + +% Store the two in a cell, so we can just loop over them: +Ys = {Y1, Y2}; +titles = {'Zero-mean', 'Zero-mean and unit variance'}; + +% Choose two PCs to plot (the projection) +i = 1; +j = 2; + +% Make the plot +mfig('NanoNose: Effect of standardization'); clf; hold all; +nrows=3; ncols=2; +for k = 0:1 + % Obtain the PCA solution by calculate the SVD of either Y1 or Y2 + [U, S, V] = svd(Ys{k+1},'econ'); + + % For visualization purposes, we flip the directionality of the + % principal directions such that the directions match for Y1 and Y2. + if k==1; V = -V; U = -U; end; + + % Compute variance explained + rho = diag(S).^2./sum(diag(S).^2); + + % Compute the projection onto the principal components + Z = U*S; + + % Plot projection + subplot(nrows, ncols, 1+k) + C = length(classNames); + hold on + colors = get(gca,'colororder'); + for c = 0:C-1 + scatter(Z(y==c,i), Z(y==c,j), 50, 'o', ... + 'MarkerFaceColor', colors(c+1,:), ... + 'MarkerEdgeAlpha', 0, ... + 'MarkerFaceAlpha', .5); + end + xlabel(sprintf('PC %d', i)); + ylabel(sprintf('PC %d', j)); + axis equal + title(sprintf( [titles{k+1}, '\n', 'Projection'] ) ) + % Add a legend to one of the plots (but not both): + if k; h = legend(classNames, 'Location', 'best', 'color', 'none'); end; + + % Plot attribute coefficients in principal component space + subplot(nrows, ncols, 3+k); + z = zeros(1,size(V,2))'; + quiver(z,z,V(:,i), V(:,j), 1, ... + 'Color', 'k', ... + 'AutoScale','off', ... + 'LineWidth', .1) + hold on + for pc=1:length(attributeNames) + text(V(pc,i), V(pc,j),attributeNames{pc}, ... + 'FontSize', 10) + end + xlabel('PC1') + ylabel('PC2') + grid; box off; axis equal; + % Add a unit circle + plot(cos(0:0.01:2*pi),sin(0:0.01:2*pi)); + title(sprintf( [titles{k+1}, '\n', 'Attribute coefficients'] ) ) + axis tight + + % Plot cumulative variance explained + subplot(nrows, ncols, 5+k); + plot(cumsum(rho), 'x-'); + ylim([.6, 1]); + xlim([1, size(V,2)]); + grid minor + xlabel('Principal component'); + ylabel('Cumulative variance explained') + title(sprintf( [titles{k+1}, '\n', 'Variance explained'] ) ) + grid + box off +end + \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex2_2_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex2_2_1.m new file mode 100644 index 0000000000000000000000000000000000000000..2f064b574ca36017f92dde65f45e22e78a017d1d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex2_2_1.m @@ -0,0 +1,28 @@ +%% exercise 2.2.1 + +% Digit number to display +i = 1; + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/zipdata.mat')); + +% Extract digits data +X = traindata(:,2:end); +y = traindata(:,1); + +% Visualize the i'th digit as a vector +mfig('Digits: Data'); +subplot(4,1,4); +imagesc(X(i,:)); +xlabel('Pixel number'); +title('Digit in vector format'); +set(gca, 'YTick', []); + +% Visualize the i'th digit as an image +subplot(4,1,1:3); +I = reshape(X(i,:), [16,16])'; +imagesc(I); +colormap(1-gray); +axis image off +title('Digit as a image'); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex2_2_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex2_2_2.m new file mode 100644 index 0000000000000000000000000000000000000000..0db965d7614fface2e85ca12af9d2e08cdaf0d1b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex2_2_2.m @@ -0,0 +1,87 @@ +%% exercise 2.2.2 + +% Digits to include in analysis (to include all, n = 1:10); +n = [0,1]; + +% Number of principal components for reconstruction +K = 22; + +% Digits to visualize +nD = 1:5; + +%% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/zipdata.mat')); + +% Extract digits +X = traindata(:,2:end); +y = traindata(:,1); +classNames = {'0';'1';'2';'3';'4';'5';'6';'7';'8';'9';'10'}; +classLabels = classNames(y+1); + +% Remove digits that are not to be inspected +j = ismember(y, n); +X = X(j,:); +classLabels = classLabels(j); +classNames = classNames(n+1); +y = cellfun(@(str) find(strcmp(str, classNames)), classLabels)-1; + +% Subtract the mean from the data +Y = bsxfun(@minus, X, mean(X)); + +% Obtain the PCA solution by calculate the SVD of Y +[U, S, V] = svd(Y, 'econ'); + +% Compute the projection onto the principal components +Z = U*S; + +% Compute variance explained +rho = diag(S).^2./sum(diag(S).^2); + +%% Plot variance explained +mfig('Digits: Var. explained'); clf; +plot(rho, 'o-'); +title('Variance explained by principal components'); +xlabel('Principal component'); +ylabel('Variance explained value'); + +%% Plot PCA of data +mfig('Digits: PCA'); clf; hold all; +C = length(classNames); +for c = 0:C-1 + plot(Z(y==c,1), Z(y==c,2), 'o'); +end +legend(classNames); +xlabel('PC 1'); +ylabel('PC 2'); +title('PCA of digits data'); + +%% Visualize the reconstructed data from the firts K principal components +mfig('Digits: Reconstruction'); clf; +W = Z(:,1:K)*V(:,1:K)'; +D = length(nD); +for d = 1:D + subplot(2,D,d); + I = reshape(X(nD(d),:), [16,16])'; + imagesc(I); + axis image off + title('Original'); + subplot(2,D,d+D); + I = reshape(W(nD(d),:)+mean(X), [16,16])'; + imagesc(I); + axis image off + title('Reconstructed'); +end +colormap(1-gray); + +%% Visualize the principal components +mfig('Digits: Principal components'); clf; +for k = 1:K + N1 = ceil(sqrt(K)); N2 = ceil(K/N1); + subplot(N2, N1, k); + I = reshape(V(:,k), [16,16])'; + imagesc(I); + colormap(hot); + axis image off + title(sprintf('PC %d',k)); +end diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex2_3_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex2_3_1.m new file mode 100644 index 0000000000000000000000000000000000000000..2a8135ef9d9ff5647fd5be3bfcb9acfa7884be85 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex2_3_1.m @@ -0,0 +1,44 @@ +%% exercise 2.3.1 +%% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/zipdata.mat')); + +% Extract digits (training set) +X = traindata(:,2:end); +y = traindata(:,1); + +% Extract digits (test set) +Xtest = testdata(:,2:end); +ytest = testdata(:,1); + +% Subtract the mean from the data +Y = bsxfun(@minus, X, mean(X)); +Ytest = bsxfun(@minus, Xtest, mean(X)); + +% Obtain the PCA solution by calculate the SVD of Y +[U, S, V] = svd(Y, 'econ'); + +% Number of principal components to use, i.e. the reduced dimensionality +Krange = [8,10,15,20,30,40,50,60,100,150]; +errorRate = zeros(length(Krange),1); +for i = 1:length(Krange) + K=Krange(i); + % Compute the projection onto the principal components + Z = Y*V(:,1:K); + Ztest = Ytest*V(:,1:K); + + % Classify digits using a K-nearest neighbour classifier + model=fitcknn(Z,y,'NumNeighbors',1); + yest = predict(model,Ztest); + + errorRate(i) = nnz(ytest~=yest)/length(ytest); + + % Display results + fprintf('Error rate %.1f%%\n',errorRate(i)*100); +end + +%% Visualize error rates vs. number of principal components considered +mfig('Variance explained by principal components'); clf; +plot(Krange,errorRate, 'o-'); +xlabel('Number of principal components K') +ylabel('Error rate [%]') diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex3_1_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex3_1_2.m new file mode 100644 index 0000000000000000000000000000000000000000..b5391b758cafba6e3c28f0beb465769334439718 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex3_1_2.m @@ -0,0 +1,9 @@ +%% exercise 3.1.2 +cdir = fileparts(mfilename('fullpath')); +[A, D] = tmg(fullfile(cdir,'../Data/textDocs.txt')); +X = full(A)'; +attributeNames = cellstr(D); + +%% Display the result +display(attributeNames); +display(X); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex3_1_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex3_1_3.m new file mode 100644 index 0000000000000000000000000000000000000000..fdd498e1c67d51f512c47132bf4298325f5abec0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex3_1_3.m @@ -0,0 +1 @@ +%% exercise 3.1.3 cdir = fileparts(mfilename('fullpath')); TMGOpts.stoplist = fullfile(cdir,'../Data/stopWords.txt'); [A, D] = tmg(fullfile(cdir,'../Data/textDocs.txt'), TMGOpts); X = full(A)'; attributeNames = cellstr(D); %% Display the result display(attributeNames); display(X); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex3_1_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex3_1_4.m new file mode 100644 index 0000000000000000000000000000000000000000..0518cd4748fdea2dec5daf77635c2de330e3bd2d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex3_1_4.m @@ -0,0 +1 @@ +%% exercise 3.1.4 cdir = fileparts(mfilename('fullpath')); TMGOpts.stoplist = '../Data/stopWords.txt'; TMGOpts.stemming = 1; [A, D] = tmg(fullfile(cdir,'../Data/textDocs.txt'), TMGOpts); X = full(A)'; attributeNames = cellstr(D); %% Display the result display(attributeNames); display(X); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex3_1_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex3_1_5.m new file mode 100644 index 0000000000000000000000000000000000000000..ffa4d21982d415f00f3b6d9424dd8cec08486e77 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex3_1_5.m @@ -0,0 +1,21 @@ +%% exercise 3.1.5 + +% Query vector +q = [0; 0; 0; 0; 0; 0; 0; 1; 0; 0; 0; 0; 1; 1; 0; 0; 0]'; + +%% Method #1 (a for loop) +N = size(X,1); % Get the number of data objects +sim = nan(N,1); % Allocate a vector for the similarity +for i = 1:N + x = X(i,:); % Get the i'th data object + sim(i) = dot(q/norm(q),x/norm(x)); % Compute cosine similarity +end + +%% Method #2 (one compact line of code) +sim = (q*X')'./(sqrt(sum(X.^2,2))*sqrt(sum(q.^2))); + +%% Method #3 (use the "similarity" function) +sim = similarity(X, q, 'cos'); + +%% Display the result +display(sim); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex3_2_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex3_2_1.m new file mode 100644 index 0000000000000000000000000000000000000000..f4115017e2054a948671c99dc72cc037b0309382 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex3_2_1.m @@ -0,0 +1,14 @@ +% exercise 3.2.1 + +x = [-0.68; -2.11; 2.39; 0.26; 1.46; 1.33; 1.03; -0.41; -0.33; 0.47]; + +mean_x = mean(x); +std_x = std(x); +median_x = median(x); +range_x = range(x); + +%% Display results +display(mean_x); +display(std_x); +display(median_x); +display(range_x); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex3_3_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex3_3_1.m new file mode 100644 index 0000000000000000000000000000000000000000..009817333dff41cc9d112663e65d03703f5c59ae --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex3_3_1.m @@ -0,0 +1,65 @@ +% exercise 3.3.1 + +% Image to use as query +i = 1; + +% Similarity: 'SMC', 'Jaccard', 'ExtendedJaccard', 'Cosine', 'Correlation' +SimilarityMeasure = 'cos'; + +%% Load the CBCL face database +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/digits.mat')); + +% You can try out the faces CBCL face database, too: +%load(fullfile(cdir,'../Data/wildfaces_grayscale.mat')); + +transpose = true; % set to true if plotted images needs to be transposed + +[N,M] = size(X); +imageDim = [sqrt(M),sqrt(M)]; +%% Search the face database for similar faces + +% Index of all other images than i +noti = [1:i-1 i+1:N]; +% Compute similarity between image i and all others +sim = similarity(X(i,:), X(noti,:), SimilarityMeasure); +% Sort similarities +[val, j] = sort(sim, 'descend'); + +%% Plot query and result +mfig('Faces: Query'); clf; +subplot(3,5,1:5); + +img = reshape(X(i,:),imageDim); +if transpose; img = img'; end; +imagesc(img); + +axis image +set(gca, 'XTick', [], 'YTick', []); +ylabel(sprintf('Image #%d', i)); +title('Query image','FontWeight','bold'); +for k = 1:5 + subplot(3,5,k+5) + ii = noti(j(k)); + img = reshape(X(ii,:),imageDim); + if transpose; img = img'; end; + imagesc(img); + axis image + set(gca, 'XTick', [], 'YTick', []); + xlabel(sprintf('sim=%.2f', val(k))); + ylabel(sprintf('Image #%d', ii)); + if k==3, title('Most similar images','FontWeight','bold'); end; +end +for k = 1:5 + subplot(3,5,k+10) + ii = noti(j(end+1-k)); + img = reshape(X(ii,:),imageDim); + if transpose; img = img'; end; + imagesc(img); + axis image + set(gca, 'XTick', [], 'YTick', []); + xlabel(sprintf('sim=%.3f', val(end+1-k))); + ylabel(sprintf('Image #%d', ii)); + if k==3, title('Least similar images','FontWeight','bold'); end; +end +colormap(gray); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex3_3_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex3_3_2.m new file mode 100644 index 0000000000000000000000000000000000000000..52eb65d331a1a39824c0313a1f1db12600f9adcc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex3_3_2.m @@ -0,0 +1,18 @@ +% exercise 3.3.2 + +% Generate two data objects with M random attributes +M = 5; +x = rand(1,M); +y = rand(1,M); + +% Two constants +a = 1.5; +b = 1.5; + +% Check the statements in the exercise +similarity(x,y,'cos') - similarity(a*x,y,'cos') +similarity(x,y,'ext') - similarity(a*x,y,'ext') +similarity(x,y,'cor') - similarity(a*x,y,'cor') +similarity(x,y,'cos') - similarity(b+x,y,'cos') +similarity(x,y,'ext') - similarity(b+x,y,'ext') +similarity(x,y,'cor') - similarity(b+x,y,'cor') \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_1_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_1.m new file mode 100644 index 0000000000000000000000000000000000000000..836189bcade545f540ca4c1ea4ee2c0298a41ef7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_1.m @@ -0,0 +1,23 @@ +% exercise 4.1.1 + +% Number of samples +N = 200; + +% Mean +mu = 17; + +% Standard deviation +s = 2; + +% Number of bins in histogram +NBins = 20; + +%% Generate samples from the Normal distribution +X = normrnd(mu, s, N, 1); + +%% Plot a histogram +mfig('Normal distribution'); +subplot(1,2,1); +plot(X, 'x'); +subplot(1,2,2); +hist(X, NBins); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_1_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_2.m new file mode 100644 index 0000000000000000000000000000000000000000..8f1263219fc092b68dc35050c7aa6fcaca688007 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_2.m @@ -0,0 +1,30 @@ +% exercise 4.1.2 + +% Number of samples +N = 100; + +% Mean +mu = 17; + +% Standard deviation +s = 2; + +% Number of bins in histogram +NBins = 10; + +%% Generate samples from the Normal distribution +X = normrnd(mu, s, N, 1); + +%% Plot a histogram +mfig('Normal distribution'); +subplot(1,2,1); +plot(X, 'x'); +subplot(1,2,2); +hist(X, NBins); + +%% Compute empirical mean and standard deviation +mu_ = mean(X); +s_ = std(X); + +display(mu_); +display(s_); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_1_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_3.m new file mode 100644 index 0000000000000000000000000000000000000000..02d28b4fe72f6ed5e078932908d3c4ec3560b13c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_3.m @@ -0,0 +1,31 @@ +% exercise 4.1.3 + +% Number of samples +N = 1000; + +% Mean +mu = 17; + +% Standard deviation +s = 2; + +% Number of bins in histogram +NBins = 50; + +%% Generate samples from the Normal distribution +X = normrnd(mu, s, N, 1); + +% Plot a histogram +mfig('Normal distribution'); clf; hold all; +[n, x] = hist(X, NBins); +bar(x, n/N./gradient(x)); +x = linspace(min(x), max(x), 1000); +plot(x, normpdf(x, mu, s), 'r', 'LineWidth', 5); +xlim([min(x), max(x)]); + +%% Compute empirical mean and standard deviation +mu_ = mean(X); +s_ = std(X); + +display(mu_); +display(s_); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_1_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_4.m new file mode 100644 index 0000000000000000000000000000000000000000..eba312a920b6d76ec7465a9d1cf4335b5e5f29a3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_4.m @@ -0,0 +1,13 @@ +% exercise 4.1.4 + +% Number of samples +N = 1000; + +% Mean +mu = [13 17]; + +% Covariance matrix +S = [4 3;3 9]; + +%% Generate samples from the Normal distribution +X = mvnrnd(mu, S, N); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_1_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_5.m new file mode 100644 index 0000000000000000000000000000000000000000..5362705dc6904be5e283b27e978a38895d76df17 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_5.m @@ -0,0 +1,44 @@ +% exercise 4.1.5 + +% Number of samples +N = 1000; + +% Mean +mu = [13 17]; + +% Standard deviation of x1 +s1 = 2; + +% Standard deviation of x2 +s2 = 3; + +% Correlation between x1 and x2 +corr = 0; + +% Covariance matrix +S = [s1^2 corr*s1*s2;corr*s1*s2 s2^2]; + +% Number of bins in histogram +NBins = 20; + +%% Generate samples from the Normal distribution +X = mvnrnd(mu, S, N); + +%% Plot scatter plot of data +mfig('2-D Normal distribution'); clf; + +subplot(1,2,1); +plot(X(:,1), X(:,2), 'x'); +axis equal; +xlabel('x_1'); ylabel('x_2'); +title('Scatter plot of data'); + +subplot(1,2,2); +[n, x] = hist2d(X, NBins); +imagesc(x(1,:), x(2,:), n); +axis equal; +axis xy; +colorbar('South'); +colormap(1-gray); +xlabel('x_1'); ylabel('x_2'); +title('2D histogram'); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_1_6.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_6.m new file mode 100644 index 0000000000000000000000000000000000000000..6f104e34242d721bb3b828499ee7eca60dafea9b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_6.m @@ -0,0 +1,40 @@ +%% exercise 4.1.6 + +% Digits to include in analysis (to include all, n = 1:10); +n = [1]; + +%% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/zipdata.mat')); + +% Extract digits +X = traindata(:,2:end); +y = traindata(:,1); +classNames = {'0';'1';'2';'3';'4';'5';'6';'7';'8';'9';'10'}; +classLabels = classNames(y+1); + +% Remove digits that are not to be inspected +j = ismember(y, n); +X = X(j,:); +classLabels = classLabels(j); +classNames = classNames(n+1); +y = cellfun(@(str) find(strcmp(str, classNames)), classLabels)-1; + +%% Compute mean, standard deviations, and covariance matrix +mu = mean(X); +s = std(X); +S = cov(X); + +%% Plot result +mfig('Digits: Mean and std'); clf; +subplot(1,2,1); +I = reshape(mu, [16,16])'; +imagesc(I); +axis image off +title('Mean'); +subplot(1,2,2); +I = reshape(s, [16,16])'; +imagesc(I); +axis image off +title('Standard deviation'); +colormap(1-gray); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_1_7.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_7.m new file mode 100644 index 0000000000000000000000000000000000000000..a79498fca3ed862980da5957982100639c337c44 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_1_7.m @@ -0,0 +1,53 @@ +%% exercise 4.1.7 + +% Digits to include in analysis (to include all, n = 1:10); +n = [1]; + +%% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/zipdata.mat')); + +% Extract digits +X = traindata(:,2:end); +y = traindata(:,1); +classNames = {'0';'1';'2';'3';'4';'5';'6';'7';'8';'9';'10'}; +classLabels = classNames(y+1); + +% Remove digits that are not to be inspected +j = ismember(y, n); +X = X(j,:); +classLabels = classLabels(j); +classNames = classNames(n+1); +y = cellfun(@(str) find(strcmp(str, classNames)), classLabels)-1; + +%% Compute mean, standard deviations, and covariance matrix +mu = mean(X); +s = std(X); +S = cov(X); + +%% Generate 10 images with same mean and standard deviation +Xgen = normrnd(repmat(mu,10,1), repmat(s,10,1)); + +%% Plot images generated using the Normal distribution +mfig('Digits: 1-D Normal'); +for k = 1:10 + subplot(2,5,k); + I = reshape(Xgen(k,:), [16,16])'; + imagesc(I); + axis image off +end +colormap(1-gray); + + +%% Generate 10 images with same mean and covariance matrix +Xgen = mvnrnd(mu, S, 10); + +%% Plot images generated using the Normal distribution +mfig('Digits: Multivariate Normal'); +for k = 1:10 + subplot(2,5,k); + I = reshape(Xgen(k,:), [16,16])'; + imagesc(I); + axis image off +end +colormap(1-gray); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_2_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_1.m new file mode 100644 index 0000000000000000000000000000000000000000..9a68ff4cf91cea0a1d5abf841a627e46c4751eae --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_1.m @@ -0,0 +1,31 @@ +% exercise 4.2.1 + +% Disable xlsread warning +warning('off', 'MATLAB:xlsread:ActiveX'); +warning('off', 'MATLAB:xlsread:Mode'); + +% Load the data into Matlab +cdir = fileparts(mfilename('fullpath')); +[NUMERIC, TXT, RAW] = xlsread(fullfile(cdir,'../Data/iris.xls'),1,'','basic'); + +% Extract the rows and columns corresponding to the data +if isnan(NUMERIC(1,1)) + X = NUMERIC(2:end,:); +else + X = NUMERIC; +end + +% Extract attribute names from the first row +attributeNames = RAW(1,1:4)'; + +% Extract unique class names from the last column +classLabels = RAW(2:end,5)'; +classNames = unique(classLabels); + +% Extract class labels that match the class names +[y_,y] = ismember(classLabels, classNames); y = y'-1; + +% Get the number of data objects, attributes, and classes +[N, M] = size(X); +C = length(classNames); + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_2_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_2.m new file mode 100644 index 0000000000000000000000000000000000000000..205a5ddaff4fe058df6cf672e33368150c48e177 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_2.m @@ -0,0 +1,11 @@ +% exercise 4.2.2 + +mfig('Histogram for attributes'); clf; +for m = 1:M + u = floor(sqrt(M)); v = ceil(M/u); + subplot(u,v,m); + hist(X(:,m)); + xlabel(attributeNames{m}); + axis square; +end +linkax('y'); % Makes the y-axes equal for improved readability \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_2_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_3.m new file mode 100644 index 0000000000000000000000000000000000000000..517a69291d54abedb5cb57c4dcb0b58aee49330c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_3.m @@ -0,0 +1,5 @@ +% exercise 4.2.3 + +%% Boxplot of each attribute +mfig('Boxplot'); clf; +boxplot(X, attributeNames); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_2_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_4.m new file mode 100644 index 0000000000000000000000000000000000000000..c4921d8653f57c47ec1a1c6047fb53a82bf21727 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_4.m @@ -0,0 +1,10 @@ +% exercise 4.2.4 + +%% Boxplot of each attribute for each class +mfig('Boxplot per class'); clf; +for c = 1:C + subplot(1,C,c,'align'); + boxplot(X(y==c-1,:), attributeNames, 'labelorientation', 'inline'); + title(classNames{c}); +end +linkax; diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_2_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_5.m new file mode 100644 index 0000000000000000000000000000000000000000..0a3c8a333e98bbc1e637a6765564c4ba9629d85d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_5.m @@ -0,0 +1,16 @@ +% exercise 4.2.5 + +mfig('Matrix of scatter plots'); clf; +for m1 = 1:M + for m2 = 1:M + subplot(M,M,(m1-1)*M+m2, 'align'); hold all; + for c = 0:C-1 + plot(X(y==c,m2), X(y==c,m1), '.'); + end + axis tight; + if m1<M, set(gca, 'XTick', []); else xlabel(attributeNames{m2}); end; + if m2>1, set(gca, 'YTick', []); else ylabel(attributeNames{m1}); end; + end +end +legend(classNames); + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_2_6.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_6.m new file mode 100644 index 0000000000000000000000000000000000000000..1c5847d8f864b1ae809b56dc3d80be31ec0c585c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_6.m @@ -0,0 +1,13 @@ +% exercise 4.2.6 + +ind = [1 2 3]; % Indices of the variables to plot +mfig('3D scatter plot'); clf; hold all; +for c = 1:C + plot3(X(y==c-1,ind(1)),X(y==c-1,ind(2)),X(y==c-1,ind(3)), '.'); +end +grid on; +xlabel(attributeNames{ind(1)}); +ylabel(attributeNames{ind(2)}); +zlabel(attributeNames{ind(3)}); +legend(classNames); +view(3); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_2_7.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_7.m new file mode 100644 index 0000000000000000000000000000000000000000..2756f69c2a28a256d26253541f6b87173a3237d9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_2_7.m @@ -0,0 +1,9 @@ +% exercise 4.2.7 + +mfig('Data matrix (standardized)'); clf; +imagesc(zscore(X)); +set(gca, 'XTick', 1:M, 'XTickLabel', attributeNames); +xlabel('Attribute'); +ylabel('Data object'); +colormap(gray); +colorbar; diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_3_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_3_1.m new file mode 100644 index 0000000000000000000000000000000000000000..4d75b13bf447bb6666ac82028fa79ddd36977fbc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_3_1.m @@ -0,0 +1,78 @@ +% exercise 4.3.1 + +% Load the data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wine')); + +% We start with a box plot of each attribute +mfig('Wine: Boxplot'); +boxplot(X, attributeNames, 'LabelOrientation', 'inline'); + +% From this it is clear that there are some outliers in the Alcohol +% attribute (10x10^14 is clearly not a proper value for alcohol content) +% However, it is impossible to see the distribution of the data, because +% the axis is dominated by these extreme outliers. To avoid this, we plot a +% box plot of standardized data (using the zscore function). + +mfig('Wine: Boxplot (standardized)'); +boxplot(zscore(X), attributeNames, 'LabelOrientation', 'inline'); + +% This plot reveals that there are clearly some outliers in the Volatile +% acidity, Density, and Alcohol attributes, i.e. attribute number 2, 8, +% and 11. + +% Next, we plot histograms of all attributes. + +mfig('Wine: Histogram'); clf; +for m = 1:M + u = floor(sqrt(M)); v = ceil(M/u); + subplot(u,v,m); + hist(X(:,m)); + xlabel(attributeNames{m}); + axis square; +end +linkax('y'); % Makes the y-axes equal for improved readability + +% This confirms our belief about outliers in attributes 2, 8, and 11. +% To take a closer look at this, we next plot histograms of the +% attributes we suspect contains outliers + +mfig('Wine: Histogram (attributes 2, 8, and 11)'); clf; +m = [2 8 11]; +for i = 1:3 + subplot(1,3,i,'align'); + hist(X(:,m(i)),50); + xlabel(attributeNames{m(i)}); +end +linkax('y'); % Makes the y-axes equal for improved readability + +% The histograms show that there are a few very extreme values in these +% three attributes. To identify these values as outliers, we must use our +% knowledge about the data set and the attributes. Say we expect volatide +% acidity to be around 0-2 g/dm^3, density to be close to 1 g/cm^3, and +% alcohol percentage to be somewhere between 5-20 % vol. Then we can safely +% identify the following outliers, which are a factor of 10 greater than +% the largest we expect. + +idxOutlier = find(X(:,2)>20 | X(:,8)>10 | X(:,11)>200); + +% Finally we will remove these from the data set +X(idxOutlier,:) = []; +y(idxOutlier) = []; +N = N-length(idxOutlier); + +% Now, we can repeat the process to see if there are any more outliers +% present in the data. We take a look at a histogram of all attributes: + +mfig('Wine: Histogram (after outlier detection)'); clf; +for m = 1:M + u = floor(sqrt(M)); v = ceil(M/u); + subplot(u,v,m); + hist(X(:,m)); + xlabel(attributeNames{m}); + axis square; +end +linkax('y'); % Makes the y-axes equal for improved readability + +% This reveals no further outliers, and we conclude that all outliers have +% been detected and removed. diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex4_3_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex4_3_2.m new file mode 100644 index 0000000000000000000000000000000000000000..cccae6c07c0c911ca4ad6f8b1182844ec690f7d9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex4_3_2.m @@ -0,0 +1,54 @@ +% exercise 4.3.2 + +% Load Matlab data file and extract variables of interest +mat_data = load('../Data/wine.mat') + +%% +X = mat_data.X; +y = mat_data.y; +C = mat_data.C; +M = mat_data.M; +classNames = mat_data.classNames; +attributeNames = mat_data.attributeNames; +%% + +% The histograms show that there are a few very extreme values in these +% three attributes. To identify these values as outliers, we must use our +% knowledge about the data set and the attributes. Say we expect volatide +% acidity to be around 0-2 g/dm^3, density to be close to 1 g/cm^3, and +% alcohol percentage to be somewhere between 5-20 % vol. Then we can safely +% identify the following outliers, which are a factor of 10 greater than +% the largest we expect. +outlier_mask = (X(:,1)>20) | (X(:,7)>200) | (X(:,11)>200); +valid_mask = ~outlier_mask; + +% Finally we will remove these from the data set +X = X(valid_mask,:); +y = y(valid_mask,:); +N = length(y); +Xnorm = zscore(X); + +Attributes = [1,4,5,6]; +NumAtr = length(Attributes); + +figure('Units','Centimeter','Position',[8,8,20,20]) +for m1=1:NumAtr + for m2=1:NumAtr + subplot(NumAtr, NumAtr, (m1-1)*NumAtr + m2); hold all; + for c=1:C + class_mask = y == (c-1); + plot(X(class_mask,Attributes(m2)), X(class_mask,Attributes(m1)), '.'); + if m1==NumAtr + xlabel(attributeNames(Attributes(m2))) + else + set(gca,'xtick',[]) + end + if m2==1 + ylabel(attributeNames(Attributes(m1))) + else + set(gca,'ytick',[]) + end + end + end +end +legend(classNames) \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_1_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_1.m new file mode 100644 index 0000000000000000000000000000000000000000..5baecb8b3afa8888c5826905ddffb25d7653eb07 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_1.m @@ -0,0 +1,61 @@ +% exercise 5.1.1 + +% Names of data objects +dataobjectNames = { ... + 'Human', ... + 'Python', ... + 'Salmon', ... + 'Whale', ... + 'Frog', ... + 'Komodo dragon', ... + 'Bat', ... + 'Pigeon', ... + 'Cat', ... + 'Leopard shark', ... + 'Turtle', ... + 'Penguin', ... + 'Porcupine', ... + 'Eel', ... + 'Salamander', ... + }; + +% Attribute names +attributeNames = { ... + 'Body temperature', ... + 'Skin cover', ... + 'Gives birth',... + 'Aquatic creature',... + 'Aerial creature',... + 'Has legs',... + 'Hibernates', + }; + +% Attribute values +X = [ ... + 1, 1, 1, 0, 0, 1, 0; ... + 0, 2, 0, 0, 0, 0, 1; ... + 0, 2, 0, 1, 0, 0, 0; ... + 1, 1, 1, 1, 0, 0, 0; ... + 0, 0, 0, 2, 0, 1, 1; ... + 0, 2, 0, 0, 0, 1, 0; ... + 1, 1, 1, 0, 1, 1, 1; ... + 1, 3, 0, 0, 1, 1, 0; ... + 1, 4, 1, 0, 0, 1, 0; ... + 0, 2, 1, 1, 0, 0, 0; ... + 0, 2, 0, 2, 0, 1, 0; ... + 1, 3, 0, 2, 0, 1, 0; ... + 1, 5, 1, 0, 0, 1, 1; ... + 0, 2, 0, 1, 0, 0, 0; ... + 0, 0, 0, 2, 0, 1, 1; ... + ]; + +% Class indices +y = [3; 4; 2; 3; 0; 4; 3; 1; 3; 2; 4; 1; 3; 2; 0]; + +% Class names +classNames = {'Amphibian', 'Bird', 'Fish', 'Mammal', 'Reptile'}; + +% Number data objects, attributes, and classes +N = 15; +M = 7; +C = 5; diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_1_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_2.m new file mode 100644 index 0000000000000000000000000000000000000000..ba429266675508b97c557e0a2749bece63787c15 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_2.m @@ -0,0 +1,12 @@ +% exercise 5.1.2 + +% Fit classification tree +T = fitctree(X, classNames(y+1), ... + 'splitcriterion', 'gdi', ... + 'categorical', 1:M, ... + 'PredictorNames', attributeNames, ... + 'prune', 'off', ... + 'minparent', 1); + +% View the tree +view(T,'Mode','graph') \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_1_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_3.m new file mode 100644 index 0000000000000000000000000000000000000000..2ef1c53b9c128d959cb028ec38f958a67a1d4aa7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_3.m @@ -0,0 +1,12 @@ +% exercise 5.1.3 + +% Fit classification tree +T = fitctree(X, classNames(y+1), ... + 'splitcriterion', 'deviance', ... + 'categorical', 1:M, ... + 'PredictorNames', attributeNames, ... + 'prune', 'off', ... + 'minparent', 1); + +% View the tree +view(T,'Mode','graph') diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_1_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_4.m new file mode 100644 index 0000000000000000000000000000000000000000..5c747a12f7463f3f06c448550f3d0396c611548c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_4.m @@ -0,0 +1,7 @@ +% exercise 5.1.4 + +% Define a new data object (a dragon) with the attributes given in the text +x = [0 2 1 2 1 1 1]; + +% Evaluate the classification tree for the new data object +T.predict(x) \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_1_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_5.m new file mode 100644 index 0000000000000000000000000000000000000000..c8eec81f074da872f0e3a82d74724922e56c6141 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_5.m @@ -0,0 +1,18 @@ +% exercise 5.1.5 + +% Load the data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wine')); + +% Identify the outliers (see exercise 4.2.1) +idxOutlier = find(X(:,2)>20 | X(:,8)>10 | X(:,11)>200); + +% Remove outliers from the data set +X(idxOutlier,:) = []; +y(idxOutlier) = []; +N = N-length(idxOutlier); + +% Remove attribute 12, Quality score +X(:,12) = []; +attributeNames(12) = []; +M = size(X,2); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_1_6.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_6.m new file mode 100644 index 0000000000000000000000000000000000000000..b1df5639969613acad9054f3bf4c766b9bf82641 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_6.m @@ -0,0 +1,12 @@ +% exercise 5.1.6 + +% Fit classification tree +T = fitctree(X, classNames(y+1), ... + 'splitcriterion', 'gdi', ... + 'categorical', [], ... + 'PredictorNames', attributeNames, ... + 'prune', 'on', ... + 'minparent', 50); + +% View the tree +view(T, 'Mode','graph') diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_1_7.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_7.m new file mode 100644 index 0000000000000000000000000000000000000000..f4a586029ff30e21dc531bbe7c5c27bc8fbdb285 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_1_7.m @@ -0,0 +1,7 @@ +% exercise 5.1.7 + +% Define a new data object with the attributes given in the text +x = [6.9 1.09 .06 2.1 .0061 12 31 .99 3.5 .44 12]; + +% Evaluate the classification tree for the new data object +T.predict(x) diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_2_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_1.m new file mode 100644 index 0000000000000000000000000000000000000000..63b207a4737520434f1f2d3bbb10b5318210a9bc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_1.m @@ -0,0 +1,23 @@ +% exercise 5.2.1 + +% Number of data objects +N = 1000; + +% Attribute values +X = (0:N-1)'; + +% Noise +epsilon = normrnd(0, 0.1, N, 1); + +% Model parameters +w0 = -.5; +w1 = 0.01; + +% Outputs +y = w0+w1*X+epsilon; + +% Make a scatter plot +mfig('Linear regression'); clf; +plot(X, y, '.'); +xlabel('X'); +ylabel('y'); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_2_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_2.m new file mode 100644 index 0000000000000000000000000000000000000000..ba9cba91ac1b207c3aadc2d43d125d1ccf966cc6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_2.m @@ -0,0 +1,15 @@ +% exercise 5.2.2 + +% Estimate model parameters +w_est = glmfit(X, y, 'normal'); + +% Plot the predictions of the model +mfig('Linear regression'); clf; hold all +plot(X, y, '.'); +y_est = w_est(1)+w_est(2)*X; +plot(X, y_est, 'r'); +y_true = w0+w1*X; +plot(X, y_true, 'g'); +xlabel('X'); +ylabel('y'); +legend('Data', 'Fitted model', 'True model'); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_2_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_3.m new file mode 100644 index 0000000000000000000000000000000000000000..1e22b272c8c567a841a99aaa505e255793265d4d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_3.m @@ -0,0 +1,54 @@ +% exercise 5.2.3 + +% Number of data objects +N = 50; + +% Number of non-linear terms in generated data +Kd = 2; + +% Number of non-linear terms in model +Km = 2; + +% Noise variance +s = 0.5; + +% X-values to evaluate model and fit +Xe = linspace(-1, 1, 1000)'; + +%% Data set generation + +% Attribute values +X = linspace(-1, 1, N)'; +Xd = bsxfun(@power, X, 1:Kd); +Xde = bsxfun(@power, Xe, 1:Kd); + +% Noise +epsilon = normrnd(0, s, N, 1); + +% Model parameters +w = -(-.9).^(1:Kd+1)'; + +% Outputs +y = [ones(N,1) Xd]*w+epsilon; + + +%% Model to fit + +% Attribute values +Xm = bsxfun(@power, X, 1:Km); +Xme = bsxfun(@power, Xe, 1:Km); + +% Estimate model parameters +w_est = glmfit(Xm, y, 'normal'); + +% Plot the predictions of the model +mfig('Linear regression'); clf; hold all +plot(X, y, '.'); +y_est = glmval(w_est, Xme, 'identity'); +plot(Xe, y_est, 'r'); +y_true = glmval(w, Xde, 'identity'); +plot(Xe, y_true, 'g'); +xlabel('X'); +ylabel('y'); +legend('Data', 'Fitted model', 'True model'); +ylim([-2 8]); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_2_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_4.m new file mode 100644 index 0000000000000000000000000000000000000000..eb6cc2a70f35a9d51e227b869fcc3a942f715a5b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_4.m @@ -0,0 +1,20 @@ +% exercise 5.2.4 + +% Load wine data +ex5_1_5; + +% Fit linear regression model to predict Alcohol from all other attributes +y = X(:, 11); +Xr = X(:, 1:10); +w_est = glmfit(Xr, y, 'normal'); + +% Make a scatter plot of predicted versus true values of Alcohol +mfig('Alcohol content'); clf; +y_est = glmval(w_est, Xr, 'identity'); +plot(y, y_est, '.'); +xlabel('Alcohol (true)'); +ylabel('Alcohol (estimated)'); + +% Make a histogram of the residual error +mfig('Residual error'); +hist(y-y_est, 40); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_2_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_5.m new file mode 100644 index 0000000000000000000000000000000000000000..21ff4897c61ed32aceaffe3070eff13459a40d9f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_5.m @@ -0,0 +1,23 @@ +% exercise 5.2.5 + +% Load wine data +ex5_1_5; + +% Fit linear regression model to predict Alcohol from all other attributes +y = X(:, 11); +Xr = [X(:,1:10), X(:,1).^2 X(:,2).^2, X(:,1).*X(:,2)]; +w_est = glmfit(Xr, y, 'normal'); + +% Make a scatter plot of predicted versus true values of Alcohol +mfig('Alcohol content'); clf; +y_est = glmval(w_est, Xr, 'identity'); +plot(y, y_est, '.'); +xlabel('Alcohol (true)'); +ylabel('Alcohol (estimated)'); + +% Make a histogram of the residual error +mfig('Residual error'); +hist(y-y_est, 40); + +% Compute mean squared error +mean((y-y_est).^2) \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex5_2_6.m b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_6.m new file mode 100644 index 0000000000000000000000000000000000000000..d30e1a6ed884424a33835e863f2339c9e38eabe7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex5_2_6.m @@ -0,0 +1,13 @@ +% exercise 5.2.6 + +% Load wine data +ex5_1_5; + +% Fit logistic regression model to predict the type of wine +w_est = glmfit(X, y, 'binomial'); + +% Define a new data object with the attributes given in the text +x = [6.9 1.09 .06 2.1 .0061 12 31 .99 3.5 .44 12]; + +% Evaluate the logistic regression for the new data object +p = glmval(w_est, x, 'logit') \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex6_1_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex6_1_1.m new file mode 100644 index 0000000000000000000000000000000000000000..703e5c1941a9e243042e65efd22191468be786b8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex6_1_1.m @@ -0,0 +1,43 @@ +% exercise 6.1.1 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wine2')) + +% Create holdout crossvalidation partition +CV = cvpartition(classNames(y+1), 'Holdout', .5); + +% Pruning levels +prune = 0:10; + +% Variable for classification error count +Error_train = nan(1,length(prune)); +Error_test = nan(1,length(prune)); + +% Extract training and test set +X_train = X(CV.training, :); +y_train = y(CV.training); +X_test = X(CV.test, :); +y_test = y(CV.test); + +% Fit classification tree to training set +T = fitctree(X_train, classNames(y_train+1), ... + 'SplitCriterion', 'gdi', ... + 'CategoricalPredictors', [], ... + 'PredictorNames', attributeNames, ... + 'Prune', 'on', ... + 'MinParentSize', 10); + +% Compute classification error +for n = 1:length(prune) % For each pruning level + Error_train(n) = sum(~strcmp(classNames(y_train+1), T.predict(X_train, 'Subtrees', prune(n)))); + Error_test(n) = sum(~strcmp(classNames(y_test+1), T.predict(X_test, 'Subtrees',prune(n)))); +end + +% Plot classification error +mfig('Wine decision tree: Holdout crossvalidation'); clf; hold all; +plot(prune, Error_train/CV.TrainSize); +plot(prune, Error_test/CV.TestSize); +xlabel('Pruning level'); +ylabel('Classification error'); +legend('Training error', 'Test error'); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex6_1_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex6_1_2.m new file mode 100644 index 0000000000000000000000000000000000000000..f6506d05a66d18d9a4dc9758c9f32f54dafc69b4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex6_1_2.m @@ -0,0 +1,50 @@ +% exercise 6.1.2 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wine2')) + +% Number of folds for crossvalidation +K = 10; + +% Create holdout crossvalidation partition +CV = cvpartition(classNames(y+1), 'Kfold', K); + +% Pruning levels +prune = 0:10; + +% Variable for classification error +Error_train = nan(K,length(prune)); +Error_test = nan(K,length(prune)); + +for k = 1:K + fprintf('Crossvalidation fold %d/%d\n', k, K); + + % Extract training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + % Fit classification tree to training set + T = fitctree(X_train, classNames(y_train+1), ... + 'splitcriterion', 'gdi', ... + 'categorical', [], ... + 'PredictorNames', attributeNames, ... + 'prune', 'on', ... + 'minparent', 10); + + % Compute classification error + for n = 1:length(prune) % For each pruning level + Error_train(k,n) = sum(~strcmp(classNames(y_train+1), T.predict(X_train, 'Subtrees', prune(n)))); + Error_test(k,n) = sum(~strcmp(classNames(y_test+1), T.predict(X_test, 'Subtrees', prune(n)))); + end +end + +% Plot classification error +mfig('Wine decision tree: K-fold crossvalidation'); clf; hold all; +plot(prune, sum(Error_train)/sum(CV.TrainSize)); +plot(prune, sum(Error_test)/sum(CV.TestSize)); +xlabel('Pruning level'); +ylabel('Classification error'); +legend('Training error', 'Test error'); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex6_2_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex6_2_1.m new file mode 100644 index 0000000000000000000000000000000000000000..d219404a915908e03c5e423d4cd44e59daf58378 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex6_2_1.m @@ -0,0 +1,112 @@ +% exercise 6.2.1 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/body')) + +%% Linear regression criterion function + +% This anonymous function takes as input a training and a test set. +% 1. It fits a generalized linear model on the training set using glmfit. +% 2. It estimates the output of the test set using glmval. +% 3. It computes the sum of squared error. +funLinreg = @(X_train, y_train, X_test, y_test) ... + sum((y_test-glmval(glmfit(X_train, y_train), ... + X_test, 'identity')).^2); + +%% Crossvalidation +% Create crossvalidation partition for evaluation +K = 5; +CV = cvpartition(N, 'Kfold', K); + +% Initialize variables +Features = nan(K,M); +Error_train = nan(K,1); +Error_test = nan(K,1); +Error_train_fs = nan(K,1); +Error_test_fs = nan(K,1); +Error_train_nofeatures = nan(K,1); +Error_test_nofeatures = nan(K,1); + +% For each crossvalidation fold +for k = 1:K + fprintf('Crossvalidation fold %d/%d\n', k, K); + + % Extract the training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + % Use 10-fold crossvalidation for sequential feature selection + [F, H] = sequentialfs(funLinreg, X_train, y_train); + + % Save the selected features + Features(k,:) = F; + + % Compute squared error without using the input data at all + Error_train_nofeatures(k) = sum((y_train-mean(y_train)).^2); + Error_test_nofeatures(k) = sum((y_test-mean(y_train)).^2); + % Compute squared error without feature subset selection + Error_train(k) = funLinreg(X_train, y_train, X_train, y_train); + Error_test(k) = funLinreg(X_train, y_train, X_test, y_test); + % Compute squared error with feature subset selection + Error_train_fs(k) = funLinreg(X_train(:,F), y_train, X_train(:,F), y_train); + Error_test_fs(k) = funLinreg(X_train(:,F), y_train, X_test(:,F), y_test); + + % Show variable selection history + mfig(sprintf('(%d) Feature selection',k)); + I = size(H.In,1); % Number of iterations + subplot(1,2,1); % Plot error criterion + plot(H.Crit); + xlabel('Iteration'); + ylabel('Squared error (crossvalidation)'); + title('Value of error criterion'); + xlim([0 I]); + subplot(1,2,2); % Plot feature selection sequence + bmplot(attributeNames, 1:I, H.In'); + title('Attributes selected'); + xlabel('Iteration'); + drawnow; +end + +%% Display results +fprintf('\n'); +fprintf('Linear regression without feature selection:\n'); +fprintf('- Training error: %8.2f\n', sum(Error_train)/sum(CV.TrainSize)); +fprintf('- Test error: %8.2f\n', sum(Error_test)/sum(CV.TestSize)); +fprintf('- R^2 train: %8.2f\n', (sum(Error_train_nofeatures)-sum(Error_train))/sum(Error_train_nofeatures)); +fprintf('- R^2 test: %8.2f\n', (sum(Error_test_nofeatures)-sum(Error_test))/sum(Error_test_nofeatures)); +fprintf('Linear regression with sequential feature selection:\n'); +fprintf('- Training error: %8.2f\n', sum(Error_train_fs)/sum(CV.TrainSize)); +fprintf('- Test error: %8.2f\n', sum(Error_test_fs)/sum(CV.TestSize)); +fprintf('- R^2 train: %8.2f\n', (sum(Error_train_nofeatures)-sum(Error_train_fs))/sum(Error_train_nofeatures)); +fprintf('- R^2 test: %8.2f\n', (sum(Error_test_nofeatures)-sum(Error_test_fs))/sum(Error_test_nofeatures)); + +% Show the selected features +mfig('Attributes'); clf; +bmplot(attributeNames, 1:K, Features'); +xlabel('Crossvalidation fold'); +ylabel('Attribute'); +title('Attributes selected'); + +% Inspect selected feature coefficients effect on the entire dataset and +% plot the fitted modeld residual error as function of each attribute to +% inspect for systematic structure in the residual +k=1; % cross-validation fold to inspect +ff=find(Features(k,:)); +w=glmfit(X(:,ff), y) + +y_est= glmval(w,X(:,ff),'identity'); +residual=y-y_est; +mfig(['Residual error vs. Attributes for features selected in cross-validation fold' num2str(k)]); clf; +for k=1:length(ff) + subplot(2,ceil(length(ff)/2),k); + plot(X(:,ff(k)),residual,'.'); + xlabel(attributeNames{ff(k)},'FontWeight','bold'); + ylabel('residual error','FontWeight','bold'); +end + + + + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex6_3_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex6_3_1.m new file mode 100644 index 0000000000000000000000000000000000000000..2d66a1c0a1fcc481948be4dd412230c9a9239076 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex6_3_1.m @@ -0,0 +1,35 @@ +% exercise 7.1.1 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth1')) + +%% Make a scatterplot of the data +mfig('Synthetic data'); clf; hold all; +Color = {'b', 'r', 'g', 'm'}; +for c = 1:C + plot(X_train(y_train==c-1,1), X_train(y_train==c-1,2), '.', 'Color', Color{c}); +end +plot(X_test(:,1), X_test(:,2), 'kx'); + +%% K-nearest neighbors +K = 5; % Number of neighbors +Distance = 'euclidean'; % Distance measure + +% Use knnclassify to find the K nearest neighbors +% old code: +% y_test_est = knnclassify(X_test, X_train, y_train, K, Distance); +% new code: +knn=fitcknn(X_train, y_train, 'NumNeighbors', K, 'Distance', Distance); +y_test_est=predict(knn, X_test); + + +% Plot estimated classes +mfig('Synthetic data'); hold all; +for c = 1:C + plot(X_test(y_test_est==c-1,1), X_test(y_test_est==c-1,2), 'o', 'Color', Color{c}); +end + +% Plot confusion matrix +mfig('Confusion matrix'); +confmatplot(classNames(y_test+1), classNames(y_test_est+1)); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex6_3_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex6_3_2.m new file mode 100644 index 0000000000000000000000000000000000000000..088972d99e41ed6ce19967c7c54046e33e9c8a58 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex6_3_2.m @@ -0,0 +1,44 @@ +% exercise 6.3.2 + +% Load data +ex4_2_1 + +% Leave-one-out crossvalidation +CV = cvpartition(N, 'Leaveout'); +K = CV.NumTestSets; + +% K-nearest neighbors parameters +Distance = 'euclidean'; % Distance measure +L = 40; % Maximum number of neighbors + +% Variable for classification error +Error = nan(K,L); + +for k = 1:K % For each crossvalidation fold + fprintf('Crossvalidation fold %d/%d\n', k, CV.NumTestSets); + + % Extract training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + for l = 1:L % For each number of neighbors + + % Use knnclassify to find the l nearest neighbors + % old code: + % y_test_est = knnclassify(X_test, X_train, y_train, l, Distance); + % new code: + knn=fitcknn(X_train, y_train, 'NumNeighbors', l, 'Distance', Distance); + y_test_est=predict(knn, X_test); + + % Compute number of classification errors + Error(k,l) = sum(y_test~=y_test_est); % Count the number of errors + end +end + +%% Plot the classification error rate +mfig('Error rate'); +plot(sum(Error)./sum(CV.TestSize)*100); +xlabel('Number of neighbors'); +ylabel('Classification error rate (%)'); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex7_1_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex7_1_1.m new file mode 100644 index 0000000000000000000000000000000000000000..ba4e4ba592b289afbceb9615675b502fc85ef118 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex7_1_1.m @@ -0,0 +1,40 @@ +% exercise 7.3.1. Evaluation of a classifier +% Load data +ex4_2_1 + +% Leave-one-out crossvalidation +CV = cvpartition(N, 'Leaveout'); +K = CV.NumTestSets; + +% K-nearest neighbors parameters +Distance = 'euclidean'; % Distance measure +L = [1,20,80]; % Maximum number of neighbors + +% Variable for classification error +Error = nan(K,length(L)); + +yhat = []; +y_true = []; +for k = 1:K % For each crossvalidation fold + fprintf('Crossvalidation fold %d/%d\n', k, CV.NumTestSets); + + % Extract training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + y_true(k,1) = y_test(1); + + for l = 1:length(L) % For each number of neighbors + % Use knnclassify to find the l nearest neighbors + knn=fitcknn(X_train, y_train, 'NumNeighbors', L(l), 'Distance', Distance); + y_test_est=predict(knn, X_test); + + % Compute number of classification errors + Error(k,l) = sum(y_test~=y_test_est); % Count the number of errors + yhat(k,l) = y_test_est(1); + end +end +%% Compute accuracy of the three models here using y_true and yhat here +% \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex7_1_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex7_1_2.m new file mode 100644 index 0000000000000000000000000000000000000000..6476360b444a328dc72c4271c6372def642d238f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex7_1_2.m @@ -0,0 +1,5 @@ +% exercise 7.3.2. Evaluation of a classifier +%% Re-compute results +ex7_1_1 +alpha = 0.05; +[thetahatA, CIA] = jeffrey_interval(y_true, yhat(:,1), alpha); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex7_1_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex7_1_4.m new file mode 100644 index 0000000000000000000000000000000000000000..ca2de4b80eb3e612d26025a229f656a7725d7ffb --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex7_1_4.m @@ -0,0 +1,5 @@ +% exercise 7.3.3. Comparing two classifiers +%% Re-compute results used in classification problem. +ex7_1_1 +alpha = 0.05; +[thetahat, CI, p] = mcnemar(y_true, yhat(:,1), yhat(:,2), alpha); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex7_2_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex7_2_1.m new file mode 100644 index 0000000000000000000000000000000000000000..faafe88b0bea9a41d0184143003a1d9fbc50885e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex7_2_1.m @@ -0,0 +1,47 @@ +% exercise 7.2.1 + +ex5_1_5; +% Construct a regression problem where the goal is to predict alcohol +% content based on attributes 1--10. +y = X(:,11); +X = X(:,1:10); +% split into a training and test set. +rng(1) +K = 1; +CV = cvpartition(N, 'HoldOut', 0.2); +%K = 10; +%CV = cvpartition(N, 'Kfold', K); + +% For each crossvalidation fold +y_true = []; +yhat = []; +for k = 1:K + fprintf('Crossvalidation fold %d/%d\n', k, K); + % Extract the training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + %% Train a linear regression model (Model A). + % see script from exercise 5.2.3 for details + w_est = glmfit(X_train, y_train, 'normal'); + yfitA = glmval(w_est, X_test, 'identity'); + %% + %% Train and test a regression tree (model B). + tree = fitrtree(X_train, y_train); + yfitB = tree.predict(X_test); + %% Gather results + y_true = [y_true ; y_test]; + yhat = [yhat ; [yfitA, yfitB]]; +end +%% perform statistical comparison of the models +% compute z with squared error. +zA = abs(y_true - yhat(:,1) ).^2; +%% compute confidence interval of model A +alpha = 0.05; +[~, ~, CIA] = ttest( zA, [], 'alpha', alpha); +%% compute confidence interval of z=zA-zB and p-value of Null hypothesis +zB = abs(y_true - yhat(:,2) ).^2; +z = zA - zB; +[~, p, CI] = ttest( z, [], 'alpha', alpha); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex7_3_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex7_3_1.m new file mode 100644 index 0000000000000000000000000000000000000000..9931ee781193d650bb27ee363fbf6d824e2db00e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex7_3_1.m @@ -0,0 +1,57 @@ +% exercise 7.3.1. Test appropriate for Setup II +ex5_1_5; +% Construct a regression problem where the goal is to predict alcohol +% content based on attributes 1--10. +y = X(:,11); +X = X(:,1:10); +% split into a training and test set. +rng('default'); +K = 10; % We presently set J = K but Setup II can also as described in the book be used for repeated cross-validation +m = 2; % repeated cross validation. + +r = []; +for dm=1:m + CV = cvpartition(N, 'Kfold', K); + % For each crossvalidation fold + y_true = []; + yhat = []; + for k = 1:K + fprintf('Crossvalidation fold %d/%d\n', k, K); + % Extract the training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + %% Train a linear regression model (Model A). + % see script from exercise 5.2.3 for details + w_est = glmfit(X_train, y_train, 'normal'); + yfitA = glmval(w_est, X_test, 'identity'); + %% + %% Train and test a regression tree (model B). + tree = fitrtree(X_train, y_train); + yfitB = tree.predict(X_test); + %% Gather results + y_true = [y_true ; y_test]; + yhat = [yhat ; [yfitA, yfitB]]; + + % calculate average difference in loss for this fold. + loss = 1; + r(end+1) = mean( abs( yfitA-y_test ).^loss - abs( yfitB-y_test).^loss ); + end +end +%% +alpha = 0.05; +rho = 1/K; +[p_setupII, CI_setupII] = correlated_ttest(r, rho, alpha); +%% perform statistical comparison of the models using setupI. +if m == 1 + % note our usual setup I ttest only makes sense if m=1. + zA = abs(y_true - yhat(:,1) ).^loss; + zB = abs(y_true - yhat(:,2) ).^loss; + z = zA - zB; + [~, p_setupI, CI_setupI] = ttest( z, [], 'alpha', alpha); + + [p_setupII, p_setupI] + [CI_setupII ; CI_setupI'] +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex7_4_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex7_4_3.m new file mode 100644 index 0000000000000000000000000000000000000000..3df2461e9d3bdd1980879d9b29388ff5bfaf5f20 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex7_4_3.m @@ -0,0 +1,30 @@ +% exercise 7.2.3 + +%% Read male and female names and extract features +cdir = fileparts(mfilename('fullpath')); +male = importdata(fullfile(cdir,'../Data/male.txt'),'\n'); +female = importdata(fullfile(cdir,'../Data/female.txt'),'\n'); + +% Filter the data to remove names that are less than four letters long +idx_male = cellfun(@(x) length(x)>=4, male); +idx_female = cellfun(@(x) length(x)>=4, female); +male=male(idx_male); +female=female(idx_female); + +% Extract male name features +Xmale = lower(cellfun(@(x) [x(1) x(2) x(end-1) x(end)], male, 'UniformOutput', false)); +Xmale = double(char(Xmale))-double('a')+1; + +% Extract female name features +Xfemale = lower(cellfun(@(x) [x(1) x(2) x(end-1) x(end)], female, 'UniformOutput', false)); +Xfemale = double(char(Xfemale))-double('a')+1; + +% Concatenate male and female +X = [Xmale; Xfemale]; + +% Make class indices etc. +y = [zeros(size(Xmale,1),1); ones(size(Xfemale,1),1)]; +[N,M] = size(X); +C = 2; +attributeNames = {'1st letter', '2nd letter', 'Next-to-last letter', 'Last letter'}; +classNames = {'Female', 'Male'}; diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex7_4_4.m b/exercises/02450Toolbox_Matlab/Scripts/ex7_4_4.m new file mode 100644 index 0000000000000000000000000000000000000000..930fc6488e405b4a290d9f1ce344af7080ec8c7d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex7_4_4.m @@ -0,0 +1,38 @@ +% exercise 7.2.4 + +% Load data +ex7_4_3; + +% K-fold crossvalidation +K = 10; +CV = cvpartition(y, 'Kfold', K); + +% Parameters for naive Bayes classifier +Distribution = 'mvmn'; +Prior = 'uniform'; + +% Variable for classification error +Error = nan(K,1); + + +for k = 1:K % For each crossvalidation fold + fprintf('Crossvalidation fold %d/%d\n', k, CV.NumTestSets); + + % Extract training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + % Fit naive Bayes classifier to training set + NB = fitcnb(X_train, y_train, 'DistributionNames', Distribution, 'Prior', Prior,'CategoricalPredictors','all'); + + % Predict model on test data + y_test_est = predict(NB, X_test); + + % Compute error rate + Error(k) = sum(y_test~=y_test_est); % Count the number of errors +end + +% Print the error rate +fprintf('Error rate: %.1f%%\n', sum(Error)./sum(CV.TestSize)*100); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex8_1_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex8_1_1.m new file mode 100644 index 0000000000000000000000000000000000000000..d0fdd316955156265151e694a21a2d1d47f12509 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex8_1_1.m @@ -0,0 +1,156 @@ +% exercise 8.1.1 +clear all +close all; +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/body')) +%% Regularized Linear regression +% include an additional attribute corresponding to the offset +X=[ones(size(X,1),1) X]; +M=M+1; +attributeNames={'Offset', attributeNames{1:end}}; + +% Crossvalidation +% Create crossvalidation partition for evaluation of performance of optimal +% model +K = 5; +CV = cvpartition(N, 'Kfold', K); + +% Values of lambda +lambda_tmp=10.^(-5:8); + +% Initialize variables +T=length(lambda_tmp); +Error_train = nan(K,1); +Error_test = nan(K,1); +Error_train_rlr = nan(K,1); +Error_test_rlr = nan(K,1); +Error_train_nofeatures = nan(K,1); +Error_test_nofeatures = nan(K,1); +Error_train2 = nan(T,K); +Error_test2 = nan(T,K); +w = nan(M,T,K); +lambda_opt = nan(K,1); +w_rlr = nan(M,K); +mu = nan(K, M-1); +sigma = nan(K, M-1); +w_noreg = nan(M,K); + +% For each crossvalidation fold +for k = 1:K + fprintf('Crossvalidation fold %d/%d\n', k, K); + + % Extract the training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + % Use 10-fold crossvalidation to estimate optimal value of lambda + KK = 10; + CV2 = cvpartition(size(X_train,1), 'Kfold', KK); + for kk=1:KK + X_train2 = X_train(CV2.training(kk), :); + y_train2 = y_train(CV2.training(kk)); + X_test2 = X_train(CV2.test(kk), :); + y_test2 = y_train(CV2.test(kk)); + + % Standardize the training and test set based on training set in + % the inner fold + mu2 = mean(X_train2(:,2:end)); + sigma2 = std(X_train2(:,2:end)); + X_train2(:,2:end) = (X_train2(:,2:end) - mu2) ./ sigma2; + X_test2(:,2:end) = (X_test2(:,2:end) - mu2) ./ sigma2; + + Xty2 = X_train2' * y_train2; + XtX2 = X_train2' * X_train2; + for t=1:length(lambda_tmp) + % Learn parameter for current value of lambda for the given + % inner CV_fold + regularization = lambda_tmp(t) * eye(M); + regularization(1,1) = 0; % Remove regularization of bias-term + w(:,t,kk)=(XtX2+regularization)\Xty2; + % Evaluate training and test performance + Error_train2(t,kk) = sum((y_train2-X_train2*w(:,t,kk)).^2); + Error_test2(t,kk) = sum((y_test2-X_test2*w(:,t,kk)).^2); + end + end + + % Select optimal value of lambda + [val,ind_opt]=min(sum(Error_test2,2)/sum(CV2.TestSize)); + lambda_opt(k)=lambda_tmp(ind_opt); + + % Display result for last cross-validation fold (remove if statement to + % show all folds) + if k == K + mfig(sprintf('(%d) Regularized Solution',k)); + subplot(1,2,1); % Plot error criterion + semilogx(lambda_tmp, mean(w(2:end,:,:),3),'.-'); + % For a more tidy plot, we omit the attribute names, but you can + % inspect them using: + %legend(attributeNames(2:end), 'location', 'best'); + xlabel('\lambda'); + ylabel('Coefficient Values'); + title('Values of w'); + subplot(1,2,2); % Plot error + loglog(lambda_tmp,[sum(Error_train2,2)/sum(CV2.TrainSize) sum(Error_test2,2)/sum(CV2.TestSize)],'.-'); + legend({'Training Error as function of lambda','Test Error as function of lambda'},'Location','SouthEast'); + title(['Optimal value of lambda: 1e' num2str(log10(lambda_opt(k)))]); + xlabel('\lambda'); + drawnow; + end + + % Standardize datasets in outer fold, and save the mean and standard + % deviations since they're part of the model (they would be needed for + % making new predictions) + mu(k, :) = mean(X_train(:,2:end)); + sigma(k, :) = std(X_train(:,2:end)); + + X_train_std = X_train; + X_test_std = X_test; + X_train_std(:,2:end) = (X_train(:,2:end) - mu(k , :)) ./ sigma(k, :); + X_test_std(:,2:end) = (X_test(:,2:end) - mu(k, :)) ./ sigma(k, :); + + % Estimate w for the optimal value of lambda + Xty=(X_train_std'*y_train); + XtX=X_train_std'*X_train_std; + + regularization = lambda_opt(k) * eye(M); + regularization(1,1) = 0; + w_rlr(:,k) = (XtX+regularization)\Xty; + + % evaluate training and test error performance for optimal selected value of + % lambda + Error_train_rlr(k) = sum((y_train-X_train_std*w_rlr(:,k)).^2); + Error_test_rlr(k) = sum((y_test-X_test_std*w_rlr(:,k)).^2); + + % Compute squared error without regularization + w_noreg(:,k)=XtX\Xty; + Error_train(k) = sum((y_train-X_train_std*w_noreg(:,k)).^2); + Error_test(k) = sum((y_test-X_test_std*w_noreg(:,k)).^2); + + % Compute squared error without using the input data at all + Error_train_nofeatures(k) = sum((y_train-mean(y_train)).^2); + Error_test_nofeatures(k) = sum((y_test-mean(y_train)).^2); + +end + +%% Display results +fprintf('\n'); +fprintf('Linear regression without feature selection:\n'); +fprintf('- Training error: %8.2f\n', sum(Error_train)/sum(CV.TrainSize)); +fprintf('- Test error: %8.2f\n', sum(Error_test)/sum(CV.TestSize)); +fprintf('- R^2 train: %8.2f\n', (sum(Error_train_nofeatures)-sum(Error_train))/sum(Error_train_nofeatures)); +fprintf('- R^2 test: %8.2f\n', (sum(Error_test_nofeatures)-sum(Error_test))/sum(Error_test_nofeatures)); +fprintf('Regularized linear regression:\n'); +fprintf('- Training error: %8.2f\n', sum(Error_train_rlr)/sum(CV.TrainSize)); +fprintf('- Test error: %8.2f\n', sum(Error_test_rlr)/sum(CV.TestSize)); +fprintf('- R^2 train: %8.2f\n', (sum(Error_train_nofeatures)-sum(Error_train_rlr))/sum(Error_train_nofeatures)); +fprintf('- R^2 test: %8.2f\n', (sum(Error_test_nofeatures)-sum(Error_test_rlr))/sum(Error_test_nofeatures)); + +fprintf('\n'); +fprintf('Weight in last fold: \n'); +for m = 1:M + disp( sprintf(['\t', attributeNames{m},':\t ', num2str(w_rlr(m,end))])) +end +%disp(w_rlr(:,end)) diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex8_1_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex8_1_2.m new file mode 100644 index 0000000000000000000000000000000000000000..e517ad994e3a84c1797600b7610ab424fa8f4b6f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex8_1_2.m @@ -0,0 +1,85 @@ +% exercise 8.1.2 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wine2')) + +%% Crossvalidation +% Create crossvalidation partition for evaluation +% using stratification and 95 pct. split between training and test +CV = cvpartition(classNames(y+1), 'Holdout', .95); + +% Extract the training and test set +X_train = X(CV.training, :); +y_train = y(CV.training); +X_test = X(CV.test, :); +y_test = y(CV.test); + +% Standardize the data +mu = mean(X_train,1); +sigma = std(X_train,1); +X_train_std = bsxfun(@times, X_train - mu, 1./ sigma); +X_test_std = bsxfun(@times, X_test - mu, 1./ sigma); + +%% Fit model +% Fit regularized logistic regression model to training data to predict +% the type of wine +lambda = logspace(-8,0,50); +test_error_rate = nan(length(lambda),1); +train_error_rate = nan(length(lambda),1); +coefficient_norm = nan(length(lambda),1); +for k = 1:length(lambda) + mdl = fitclinear(X_train_std, y_train, ... + 'Lambda', lambda(k), ... + 'Learner', 'logistic', ... + 'Regularization', 'ridge'); + [y_train_est, p] = predict(mdl, X_train_std); + train_error_rate(k) = sum( y_train ~= y_train_est ) / length(y_train); + + [y_test_est, p] = predict(mdl, X_test_std); + test_error_rate(k) = sum( y_test ~= y_test_est ) / length(y_test); + + coefficient_norm(k) = norm(mdl.Beta,2); +end +[min_error,lambda_idx] = min(test_error_rate); + +%% +mfig('Logistic regression: optimal regularization strength'); clf; +subplot(3,1,1) + semilogx(lambda, test_error_rate*100) + hold on + semilogx(lambda, train_error_rate*100) + xlabel('Regularization strength (\lambda)') + ylabel('Error rate (%)') + ylim([0 10]) + xlim([min(lambda) max(lambda)]) + title('Error rate') + legend(['Test error, n=', num2str(length(y_test))], ... + ['Training Error, n=', num2str(length(y_train))]) + grid minor + +subplot(3,1,2) + semilogx(lambda, test_error_rate*100) + hold on + semilogx(lambda, train_error_rate*100) + title('Error rate (zoom)') + xlabel('Regularization strength (\lambda)') + ylabel('Error rate (%)') + xlim([1e-6 1e0]) + ylim([0 2.5]) + text(1.5e-6, 2.25, ['Minimum test error: ', num2str(min_error*100,3), ' % at \lambda=1e', ... + num2str(log10(lambda(lambda_idx)),2)], ... + 'FontSize',16) + grid minor + +subplot(3,1,3) + semilogx(lambda, coefficient_norm,'k') + xlabel('Regularization strength (\lambda)') + ylabel('L2 norm of parameter vector') + title('Parameter vector norm') + xlim([min(lambda) max(lambda)]) + grid minor + + + + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex8_2_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex8_2_2.m new file mode 100644 index 0000000000000000000000000000000000000000..2f222d22949fc3dbcf1c5c3757dc6ef8580e84ce --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex8_2_2.m @@ -0,0 +1,63 @@ +% exercise 8.2.2 +% Last updated 17 nov. 2015 +% Load data +p = path(); +cdir = fileparts(mfilename('fullpath')); +rmpath(fullfile(cdir,'../Tools/nc_multiclass')); +addpath(fullfile(cdir,'../Tools/nc_binclass')); + +load(fullfile(cdir,'../Data/xor')) + +% K-fold crossvalidation +K = 10; +CV = cvpartition(y, 'Kfold', K); + +% Parameters for neural network classifier +NHiddenUnits = 1; % Number of hidden units +NTrain = 1; % Number of re-trains of neural network + +% Variable for classification error +Error = nan(K,1); +bestnet = cell(K,1); + +for k = 1:K % For each crossvalidation fold + fprintf('Crossvalidation fold %d/%d\n', k, CV.NumTestSets); + + % Extract training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + % Fit neural network to training set + MSEBest = inf; + for t = 1:NTrain + netwrk = nc_main(X_train, y_train, X_test, y_test, NHiddenUnits); + if netwrk.Etrain(end)<MSEBest, bestnet{k} = netwrk; MSEBest=netwrk.Etrain(end); end + end + + % Predict model on test data + y_test_est = bestnet{k}.t_est_test>.5; + + % Compute error rate + Error(k) = sum(y_test~=y_test_est); % Count the number of errors +end + + +% Print the error rate +fprintf('Error rate: %.1f%%\n', sum(Error)./sum(CV.TestSize)*100); + +% Display the trained network +mfig('Trained Network'); +clf; +k=1; % cross-validation fold +displayNetworkClassification(bestnet{k}); + + +% Display the decision boundary (use only for two class classification problems) +if size(X_train,2)==2 % Works only for problems with two attributes + mfig('Decision Boundary'); + displayDecisionFunctionNetworkClassification(X_train, y_train, X_test, y_test, bestnet{k}); +end + +path(p); %reset path. \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex8_2_5.m b/exercises/02450Toolbox_Matlab/Scripts/ex8_2_5.m new file mode 100644 index 0000000000000000000000000000000000000000..f5621f667e61e09db6bea388c7f218a7d571279d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex8_2_5.m @@ -0,0 +1,71 @@ +% exercise 8.2.5 +% Last updated 17 nov. 2015 +p = path(); +cdir = fileparts(mfilename('fullpath')); +rmpath(fullfile(cdir,'../Tools/nc_multiclass')); +addpath(fullfile(cdir,'../Tools/nc_binclass')); +% Load data +load(fullfile(cdir,'../Data/wine2')) + +% predict white vs. red wine type. + +% K-fold crossvalidation +K = 5; +CV = cvpartition(N,'Kfold', K); + +% Parameters for neural network classifier +NHiddenUnits = 2; % Number of hidden units +NTrain = 2; % Number of re-trains of neural network + +% Variable for classification error +Error_train = nan(K,1); +Error_test = nan(K,1); +bestnet=cell(K,1); + +for k = 1:K % For each crossvalidation fold + fprintf('Crossvalidation fold %d/%d\n', k, CV.NumTestSets); + + % Extract training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + % Fit neural network to training set + MSEBest = inf; + for t = 1:NTrain + netwrk = nc_main(X_train, y_train, X_test, y_test, NHiddenUnits); + if netwrk.Etrain(end)<MSEBest, + bestnet{k} = netwrk; + % MSEBest=netwrk.Etrain(end); + MSEBest=netwrk.Etrain(end); + end + end + + % Predict model on test and training data + y_train_est = bestnet{k}.t_est_train; + y_test_est = bestnet{k}.t_est_test; + + % Compute number of committed errors + Error_train(k) = sum((y_train~=y_train_est)); + Error_test(k) = sum((y_test~=y_test_est)); +end + +% Print the least squares errors +%% Display results +fprintf('\n'); +fprintf('Neural network regression without feature selection:\n'); +fprintf('- Training error rate: %.1f%%\n', sum(Error_train)/sum(CV.TrainSize)*100); +fprintf('- Test error rate: %.1f%%\n', sum(Error_test)/sum(CV.TestSize)*100); + +path(p); % reset path. +% Display the trained network +mfig('Trained Network'); +k=1; % cross-validation fold +displayNetworkClassification(bestnet{k}); + +% Display the decition boundary (use only for two class classification problems) +if size(X_train,2)==2 % Works only for problems with two attributes + mfig('Decision Boundary'); + displayDecisionFunctionNetworkClassification(X_train, y_train, X_test, y_test, bestnet{k}); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex8_2_6.m b/exercises/02450Toolbox_Matlab/Scripts/ex8_2_6.m new file mode 100644 index 0000000000000000000000000000000000000000..61d9c7c55536c6f5d71e84a1bf490ad3401c4406 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex8_2_6.m @@ -0,0 +1,75 @@ +% exercise 8.2.6 +% Last updated 17 nov. 2015 +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wine2')) + +% predict alcohol content +y=X(:,11); +X(:,11)=[]; + +% K-fold crossvalidation +K = 10; +CV = cvpartition(N,'Kfold', K); + +% Parameters for neural network classifier +NHiddenUnits = 10; % Number of hidden units +NTrain = 1; % Number of re-trains of neural network + +% Variable for regression error +Error_train = nan(K,1); +Error_test = nan(K,1); +Error_train_nofeatures = nan(K,1); +Error_test_nofeatures = nan(K,1); +bestnet=cell(K,1); + +for k = 1:K % For each crossvalidation fold + fprintf('Crossvalidation fold %d/%d\n', k, CV.NumTestSets); + + % Extract training and test set + X_train = X(CV.training(k), :); + y_train = y(CV.training(k)); + X_test = X(CV.test(k), :); + y_test = y(CV.test(k)); + + % Fit neural network to training set + MSEBest = inf; + for t = 1:NTrain + netwrk = nr_main(X_train, y_train, X_test, y_test, NHiddenUnits); + if netwrk.mse_train(end)<MSEBest, bestnet{k} = netwrk; MSEBest=netwrk.mse_train(end); MSEBest=netwrk.mse_train(end); end + end + + % Predict model on test and training data + y_train_est = bestnet{k}.t_pred_train; + y_test_est = bestnet{k}.t_pred_test; + + % Compute least squares error + Error_train(k) = sum((y_train-y_train_est).^2); + Error_test(k) = sum((y_test-y_test_est).^2); + + % Compute least squares error when predicting output to be mean of + % training data + Error_train_nofeatures(k) = sum((y_train-mean(y_train)).^2); + Error_test_nofeatures(k) = sum((y_test-mean(y_train)).^2); +end + +% Print the least squares errors +%% Display results +fprintf('\n'); +fprintf('Neural network regression without feature selection:\n'); +fprintf('- Training error: %8.2f\n', sum(Error_train)/sum(CV.TrainSize)); +fprintf('- Test error: %8.2f\n', sum(Error_test)/sum(CV.TestSize)); +fprintf('- R^2 train: %8.2f\n', (sum(Error_train_nofeatures)-sum(Error_train))/sum(Error_train_nofeatures)); +fprintf('- R^2 test: %8.2f\n', (sum(Error_test_nofeatures)-sum(Error_test))/sum(Error_test_nofeatures)); + + +% Display the trained network +mfig('Trained Network'); +k=1; % cross-validation fold +displayNetworkRegression(bestnet{k}); + +% Display how network predicts (only for when there are two attributes) +if size(X_train,2)==2 % Works only for problems with two attributes + mfig('Decision Boundary'); + displayDecisionFunctionNetworkRegression(X_train, y_train, X_test, y_test, bestnet{k}); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex8_3_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex8_3_1.m new file mode 100644 index 0000000000000000000000000000000000000000..548fb68dab09ca93c7a7ad50b2f1051f8cd6fdba --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex8_3_1.m @@ -0,0 +1,36 @@ +% exercise 8.3.1 +clear all; +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth1')) + +% Parameters for neural network classifier +NHiddenUnits = 3; % Number of hidden units + +%% Fit multiclass neural network to training set +net = nc_main(X_train, y_train+1, X_test, y_test+1, NHiddenUnits); + +%% Compute results on test data +% Get the predicted output for the test data +Y_test_est = nc_eval(net, X_test); + +% Compute the class index by finding the class with highest probability from the neural +% network +y_test_est = max_idx(Y_test_est); +% Subtract one to have y_test_est between 0 and C-1 +y_test_est = y_test_est-1; + +% Compute error rate +ErrorRate = sum(y_test~=y_test_est)/N_test; +fprintf('Error rate: %.0f%%\n', ErrorRate*100); + +%% Plot results +% Display trained network +mfig('Trained network'); clf; +displayNetworkClassification(net) + +% Display decision boundaries +mfig('Decision Boundaries'); clf; +dbplot(X_test, y_test, @(X) max_idx(nc_eval(net, X))-1); +xlabel(attributeNames(1)); +ylabel(attributeNames(2)); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex8_3_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex8_3_2.m new file mode 100644 index 0000000000000000000000000000000000000000..38a7bb6679da90e8d6e1da1707690680581836f6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex8_3_2.m @@ -0,0 +1,31 @@ +% exercise 8.3.2 +clear all; +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth1')) + +%% Fit multinomial regression model +Y_train=oneoutofk(y_train,C); +Y_test=oneoutofk(y_test,C); + +W_est = mnrfit(X_train, Y_train); + +%% Compute results on test data +% Get the predicted output for the test data +Y_test_est = mnrval(W_est, X_test); + +% Compute the class index by finding the class with highest probability from the multinomial regression model +[y_, y_test_est] = max(Y_test_est, [], 2); +% Subtract one to have y_test_est between 0 and C-1 +y_test_est = y_test_est-1; + +% Compute error rate +ErrorRate = sum(y_test~=y_test_est)/N_test; +fprintf('Error rate: %.0f%%\n', ErrorRate*100); + +%% Plot results +% Display decision boundaries +mfig('Decision Boundaries'); clf; +dbplot(X_test, y_test, @(X) max_idx(mnrval(W_est,X))-1); +xlabel(attributeNames(1)); +ylabel(attributeNames(2)); diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex8_3_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex8_3_3.m new file mode 100644 index 0000000000000000000000000000000000000000..140c72700d2510daaee2d4801567e283cd7f2d7c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex8_3_3.m @@ -0,0 +1,95 @@ +% exercise 8.3.3 +clear all; +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth2')) + +%% Fit regularized multinomial regression model +% Standardize based on training set +mu = mean(X_train,1); +sigma = std(X_train,1); +X_train = bsxfun(@times, X_train - mu, 1./ sigma); +X_test = bsxfun(@times, X_test - mu, 1./ sigma); + +% Define the softmax loss for multinomial logistic regression +funObj = @(W)SoftmaxLoss2(W, ... + [ones(length(X_train),1) X_train], ... + y_train+1,C); + +% Setup the reguliarzation parameter +regularization_strength = 1e3; +% Try a high regularization strength, e.g. 1e3, especially for synth2, +% synth3 and synth 4, and investigate the estimated distributions + +lambda = regularization_strength*ones(M+1,C-1);i +lambda(1,:) = 0; % Don't penalize biases +options = []; + +% Train the model using fminunc +fprintf('Training multinomial logistic regression model...\n'); +wSoftmax = fminunc(@penalizedL2,zeros((M+1)*(C-1),1), ... + options,funObj,lambda(:)); +%wSoftmax = minFunc(@penalizedL2, zeros((M+1)*(C-1),1), ... +% options, funObj, lambda(:)); +% Notice that we fit to obtain weights for C-1 classes. We now reshape the +% weights such that each row represents an attribute (including the bias) +% and each column represent a class, representing the last class by zero +% weights +wSoftmax = reshape(wSoftmax,[M+1 C-1]); +wSoftmax = [wSoftmax zeros(M+1,1)]; + +% Predict the class of the test set using the fitted model +[~, y_test_est] = max([ones(length(X_test),1) X_test]*wSoftmax,[],2); +y_test_est = y_test_est-1; + +% Compute error rate +ErrorRate = sum( y_test ~= y_test_est ) / N_test; +fprintf('Error rate: %.0f%%\n', ErrorRate * 100); + +%% Plot results +% Display decision boundaries +mfig('Decision Boundaries'); clf; +dbplot(X_test, y_test, @(X) max_idx([ones(length(X),1) X]*wSoftmax)-1); +xlabel(attributeNames(1)); +ylabel(attributeNames(2)); + +%% Effect of high regularization strength +% Make a plot of the distribution of the training set labels and the +% estimated labels. Try using a very high regularization strength, e.g. +% 1e10, how does that affect the estimates (which label dominates in the +% estimations)? Try relating this effect to the regularized linear +% regression with very high regularization strength. + +edges = unique(y)-.5; +edges(C+1) = edges(C)+1 +counts = [ histcounts(y_train, edges,'normalization','probability'); ... + histcounts(y_test, edges,'normalization','probability'); ... + histcounts(y_test_est, edges, 'normalization','probability') ]'; + +mfig('True label and estimated label distributions') + bar(counts) + ylim([0 1]) + ylabel('Probability') + xlabel('Label') + legend('Training set', 'Test set', 'Test estimates', 'Location','best') + grid minor + + +%% (OPTIONAL) High performance fitting +% If you need to train e.g. large data sets or with many input features, it +% would likely be beneficial to use the minFunc software available in the +% toolbox. +% To use the minFunc-function you would then replace the call to fminunc +% above with the following lines: +% +% wSoftmax = minFunc(@penalizedL2, zeros((M+1)*(C-1),1), ... +% options, funObj, lambda(:)); +% +% You might need to compile the needed mex-files for your machine. You can +% do this by running: +% +% cd(fullfile(cdir,'../Tools/minFunc_2012')); mexAll; cd(cdir); +% +% You might, in turn, need to have installed the proper compiler, in which +% case you should simply follow the instructions in the message that comes +% when running the mexAll.m. \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex9_1_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex9_1_1.m new file mode 100644 index 0000000000000000000000000000000000000000..23ef1224080e99dc97b5daedac1afee7e82ce077 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex9_1_1.m @@ -0,0 +1,45 @@ +% exercise 9.1.1 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth5')) + +%% Fit model using bootstrap aggregation (bagging) + +% Number of rounds of bagging +L = 100; + +% Variable for model parameters +w_est = nan(M+1, L); + +% Weights for selecting samples in each bootstrap +weights = ones(N,1)/N; + +% For each round of bagging +for l = 1:L + % Choose data objects by random sampling with replacement + i = discreternd(weights, N); + + % Extract training set + X_train = X(i, :); + y_train = y(i); + + % Fit logistic regression model to training data and save result + w_est(:,l) = glmfit(X_train, y_train, 'binomial'); +end + +% Evaluate the logistic regression on the training data +p = glmval(w_est, X, 'logit'); + +% Estimated value of class labels (using 0.5 as threshold) by majority voting +y_est = sum(p>.5,2)>L/2; + +% Compute error rate +ErrorRate = sum(y~=y_est)/N; +fprintf('Error rate: %.0f%%\n', ErrorRate*100); + +%% Plot decision boundary +mfig('Decision boundary'); clf; +dbplot(X, y, @(X) sum(glmval(w_est, X, 'logit'),2)); +xlabel(attributeNames(1)); ylabel(attributeNames(2)); +legend(classNames); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex9_1_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex9_1_2.m new file mode 100644 index 0000000000000000000000000000000000000000..659e88676fd8eeeb75b9f597364d193b2addaa29 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex9_1_2.m @@ -0,0 +1,81 @@ +% exercise 9.1.2 +close all; +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth5')) +% for u=unique(y)', I = y == u; plot(X(I,1),X(I,2),'o'); hold all; end + +%% +%% Fit model using boosting (AdaBoost) + +% Number of rounds of boosting +L = 500; + +% Allocate variable for model parameters +w_est = nan(M+1, L); + +% Allocate variable for model importance weights +alpha = nan(1, L); + +% Weights for selecting samples in each round of boosting +weights = ones(N,1)/N; + close all; +%% Boosting (AdaBoost) +% For each round of boosting +for l=1:L, + disp(l) + % Choose data objects by random sampling with replacement + i = discreternd(weights, N); +% for j=1:length(i) +% i(j) = randsample(N,1,true,weights); +% end + + % Extract training set + X_train = X(i, :); + y_train = y(i); + + % Fit logistic regression model to training data and save result + %if nnz(y_train == 0) == 0 || nnz(y_train == 1) == 0, + % assert(false); + %end + %fprintf('%g, %g\n', nnz(y_train==0),nnz(y_train==1)); + w_est(:,l) = glmfit(X_train, y_train, 'binomial'); + + % Make predictions on the whole data set + p = glmval(w_est(:,l), X, 'logit'); + + y_est = p>0.5; + + % Compute error rate + ErrorRate = sum(weights.*(y~=y_est)); + + % Compute model importance weight + alpha(l) = .5*log((1-ErrorRate)/ErrorRate); + + % Update weights + weights(y==y_est) = weights(y==y_est)*exp(-alpha(l)); + weights(y~=y_est) = weights(y~=y_est)*exp(alpha(l)); + weights = weights/sum(weights); + +end + +% Normalize the importance weights +alpha = alpha/sum(alpha); + +% Evaluate the logistic regression on the training data +p = glmval(w_est, X, 'logit'); + +% From Tan el al. p. 288: "Instead of using a majority voting scheme, the +% prediction made by each classifier (...) is weighted according to +% (alpha). +y_est = sum(bsxfun(@times, p>.5, alpha), 2)>.5; + +% Compute error rate +ErrorRate = sum(y~=y_est)/N; +fprintf('Error rate: %.0f%%\n', ErrorRate*100); + +%% Plot decision boundary +mfig('Decision boundary'); clf; +dbplot(X, y, @(X) sum(bsxfun(@times, glmval(w_est, X, 'logit')>.5, alpha), 2)); +xlabel(attributeNames(1)); ylabel(attributeNames(2)); +legend(classNames); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex9_1_3.m b/exercises/02450Toolbox_Matlab/Scripts/ex9_1_3.m new file mode 100644 index 0000000000000000000000000000000000000000..dabcbd809790d2bd2005d991271a24cb50e09352 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex9_1_3.m @@ -0,0 +1,29 @@ +% exercise 9.1.3 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/synth7')) + +%% Fit model using bootstrap aggregation (bagging) + +% Number of rounds of bagging +L = 100; + +% Fit classification trees using the TreeBagger function +B = TreeBagger(L, X, classNames(y+1)); + +% Make predictions for the whole data set. The predict function outputs a +% cell array of strings, so y_est can be computed by comparing the returned +% strings using the strcmp function to the name of the second class. This +% will give a 0 for "Class 1" and a 1 for "Class 2". +y_est = strcmp(predict(B, X), classNames(2)); + +% Compute error rate +ErrorRate = sum(y~=y_est)/N; +fprintf('Error rate: %.0f%%\n', ErrorRate*100); + +%% Plot decision boundary +mfig('Decision boundary'); clf; +dbplot(X, y, @(X) strcmp(predict(B, X), classNames(2))); +xlabel(attributeNames(1)); ylabel(attributeNames(2)); +legend(classNames); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex9_2_1.m b/exercises/02450Toolbox_Matlab/Scripts/ex9_2_1.m new file mode 100644 index 0000000000000000000000000000000000000000..849606f36744aa9b848f1e64f637c7f74921691b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex9_2_1.m @@ -0,0 +1,34 @@ +% exercise 9.2.1 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wine2')) + +%% Crossvalidation +% Create crossvalidation partition for evaluation +% using stratification and 50 pct. split between training and test +CV = cvpartition(classNames(y+1), 'Holdout', .5); + +% Extract the training and test set +X_train = X(CV.training, :); +y_train = y(CV.training); +X_test = X(CV.test, :); +y_test = y(CV.test); + +%% Fit model +% Fit logistic regression model to training data to predict the type of wine +w_est = glmfit(X_train, y_train, 'binomial'); + +% Evaluate the logistic regression on the test data +p = glmval(w_est, X_test, 'logit'); + +%% Plot receiver operating characteristic (ROC) curve +mfig('ROC'); clf; +rocplot(p, y_test); + +% We'll plot a confusion matrix as well +mfig('Confusion matrix'); clf; +y_test_est = p>.5; +confmatplot(classNames(y_test+1), classNames(y_test_est+1)); + + diff --git a/exercises/02450Toolbox_Matlab/Scripts/ex9_2_2.m b/exercises/02450Toolbox_Matlab/Scripts/ex9_2_2.m new file mode 100644 index 0000000000000000000000000000000000000000..92a460c9c06ad12092ec65a611f90ecb0d1349e8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Scripts/ex9_2_2.m @@ -0,0 +1,38 @@ +% exercise 9.2.2 + +% Load data +cdir = fileparts(mfilename('fullpath')); +load(fullfile(cdir,'../Data/wine2')) + +% Remove all attributes except "Alcohol" +i = 11; % Attribute indices to keep +X(:, ~ismember(1:M, i)) = []; % Remove all except attributes in i + +%% Crossvalidation +% Create crossvalidation partition for evaluation +% using stratification and 50 pct. split between training and test +CV = cvpartition(classNames(y+1), 'Holdout', .5); + +% Extract the training and test set +X_train = X(CV.training, :); +y_train = y(CV.training); +X_test = X(CV.test, :); +y_test = y(CV.test); + +%% Fit model +% Fit logistic regression model to training data to predict the type of wine +w_est = glmfit(X_train, y_train, 'binomial'); + +% Evaluate the logistic regression on the test data +p = glmval(w_est, X_test, 'logit'); + +%% Plot receiver operating characteristic (ROC) curve +mfig('ROC'); clf; +rocplot(p, y_test); + +% We'll plot a confusion matrix as well +mfig('Confusion matrix'); clf; +y_test_est = p>.5; +confmatplot(classNames(y_test+1), classNames(y_test_est+1)); + + diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/binarize.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/binarize.m new file mode 100644 index 0000000000000000000000000000000000000000..80d48bc6e61a42fc7512aa43ca21e8150a7c82f2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/binarize.m @@ -0,0 +1,47 @@ +function [Xbinary,attributeNamesBin]=binarize(X,nIntervals,attributeNames) + +% function to turn data binary in order to do association mining by the +% Apriori algorithm +% +% Usage: +% [Xbinary,attributeNames_binary]=binarize(X,nIntervals,attributeNames) +% +% Input: +% X N x M data matrix +% nIntervals M x 1 vector specifying the number of bins used for each +% attribute. Each bin defined as percentiles of the data +% attributeNames M x 1 cell array of names of each of the M attributes +% +% Output: +% Xbin binarized data matrix +% attributeNamesBin attributeNames for the binarized data +% +% Copyright 2011, Morten M�rup, Technical University of Denmark + + +Y=sort(X,'ascend'); +[N,M]=size(X); +Q=zeros(N,M); +t=0; +attributeNamesBin={}; +Xbinary=zeros(N,sum(nIntervals)); +for m=1:M + for nI=1:nIntervals(m)-1 + Q(:,m) = Q(:,m) + double(X(:,m)>Y(ceil(nI/(nIntervals(m))*N),m)); + end + v=unique(Q(:,m))+1; + X_tmp=categoric2numeric(Q(:,m)); + m_new=size(X_tmp,2); + Xbinary(:,t+1:t+m_new)=X_tmp; + for a=1:length(v) + t=t+1; + if a==1 + attributeNamesBin{t}=[attributeNames{m} ' ' num2str(0) '-' num2str(ceil(v(a)/nIntervals(m)*10000)/100) ' percentile']; + elseif a==length(v) && nIntervals(m)~=length(v) + attributeNamesBin{t}=[attributeNames{m} ' ' num2str(ceil((v(a-1))/nIntervals(m)*10000)/100) '-' num2str(100) ' percentile']; + else + attributeNamesBin{t}=[attributeNames{m} ' ' num2str(ceil((v(a-1))/nIntervals(m)*10000)/100) '-' num2str(ceil(v(a)/nIntervals(m)*10000)/100) ' percentile']; + end + end +end +Xbinary=Xbinary(:,1:t); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/bmplot.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/bmplot.m new file mode 100644 index 0000000000000000000000000000000000000000..48e3212e9a6480f73d9d1b84d73c5527885f602b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/bmplot.m @@ -0,0 +1,33 @@ +function bmplot(i,j,X) +% BMPLOT Plots a binary matrix +% +% Usage: +% bmplot(i, j, X); +% +% Input: +% i : labels for rows +% j : Labels for columns +% X : Binary data matrix of size length(i) x length(j) +% +% Copyright 2011 Mikkel N. Schmidt, Technical University of Denmark + +c0 = [1 1 1]; +c1 = [.2 .5 .4]; +c2 = [.7 .8 .8]; + +[I,J] = size(X); +imagesc(X); +colormap([c0;c1]); +set(gca, 'XTick', 1:J); +set(gca, 'YTick', 1:I) +set(gca, 'YTickLabel', i); +set(gca, 'XTickLabel', j); +set(gca, 'TickLength', [0 0]); +box on; +for i=1:I + line([.5, J+.5], [1,1]*i-.5, 'Color', c2); +end +for j=1:J + line([1,1]*j-.5, [.5, I+.5], 'Color', c2); +end +axis image \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/calcMI.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/calcMI.m new file mode 100644 index 0000000000000000000000000000000000000000..fca459d2bb41c24b51c673126cdda3d6a13bc9e5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/calcMI.m @@ -0,0 +1,22 @@ +function MI=calcMI(Z1,Z2) + +% Function to calculate mutual information between two assignment matrices +% Z1 and Z2 +% +% Usage: +% MI=calcMI(Z1,Z2) +% +% Input: +% Z1 D1 x N Assignment matrix +% Z2 D2 x N Assignment matrix +% +% Output: +% MI Mutual information between Z1 and Z2. +% +% Written by Morten M�rup + +P=Z1*Z2'; +PXY=P/sum(sum(P)); +PXPY=sum(PXY,2)*sum(PXY,1); +ind=find(PXY>0); +MI=sum(PXY(ind).*log(PXY(ind)./PXPY(ind))); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/categoric2numeric.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/categoric2numeric.m new file mode 100644 index 0000000000000000000000000000000000000000..b9137b5a6ca5a80cefde82e9ad624e504d497c42 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/categoric2numeric.m @@ -0,0 +1,32 @@ +function [X_tmp, attributeNames_tmp]=categoric2numeric(x) + +% CATEGORIC2NUMERIC converts data matrix with categorical columns given by +% numeric values or cells to numeric columns using one out of K coding. +% +% Usage: +% [X_tmp, attributeNames_tmp]=categoric2numeric(x) +% +% Input: +% x categorical column of a data matrix +% +% Output: +% X_tmp Data matrix where categoric column has been +% converted to one out of K coding +% attributeNames_tmp new cell array of the M' attributes +% +% Copyright 2011, Morten M�rup, Technical University of Denmark + +N=size(x,1); +val=unique(x); +M=length(val); +X_tmp=zeros(N,M); +attributeNames_tmp=cell(1,M); +for t=1:M + if isnumeric(val(t)) + X_tmp(:,t)=(x==val(t)); + attributeNames_tmp{t}=num2str(val(t)); + else + X_tmp(:,t)=strcmp(x,val{t}); + attributeNames_tmp{t}=val{t}; + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/clusterplot.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/clusterplot.m new file mode 100644 index 0000000000000000000000000000000000000000..c11ebcaf3113c351175a51272d0c122a99cd363f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/clusterplot.m @@ -0,0 +1,103 @@ +function clusterplot(X, y, i, varargin) +% CLUSTERPLOT Plots a clustering of a data set as well as the true class +% labels. If data is more than 2-dimensional they are projected onto the +% first two principal components. Data objects are plotted as a dot with a +% circle around. The color of the dot indicates the true class, and the +% cicle indicates the cluster index. +% +% Usage: +% clusterplot(X, y, i) where X is an N-by-M matrix of attribute +% values, y is an N-by-1 vector of class labels, and i is an N-by-1 +% vector of cluster indices. N is the number of data objects and C is +% the number of classes. +% +% clusterplot(X, y, i, Xc) where Xc is an K-by-M matrix of cluster +% centroids plots centroids as crosses. +% +% If the number of attributes is M=2, the clustering is plotted in the +% attribute space. If M>2, the clusteringis plotted in the plane spanned +% by the first two principal components. +% +% Input: +% X N-by-M matrix of attribute values for N data objects with M +% attributes. +% y N-by-1 vector of class labels +% i N-by-1 vector of cluster indices +% Xc K-by-M matrix of cluster centroids (optional) +% Covc M-by-M-by-K tensor of covariance matrices (optional) +% +% Copyright 2011, Mikkel N. Schmidt, Technical University of Denmark + +[N,M] = size(X); + +if nargin>3 + centroids = varargin{1}; + if length(varargin)>1 + Sigmas = varargin{2}; + else + Sigmas=[]; + end +else + centroids = zeros(0,M); + Sigmas=[]; +end + + +DoPCA = M>2; +if DoPCA + mX = mean(X); + Z = bsxfun(@minus, X, mX); + [U,S,V] = svd(Z, 'econ'); + X = U(:,1:2)*S(1:2,1:2); + V=V(:,1:2); + centroids = bsxfun(@minus, centroids, mX)*V; + if ~isempty(Sigmas) + Sigmas_old=Sigmas; + Sigmas=zeros(size(V,2),size(V,2),size(Sigmas,3)); + for n=1:size(Sigmas,3) + Sigmas(:,:,n)= V'*Sigmas_old(:,:,n)*V; + end + end +end + +xRange = [min(X(:,1)), max(X(:,1))]; +xRange = xRange + [-1 1]*range(xRange)*0.05; +yRange = [min(X(:,2)), max(X(:,2))]; +yRange = yRange + [-1 1]*range(yRange)*0.05; + +AxisNextPlot = get(gca, 'NextPlot'); +ColorOrder = get(gca, 'ColorOrder'); +Ncol = size(ColorOrder,1); + +C = max(y)+1; + +% Plot clustering +ui = unique(i); K = length(ui); +for k = 1:K + plot(X(i==ui(k),1), X(i==ui(k),2), 'o', 'MarkerEdgeColor', ColorOrder(mod(k-1,Ncol)+1,:), 'LineWidth', 2, 'MarkerSize', 8); hold on; +end + +% Plot class labels +for k = 1:C + plot(X(y==k-1,1), X(y==k-1,2), 'o', 'MarkerEdgeColor', ColorOrder(mod(k-1,Ncol)+1,:), 'MarkerFaceColor', ColorOrder(mod(k-1,Ncol)+1,:), 'LineWidth', 1, 'MarkerSize', 4); +end + +% Plot cluster centroids +if ~isempty(Sigmas) + q=2*[cos(2*pi*linspace(0,1,100))' sin(2*pi*linspace(0,1,100))']; +end +for k = 1:size(centroids,1) + plot(centroids(k,1), centroids(k,2), 'x', 'MarkerEdgeColor', 'w', 'LineWidth', 5, 'MarkerSize', 20); + plot(centroids(k,1), centroids(k,2), 'x', 'MarkerEdgeColor', ColorOrder(mod(k-1,Ncol)+1,:), 'LineWidth', 3, 'MarkerSize', 18); + if ~isempty(Sigmas) + [V,D]=eig(Sigmas(:,:,k)); + p=q*sqrt(D)'*V'; + plot(centroids(k,1)+p(:,1), centroids(k,2)+p(:,2),'-','color',ColorOrder(mod(k-1,Ncol)+1,:),'LineWidth', 3) + end +end + +axis xy; + +set(gca, 'NextPlot', AxisNextPlot); + +if DoPCA, xlabel('PC1'); ylabel('PC2'); end; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/clusterval.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/clusterval.m new file mode 100644 index 0000000000000000000000000000000000000000..22945abdea4078da8f909ff79170346337ce8bec --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/clusterval.m @@ -0,0 +1,38 @@ +function [Rand, Jaccard, NMI] = clusterval(y, i) +% CLUSTERVAL Estimate cluster validity using entroy, purity, rand index, +% and Jaccard coefficient. +% +% Usage: +% [Rand, Jaccard, NMI] = clusterval(y, i); +% +% Input: +% y N-by-1 vector of class labels +% i N-by-1 vector of cluster indices +% +% Output: +% Rand Rand index. +% Jaccard Jaccard coefficient. +% NMI Normalized mutual information +% Copyright 2011, Mikkel N. Schmidt, Morten Mørup, Technical University of Denmark +% Updated 3 November 2015 to not count self pairs in Rand and Jaccard +% Updated 17 October 2016 to include NMI replacing two other measures + + +N = length(y); +[d1_,d2_,jy] = unique(y); +Zy = sparse(jy, 1:N, ones(1,N)); +Ay = Zy'*Zy; + +[d1_,d2_,ji] = unique(i); +Zi = sparse(ji, 1:N, ones(1,N)); +Ai = Zi'*Zi; + +f11 = full(sum(sum(triu(Ai.*Ay,1)))); +f00 = full(sum(sum(triu((1-Ai).*(1-Ay),1)))); + +Rand = (f11+f00)/(N*(N-1)/2); +Jaccard = f11/(N*(N-1)/2-f00); +NMI=full((calcMI(Zy,Zi))/(sqrt(calcMI(Zy,Zy)*calcMI(Zi,Zi)))); + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/clusterval_old.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/clusterval_old.m new file mode 100644 index 0000000000000000000000000000000000000000..932d29a47bcb6844e3e34710925da407608ab239 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/clusterval_old.m @@ -0,0 +1,42 @@ +function [Entropy, Purity, Rand, Jaccard] = clusterval(y, i) +% CLUSTERVAL Estimate cluster validity using entroy, purity, rand index, +% and Jaccard coefficient. +% +% Usage: +% [Entropy, Purity, Rand, Jaccard] = clusterval(y, i); +% +% Input: +% y N-by-1 vector of class labels +% i N-by-1 vector of cluster indices +% +% Output: +% Entropy Entropy measure. +% Purity Purity measure. +% Rand Rand index. +% Jaccard Jaccard coefficient. +% +% Copyright 2011, Mikkel N. Schmidt, Morten Mørup, Technical University of Denmark +% Updated 3 November 2015 to not count self pairs in Rand and Jaccard + +N = length(y); +[d1_,d2_,jy] = unique(y); +Zy = sparse(jy, 1:N, ones(1,N)); +Ay = Zy'*Zy; + +[d1_,d2_,ji] = unique(i); +Zi = sparse(ji, 1:N, ones(1,N)); +Ai = Zi'*Zi; + +f11 = full(sum(sum(triu(Ai.*Ay,1)))); +f00 = full(sum(sum(triu((1-Ai).*(1-Ay),1)))); +mZi = sum(Zi,2); +P = diag(1./mZi)*Zi*Zy'; +e = -sum(P.*log(P+eps),2); + +Entropy = full(sum(e.*mZi)/sum(mZi)); +Purity = full(sum(max(P,[],2).*mZi)/sum(mZi)); +Rand = (f11+f00)/(N*(N-1)/2); +Jaccard = f11/(N*(N-1)/2-f00); + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/confmatplot.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/confmatplot.m new file mode 100644 index 0000000000000000000000000000000000000000..fd0192706f816e2b2d3bdd1d89bd08ba9824b33f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/confmatplot.m @@ -0,0 +1,36 @@ +function confmatplot(G, Ghat) +% CONFMATPLOT +% Graphically display a confusion matrix +% +% Usage: +% confmatplot(G, Ghat) plots a confusion matrix +% +% Input: +% G Grouping variable for the known groups +% Ghat Grouping variable for the predicted groups +% +% Copyright 2011, Mikkel N. Schmidt, Morten Mørup, Technical University of Denmark + +[C, classNames] = confusionmat(G, Ghat); +if isnumeric(classNames), classNames = cellstr(num2str(classNames)); end; + +% Create image of confusion matrix +image(64*bsxfun(@rdivide, C, sum(C,2))); +axis equal tight; +colormap(1-gray); +set(gca, 'XTick', 1:length(classNames), 'XTickLabel', classNames); +set(gca, 'YTick', 1:length(classNames), 'YTickLabel', classNames); +set(gca, 'TickLength', [0 0]); +xlabel('Predicted class'); +ylabel('Actual class'); + +% Set labels on plot +for i = 1:size(C,1) + for j = 1:size(C,2) + text(j, i, num2str(C(i,j)), 'Color', 'r', 'HorizontalAlignment', 'center'); + if i==size(C,1) + end + end +end +title(sprintf('Accuracy=%.1f%%, Error Rate=%.1f%%', ... + trace(C)/sum(sum(C))*100, (sum(sum(C))-trace(C))/sum(sum(C))*100)); diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/correlated_ttest.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/correlated_ttest.m new file mode 100644 index 0000000000000000000000000000000000000000..69e39fc0b77eb82c05056be468f249620953ad3e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/correlated_ttest.m @@ -0,0 +1,16 @@ +function [p,CI] = correlated_ttest(r, rho, alpha) +% Implement the corrected t-test. +% The parameter rho is usually 1/K +% where K is the number of folds used in cross-validation +% (see lecture notes) +if nargin < 3 + alpha = 0.05; +end +rhat = mean(r); +shat = std(r); +J = length(r); +sigmatilde = shat * sqrt(1/J + rho / (1-rho) ); +CI = tinv([alpha/2, 1-alpha/2], J-1) * sigmatilde + rhat; +th = rhat / sigmatilde; +p = tcdf(-abs(th), J-1); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/dbplot.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/dbplot.m new file mode 100644 index 0000000000000000000000000000000000000000..b8c79632c4d56325f67510761c3b127bb974b198 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/dbplot.m @@ -0,0 +1,102 @@ +function dbplot(X, y, fun, varargin) +% DBPLOT Plots a decision boundary for a classification problem. +% +% Usage: +% dbplot(X, y, fun) where X is an N-by-M matrix of attribute values, +% y is an N-by-1 vector of class labels, and fun is a function +% handle to a function fun(X) that returns a class label for a +% matrix of attribute values. N is the number of data objects and M is +% the number of attributes. For a binary classification problem, fun(X) +% can also return a class probability (between 0 and 1). +% +% If the number of attributes is M=2, the decision boundary is plotted +% in the attribute space. If M>2, the decision boundary is plotted in +% the plane spanned by the first two principal components. +% +% Input: +% X N-by-M matrix of attribute values for N data objects with M +% attributes. +% y N-by-1 vector of class labels +% fun Function handle to classification function that takes a +% matrix of data objects as input and returns class labels or +% (for a binary classifier) class funReturnsProbabilities. +% +% Copyright 2011, Mikkel N. Schmidt, Technical University of Denmark + +%% +p = inputParser; +addOptional(p, 'MarkerSize', 7); +addOptional(p, 'Markers', {}); + +parse(p, varargin{:}); +ms = p.Results.MarkerSize; +markers = p.Results.Markers; + +%% +[N,M] = size(X); + +DoPCA = M>2; +if DoPCA + mX = mean(X); + Z = bsxfun(@minus, X, mX); + [U,S,V] = svd(Z, 'econ'); + X = U*S; +end + +xRange = [min(X(:,1)), max(X(:,1))]; +xRange = xRange + [-1 1]*range(xRange)*0.05; +yRange = [min(X(:,2)), max(X(:,2))]; +yRange = yRange + [-1 1]*range(yRange)*0.05; + +NGrid = 400; +xGrid = linspace(xRange(1), xRange(2), NGrid); +yGrid = linspace(yRange(1), yRange(2), NGrid); +[xMesh,yMesh] = meshgrid(xGrid, yGrid); + +if DoPCA + Xeval = bsxfun(@plus, [xMesh(:) yMesh(:) zeros(NGrid^2,M-2)]*V', mX); +else + Xeval = [xMesh(:) yMesh(:)]; +end +fMesh = reshape(fun(Xeval), NGrid, NGrid); + +AxisNextPlot = get(gca, 'NextPlot'); +%% +% colormap bone +ColorOrder = get(gca, 'ColorOrder'); +% ColorOrder = ColorOrder * 0 + linspace(0,1, size(ColorOrder,1))'; +% ColorOrder = bone(4); + +Ncol = size(ColorOrder,1); + +C = max(y)+1; +funReturnsProbabilities = ~all(ismember(unique(fMesh(:)), 0:C-1)); +a = .3; b = .7; +% b = 0.2; +% a = 1-2*b; + +if funReturnsProbabilities + cMap = interp1([0 .5 1], [ColorOrder(1,:)*a+b; 1 1 1; ColorOrder(2,:)*a+b], linspace(0,1,256)); + imagesc(xGrid, yGrid, fMesh); +else + cMap = ColorOrder(mod(0:C-1,Ncol)+1,:)*a+b; + image(xGrid, yGrid, fMesh+1); +end + +hold all; +for c = 1:C + mo = {'MarkerFaceColor', ColorOrder(mod(c-1,Ncol)+1,:), 'LineWidth', 1}; + mspec = 'wo'; + if ~isempty(markers) + mspec = markers{c}; + mo = {'LineWidth', 1}; + end + plot(X(y==c-1,1), X(y==c-1,2), mspec, mo{:}, 'MarkerSize', ms); +end +colormap(cMap); +% cMap +% colormap(cMap*0 + mean(cMap,2) ); +%% +axis xy; +set(gca, 'NextPlot', AxisNextPlot); +if DoPCA, xlabel('PC1'); ylabel('PC2'); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/discreternd.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/discreternd.m new file mode 100644 index 0000000000000000000000000000000000000000..631809eeca0877c7abbc6f08243eb389a025844a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/discreternd.m @@ -0,0 +1,31 @@ +function i = discreternd(p, varargin) +% DISCRETERND Random numbers from a discrete distribution +% +% Usage: +% p = [.5 .25 .25]; +% i = discreternd(p) +% Generates a random number in {1,2,3} with 50 pct. probability of +% being 1 and 25 pct. probability of being 2 or 3. +% +% i = discreternd(p, M, N, ...) +% Returns an N-by-M-by-... array. +% +% Input: +% p Vector of (relative) probabilities. If p sums to one, each +% element in p is the probability of generating the +% corresponding integer. If p is not normalized it denotes +% the relative probability. +% M, N, ... Size of the returned array. +% +% Output: +% i Array of size M-by-N-by-... of random integers +% between 1 and length(p). +% +% Copyright 2011, Mikkel N. Schmidt, Technical University of Denmark + +if nargin>1 + n = varargin{:}; +else + n = 1; +end +i = sum(~bsxfun(@gt, cumsum(p(:)'), rand(n,1)*sum(p(:))),2)+1; diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayDecisionFunctionNetworkClassification.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayDecisionFunctionNetworkClassification.m new file mode 100644 index 0000000000000000000000000000000000000000..8e7d7cece27bc7619ddd33b516c7abea474eaae1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayDecisionFunctionNetworkClassification.m @@ -0,0 +1,39 @@ +function displayDecisionFunctionNetworkClassification(Xtrain,ytrain,Xtest,ytest,net) +% Display decision boundaries for model or model ensemble +X=[Xtrain; Xtest]; +X_min=min(X); +X_max=max(X); + + +% Define resolution of grid +Nx1 = 2500; +Nx2 = 2500; + +% Display decision boundary +x1=linspace(X_min(1),X_max(1),Nx1); +x2=linspace(X_min(2),X_max(2),Nx2); +[xx1,xx2] = meshgrid(x1,x2); +XX=[xx1(:) xx2(:)]; + +% Evaluate network on a grid of values +XX=XX-ones(size(XX,1),1)*net.mean_x; +XX=XX./(ones(size(XX,1),1)*net.std_x); +[dummy,y_pred] = nc_forward(net.Wi,net.Wo,XX); +imagesc(x1,x2,reshape(y_pred,Nx2,Nx1)); +title(['Decision boundaries for trained network'],'FontWeight','bold'); + +% Plot Training and test data +hold on; +col=colormap(jet); +scol=size(col,1); +Nclass=2; +plot(Xtrain(ytrain==0,1),Xtrain(ytrain==0,2),'o','Color',col(1,:)); +plot(Xtrain(ytrain==1,1),Xtrain(ytrain==1,2),'o','Color',col(end,:)); +plot(Xtest(ytest==0,1),Xtest(ytest==0,2),'x','Color',col(1,:)); +plot(Xtest(ytest==1,1),Xtest(ytest==1,2),'x','Color',col(end,:)); +caxis([0 1]); +colormap(jet/2+.5); +set(gca,'YDir','normal'); +xlabel('x_1','FontWeight','bold'); +ylabel('x_2','FontWeight','bold'); +legend({'Train class 0','Train class 1','test class 0','test class 1'}); diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayDecisionFunctionNetworkRegression.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayDecisionFunctionNetworkRegression.m new file mode 100644 index 0000000000000000000000000000000000000000..c04191735dc6f9779bdec6ca0df05028cf179d62 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayDecisionFunctionNetworkRegression.m @@ -0,0 +1,39 @@ +function displayDecisionFunctionNetworkRegression(Xtrain,ytrain,Xtest,ytest,net) +% Display decision boundaries for model or model ensemble +X=[Xtrain; Xtest]; +X_min=min(X); +X_max=max(X); + + +% Define resolution of grid +Nx1 = 2500; +Nx2 = 2500; + +% Display decision boundary +x1=linspace(X_min(1),X_max(1),Nx1); +x2=linspace(X_min(2),X_max(2),Nx2); +[xx1,xx2] = meshgrid(x1,x2); +XX=[xx1(:) xx2(:)]; + +% Evaluate network on a grid of values +XX=XX-ones(size(XX,1),1)*net.mean_x; +XX=XX./(ones(size(XX,1),1)*net.std_x); +[dummy,y_pred] = nr_forward(net.Wi,net.Wo,XX); +imagesc(x1,x2,reshape(y_pred,Nx2,Nx1)); +title(['Decision boundaries for trained network'],'FontWeight','bold'); + +% Plot Training and test data +hold on; +col=colormap(jet); +scol=size(col,1); +Nclass=2; +plot(Xtrain(ytrain==0,1),Xtrain(ytrain==0,2),'o','Color',col(1,:)); +plot(Xtrain(ytrain==1,1),Xtrain(ytrain==1,2),'o','Color',col(end,:)); +plot(Xtest(ytest==0,1),Xtest(ytest==0,2),'x','Color',col(1,:)); +plot(Xtest(ytest==1,1),Xtest(ytest==1,2),'x','Color',col(end,:)); +caxis([0 1]); +colormap(jet/2+.5); +set(gca,'YDir','normal'); +xlabel('x_1','FontWeight','bold'); +ylabel('x_2','FontWeight','bold'); +legend({'Train class 0','Train class 1','test class 0','test class 1'}); diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayNetworkClassification.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayNetworkClassification.m new file mode 100644 index 0000000000000000000000000000000000000000..0d0cef23bcc3e5be4406c0089deba8a9bb9f64b9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayNetworkClassification.m @@ -0,0 +1,82 @@ +function displayNetworkRegression(net) +% Visualize neural network + +markersize=100; +linewidth=10; +hold on; + +% convert network to Matlab standard network format +net.IW{1}=net.Wi(:,1:end-1); +net.b{1}=net.Wi(:,end); +net.LW{2,1}=net.Wo(:,1:end-1); +net.b{2}=net.Wo(:,end); +net.layers{1}.transferFcn='tansig'; +net.layers{2}.transferFcn='purelin'; + +% Define plot locations of the neural network nodes +[Nhidden,Ninput]=size(net.IW{1}); +y_posInput=linspace(0,1,Ninput+2); +y_posInput=fliplr(y_posInput(2:end-1)); +x_posInput=0*ones(Ninput,1); + +y_posHidden=linspace(0,1,Nhidden+2); +y_posHidden=fliplr(y_posHidden(2:end-1)); +x_posHidden=0.5*ones(Nhidden,1); + +[Noutput,Nhidden]=size(net.LW{2,1}); +y_posOutput=linspace(0,1,Noutput+2); +y_posOutput=fliplr(y_posOutput(2:end-1)); +x_posOutput=1*ones(Noutput,1); + +% Plot edges from Input to Hidden layer +W=net.IW{1}; +maxW=max(max(abs(W))); +for n=1:Ninput + for nn=1:Nhidden + if W(nn,n)>0 + plot([x_posInput(n) x_posHidden(nn)],[y_posInput(n) y_posHidden(nn)],'-g','LineWidth',linewidth*abs(W(nn,n))/maxW); + else + plot([x_posInput(n) x_posHidden(nn)],[y_posInput(n) y_posHidden(nn)],'-r','LineWidth',linewidth*abs(W(nn,n))/maxW); + end + text((0.35*x_posInput(n)+0.65*x_posHidden(nn)),(0.35*y_posInput(n)+0.65*y_posHidden(nn)),['w_{' num2str(nn) ',' num2str(n) '}^{(Hidden)}=' num2str(W(nn,n))],'HorizontalAlignment','center'); + end +end + +% Plot edges from Hidden to Output layer +W=net.LW{2,1}; +maxW=max(max(abs(W))); +for n=1:Nhidden + for nn=1:Noutput + if W(nn,n)>0 + plot([x_posHidden(n) x_posOutput(nn)],[y_posHidden(n) y_posOutput(nn)],'-g','LineWidth',linewidth*abs(W(nn,n))/maxW); + else + plot([x_posHidden(n) x_posOutput(nn)],[y_posHidden(n) y_posOutput(nn)],'-r','LineWidth',linewidth*abs(W(nn,n))/maxW); + end + text((0.35*x_posHidden(n)+0.65*x_posOutput(nn)),(0.35*y_posHidden(n)+0.65*y_posOutput(nn)),['w_{' num2str(nn) ',' num2str(n) '}^{(Output)}=' num2str(W(nn,n))],'HorizontalAlignment','center'); + end +end + + +% Plot input units +plot(x_posInput,y_posInput,'.y','Markersize',markersize); +text(0,1,'Input Layer','HorizontalAlignment','center','FontWeight','bold'); +for k=1:Ninput + text(x_posInput(k),y_posInput(k),['x_{' num2str(k) '}'],'HorizontalAlignment','center'); +end + + +% Plot hidden units +plot(x_posHidden,y_posHidden,'.y','Markersize',markersize); +text(0.5,1,{'Hidden Layer', ['transfer function: Tansig' ]},'HorizontalAlignment','center','FontWeight','bold'); +for k=1:Nhidden + text(x_posHidden(k),y_posHidden(k),{['H_{' num2str(k) '}'], ['w_{' num2str(k) ',0}^{(Hidden)}=' num2str(net.b{1}(k))]},'HorizontalAlignment','center'); +end + +% Plot output units +plot(x_posOutput,y_posOutput,'.y','Markersize',markersize); +text(1,1,{'Output Layer', ['transfer function: logistic/softmax']},'HorizontalAlignment','center','FontWeight','bold'); +for k=1:Noutput + text(x_posOutput(k),y_posOutput(k),{['y_' num2str(k)], ['w_{' num2str(k) ',0}^{(Output)}=' num2str(net.b{2}(k))]},'HorizontalAlignment','center'); +end +axis([0 1 0 1]); +axis off; diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayNetworkRegression.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayNetworkRegression.m new file mode 100644 index 0000000000000000000000000000000000000000..5557116d28ea79eb52c1a39fddcfa70f2235753b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/displayNetworkRegression.m @@ -0,0 +1,82 @@ +function displayNetworkRegression(net) +% Visualize neural network + +markersize=100; +linewidth=10; +hold on; + +% convert network to Matlab standard network format +net.IW{1}=net.Wi(:,1:end-1); +net.b{1}=net.Wi(:,end); +net.LW{2,1}=net.Wo(:,1:end-1); +net.b{2}=net.Wo(:,end); +net.layers{1}.transferFcn='tansig'; +net.layers{2}.transferFcn='purelin'; + +% Define plot locations of the neural network nodes +[Nhidden,Ninput]=size(net.IW{1}); +y_posInput=linspace(0,1,Ninput+2); +y_posInput=fliplr(y_posInput(2:end-1)); +x_posInput=0*ones(Ninput,1); + +y_posHidden=linspace(0,1,Nhidden+2); +y_posHidden=fliplr(y_posHidden(2:end-1)); +x_posHidden=0.5*ones(Nhidden,1); + +[Noutput,Nhidden]=size(net.LW{2,1}); +y_posOutput=linspace(0,1,Noutput+2); +y_posOutput=fliplr(y_posOutput(2:end-1)); +x_posOutput=1*ones(Noutput,1); + +% Plot edges from Input to Hidden layer +W=net.IW{1}; +maxW=max(max(abs(W))); +for n=1:Ninput + for nn=1:Nhidden + if W(nn,n)>0 + plot([x_posInput(n) x_posHidden(nn)],[y_posInput(n) y_posHidden(nn)],'-g','LineWidth',linewidth*abs(W(nn,n))/maxW); + else + plot([x_posInput(n) x_posHidden(nn)],[y_posInput(n) y_posHidden(nn)],'-r','LineWidth',linewidth*abs(W(nn,n))/maxW); + end + text((0.35*x_posInput(n)+0.65*x_posHidden(nn)),(0.35*y_posInput(n)+0.65*y_posHidden(nn)),['w_{' num2str(nn) ',' num2str(n) '}^{(Hidden)}=' num2str(W(nn,n))],'HorizontalAlignment','center'); + end +end + +% Plot edges from Hidden to Output layer +W=net.LW{2,1}; +maxW=max(max(abs(W))); +for n=1:Nhidden + for nn=1:Noutput + if W(nn,n)>0 + plot([x_posHidden(n) x_posOutput(nn)],[y_posHidden(n) y_posOutput(nn)],'-g','LineWidth',linewidth*abs(W(nn,n))/maxW); + else + plot([x_posHidden(n) x_posOutput(nn)],[y_posHidden(n) y_posOutput(nn)],'-r','LineWidth',linewidth*abs(W(nn,n))/maxW); + end + text((0.35*x_posHidden(n)+0.65*x_posOutput(nn)),(0.35*y_posHidden(n)+0.65*y_posOutput(nn)),['w_{' num2str(nn) ',' num2str(n) '}^{(Output)}=' num2str(W(nn,n))],'HorizontalAlignment','center'); + end +end + + +% Plot input units +plot(x_posInput,y_posInput,'.y','Markersize',markersize); +text(0,1,'Input Layer','HorizontalAlignment','center','FontWeight','bold'); +for k=1:Ninput + text(x_posInput(k),y_posInput(k),['x_{' num2str(k) '}'],'HorizontalAlignment','center'); +end + + +% Plot hidden units +plot(x_posHidden,y_posHidden,'.y','Markersize',markersize); +text(0.5,1,{'Hidden Layer', ['transfer function: Tansig' ]},'HorizontalAlignment','center','FontWeight','bold'); +for k=1:Nhidden + text(x_posHidden(k),y_posHidden(k),{['H_{' num2str(k) '}'], ['w_{' num2str(k) ',0}^{(Hidden)}=' num2str(net.b{1}(k))]},'HorizontalAlignment','center'); +end + +% Plot output units +plot(x_posOutput,y_posOutput,'.y','Markersize',markersize); +text(1,1,{'Output Layer', ['transfer function: Linear']},'HorizontalAlignment','center','FontWeight','bold'); +for k=1:Noutput + text(x_posOutput(k),y_posOutput(k),{['y_' num2str(k)], ['w_{' num2str(k) ',0}^{(Output)}=' num2str(net.b{2}(k))]},'HorizontalAlignment','center'); +end +axis([0 1 0 1]); +axis off; diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/findRules.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/findRules.m new file mode 100644 index 0000000000000000000000000000000000000000..6b73a2fff2724ada51cbd3873736241eac2916bd --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/findRules.m @@ -0,0 +1,218 @@ +function [Rules FreqItemsets] = findRules(transactions, minSup, minConf, nRules, sortFlag, labels, fname) +% +% This function performs Association Analysis (Apriori Algorithm): Given a set of transactions, +% find rules that will predict the occurrence of an item based on the occurrences of other +% items in the transaction +% +% Rules are of the form A-> B (e.g., {milk, diaper} - > {Coke}), where +% support = minSup (minimum support threshold) +% confidence = minConf (minimum confidence threshold) +% +% Support is the fraction of transactions that contain both A and B: +% Support(A,B) = P(A,B) +% +% Confidence is the fraction of transactions where items in B appear in transactions that contain A: +% Confidence(A,B) = P(B|A) +% +% +% INPUT: +% transactions: M x N matrix of binary transactions, where each row +% represents one transaction and each column represents +% one attribute/item +% minSup: scalar value that represents the minimum +% threshold for support for each rule +% minConf: scalar value that represents the minimum +% threshold for confidence of each rule +% nRules: scalar value indicating the number of rules +% the user wants to find +% sortFlag: binary value indicating if the rules should be +% sorted by support level or confidence level +% 1: sort by rule support level +% 2: sort by rule confidence level +% labels: optional parameter that provides labels for +% each attribute (columns of transactions), +% by default attributes are represented +% with increasing numerical values 1:N +% fname: optional file name where rules are saved +% +% OUTPUT: +% Rules: 2 x 1 cell array, where the first cell (Rules{1}{:}) +% contains the itemsets in the left side of the rule and second +% cell (Rules{2}{:}) contains the itemsets +% in the right side of the rule (e.g., if +% the first rule is {1, 2} -> 3, +% Rules{1}{1} = [1,2], Rules{2}{1} = [3]) +% FreqItemsets: A cell array of frequent itemsets of size 1, 2, +% etc., with itemset support >= minSup, +% where FreqItemSets{1} represents itemsets +% of size 1, FreqItemSets{2} itemsets of +% size 2, etc. +% fname.txt: The code creates a text file and stores all the +% rules in the form left_side -> right_side. +% +% author: Narine Manukyan 07/08/2013 + +% Number of transactions in the dataset +M = size(transactions,1); +% Number of attributes in the dataset +N = size(transactions,2); + +if nargin < 7 + fname = 'default'; +end + +if nargin < 6 + labels = cellfun(@(x){num2str(x)}, num2cell(1:N)); +end + +if nargin < 5 + sortFlag = 1; +end + +if nargin < 4 + nRules = 100; +end + +if nargin < 3 + minConf = 0.5; +end + +if nargin < 2 + minSup = 0.5; +end + +if nargin == 0 + error('No input arguments were supplied. At least one is expected.'); +end + +% Preallocate memory for Rules and FreqItemsets +maxSize = 10^2; +Rules = cell(2,1); +Rules{1} = cell(nRules,1); +Rules{2} = cell(nRules,1); +FreqItemsets = cell(maxSize); +RuleConf = zeros(nRules,1); +RuleSup = zeros(nRules,1); +ct = 1; + +% Find frequent item sets of size one (list of all items with minSup) +T = []; +for i = 1:N + S = sum(transactions(:,i))/M; + if S >= minSup + T = [T; i]; + end +end +FreqItemsets{1} = T; + +%Find frequent item sets of size >=2 and from those identify rules with minConf + +for steps = 2:N + + % If there aren't at least two items with minSup terminate + U = unique(T); + if isempty(U) || size(U,1) == 1 + Rules{1}(ct:end) = []; + Rules{2}(ct:end) = []; + FreqItemsets(steps-1:end) = []; + break + end + + % Generate all combinations of items that are in frequent itemset + Combinations = nchoosek(U',steps); + TOld = T; + T = []; + + for j = 1:size(Combinations,1) + if ct > nRules + break; + else + % Apriori rule: if any subset of items are not in frequent itemset do not + % consider the superset (e.g., if {A, B} does not have minSup do not consider {A,B,*}) + if sum(ismember(nchoosek(Combinations(j,:),steps-1),TOld,'rows')) - steps+1>0 + + % Calculate the support for the new itemset + S = mean((sum(transactions(:,Combinations(j,:)),2)-steps)>=0); + if S >= minSup + T = [T; Combinations(j,:)]; + + % Generate potential rules and check for minConf + for depth = 1:steps-1 + R = nchoosek(Combinations(j,:),depth); + for r = 1:size(R,1) + if ct > nRules + break; + else + % Calculate the confidence of the rule + Ctemp = S/mean((sum(transactions(:,R(r,:)),2)-depth)==0); + if Ctemp >= minConf + + % Store the rules that have minSup and minConf + Rules{1}{ct} = R(r,:); + Rules{2}{ct} = setdiff(Combinations(j,:),R(r,:)); + RuleConf(ct) = Ctemp; + RuleSup(ct) = S; + ct = ct+1; + end + end + end + end + end + end + end + end + + % Store the freqent itemsets + FreqItemsets{steps} = T; +end + +% Get rid of unnecessary rows due to preallocation (helps with speed) +FreqItemsets(steps-1:end) = []; +RuleConf = RuleConf(1:ct-1); +RuleSup = RuleSup(1:ct-1); + +% Sort the rules in descending order based on the confidence or support level +switch sortFlag + case 1 % Sort by Support level + [V ind] = sort(RuleSup,'descend'); + case 2 % Sort by Confidence level + [V ind] = sort(RuleConf,'descend'); +end + +RuleConf = RuleConf(ind); +RuleSup = RuleSup(ind); + +for i = 1:2 + temp = Rules{i,1}; + temp = temp(ind); + Rules{i,1} = temp; +end + + +% Save the rule in a text file and print them on display +fid = fopen([fname '.txt'], 'w'); +fprintf(fid, '%s (%s, %s) \n', 'Rule', 'Support', 'Confidence'); + +for i = 1:size(Rules{1},1) + s1 = ''; + s2 = ''; + for j = 1:size(Rules{1}{i},2) + if j == size(Rules{1}{i},2) + s1 = [s1 labels{Rules{1}{i}(j)}]; + else + s1 = [s1 labels{Rules{1}{i}(j)} ',']; + end + end + for k = 1:size(Rules{2}{i},2) + if k == size(Rules{2}{i},2) + s2 = [s2 labels{Rules{2}{i}(k)}]; + else + s2 = [s2 labels{Rules{2}{i}(k)} ',']; + end + end + s3 = num2str(RuleSup(i)*100); + s4 = num2str(RuleConf(i)*100); + fprintf(fid, '%s -> %s (%s%%, %s%%)\n', s1, s2, s3, s4); +end +fclose(fid); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/gausKernelDensity.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/gausKernelDensity.m new file mode 100644 index 0000000000000000000000000000000000000000..a676933565c27b0c2810e7bc9d702a052fbf89e6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/gausKernelDensity.m @@ -0,0 +1,27 @@ +function [density, log_density]=gausKernelDensity(X,width) +% function to calculate efficiently leave-one-out Gaussian Kernel Density estimate +% Input: +% X N x M data matrix +% width variance of the Gaussian kernel +% +% Output: +% density vector of estimated densities +% log_density vector of estimated log_densities +% +% Written by Morten M�rup + +[N,M]=size(X); + +% Calculate squared euclidean distance between data points +% given by ||x_i-x_j||_F^2=||x_i||_F^2-2x_i^Tx_j+||x_i||_F^2 efficiently +x2=sum(X.^2,2); +D=x2(:,ones(1,N))-2*(X*X')+x2(:,ones(1,N))'; + +% Evaluate densities to each observation +Q=exp(-1/(2*width)*D); +% do not take density generated from the data point itself into account +Q=Q-diag(diag(Q)); + +sQ=sum(Q,2); +density=1/((N-1)*sqrt(2*pi*width)^M)*sQ; +log_density=-log(N-1)-M/2*log(2*pi*width)+log(sQ); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/hist2d.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/hist2d.m new file mode 100644 index 0000000000000000000000000000000000000000..ad6878c186360e6e7aab776633d0486356d0d54c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/hist2d.m @@ -0,0 +1,29 @@ +function [N,Range]=hist2d(X,B) +% Function to evaluate co-occurence, i.e. 2D histogram +% +% Usage: +% [N,Range]=hist2d(X,B) +% +% Input: +% X N x 2 data matrix +% B number of bins +% +% Output: +% N B x B matrix of co-occurences N(l,m) is the co-occurrence +% of bin m of X(:,1) with bin l of X(:,2) +% Range The ranges used to define the co-occurences +% +% Copyright 2013, Morten M�rup, Technical University of Denmark + +minX=min(X); +maxX=max(X); +x_vals=linspace(minX(1)-eps*abs(minX(1)),maxX(1)+eps*abs(maxX(1)),B+1); +y_vals=linspace(minX(2)-eps*abs(minX(2)),maxX(2)+eps*abs(maxX(2)),B+1); +Range=[x_vals; y_vals]; +N=zeros(B); +for k=1:length(x_vals)-1 + Xt=X((X(:,1)>=x_vals(k)) & (X(:,1)<x_vals(k+1)),:); + for kk=1:length(y_vals)-1 + N(kk,k)=sum((Xt(:,2)>=y_vals(kk)) & (Xt(:,2)<y_vals(kk+1))); + end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/jeffrey_interval.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/jeffrey_interval.m new file mode 100644 index 0000000000000000000000000000000000000000..4c0af2ba364eda962b2c55dc8f7f5abdefb13432 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/jeffrey_interval.m @@ -0,0 +1,21 @@ +function [thetahat, CI] = jeffrey_interval(y_true, yhat, alpha) +if nargin < 3 + alpha = 0.05; +end + +m = sum(y_true == yhat); +n = length(y_true); + +a = m+.5; +b = n-m+.5; + +CI = betainv([alpha/2, 1-alpha/2], a, b); +if m == 0 + CI(1) = 0; +end +if m == n + CI(2) = 1; +end +thetahat = a/(a+b); + +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/linkax.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/linkax.m new file mode 100644 index 0000000000000000000000000000000000000000..6fc01afd5e4cb07a301b9943f394e160f9545072 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/linkax.m @@ -0,0 +1,93 @@ +function linkax(varargin) +% LINKAX Links axes together and set the axis limits to the common min/max +% +% Usage: +% linkax Links all x and y axes in the current figure together +% linkax(s) Links axes specified in s in the current figure together +% linkax(h, s) Links axes specified by the handle(s) h together +% +% Parameters: +% s 'x' Links all x-axes +% 'y' Links all y-axes +% 'xy' Links all x- and y-axes +% 'grid' Links x- and y-axes that are aligned in the figure and +% removes redundant axis ticks and labels +% 'off' Unlinks all axes +% h Handle(s) to axes or figure +% +% Copyright 2011, Mikkel N. Schmidt, Technical University of Denmark + +h0 = gcf; +s = 'xy'; +if nargin==1 + s = varargin{1}; +end +if nargin==2 + h0 = varargin{1}; + s = varargin{2}; +end + +% If h0 is an axes object, use this, otherwise, get all axes children of h +if strcmp(get(h0(1),'type'), 'axes') + h = h0; +else + h = findobj(h0, 'type', 'axes'); +end + +if strcmp(s, 'grid') + p = round(cell2mat(get(h, 'Position'))*1000)/1000; + [b,i,j] = unique(p(:,[1 3 4]),'rows'); + for u = 1:length(i) + k = find(j==u); + % Get current axes limits + xlim = mycell2mat(get(h(k), 'XLim')); + % Link x-axes + linkaxes(h(k), 'x'); + % Set axes limits + set(h(k), 'XLim', [min(xlim(:)), max(xlim(:))]); + % Sort axes according to y position + [l_,l] = sort(p(j==u,2)); + set(h(k(l(2:end))), 'XTickLabel', []); + set(mycell2mat(get(h(k(l(2:end))), 'XLabel')), 'String', ''); + end + [b,i,j] = unique(p(:,[2 3 4]),'rows'); + for u = 1:length(i) + k = find(j==u); + % Get current axes limits + ylim = mycell2mat(get(h(k), 'YLim')); + % Link y-axes + linkaxes(h(k), 'y'); + % Set axes limits + set(h(k), 'YLim', [min(ylim(:)), max(ylim(:))]); + % Sort axes according to x position + [l_,l] = sort(p(j==u,1)); + set(h(k(l(2:end))), 'YTickLabel', []); + set(mycell2mat(get(h(k(l(2:end))), 'YLabel')), 'String', ''); + end +else + % Get current axes limits + xlim = mycell2mat(get(h, 'XLim')); + ylim = mycell2mat(get(h, 'YLim')); + + % Link (or unlink) axes + linkaxes(h, s); + + % Set axes limits + if strcmp(s, 'x') | strcmp(s, 'xy') + set(h, 'XLim', [min(xlim(:)), max(xlim(:))]); + end + if strcmp(s, 'y') | strcmp(s, 'xy') + set(h, 'YLim', [min(ylim(:)), max(ylim(:))]); + end + if strcmp(s, 'off') + set(h, 'XLimMode', 'auto', 'YLimMode', 'auto'); + end +end + +function m = mycell2mat(c) +if iscell(c) + m = cell2mat(c); +else + m = c; +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/max_idx.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/max_idx.m new file mode 100644 index 0000000000000000000000000000000000000000..1051a3a86f2d210ae4e9bd6b199b3eea6d8d5a68 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/max_idx.m @@ -0,0 +1,4 @@ +function idx=max_idx(Y) +% function to extract the column index of the max value for each row of Y + +[val,idx]=max(Y,[],2); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/mcnemar.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/mcnemar.m new file mode 100644 index 0000000000000000000000000000000000000000..3fc8d6cdf1844ef488e73f2a5ddf29164a085909 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/mcnemar.m @@ -0,0 +1,40 @@ +function [thetahat, CI, p] = mcnemar(y_true, yhatA, yhatB, alpha, verbose) +if nargin < 4 + alpha = 0.05; +end +if nargin < 5 + verbose = false; +end +%% perform McNemars test +n = zeros(2); +c1 = yhatA == y_true; +c2 = yhatB == y_true; +nn(1,1) = sum(c1 & c2); +nn(1,2) = sum(c1 & ~c2); +nn(2,1) = sum(~c1 & c2); +nn(2,2) = sum(~c1 & ~c2); +n = sum(nn(:)); + +Etheta = (nn(1,2)-nn(2,1))/n; +n12 = nn(1,2); n21 = nn(2,1); +Q = n^2 * (n+1) * (Etheta+1) * (1-Etheta) / ( (n*(n12+n21) - (n12-n21)^2) ); +p = (Etheta + 1)/2 * (Q-1); +q = (1-Etheta)/2 * (Q-1); +thetaL = betainv(alpha/2, p, q)*2-1; +thetaU = betainv(1-alpha/2, p, q)*2-1; +%% +CI = [thetaL,thetaU]; +p = 2*binocdf(min([n12,n21]), n12+n21, 0.5); +if verbose + disp("Result of McNemars test using alpha=" + alpha) + disp("Comparison matrix n") + disp(nn) + if n12+n21 <= 10 + disp("Warning, n12+n21 is low: n12+n21=" + (n12+n21)) + end + disp("Approximate 1-alpha confidence interval of theta: [thetaL,thetaU] = [" + CI(1) + ", " + CI(2) +"]"); + disp("p-value for two-sided test A and B have same accuracy (exact binomial test): p=" + p) +end + +thetahat = (nn(1,2)-nn(2,1))/n; +end diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/nntoolbox_select.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/nntoolbox_select.m new file mode 100644 index 0000000000000000000000000000000000000000..7d8631e640fa35c883827191f55d099ee44653b3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/nntoolbox_select.m @@ -0,0 +1,12 @@ +function nntoolbox_select(type) +if strcmp(type,'mul'), + +elseif strcmp(type,'bin'), + +else + disp('Wrong type of neural network toolbox selected') + type + asser(false); +end + +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/oneoutofk.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/oneoutofk.m new file mode 100644 index 0000000000000000000000000000000000000000..8cb91919a2101adc8e6bcc16da4337be1a154682 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/oneoutofk.m @@ -0,0 +1,21 @@ +function Y = oneoutofk(y, C) +% ONEOUTOFK One-out-of-K coding +% Converts a class index vector to a one-out-of-K coding matrix +% +% Usage: +% Y = oneoutofk(y, K) +% +% Input: +% y Vector of class indices in (0,1,...,K-1) +% K Number of classes +% +% Output: +% Y N-by-K binary matrix +% +% Copyright 2011, Mikkel N. Schmidt, Technical University of Denmark + +N = length(y); +Y = false(N, C); +for n = 1:N + Y(n, y(n)+1) = true; +end diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/print_apriori_rules.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/print_apriori_rules.m new file mode 100644 index 0000000000000000000000000000000000000000..fb9b87cc307703133f53dc42966a13fe9c0b42de --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/print_apriori_rules.m @@ -0,0 +1,13 @@ +% Helper function for pretty printing +function print_apriori_rules(Rules,labels) +for i=1:length(Rules{1}) + if nargin < 2 + s1 = arrayfun(@(s)num2str(s), Rules{1}{i},'UniformOutput',false); + s2 = arrayfun(@(s)num2str(s), Rules{2}{i},'UniformOutput',false); + else + s1 = labels(Rules{1}{i}); + s2 = labels(Rules{2}{i}); + end + fprintf('{%s} -> {%s}\n', strjoin(s1, ', '), strjoin(s2, ', ')) +end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/rocplot.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/rocplot.m new file mode 100644 index 0000000000000000000000000000000000000000..83f92eb3603242438a6c50447c9405d2b35e5a02 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/rocplot.m @@ -0,0 +1,65 @@ +function [AUC, TPR, FPR] = rocplot(p, y) +% ROCPLOT Plots the receiver operating characteristic (ROC) curve and +% calculates the area under the curve (AUC). +% +% Usage: +% rocplot(p, y); +% [AUC, TPR, FDR] = rocplot(p, y); +% +% Input: +% p: Estimated probability of class 1. (Between 0 and 1.) +% y: True class indices. (Equal to 0 or 1.) +% +% Output: +% AUC: The area under the ROC curve +% TPR: True positive rate +% FPR: False positive rate +% +% Copyright 2011, Mikkel N. Schmidt, Morten Mørup, Technical University of Denmark + +%% Old code assumes values of p are not the same +% [val, ind] = sort(p(:), 'ascend'); +% x = y(ind); +% FNR = cumsum(x==1)/sum(x==1); +% TPR = 1-FNR; +% TNR = cumsum(x==0)/sum(x==0); +% FPR = 1-TNR; +% TPR = [1; TPR]; +% FPR = [1; FPR]; +% AUC = -diff(FPR)' * (TPR(1:end-1)+TPR(2:end))/2; + +%% Code assuming values of p may be the same +[val,ind]=sort(p(:),'ascend'); +x=y(ind); +N0=sum(1-x); +N1=sum(x); +FNR=[zeros(length(x),1); 1]; +TNR=[zeros(length(x),1); 1]; +N_true=x(1); +N_false=1-x(1); +t=1; +for k=2:length(val) + if val(k-1)~=val(k) + t=t+1; + FNR(t)=N_true/N1; + TNR(t)=N_false/N0; + end + N_true=N_true+x(k); + N_false=N_false+(1-x(k)); +end +FNR(t+1)=1; +FNR(t+2:end)=[]; +TNR(t+1)=1; +TNR(t+2:end)=[]; +TPR = 1-FNR; +FPR = 1-TNR; +AUC = -trapz(FPR,TPR); + +plot(FPR, TPR, 'r', [0 1], [0 1], 'k'); +axis equal; +axis([0 1 0 1]); +set(gca, 'XTick', 0:.1:1, 'YTick', 0:.1:1); +grid on; +xlabel('False positive rate (1-Specificity)'); +ylabel('True positive rate (Sensitivity)'); +title(sprintf('Receiver operating characteristic (ROC)\n AUC=%.3f', AUC)); diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/similarity.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/similarity.m new file mode 100644 index 0000000000000000000000000000000000000000..9df9bd4f14fa845349f69c52c9aae96f3f71d300 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/similarity.m @@ -0,0 +1,52 @@ +function sim = similarity(X, Y, method) +% SIMILARITY Computes similarity matrices +% +% Usage: +% sim = similarity(X, Y, method) +% +% Input: +% X N1 x M matrix +% Y N2 x M matrix +% method string defining one of the following similarity measure +% 'SMC', 'smc' : Simple Matching Coefficient +% 'Jaccard', 'jac' : Jaccard coefficient +% 'ExtendedJaccard', 'ext' : The Extended Jaccard coefficient +% 'Cosine', 'cos' : Cosine Similarity +% 'Correlation', 'cor' : Correlation coefficient +% +% Output: +% sim Estimated similarity matrix between X and Y +% If input is not binary, SMC and Jaccard will make each +% attribute binary according to x>median(x) +% +% Copyright, Morten M�rup and Mikkel N. Schmidt +% Technical University of Denmark + +[N1, M] = size(X); +[N2, M] = size(Y); + +switch lower(method(1:3)) + case 'smc' % SMC + if ~all(ismember([X(:);Y(:)], [0 1])), [X,Y] = binarize(X,Y); end + sim = ((X*Y')+((1-X)*(1-Y)'))/M; + case 'jac' % Jaccard + if ~all(ismember([X(:);Y(:)], [0 1])), [X,Y] = binarize(X,Y); end + sim = (X*Y')./(M-(1-X)*(1-Y)'); + case 'ext' % Extended Jaccard + XYt = X*Y'; + %sim = XYt./(log(exp(sum(X'.^2))'*exp(sum(Y'.^2)))-XYt) % This line replaced by line below 25/2-2020 + sim = XYt./(sum(X'.^2)'+sum(Y'.^2)-XYt); + case 'cos' % Cosine + sim = (X*Y')./(sqrt(sum(X'.^2))'*sqrt(sum(Y'.^2))); + case 'cor' % Correlation + X_ = zscore(X); + Y_ = zscore(Y); + sim = 1/(M-1)*X_*Y_'; +end + +function [X,Y] = binarize(X,Y) +disp('Attributes non-binary: Forcing representation to be binary.') +med = median([X;Y]); +X = double(bsxfun(@gt, X, med)); +Y = double(bsxfun(@gt, Y, med)); + diff --git a/exercises/02450Toolbox_Matlab/Tools/02450Tools/visualize_pca.m b/exercises/02450Toolbox_Matlab/Tools/02450Tools/visualize_pca.m new file mode 100644 index 0000000000000000000000000000000000000000..84a8932ad0f87cf9d6ed58a5bdfdc0cfdcae2a7d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/02450Tools/visualize_pca.m @@ -0,0 +1,139 @@ +function visualize_pca(X, y, pcs, att, attributeNames, classNames) +%VISUALIZE_PCA Visualize a pair of chosen attributes and a pair of +%principal components from a PCA analysis. +% The function takes as input a data matrix X and a grouping variable y. +% The input X is standardized, and a PCA is done on X. Following this, +% the function makes two plots. The first plot is a plot of a chosen pair +% of attributes where a chosen pair of principal directions are +% visualized as vectors (in red). The second plot is the projection of +% all the data onto the two chosen principal directions, and in that +% space the coefficients in the principal direction for the chosen +% attributes are shown as vectors (in blue). +% +% Usage: +% figure(); +% visualize_pca(X, y, pcs, att, attributeNames, classNames); +% +% Input: +% X N x M data matrix +% y N x 1 vector grouping variable (class labels) +% pcs 2 x 1 vector of chosen principal components to show +% att 2 x 1 vector of chosen attributes to show +% attributeNames M x 1 cell array of names of each of the M attributes +% classNames C x 1 cell array of names of each of the C classes in y +% +% Output: +% Two figures in a subplot visualizing the chosen attributes and +% principal directions. +% +% Copyright 2019, Technical University of Denmark + +% Standardize the data +X = zscore(X); + +% Obtain the PCA solution by calculate the SVD of input X +[U, S, V] = svd(X,'econ'); + +% Determien projection: +Z = U*S; + +% Set fontsize of vector labels +fz = 20; + +% First plot of attribute space: +subplot(1,2,1) + % Plot scatter plot of chosen attributes + C = length(classNames); + hold on + colors = get(gca,'colororder'); + for c = 0:C-1 + scatter(X(y==c,att(1)), X(y==c,att(2)), 50, 'o', ... + 'MarkerFaceColor', colors(c+1,:), ... + 'MarkerEdgeAlpha', 0, ... + 'MarkerFaceAlpha', .5); + end + xlabel(attributeNames{att(1)}, 'Color', 'b'); + ylabel(attributeNames{att(2)}, 'Color', 'b'); + axis equal + + % Plot principal directions in the attribute space, both as the unit + % vector and as a line extending along the vector. + % Start with the line: + xlimits = get(gca,'XLim'); + ylimits = get(gca,'YLim'); + for k = pcs + m = V(att(2),k)/V(att(1),k); + y1 = m*xlimits(1); + y2 = m*xlimits(2); + line([xlimits(1) xlimits(2)],[y1 y2], ... + 'LineStyle','--', ... + 'Color','k',... + 'LineWidth',.01) + text(2*V(att(1),k), 2*V(att(2),k), ... + sprintf('PC%d', k), ... + 'Color','r', ... + 'FontSize',fz); + end + % The the arrow: + quiver([0, 0],[0, 0],V(att(1),pcs),V(att(2),pcs), 1, ... + 'AutoScale','off', ... + 'Color', 'r', ... + 'MaxHeadSize', .5, ... + 'LineWidth', 1) + xlim(xlimits); + ylim(ylimits); + title('Standardized attribute space'); + grid + +% Second plot of the principal component space +subplot(1,2,2) + % Plot projection + C = length(classNames); + hold on + colors = get(gca,'colororder'); + for c = 0:C-1 + scatter(Z(y==c,pcs(1)), Z(y==c,pcs(2)), 50, 'o', ... + 'MarkerFaceColor', colors(c+1,:), ... + 'MarkerEdgeAlpha', 0, ... + 'MarkerFaceAlpha', .5); + end + xlabel(sprintf('PC %d', pcs(1)),'Color','r'); + ylabel(sprintf('PC %d', pcs(2)),'Color','r'); + axis equal + + % Determine limits to make the extended line of the attribute + % direction: + xlimits = get(gca,'XLim'); + ylimits = get(gca,'YLim'); + + % Plot the attribute coefficients as a vector in the PC space as well + % as a dashed line that spans the plot. + % Start with the line: + for a=att + m = V(a,pcs(2))/V(a,pcs(1)); + y1 = m*xlimits(1); + y2 = m*xlimits(2); + line([xlimits(1) xlimits(2)],[y1 y2], ... + 'LineStyle','--', ... + 'Color','k',... + 'LineWidth',.01) + text(2*V(a,pcs(1)), 2*V(a,pcs(2)),attributeNames{a}, ... + 'FontSize', fz, ... + 'Color','b') + end + % Then the arrow: + z = zeros(length(att),1); + quiver(z,z,V(att,pcs(1)), V(att,pcs(2)), 1, ... + 'AutoScale','off', ... + 'Color', 'b', ... + 'MaxHeadSize', .5, ... + 'LineWidth', 1) + grid + box off + xlim(xlimits); + ylim(ylimits); + legend(classNames,'Location','best'); + title('Principal component space'); + +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/MBox/mfig.m b/exercises/02450Toolbox_Matlab/Tools/MBox/mfig.m new file mode 100644 index 0000000000000000000000000000000000000000..fb6535607c87382901fac980a67d04d903fb1458 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/MBox/mfig.m @@ -0,0 +1,29 @@ +function varargout = mfig(varargin) +% MFIG Create named figure window +% +% Usage +% mfig('fig1') creates a named figure called 'fig1'. If 'fig1' already +% exists, it just becomes the current figure. + +% Copyright 2007 Mikkel N. Schmidt, ms@it.dk, www.mikkelschmidt.dk + +if nargin==0 + h = figure; + set(h, 'WindowStyle', 'docked'); +else + name = varargin{1}; + h = findobj('Name', name, 'Type', 'Figure'); + if isempty(h) + h = figure; + set(h, 'Name', name); + set(h, 'NumberTitle', 'off'); + set(h, 'WindowStyle', 'docked'); + else + h = h(1); + set(0, 'CurrentFigure', h); + end +end + +if nargout>=1 + varargout{1} = h; +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/MBox/mprogress.m b/exercises/02450Toolbox_Matlab/Tools/MBox/mprogress.m new file mode 100644 index 0000000000000000000000000000000000000000..459388eaf9d9bce43f5afa7d7c622635ca06d00d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/MBox/mprogress.m @@ -0,0 +1,84 @@ +function mprogress(n) +% MPROGRESS Display elapsed and remaining time of a for-loop +% +% Example: +% +% for n=1:N +% ... do stuff ... +% mprogress(n/N); +% end + +% Copyright 2007 Mikkel N. Schmidt, ms@it.dk, www.mikkelschmidt.dk + +% Variables +% n : Current value of counter (btwn 0 and 1) +% m : Value of counter at last display +% t0 : Time when counter was started +% c : Counter string to display +% p : Step (seconds) +% tp : Time when counter was last displayed +persistent m t0 c p tp + +% Minimum change in counter before it is displayed +N0 = .01; + +% Minimum time (seconds) between counter is displayed +T0 = 1; + +% No arguments: restart the counter +if nargin==0, n = 0; end +% Clear display +if strcmp(n, 'clear') + fprintf('%c',8*ones(length(c)+(1*length(c)>1),1)); + c = ''; + return; +end + +if isempty(m), m = inf; end +if isempty(p) || n<m, p = N0; end + + +% Only display the counter if +% (1) (2) (3) +if n-m>p || n<m || n==1 +% 1) we have taken a step greater then p +% 2) the counter has been restarted +% 3) the counter is at 100% + + % Update the counter string + if n<m % New counter + t0 = tic; + tp = []; + c = '0%'; + else % Already running counter + fprintf('%c',8*ones(length(c)+1*(length(c)>1),1)); + c = sprintf('%0.f%% (%s) %s', ... + n*100, mtime(toc(t0)), mtime(toc(t0)*(1-n)/n)); + end + + % Display counter string + disp(c); + + % Refresh display + pause(0); drawnow; + + % If timer has been displayed before, set p to make next + % update in T0 sec and counter has incresed more than N0 + if ~isempty(tp), p = max(T0*p/toc(tp), N0); end + + % Remember when the counter was last displayed + tp = tic; + + % Remember the value of the counter that was displayed + m = n; +end + + +function tstr = mtime(t) +if t<60*60 + tstr = sprintf('%02.f:%02.f', floor(t/60), mod(t,60)); +elseif t<60*60*24 + tstr = sprintf('%02.f:%02.f:%02.f', floor(t/60/60), mod(floor(t/60),60), mod(t,60)); +else + tstr = sprintf('%0.f - %02.f:%02.f:%02.f', floor(t/60/60/24), mod(floor(t/60/60),24), mod(floor(t/60),60), mod(t,60)); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/about_tmg_gui.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/about_tmg_gui.fig new file mode 100644 index 0000000000000000000000000000000000000000..b8275e33d9790bd0dbc7ac8735d91305b72fe956 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/about_tmg_gui.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/about_tmg_gui.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/about_tmg_gui.m new file mode 100644 index 0000000000000000000000000000000000000000..d6ab410a36bd420dad07a14d835a0af2263015b9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/about_tmg_gui.m @@ -0,0 +1,100 @@ +function varargout = about_tmg_gui(varargin) +% ABOUT_TMG_GUI +% ABOUT_TMG_GUI displays information for TMG. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +%Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @about_tmg_gui_OpeningFcn, ... + 'gui_OutputFcn', @about_tmg_gui_OutputFcn, ... + 'gui_LayoutFcn', [] , ... + 'gui_Callback', []); +if nargin & isstr(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + + +% --- Executes just before about_tmg_gui is made visible. +function about_tmg_gui_OpeningFcn(hObject, eventdata, handles, varargin) + +handles.output = hObject; +%load the matlab logo +current_path=strcat(fileparts(mfilename('fullpath'))); +A=imread(strcat(current_path, filesep, 'documentation', filesep, 'images', filesep, 'logo-upatras.jpg')); +image(A); +set(handles.AxesImage, 'Visible', 'off'); + +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=6.107230937499999; +wdth=11.712135520833332; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +guidata(hObject, handles); + + +% --- Outputs from this function are returned to the command line. +function varargout = about_tmg_gui_OutputFcn(hObject, eventdata, handles) + +varargout{1} = handles.output; + + +% --- Executes on button press in OnButton. +function OnButton_Callback(hObject, eventdata, handles) + +delete(handles.figure1); + + +% --- Executes during object creation, after setting all properties. +function edit1_CreateFcn(hObject, eventdata, handles) +% hObject handle to edit1 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function edit1_Callback(hObject, eventdata, handles) +% hObject handle to edit1 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of edit1 as text +% str2double(get(hObject,'String')) returns contents of edit1 as a double + + +% --- Executes on button press in updatebutton. +function updatebutton_Callback(hObject, eventdata, handles) +% hObject handle to updatebutton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +cur_tmg_version='6.0R7'; +% dis_tmg_version='5.0R6'; +% urlwrite(kapoio url); +latest_tmg_version = urlread('http://scgroup20.ceid.upatras.gr:8000/tmg/v.html'); +if ~strcmp(cur_tmg_version, latest_tmg_version), + msgbox('New Version available', 'Update', 'modal'); + web('http://scgroup20.ceid.upatras.gr:8000/tmg/index.php?option=com_content&view=article&id=118&Itemid=14','-browser'); +else + msgbox('No new versions available...','Update','modal'); +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_multi.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_multi.m new file mode 100644 index 0000000000000000000000000000000000000000..87af7873f6ab0044eea96434bb06f13c93af585e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_multi.m @@ -0,0 +1,16 @@ +function labels_as=knn_multi(A, Q, k, labels, normalize_docs, thresholds) +% KNN_MULTI - k-Nearest Neighboors classifier for multi-label +% collections +% LABELS_AS=KNN_MULTI(A, Q, K, LABELS, NORMALIZED_DOCS, +% THRESHOLDS) classifies the columns of Q with the K-Nearest +% Neighboors classifier using the pre-classified columns of +% matrix A with labels LABELS (cell array of vectors of +% integers). THRESHOLDS is a vector of class threshold +% values. NORMALIZED_DOCS defines if cosine (1) or euclidean +% distance (0) similarity measure is to be used. LABELS_AS +% contains the assigned labels for the columns of Q. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(6, 6, nargin)); +labels_as=knn_multi_p(A, Q, k, labels, normalize_docs, thresholds); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_multi_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_multi_p.p new file mode 100644 index 0000000000000000000000000000000000000000..6bc8d1215c53f04ac597299b3cc4a1e64207c31f Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_multi_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_single.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_single.m new file mode 100644 index 0000000000000000000000000000000000000000..0741df6225f012bad6592dca839ef52c321784ae --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_single.m @@ -0,0 +1,15 @@ +function labels_as=knn_single(A, Q, k, labels, normalize_docs) +% KNN_SINGLE - k-Nearest Neighboors classifier for single-label +% collections +% LABELS_AS=KNN_SINGLE(A, Q, K, LABELS, NORMALIZED_DOCS) +% classifies the columns of Q with the K-Nearest Neighboors +% classifier using the pre-classified columns of matrix A +% with labels LABELS (vector of integers). NORMALIZED_DOCS +% defines if cosine (1) or euclidean distance (0) similarity +% measure is to be used. LABELS_AS contains the assigned +% labels for the columns of Q. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(5, 5, nargin)); +labels_as=knn_single_p(A, Q, k, labels, normalize_docs); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_single_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_single_p.p new file mode 100644 index 0000000000000000000000000000000000000000..5cd98661588b4c2ed0f6b1475b9b3e6896b0ca4f Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/knn_single_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_multi.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_multi.m new file mode 100644 index 0000000000000000000000000000000000000000..c73fad5969e403d048e46c361b3a46b12e7cfbe0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_multi.m @@ -0,0 +1,38 @@ +function labels_as=llsf_multi(A, Q, clusters, labels, l, method, thresholds, svd_method, clsi_method) +% LLSF_MULTI - Linear Least Squares Fit for multi-label +% collections [2] +% LABELS_AS=LLSF_MULTI(A, Q, CLUSTERS, LABELS, L, METHOD, +% THRESHOLDS, SVD_METHOD, CLSI_METHOD) classifies the +% columns of Q with the Linear Least Squares Fit classifier +% [2] using the pre-classified columns of matrix A with +% labels LABELS (cell array of vectors of integers). +% THRESHOLDS is a vector of class threshold values, while +% CLUSTERS is a structure defining the classes. METHOD +% is the method used for the approximation of the rank-l +% truncated SVD, with possible values: +% - 'clsi': Clustered Latent Semantic Indexing [3]. +% - 'cm': Centroids Method [1]. +% - 'svd': Singular Value Decomosition. +% SVD_METHOD defines the method used for the computation +% of the SVD, while CLSI_METHOD defines the method used +% for the determination of the number of factors from each +% class used in Clustered Latent Semantic Indexing in case +% METHOD equals 'clsi'. +% +% REFERENCES: +% [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional +% Representation of Text Data Based on Centroids and Least +% Squares. BIT Numerical Mathematics, 43(2):427�448, 2003. +% [2] Y. Yang and C. Chute. A Linear Least Squares Fit +% Mapping Method for Information Retrieval from Natural +% Language Texts. In Proc. 14th Conference on Computational +% Linguistics, pages 447�453, Morristown, NJ, USA, 1992. +% [3] D. Zeimpekis and E. Gallopoulos, "Linear and +% Non-Linear Dimensional Reduction via Class Representatives +% for Text Classification". In Proc. 2006 IEEE International +% Conference on Data Mining (ICDM'06), Hong Kong, Dec. 2006. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(9, 9, nargin)); +labels_as=llsf_multi_p(A, Q, clusters, labels, l, method, thresholds, svd_method, clsi_method); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_multi_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_multi_p.p new file mode 100644 index 0000000000000000000000000000000000000000..11fc478a584dafd57df0df65d29a4a6ff164b747 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_multi_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_single.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_single.m new file mode 100644 index 0000000000000000000000000000000000000000..41c4eb312b13e4f806c1b93b3dd9584d5bf7e501 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_single.m @@ -0,0 +1,37 @@ +function labels_as=llsf_single(A, Q, clusters, labels, l, method, svd_method, clsi_method) +% LLSF_SINGLE - Linear Least Squares Fit for single-label +% collections [2] +% LABELS_AS=LLSF_SINGLE(A, Q, CLUSTERS, LABELS, L, METHOD, +% SVD_METHOD, CLSI_METHOD) classifies the columns of Q +% with the Linear Least Squares Fit classifier [2] using +% the pre-classified columns of matrix A with labels LABELS +% (cell array of vectors of integers). CLUSTERS is a +% structure defining the classes. METHOD is the method +% used for the approximation of the rank-l truncated SVD, +% with possible values: +% - 'clsi': Clustered Latent Semantic Indexing [3]. +% - 'cm': Centroids Method [1]. +% - 'svd': Singular Value Decomosition. +% SVD_METHOD defines the method used for the computation +% of the SVD, while CLSI_METHOD defines the method used for +% the determination of the number of factors from each class +% used in Clustered Latent Semantic Indexing in case METHOD +% equals 'clsi'. +% +% REFERENCES: +% [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional +% Representation of Text Data Based on Centroids and Least +% Squares. BIT Numerical Mathematics, 43(2):427�448, 2003. +% [2] Y. Yang and C. Chute. A Linear Least Squares Fit +% Mapping Method for Information Retrieval from Natural +% Language Texts. In Proc. 14th Conference on Computational +% Linguistics, pages 447�453, Morristown, NJ, USA, 1992. +% [3] D. Zeimpekis and E. Gallopoulos, "Non-Linear Dimensional +% Reduction via Class Representatives for Text Classification". +% In Proc. 2006 IEEE International Conference on Data Mining +% (ICDM'06), Hong Kong, Dec. 2006. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(8, 8, nargin)); +labels_as=llsf_single_p(A, Q, clusters, labels, l, method, svd_method, clsi_method); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_single_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_single_p.p new file mode 100644 index 0000000000000000000000000000000000000000..6d7336001be6f1122d80f764fbd8de3587256511 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/llsf_single_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_multi.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_multi.m new file mode 100644 index 0000000000000000000000000000000000000000..787ea865c9253cfe0f866646b9d6c13a68eebfa8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_multi.m @@ -0,0 +1,12 @@ +function clusters=make_clusters_multi(labels) +% MAKE_CLUSTERS_MULTI - auxiliary function for the classification +% algorithms +% CLUSTERS=MAKE_CLUSTERS_MULTI(LABELS) forms the cluster +% structure of a multi-label collection with document +% classes defined by LABELS (cell array of vectors of +% integers). +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +clusters=make_clusters_multi_p(labels); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_multi_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_multi_p.p new file mode 100644 index 0000000000000000000000000000000000000000..3bb056fad46a5d5aa29c07cdd61c1a22abcdb1eb Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_multi_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_single.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_single.m new file mode 100644 index 0000000000000000000000000000000000000000..0e699d3efea905a52c7f1edbb34b86fb17be75b2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_single.m @@ -0,0 +1,11 @@ +function clusters=make_clusters_single(labels) +% MAKE_CLUSTERS_SINGLE - auxiliary function for the classification +% algorithms +% CLUSTERS=MAKE_CLUSTERS_SINGLE(LABELS) forms the cluster +% structure of a single-label collection with document classes +% defined by LABELS (vector of integers). +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +clusters=make_clusters_single_p(labels); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_single_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_single_p.p new file mode 100644 index 0000000000000000000000000000000000000000..af06f937248fce4f0ef439b15774b62c2bd25b00 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_clusters_single_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_val_inds.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_val_inds.m new file mode 100644 index 0000000000000000000000000000000000000000..d85b092234bccd143ec62044f7cf9a8e437559cc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_val_inds.m @@ -0,0 +1,12 @@ +function inds=make_val_inds(labels) +% MAKE_VAL_INDS - auxiliary function for the classification +% algorithms +% INDS=MAKE_VAL_INDS(LABELS) constructs an index vector used +% during the thresholding phase of any classifier for the +% multi-label collection with document classes defined by +% LABELS (cell array of vectors of integers). +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +inds=make_val_inds_p(labels); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_val_inds_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_val_inds_p.p new file mode 100644 index 0000000000000000000000000000000000000000..ddb46fa1e0798f9081ead62e035df46b99ace112 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/make_val_inds_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_multi.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_multi.m new file mode 100644 index 0000000000000000000000000000000000000000..003fd3b33aec75f12e07eaa71d3018f8dfc2be64 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_multi.m @@ -0,0 +1,17 @@ +function labels_as=rocchio_multi(A, clusters, beta, gamma, Q, labels, normalize_docs, thresholds) +% ROCCHIO_MULTI - Rocchio classifier for multi-label collections +% LABELS_AS=KNN_MULTI(A, CLUSTERS, BETA, GAMMA, Q, LABELS, +% NORMALIZED_DOCS, THRESHOLDS) classifies the columns of Q +% with the Rocchio classifier using the pre-classified columns +% of matrix A with labels LABELS (vector of integers). +% THRESHOLDS is a vector of class threshold values. BETA and +% GAMMA define the weight of positive and negative examples in +% the formation of each class centroid. NORMALIZED_DOCS defines +% if cosine (1) or euclidean distance (0) similarity measure is +% to be used. LABELS_AS contains the assigned labels for the +% columns of Q. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(8, 8, nargin)); +labels_as=rocchio_multi_p(A, clusters, beta, gamma, Q, labels, normalize_docs, thresholds); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_multi_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_multi_p.p new file mode 100644 index 0000000000000000000000000000000000000000..f61045951fe953153c106c9c55fd48abceeda4db Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_multi_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_single.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_single.m new file mode 100644 index 0000000000000000000000000000000000000000..9715f09995e697aa332c2c5c13927e32c714f530 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_single.m @@ -0,0 +1,16 @@ +function labels_as=rocchio_single(A, clusters, beta, gamma, Q, labels, normalize_docs) +% ROCCHIO_SINGLE - Rocchio classifier for single-label collections +% LABELS_AS=KNN_SINGLE(A, CLUSTERS, BETA, GAMMA, Q, LABELS, +% NORMALIZED_DOCS) classifies the columns of Q with the +% Rocchio classifier using the pre-classified columns of +% matrix A with labels LABELS (vector of integers). +% BETA and GAMMA define the weight of positive and negative +% examples in the formation of each class centroid. +% NORMALIZED_DOCS defines if cosine (1) or euclidean distance +% (0) similarity measure is to be used. LABELS_AS contains +% the assigned labels for the columns of Q. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(7, 7, nargin)); +labels_as=rocchio_single_p(A, clusters, beta, gamma, Q, labels, normalize_docs); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_single_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_single_p.p new file mode 100644 index 0000000000000000000000000000000000000000..67fb8b935e33af04b2721ba1ab087437a35765fa Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/rocchio_single_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_knn.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_knn.m new file mode 100644 index 0000000000000000000000000000000000000000..d5744703d9707d078627f6967f438ede8c8df602 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_knn.m @@ -0,0 +1,28 @@ +function varargout=scut_knn(A, Q, k, labels_tr, labels_te, minf1, normalize, steps) +% SCUT_KNN - implements the Scut thresholding technique from [1] +% for the k-Nearest Neighboors classifier +% THRESHOLD=SCUT_KNN(A, Q, K, LABELS_TR, LABELS_TE, MINF1, +% NORMALIZE, STEPS) returns the vector of thresholds for +% the k-Nearest Neighboors classifier for the collection +% [A Q]. A and Q define the training and test parts of +% the validation set with labels LABELS_TR and LABELS_TE +% respectively. MINF1 defines the minimum F1 value and +% NORMALIZE defines if cosine (1) or euclidean distance (0) +% measure of similarity is to be used. Finally, STEPS +% defines the number of steps used during thresholding. +% [THRESHOLD, F, THRESHOLDS]=SCUT_KNN(A, Q, K, LABELS_TR, +% LABELS_TE, MINF1, NORMALIZE, STEPS) returns also the best +% F1 value as well as the matrix of thresholds for each step +% (row i corresponds to step i). +% +% REFERENCES: +% [1] Y. Yang. A Study of Thresholding Strategies for Text +% Categorization. In Proc. 24th ACM SIGIR, pages 137�145, +% New York, NY, USA, 2001. ACM Press. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(8, 8, nargin)); +if nargout==1, varargout{1}=scut_knn_p(A, Q, k, labels_tr, labels_te, minf1, normalize, steps); end +if nargout==2, [varargout{1}, varargout{2}]=scut_knn_p(A, Q, k, labels_tr, labels_te, minf1, normalize, steps); end +if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=scut_knn_p(A, Q, k, labels_tr, labels_te, minf1, normalize, steps); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_knn_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_knn_p.p new file mode 100644 index 0000000000000000000000000000000000000000..4e524e00a1a1dc18f67c0072fec6111e28edf2a0 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_knn_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_llsf.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_llsf.m new file mode 100644 index 0000000000000000000000000000000000000000..161486d589b21073239c3a7572bc80f463e288a2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_llsf.m @@ -0,0 +1,50 @@ +function varargout=scut_llsf(A, Q, clusters, labels_tr, labels_te, minf1, l, method, steps, svd_method, clsi_method) +% SCUT_LLSF - implements the Scut thresholding technique from [2] +% for the Linear Least Squares Fit classifier [3] +% THRESHOLD=SCUT_LLSF(A, Q, CLUSTERS, K, LABELS_TR, LABELS_TE, +% MINF1, L, METHOD, STEPS, SVD_METHOD, CLSI_METHOD) returns +% the vector of thresholds for the Linear Least Squares Fit +% classifier for the collection [A Q]. A and Q define the +% training and test parts of the validation set with labels +% LABELS_TR and LABELS_TE respectively. CLUSTERS is a +% structure defining the classes, while MINF1 defines the +% minimum F1 value and STEPS defines the number of steps +% used during thresholding. +% METHOD is the method used for the approximation of the +% rank-l truncated SVD, with possible values: +% - 'clsi': Clustered Latent Semantic Indexing [4]. +% - 'cm': Centroids Method [1]. +% - 'svd': Singular Value Decomosition. +% SVD_METHOD defines the method used for the computation of +% the SVD, while CLSI_METHOD defines the method used for the +% determination of the number of factors from each class used +% in Clustered Latent Semantic Indexing in case METHOD equals +% 'clsi'. +% [THRESHOLD, F, THRESHOLDS]=SCUT_LLSF(A, Q, CLUSTERS, K, +% LABELS_TR, LABELS_TE, MINF1, L, METHOD, STEPS, SVD_METHOD, +% CLSI_METHOD) returns also the best F1 value as well as the +% matrix of thresholds for each step (row i corresponds to +% step i). +% +% REFERENCES: +% [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional +% Representation of Text Data Based on Centroids and Least +% Squares. BIT Numerical Mathematics, 43(2):427�448, 2003. +% [2] Y. Yang. A Study of Thresholding Strategies for Text +% Categorization. In Proc. 24th ACM SIGIR, pages 137�145, +% New York, NY, USA, 2001. ACM Press. +% [3] Y. Yang and C. Chute. A Linear Least Squares Fit +% Mapping Method for Information Retrieval from Natural +% Language Texts. In Proc. 14th Conference on Computational +% Linguistics, pages 447�453, Morristown, NJ, USA, 1992. +% [4] D. Zeimpekis and E. Gallopoulos, "Non-Linear Dimensional +% Reduction via Class Representatives for Text Classification". +% In Proc. 2006 IEEE International Conference on Data Mining +% (ICDM'06), Hong Kong, Dec. 2006. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(11, 11, nargin)); +if nargout==1, varargout{1}=scut_llsf_p(A, Q, clusters, labels_tr, labels_te, minf1, l, method, steps, svd_method, clsi_method); end +if nargout==2, [varargout{1}, varargout{2}]=scut_llsf_p(A, Q, clusters, labels_tr, labels_te, minf1, l, method, steps, svd_method, clsi_method); end +if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=scut_llsf_p(A, Q, clusters, labels_tr, labels_te, minf1, l, method, steps, svd_method, clsi_method); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_llsf_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_llsf_p.p new file mode 100644 index 0000000000000000000000000000000000000000..46845e3037ea1f325193684469562a82bd7570fb Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_llsf_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_rocchio.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_rocchio.m new file mode 100644 index 0000000000000000000000000000000000000000..36e31e13719a86da3a79f70cdfc1f261dcfbe7d5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_rocchio.m @@ -0,0 +1,32 @@ +function varargout=scut_rocchio(A, clusters, beta, gamma, Q, labels_tr, labels_te, minf1, normalize, steps) +% SCUT_ROCCHIO - implements the Scut thresholding technique +% from [1] for the Rocchio classifier +% THRESHOLD=SCUT_ROCCHIO(A, CLUSTERS, BETA, GAMMA, Q, +% LABELS_TR, LABELS_TE, MINF1, NORMALIZE, STEPS) returns +% the vector of thresholds for the Rocchio classifier +% for the collection [A Q]. A and Q define the training +% and test parts of the validation set with labels +% LABELS_TR and LABELS_TE respectively. MINF1 defines +% the minimum F1 value, while NORMALIZE defines if cosine +% (1) or euclidean distance (0) measure of similarity is +% to be used, CLUSTERS is a structure defining the classes +% and STEPS defines the number of steps used during +% thresholding. BETA and GAMMA define the weight of positive +% and negative examples in the formation of each class +% centroid. +% [THRESHOLD, F, THRESHOLDS]=SCUT_ROCCHIO(A, CLUSTERS, BETA, +% GAMMA, Q, LABELS_TR, LABELS_TE, MINF1, NORMALIZE, STEPS) +% returns also the best F1 value as well as the matrix of +% thresholds for each step (row i corresponds to step i). +% +% REFERENCES: +% [1] Y. Yang. A Study of Thresholding Strategies for Text +% Categorization. In Proc. 24th ACM SIGIR, pages 137�145, +% New York, NY, USA, 2001. ACM Press. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(10, 10, nargin)); +if nargout==1, varargout{1}=scut_rocchio_p(A, clusters, beta, gamma, Q, labels_tr, labels_te, minf1, normalize, steps); end +if nargout==2, [varargout{1}, varargout{2}]=scut_rocchio_p(A, clusters, beta, gamma, Q, labels_tr, labels_te, minf1, normalize, steps); end +if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=scut_rocchio_p(A, clusters, beta, gamma, Q, labels_tr, labels_te, minf1, normalize, steps); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_rocchio_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_rocchio_p.p new file mode 100644 index 0000000000000000000000000000000000000000..8c563df97d172f4c792ff3d80c3e2f4de97dca5a Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification/scut_rocchio_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification_gui.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification_gui.fig new file mode 100644 index 0000000000000000000000000000000000000000..3542e575728b9cb214de4b7bac0bca88853542ba Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification_gui.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification_gui.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification_gui.m new file mode 100644 index 0000000000000000000000000000000000000000..e3ee9cf6078afeff7a7779d5e8faf406f66de790 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/classification_gui.m @@ -0,0 +1,1512 @@ +function varargout = classification_gui(varargin) +% CLASSIFICATION_GUI +% CLASSIFICATION_GUI is a graphical user interface for all +% the classification functions of the Text to Matrix Generator +% (TMG) Toolbox. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @classification_gui_OpeningFcn, ... + 'gui_OutputFcn', @classification_gui_OutputFcn, ... + 'gui_LayoutFcn', [], ... + 'gui_Callback', []); +if nargin && ischar(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + +% --- Executes just before classification_gui is made visible. +function classification_gui_OpeningFcn(hObject, eventdata, handles, varargin) +% This function has no output args, see OutputFcn. +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +% varargin unrecognized PropertyName/PropertyValue pairs from the +% command line (see VARARGIN) + +% Choose default command line output for classification_gui +handles.output = hObject; + +handles.light_gray=[0.8824 0.8824 0.8824]; +handles.gray=[0.9255 0.9137 0.8471]; +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=14.5410; +wdth=15.7572; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +OPTIONS=struct('delimiter', 'none_delimiter', 'line_delimiter', 1, 'stemming', 0, ... + 'local_weight', 't', 'dsp', 0, 'parse_subd', 0, 'remove_al', 0, 'remove_num', 0); +handles.OPTIONS=OPTIONS; +handles.gwquery_type='Files'; handles.labels_type='Files'; + +handles.objects=[handles.Labels;handles.LabelsButton;handles.StoredLabels;handles.SQuery;... + handles.FQuery;handles.FQueryButton;handles.SQueryRadio;handles.FQueryRadio;... + handles.GW;handles.GWButton;handles.StoredGW;handles.Stoplist;handles.StoplistButton;... + handles.TW;handles.MultiRadio;handles.SingleRadio;handles.kNNRadio;handles.kNN;... + handles.RocchioRadio;handles.RocchioPos;handles.RocchioNeg;handles.LLSFRadio;... + handles.nFactorsLLSF;handles.UseThresholds;handles.ComputeThresholds;handles.Thresholds;... + handles.ThresholdsButton;handles.Fvalue;handles.VSMRadio;handles.LSARadio;handles.LSAMethod;... + handles.nFactors;handles.Similarity;handles.svdsRadio;handles.propackRadio;handles.Delimiter;... + handles.LineDelimiter;handles.RemoveNum;handles.RemoveAl;handles.ParseSubd;]; + +states=zeros(length(handles.objects), 1); +states([4 7 8])=1; +handles=activate_uicontrol(states, handles); +handles.methods={'Singular Value Decomposition';'Clustered Latent Semantic Indexing';'Centroid Method'}; +handles.k=cell(1, 1); +handles.real_methods=cell(1, 1); +set(handles.sp_text1, 'Visible', 'off'); set(handles.sp_text2, 'Visible', 'off'); +set(handles.sp_text3, 'Visible', 'off'); set(handles.sp_text4, 'Visible', 'off'); +set(handles.sp_text5, 'Visible', 'off'); set(handles.sp_text6, 'Visible', 'on'); +set(handles.FQuery, 'Visible', 'off'); set(handles.FQueryButton, 'Visible', 'off'); +set(handles.svdsRadio, 'Visible', 'off'); set(handles.propackRadio, 'Visible', 'off'); +set(handles.Delimiter, 'Visible', 'off'); set(handles.LineDelimiter, 'Visible', 'off'); +set(handles.RemoveAl, 'Visible', 'off'); set(handles.RemoveNum, 'Visible', 'off'); +set(handles.ParseSubd, 'Visible', 'off'); +% Update handles structure +guidata(hObject, handles); + +% UIWAIT makes classification_gui wait for user response (see UIRESUME) +% uiwait(handles.figure1); + + +% --- Outputs from this function are returned to the command line. +function varargout = classification_gui_OutputFcn(hObject, eventdata, handles) +% varargout cell array for returning output args (see VARARGOUT); +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Get default command line output from handles structure +varargout{1} = handles.output; + + +% --- Executes on selection change in DatasetMenu. +function DatasetMenu_Callback(hObject, eventdata, handles) +% hObject handle to DatasetMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns DatasetMenu contents as cell array +% contents{get(hObject,'Value')} returns selected item from +% DatasetMenu +s=get(hObject, 'String'); v=get(hObject, 'Value'); +states=zeros(length(handles.objects), 1); +if ~isempty(s{v}), + states(3)=1; + if get(handles.StoredLabels, 'Value')==0, states([1 2])=1; end + states((4:8))=1; + if get(handles.StoredGW, 'Value')==0, states([9 10])=1; end + states((11:17))=1; states(19)=1; states(22)=1; + if get(handles.kNNRadio, 'Value')==1, states(18)=1; end + if get(handles.RocchioRadio, 'Value')==1, states([20 21])=1; end + if get(handles.LLSFRadio, 'Value')==1, states(23)=1; end + if get(handles.MultiRadio, 'Value')==1, + states([24 25])=1; + if get(handles.UseThresholds, 'Value')==1, states([26 27])=1; end + if get(handles.ComputeThresholds, 'Value')==1, states(28)=1; end + end + states(29)=1; + k=cell(4, 1); + act=zeros(4, 1); + ss={'svd';'clsi';'cm'}; + str=s{v}; + for i=1:length(ss), + str1=strcat(str, filesep, ss{i}); + if exist(str1), + sss=dir(str1); + for j=1:size(sss, 1), + cur=sss(j); + if isequal(cur, '.') | isequal(cur, '..') | ~isdir(strcat(str1, filesep, cur.name)), continue; end + if i==1, + if exist(strcat(str1, filesep, cur.name, filesep, 'Usvd.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Ssvd.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Vsvd.mat')), + act(1)=1; + kk=str2double(cur.name(3:end)); if isempty(k{1}), k{1}=kk; else, k{1}(end+1, 1)=kk; end + end + end + if i==2, + if exist(strcat(str1, filesep, cur.name, filesep, 'Xclsi.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Yclsi.mat')), + act(2)=1; + kk=str2double(cur.name(3:end)); if isempty(k{2}), k{2}=kk; else, k{2}(end+1, 1)=kk; end + end + end + if i==3, + if exist(strcat(str1, filesep, cur.name, filesep, 'Xcm.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Ycm.mat')), + act(3)=1; + kk=str2double(cur.name(3:end)); if isempty(k{3}), k{3}=kk; else, k{3}(end+1, 4)=kk; end + end + end + end + end + end + + if ~isempty(find(act)), + handles.k=k; handles.real_methods={handles.methods{find(act)}}'; + set(handles.sp_text1, 'Visible', 'off'); set(handles.sp_text2, 'Visible', 'off'); + states(32)=1; + else, + handles.k=cell(1, 1); handles.real_methods=cell(1, 1); + set(handles.sp_text1, 'Visible', 'on'); set(handles.sp_text2, 'Visible', 'on'); + set(handles.LSARadio, 'Value', 0); set(handles.VSMRadio, 'Value', 1); + end + guidata(hObject, handles); + set(handles.LSAMethod, 'String', handles.real_methods); set(handles.LSAMethod, 'Value', 1); + set(handles.nFactors, 'String', handles.k); set(handles.nFactors, 'Value', 1); + + if get(handles.LLSFRadio, 'Value')==1, + states([29 32 33])=0; states([30 31 34 35])=1; + set(handles.svdsRadio, 'Visible', 'on'); set(handles.propackRadio, 'Visible', 'on'); set(handles.sp_text3, 'Visible', 'on'); + set(handles.svdsRadio, 'Enable', 'on'); set(handles.propackRadio, 'Enable', 'on'); + set(handles.LSARadio, 'Value', 1); + else, + set(handles.svdsRadio, 'Visible', 'off'); set(handles.propackRadio, 'Visible', 'off'); set(handles.sp_text3, 'Visible', 'off'); + set(handles.svdsRadio, 'Enable', 'off'); set(handles.propackRadio, 'Enable', 'off'); + states(33)=1; + states(29)=1; + if isempty(find(act)), + states([30 31])=0; + else, + states([30 31])=1; + set(handles.LSAMethod, 'String', {handles.methods{find(act)}}'); + frs=find(act); set(handles.nFactors, 'String', k{frs(1)}); + end + end + + if get(handles.FQueryRadio, 'Value')==1, + set(handles.sp_text5, 'Visible', 'on'); set(handles.sp_text6, 'Visible', 'off'); + states([5 6 36 37])=1; + set(handles.Delimiter, 'Enable', 'on'); set(handles.Delimiter, 'BackgroundColor', 'white'); set(handles.sp_text4, 'Visible', 'on'); + set(handles.LineDelimiter, 'Visible', 'on'); + else, + set(handles.sp_text5, 'Visible', 'off'); set(handles.sp_text6, 'Visible', 'on'); + states(36)=0; + set(handles.Delimiter, 'Enable', 'off'); set(handles.Delimiter, 'BackgroundColor', handles.light_gray);set(handles.sp_text4, 'Visible', 'off'); + set(handles.LineDelimiter, 'Visible', 'off'); + end +end +handles=activate_uicontrol(states, handles); +if get(handles.SQueryRadio, 'Value')==1, + set(handles.SQuery, 'Visible', 'on'); + set(handles.FQuery, 'Visible', 'off'); set(handles.FQueryButton, 'Visible', 'off'); +else, + set(handles.SQuery, 'Visible', 'off'); + set(handles.FQuery, 'Visible', 'on'); set(handles.FQueryButton, 'Visible', 'on'); +end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function DatasetMenu_CreateFcn(hObject, eventdata, handles) +% hObject handle to DatasetMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end +datasets=cell(1, 1); datasets{1, 1}=''; +n_datasets=0; +str=fileparts(mfilename('fullpath')); +dirs=dir(strcat(str, filesep, 'data')); +for i=1:size(dirs, 1), + cur=dirs(i); + if isequal(cur.name, '.') | isequal(cur.name, '..') | ~isdir(strcat(str, filesep, 'data', filesep, cur.name)), continue; end + if exist(strcat(str, filesep, 'data', filesep, cur.name, filesep, 'A.mat')), n_datasets=n_datasets+1; datasets{n_datasets+1, 1}=strcat(str, filesep, 'data', filesep, cur.name); end +end +set(hObject, 'String', datasets); +guidata(hObject, handles); + +% --- Executes on button press in ContinueButton. +function ContinueButton_Callback(hObject, eventdata, handles) +% hObject handle to ContinueButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +str=get(handles.DatasetMenu, 'String'); str=str{get(handles.DatasetMenu, 'Value')}; +if isempty(str), + an=new_sprintf('Select a dataset...'); + msgbox(an, 'Error', 'modal'); + return; +end + +load(strcat(str, filesep, 'A.mat')); + +if get(handles.StoredLabels, 'Value')==1, + try, + load(strcat(str, filesep, 'labels.mat')); + catch, + an=new_sprintf('Variable %s not found...', strcat(str, filesep, 'labels.mat')); + msgbox(an, 'Error', 'modal'); + return; + end +else, + if isempty(get(handles.Labels, 'String')), + an=new_sprintf('You didn''t supply the labels file-variable...'); + msgbox(an, 'Error', 'modal'); + return; + end + if isequal(handles.labels_type, 'Files'), + try, + load(get(handles.Labels, 'String')); + labels=eval(char(fieldnames(load(get(handles.Labels, 'String'))))); + catch, + an=new_sprintf('Bad format for labels file %s...', get(handles.Labels, 'String')); + msgbox(an, 'Error', 'modal'); + return; + end + else, + labels=evalin('base', get(handles.Labels, 'String')); + end +end + +if ~iscell(labels), + an=new_sprintf('Labels must be a cell array...'); + msgbox(an, 'Error', 'modal'); + return; +end + +if size(A, 2)~=length(labels) | (size(labels, 2)~=1 & size(labels, 2)~=1 & size(A, 2)~=1), + an=new_sprintf('Labels variable size does not match with number of documents...', get(handles.Labels, 'String')); + msgbox(an, 'Error', 'modal'); + return; +end + +[labels, unique_labels]=make_labels(labels); + + +if iscell(labels)==1 & get(handles.SingleRadio, 'Value')==1, + an=new_sprintf('You supplied a multi-label variable for a single-label collection...', get(handles.Labels, 'String')); + msgbox(an, 'Error', 'modal'); + return; +end + +if get(handles.MultiRadio, 'Value')==1, + if get(handles.UseThresholds, 'Value')==1, + if isempty(get(handles.Thresholds, 'String')), + an=new_sprintf('You haven''t supplied the thresholds variable...', get(handles.Labels, 'String')); + msgbox(an, 'Error', 'modal'); + return; + end + try, + thresholds=evalin('base', get(handles.Thresholds, 'String')); + catch, + an=new_sprintf('Variable %s not found...', get(handles.Thresholds, 'String')); + msgbox(an, 'Error', 'modal'); + return; + end + if length(thresholds)~=length(unique_labels), + an=new_sprintf('Length of thresholds variable does not match number of classes...'); + msgbox(an, 'Error', 'modal'); + return; + end + else, + if isempty(get(handles.Fvalue, 'String')), + an=new_sprintf('You haven''t supply the minimum F-value...'); + msgbox(an, 'Error', 'modal'); + return; + end + minF1=str2double(get(handles.Fvalue, 'String')); + if minF1<=0 | minF1>=1, + an=new_sprintf('Minimum F-value must be greater than 0 and less than 1...'); + msgbox(an, 'Error', 'modal'); + return; + end + thresholds=[]; + inds=make_val_inds(labels); + clusters1=make_clusters_multi({labels{find(inds==1)}}'); + end +end +if get(handles.MultiRadio, 'Value')==1, clusters=make_clusters_multi(labels); else, clusters=make_clusters_single(labels); end + +if get(handles.SQueryRadio, 'Value')==1, + if isempty(get(handles.SQuery, 'String')), + an=new_sprintf('You didn''t provide a query...'); + msgbox(an, 'Error', 'modal'); + return; + end +else, + if isempty(handles.filename), + an=new_sprintf('You didin''t supply a file...'); + msgbox(an, 'Error', 'modal'); + return; + end + if ~exist(handles.filename), + an=new_sprintf('File %s not found...', handles.filename); + msgbox(an, 'Error', 'modal'); + return; + end +end +if get(handles.StoredGW, 'Value'), + if exist(strcat(str, filesep, 'global_weights.mat')), load(strcat(str, filesep, 'global_weights.mat')); end +else, + if isempty(get(handles.GW, 'String')), + global_weights=ones(size(dictionary, 1), 1); + else, + if isequal(handles.gwquery_type, 'Files'), + if ~exist(get(handles.GW, 'String')), + an=new_sprintf('File %s not found...', get(handles.GW, 'String')); + msgbox(an, 'Error', 'modal'); + return; + else, + load(get(handles.GW, 'String')) + global_weights=eval(char(fieldnames(load(get(handles.GW, 'String'))))); + if size(global_weights, 1)~=size(A, 1), + an=new_sprintf('Dictionary size does not match...'); + msgbox(an, 'Error', 'modal'); + return; + end + opts.global_weights=global_weights; + end + else, + global_weights=evalin('base', get(handles.GW, 'String')); + if size(global_weights, 1)~=size(A, 1), + an=new_sprintf('Dictionary size does not match...'); + msgbox(an, 'Error', 'modal'); + return; + end + opts.global_weights=global_weights; + end + end +end +if ~isempty(get(handles.Stoplist, 'String')), + if ~exist(get(handles.Stoplist, 'String')), + an=new_sprintf('File %s not found...', get(handles.Stoplist, 'String')); + msgbox(an, 'Error', 'modal'); + return; + else, + handles.OPTIONS.stoplist=get(handles.Stoplist, 'String'); + end +end +if exist(strcat(str, filesep, 'update_struct.mat')), + load(strcat(str, filesep, 'update_struct.mat')); + handles.OPTIONS.stemming=update_struct.stemming; +end +guidata(hObject, handles); +try, + load(strcat(str, filesep, 'dictionary.mat')); +catch, + an=new_sprintf('Dictionary not found in %s...', strcat(str, filesep, 'dictionary.mat')); + msgbox(an, 'Error', 'modal'); + return; +end +if get(handles.FQueryRadio, 'Value')==1, + Q=tmg_query(handles.filename, dictionary,handles.OPTIONS); +else, + fname=datestr(now); fname=strrep(fname, ' ', '_'); fname=strrep(fname, ':', '-'); + qry=get(handles.SQuery, 'String'); + fid=fopen(fname, 'wt'); fprintf(fid, '%s', qry); fclose(fid); + Q=tmg_query(fname, dictionary, handles.OPTIONS); + delete(fname); +end +if nnz(Q)==0, an=new_sprintf('The query is empty...'); msgbox(an, 'Error', 'modal'); return; end + +if get(handles.MultiRadio, 'Value')==1, k_max=max([labels{:}]); else, k_max=max(labels); labels; end; +if get(handles.LLSFRadio, 'Value')==1, + method=[]; svd_method=[]; clsi_method='f1'; + if get(handles.LSAMethod, 'Value')==1, method='svd'; end + if get(handles.LSAMethod, 'Value')==2, method='clsi'; end + if get(handles.LSAMethod, 'Value')==3, method='cm'; end + if get(handles.svdsRadio, 'Value')==1, svd_method='svds'; else, svd_method='propack'; end + if isempty(get(handles.nFactorsLLSF, 'String')), + an=new_sprintf('You haven''t supply the number of factors...'); + msgbox(an, 'Error', 'modal'); + return; + end + l=str2double(get(handles.nFactorsLLSF, 'String')); + if l<k_max, + an=new_sprintf('Number of factors must be at least equal to the number of classes...'); + msgbox(an, 'Error', 'modal'); + return; + end + if get(handles.MultiRadio, 'Value')==1, + if isempty(thresholds), + thresholds=scut_llsf(A(:, find(inds==1)), A(:, find(inds==2)), clusters1, {labels{find(inds==1)}}', {labels{find(inds==2)}}', minF1, l, method, 10, svd_method, clsi_method); + end + labels_as=llsf_multi(A, Q, clusters, labels, l, method, thresholds, svd_method, clsi_method); +% for i=1:length(labels_as), +% tmp=labels_as{i}; tmp1=''; +% for j=1:length(tmp), +% if j==1, tmp1=unique_labels{tmp(j)}; else, tmp1=new_sprintf('%s %s', tmp1, unique_labels{tmp(j)}); end +% end +% labels_as{i}=tmp1; +% end + else, + labels_as=llsf_single(A, Q, clusters, labels, l, method, svd_method, clsi_method); +% labels_as={unique_labels{labels_as}}'; + end +else, + if get(handles.Similarity, 'Value')==1, normalize=1; else, normalize=0; end + if get(handles.VSMRadio, 'Value')==1, + AA=A; QQ=Q; + else, + s=get(handles.LSAMethod, 'String'); v=get(handles.LSAMethod, 'Value'); k=get(handles.nFactors, 'String'); + if isequal(s{v}, handles.methods{1}), + str=strcat(str, filesep, 'svd', filesep, 'k_', k); + load(strcat(str, filesep, 'Usvd.mat')); load(strcat(str, filesep, 'Ssvd.mat')); load(strcat(str, filesep, 'Vsvd.mat')); + AA=Ssvd*Vsvd'; QQ=Usvd'*Q; + end + if isequal(s{v}, handles.methods{2}), + str=strcat(str, filesep, 'clsi', filesep, 'k_', k); + load(strcat(str, filesep, 'Xclsi.mat')); load(strcat(str, filesep, 'Yclsi.mat')); + AA=Yclsi; QQ=Xclsi'*Q; + end + if isequal(s{v}, handles.methods{3}), + str=strcat(str, filesep, 'cm', filesep, 'k_', k); + load(strcat(str, filesep, 'Xcm.mat')); load(strcat(str, filesep, 'Ycm.mat')); + AA=Ycm; QQ=Xcm'*Q; + end + end + if get(handles.kNNRadio, 'Value')==1, + if isempty(get(handles.kNN, 'String')), + an=new_sprintf('You haven''t supply the number of nearest neighboors...'); + msgbox(an, 'Error', 'modal'); + return; + end + knn=str2double(get(handles.kNN, 'String')); + if knn<1, + an=new_sprintf('Number of nearest neighboors must be at least 1...'); + msgbox(an, 'Error', 'modal'); + return; + end + end + if get(handles.RocchioRadio, 'Value')==1, + if isempty(get(handles.RocchioPos, 'String')), + an=new_sprintf('You haven''t supply the weight of positive examples...'); + msgbox(an, 'Error', 'modal'); + return; + end + r_pos=str2double(get(handles.RocchioPos, 'String')); + if r_pos<=0, + an=new_sprintf('Positive weight must be a positive value...'); + msgbox(an, 'Error', 'modal'); + return; + end + if isempty(get(handles.RocchioNeg, 'String')), + r_neg=0; + else, + r_neg=str2double(get(handles.RocchioNeg, 'String')); + if r_neg<0, + an=new_sprintf('Negative weight must be a non-negative value...'); + msgbox(an, 'Error', 'modal'); + return; set(handles.RemoveAl, 'Visible', 'off');set(handles.RemoveNum, 'Visible', 'off');set(handles.ParseSubd, 'Visible', 'off'); + end + end + end + if get(handles.kNNRadio, 'Value')==1, + if get(handles.SingleRadio, 'Value')==1, + labels_as=knn_single(AA, QQ, knn, labels, normalize); + else, + if isempty(thresholds), + thresholds=scut_knn(AA(:, find(inds==1)), AA(:, find(inds==2)), knn, {labels{find(inds==1)}}', {labels{find(inds==2)}}', minF1, normalize, 10); + end + labels_as=knn_multi(AA, QQ, knn, labels, normalize, thresholds); + end + end + if get(handles.RocchioRadio, 'Value')==1, + if get(handles.SingleRadio, 'Value')==1, + labels_as=rocchio_single(AA, clusters, r_pos, r_neg, QQ, labels, normalize); + else, + if isempty(thresholds), + thresholds=scut_rocchio(AA(:, find(inds==1)), clusters1, r_pos, r_neg, AA(:, find(inds==2)), {labels{find(inds==1)}}', {labels{find(inds==2)}}', minF1, normalize, 10); + end + labels_as=rocchio_multi(AA, clusters, r_pos, r_neg, QQ, labels, normalize, thresholds); + end + end + assignin('base', 'Anew', AA); assignin('base', 'Qnew', QQ); +end +if get(handles.SingleRadio, 'Value')==1, + labels_as={unique_labels{labels_as}}'; +else, + for i=1:length(labels_as), + tmp=labels_as{i}; tmp1=''; + for j=1:length(tmp), + if j==1, tmp1=unique_labels{tmp(j)}; else, tmp1=new_sprintf('%s %s', tmp1, unique_labels{tmp(j)}); end + end + labels_as{i}=tmp1; + end +end +assignin('base', 'labels_as', labels_as); +assignin('base', 'A', A); assignin('base', 'Q', Q); +msgbox('Done! Results saved to labels_as variable of workspace.', 'modal'); + +% --- Executes on button press in ClearBotton. +function ClearBotton_Callback(hObject, eventdata, handles) +% hObject handle to ClearBotton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +set(handles.DatasetMenu, 'Value', 1); set(handles.Labels, 'String', ''); +set(handles.StoredLabels, 'Value', 1); set(handles.SQuery, 'String', ''); +set(handles.SQuery, 'Visible', 'on'); set(handles.FQuery, 'Visible', 'off'); set(handles.FQueryButton, 'Visible', 'off'); +set(handles.SQueryRadio, 'Value', 1); set(handles.FQueryRadio, 'Value', 0); +set(handles.GW, 'String', ''); set(handles.StoredGW, 'Value', 1); +set(handles.Stoplist, 'String', ''); set(handles.TW, 'Value', 1); +set(handles.LSAMethod, 'String', cell(1, 1)); +set(handles.MultiRadio, 'Value', 1); set(handles.SingleRadio, 'Value', 0); +set(handles.kNNRadio, 'Value', 1); set(handles.kNN, 'String', ''); +set(handles.RocchioRadio, 'Value', 0); set(handles.RocchioPos, 'String', ''); set(handles.RocchioNeg, 'String', ''); +set(handles.LLSFRadio, 'Value', 0); set(handles.nFactorsLLSF, 'String', ''); +set(handles.UseThresholds, 'Value', 1); set(handles.ComputeThresholds, 'Value', 0); +set(handles.Thresholds, 'String', ''); set(handles.Fvalue, 'String', ''); +set(handles.VSMRadio, 'Value', 1); set(handles.LSARadio, 'Value', 0); +set(handles.LSAMethod, 'String', cell(1, 1)); set(handles.LSAMethod, 'Value', 1); +set(handles.nFactors, 'String', cell(1, 1)); set(handles.Similarity, 'Value', 1); +set(handles.Similarity, 'Value', 1); +set(handles.svdsRadio, 'Value', 1); set(handles.propackRadio, 'Value', 1); +set(handles.svdsRadio, 'Visible', 'off'); set(handles.propackRadio, 'Visible', 'off'); +set(handles.sp_text1, 'Visible', 'off'); set(handles.sp_text2, 'Visible', 'off'); +set(handles.sp_text3, 'Visible', 'off'); set(handles.sp_text4, 'Visible', 'off'); +set(handles.sp_text5, 'Visible', 'off'); set(handles.sp_text6, 'Visible', 'on'); +set(handles.Delimiter, 'Visible', 'off'); set(handles.LineDelimiter, 'Visible', 'off'); set(handles.LineDelimiter, 'Value', 1); +set(handles.RemoveAl, 'Visible', 'off'); set(handles.RemoveNum, 'Visible', 'off'); set(handles.ParseSubd, 'Visible', 'off'); + +states=zeros(size(handles.objects, 1), 1); states([4 7 8])=1; +handles=activate_uicontrol(states, handles); + +% --- Executes on button press in ExitButton. +function ExitButton_Callback(hObject, eventdata, handles) +% hObject handle to ExitButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +delete(handles.figure1); + + + +function Labels_Callback(hObject, eventdata, handles) +% hObject handle to Labels (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of Labels as text +% str2double(get(hObject,'String')) returns contents of Labels as a double +s=get(hObject, 'String'); +handles.labels_type='Files'; +guidata(hObject, handles); +if isempty(s), return; end +if isequal(handles.labels_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + set(hObject, 'String', '');guidata(hObject, handles); + return; + end +end + +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Labels_CreateFcn(hObject, eventdata, handles) +% hObject handle to Labels (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in LabelsButton. +function LabelsButton_Callback(hObject, eventdata, handles) +% hObject handle to LabelsButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +[s, handles.labels_type]=open_file(2); +guidata(hObject, handles); +set(handles.Labels, 'String', s); + +if isempty(s), return; end +if isequal(handles.labels_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + set(handles.Labels, 'String', '');guidata(hObject, handles); + return; + end +end + +guidata(hObject, handles); + +% --- Executes on button press in StoredLabels. +function StoredLabels_Callback(hObject, eventdata, handles) +% hObject handle to StoredLabels (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of StoredLabels +s=get(hObject, 'Value'); +if s==1, + set(handles.Labels, 'BackgroundColor', handles.light_gray); + set(handles.Labels, 'Enable', 'off'); set(handles.LabelsButton, 'Enable', 'off'); +else, + set(handles.Labels, 'BackgroundColor', 'white'); + set(handles.Labels, 'Enable', 'on'); set(handles.LabelsButton, 'Enable', 'on'); +end +guidata(hObject, handles); + +% --- Executes on button press in MultiRadio. +function MultiRadio_Callback(hObject, eventdata, handles) +% hObject handle to MultiRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of MultiRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.SingleRadio, 'Value', 0); +end +set(handles.UseThresholds, 'Enable', 'on'); set(handles.ComputeThresholds, 'Enable', 'on'); +if get(handles.UseThresholds, 'Value')==1, + set(handles.Thresholds, 'Enable', 'on'); set(handles.ThresholdsButton, 'Enable', 'on'); + set(handles.Thresholds,'BackgroundColor', 'white'); + set(handles.Fvalue, 'Enable', 'off'); set(handles.Fvalue,'BackgroundColor', handles.light_gray); +else, + set(handles.Thresholds, 'Enable', 'off'); set(handles.ThresholdsButton, 'Enable', 'off'); + set(handles.Thresholds,'BackgroundColor', handles.light_gray); + set(handles.Fvalue, 'Enable', 'on'); set(handles.Fvalue,'BackgroundColor', 'white'); +end + +% --- Executes on button press in SingleRadio. +function SingleRadio_Callback(hObject, eventdata, handles) +% hObject handle to SingleRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of SingleRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.MultiRadio, 'Value', 0); +end +set(handles.UseThresholds, 'Enable', 'off'); set(handles.ComputeThresholds, 'Enable', 'off'); +set(handles.Thresholds, 'Enable', 'off'); set(handles.ThresholdsButton, 'Enable', 'off'); +set(handles.Fvalue, 'Enable', 'off'); +set(handles.Thresholds, 'BackgroundColor', handles.light_gray); set(handles.Fvalue, 'BackgroundColor', handles.light_gray); + +% --- Executes on button press in kNNRadio. +function kNNRadio_Callback(hObject, eventdata, handles) +% hObject handle to kNNRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of kNNRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.RocchioRadio, 'Value', 0); + set(handles.LLSFRadio, 'Value', 0); +end +set(handles.kNN, 'Enable', 'on'); set(handles.kNN, 'BackgroundColor', 'white'); +set(handles.RocchioPos, 'Enable', 'off'); set(handles.RocchioNeg, 'Enable', 'off'); set(handles.nFactorsLLSF, 'Enable', 'off'); +set(handles.RocchioPos, 'BackgroundColor', handles.light_gray); set(handles.RocchioNeg, 'BackgroundColor', handles.light_gray); +set(handles.nFactorsLLSF, 'BackgroundColor', handles.light_gray); + +set(handles.VSMRadio, 'Enable', 'on'); +if isempty(handles.k{1}), set(handles.VSMRadio, 'Value', 1); set(handles.LSARadio, 'Value', 0); set(handles.LSARadio, 'Enable', 'off'); set(handles.LSAMethod, 'Enable', 'off'); +else, set(handles.LSARadio, 'Enable', 'on'); set(handles.LSAMethod, 'Enable', 'on'); end +set(handles.LSAMethod, 'String', handles.real_methods); set(handles.LSAMethod, 'Value', 1); +set(handles.nFactors, 'String', handles.k); set(handles.nFactors, 'Value', 1); +set(handles.svdsRadio, 'Visible', 'off'); set(handles.propackRadio, 'Visible', 'off'); set(handles.sp_text3, 'Visible', 'off'); +set(handles.svdsRadio, 'Enable', 'off'); set(handles.propackRadio, 'Enable', 'off'); + + +% --- Executes on button press in RocchioRadio. +function RocchioRadio_Callback(hObject, eventdata, handles) +% hObject handle to RocchioRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of RocchioRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.kNNRadio, 'Value', 0); + set(handles.LLSFRadio, 'Value', 0); +end +set(handles.kNN, 'Enable', 'off'); set(handles.kNN, 'BackgroundColor', handles.light_gray); +set(handles.RocchioPos, 'Enable', 'on'); set(handles.RocchioNeg, 'Enable', 'on'); set(handles.nFactorsLLSF, 'Enable', 'off'); +set(handles.RocchioPos, 'BackgroundColor', 'white'); set(handles.RocchioNeg, 'BackgroundColor', 'white'); +set(handles.nFactorsLLSF, 'BackgroundColor', handles.light_gray); + +set(handles.VSMRadio, 'Enable', 'on'); +if isempty(handles.k{1}), set(handles.VSMRadio, 'Value', 1); set(handles.LSARadio, 'Value', 0); set(handles.LSARadio, 'Enable', 'off'); set(handles.LSAMethod, 'Enable', 'off'); +else, set(handles.LSARadio, 'Enable', 'on'); set(handles.LSAMethod, 'Enable', 'on'); end +set(handles.LSAMethod, 'String', handles.real_methods); set(handles.LSAMethod, 'Value', 1); +set(handles.nFactors, 'String', handles.k); set(handles.nFactors, 'Value', 1); +set(handles.svdsRadio, 'Visible', 'off'); set(handles.propackRadio, 'Visible', 'off'); set(handles.sp_text3, 'Visible', 'off'); +set(handles.svdsRadio, 'Enable', 'off'); set(handles.propackRadio, 'Enable', 'off'); + +function kNN_Callback(hObject, eventdata, handles) +% hObject handle to kNN (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of kNN as text +% str2double(get(hObject,'String')) returns contents of kNN as a double + + +% --- Executes during object creation, after setting all properties. +function kNN_CreateFcn(hObject, eventdata, handles) +% hObject handle to kNN (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function RocchioPos_Callback(hObject, eventdata, handles) +% hObject handle to RocchioPos (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of RocchioPos as text +% str2double(get(hObject,'String')) returns contents of RocchioPos as a double + + +% --- Executes during object creation, after setting all properties. +function RocchioPos_CreateFcn(hObject, eventdata, handles) +% hObject handle to RocchioPos (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function RocchioNeg_Callback(hObject, eventdata, handles) +% hObject handle to RocchioNeg (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of RocchioNeg as text +% str2double(get(hObject,'String')) returns contents of RocchioNeg as a double + + +% --- Executes during object creation, after setting all properties. +function RocchioNeg_CreateFcn(hObject, eventdata, handles) +% hObject handle to RocchioNeg (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in VSMRadio. +function VSMRadio_Callback(hObject, eventdata, handles) +% hObject handle to VSMRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of VSMRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.LSARadio, 'Value', 0); + set(handles.LSAMethod, 'Enable', 'off'); set(handles.nFactors, 'Enable', 'off'); +end + +% --- Executes on button press in LSARadio. +function LSARadio_Callback(hObject, eventdata, handles) +% hObject handle to LSARadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of LSARadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.VSMRadio, 'Value', 0); +end + +% --- Executes on selection change in LSAMethod. +function LSAMethod_Callback(hObject, eventdata, handles) +% hObject handle to LSAMethod (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns LSAMethod contents as cell array +% contents{get(hObject,'Value')} returns selected item from LSAMethod + + +% --- Executes during object creation, after setting all properties. +function LSAMethod_CreateFcn(hObject, eventdata, handles) +% hObject handle to LSAMethod (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on selection change in nFactors. +function nFactors_Callback(hObject, eventdata, handles) +% hObject handle to nFactors (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns nFactors contents as cell array +% contents{get(hObject,'Value')} returns selected item from nFactors + + +% --- Executes during object creation, after setting all properties. +function nFactors_CreateFcn(hObject, eventdata, handles) +% hObject handle to nFactors (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on selection change in Similarity. +function Similarity_Callback(hObject, eventdata, handles) +% hObject handle to Similarity (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns Similarity contents as cell array +% contents{get(hObject,'Value')} returns selected item from Similarity + + +% --- Executes during object creation, after setting all properties. +function Similarity_CreateFcn(hObject, eventdata, handles) +% hObject handle to Similarity (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + +%-------------------------------------------------------------------------- +%set Active and BackgroundColor field of each uicontrol item depending on +%the Radio Button that is pressed (called by the corresponding callback) +function handles=activate_uicontrol(states, handles) +sz=size(handles.objects, 1); +for i=1:sz, + if states(i)==1, tmp='on'; elseif states(i)==0, tmp='off'; else, tmp='inactive'; end + set(handles.objects(i), 'Enable', tmp); + if states(i)~=1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', handles.light_gray);continue; + end + if states(i)==1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', 'white'); + end +end + + + +function SQuery_Callback(hObject, eventdata, handles) +% hObject handle to SQuery (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of SQuery as text +% str2double(get(hObject,'String')) returns contents of SQuery as a double + + +% --- Executes during object creation, after setting all properties. +function SQuery_CreateFcn(hObject, eventdata, handles) +% hObject handle to SQuery (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function GW_Callback(hObject, eventdata, handles) +% hObject handle to GW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of GW as text +% str2double(get(hObject,'String')) returns contents of GW as a double +s=get(hObject, 'String'); +handles.gwquery_type='Files'; +guidata(hObject, handles); +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'global_weights'), + OPT=rmfield(OPT, 'global_weights'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.gwquery_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + OPT=handles.OPTIONS;if isfield(OPT, 'global_weights'), OPT=rmfield(OPT, 'global_weights'); end + handles.OPTIONS=OPT; + set(hObject, 'String', '');guidata(hObject, handles); + return; + end +end + +OPT.global_weights=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function GW_CreateFcn(hObject, eventdata, handles) +% hObject handle to GW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in GWButton. +function GWButton_Callback(hObject, eventdata, handles) +% hObject handle to GWButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +[s, handles.gwquery_type]=open_file(2); +guidata(hObject, handles); +set(handles.GW, 'String', s); + +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'global_weights'), + OPT=rmfield(OPT, 'global_weights'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.gwquery_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + OPT=handles.OPTIONS;if isfield(OPT, 'global_weights'), OPT=rmfield(OPT, 'global_weights'); end + handles.OPTIONS=OPT; + set(handles.GW, 'String', '');guidata(hObject, handles); + return; + end +end + +OPT.global_weights=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes on selection change in TW. +function TW_Callback(hObject, eventdata, handles) +% hObject handle to TW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns TW contents as cell array +% contents{get(hObject,'Value')} returns selected item from TW +OPT=handles.OPTIONS; +ind=get(hObject, 'Value'); +switch ind, + case 1, + OPT.local_weight='t'; + case 2, + OPT.local_weight='b'; + case 3, + OPT.local_weight='l'; + case 4, + OPT.local_weight='a'; + case 5, + OPT.local_weight='n'; +end +handles.OPTIONS=OPT; +handles.gwquery_type='Files'; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function TW_CreateFcn(hObject, eventdata, handles) +% hObject handle to TW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function Stoplist_Callback(hObject, eventdata, handles) +% hObject handle to Stoplist (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of Stoplist as text +% str2double(get(hObject,'String')) returns contents of Stoplist as a double +s=get(hObject,'String'); +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'stoplist'), + OPT=rmfield(OPT, 'stoplist'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end + +OPT.stoplist=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Stoplist_CreateFcn(hObject, eventdata, handles) +% hObject handle to Stoplist (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in StoplistButton. +function StoplistButton_Callback(hObject, eventdata, handles) +% hObject handle to StoplistButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s=open_file(1); +set(handles.Stoplist, 'String', s); + +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'stoplist'), + OPT=rmfield(OPT, 'stoplist'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end + +OPT.stoplist=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes on button press in StoredGW. +function StoredGW_Callback(hObject, eventdata, handles) +% hObject handle to StoredGW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of StoredGW +s=get(hObject, 'Value'); +if s==1, + set(handles.GW, 'BackgroundColor', handles.light_gray); + set(handles.GW, 'Enable', 'off'); set(handles.GWButton, 'Enable', 'off'); +else, + set(handles.GW, 'BackgroundColor', 'white'); + set(handles.GW, 'Enable', 'on'); set(handles.GWButton, 'Enable', 'on'); +end +guidata(hObject, handles); + +% --- Executes on button press in LLSFRadio. +function LLSFRadio_Callback(hObject, eventdata, handles) +% hObject handle to LLSFRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of LLSFRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.kNNRadio, 'Value', 0); + set(handles.RocchioRadio, 'Value', 0); +end +set(handles.kNN, 'Enable', 'off'); set(handles.kNN, 'BackgroundColor', handles.light_gray); +set(handles.RocchioPos, 'Enable', 'off'); set(handles.RocchioNeg, 'Enable', 'off'); set(handles.nFactorsLLSF, 'Enable', 'on'); +set(handles.RocchioPos, 'BackgroundColor', handles.light_gray); set(handles.RocchioNeg, 'BackgroundColor', handles.light_gray); +set(handles.nFactorsLLSF, 'BackgroundColor', 'white'); +set(handles.VSMRadio, 'Value', 0); set(handles.VSMRadio, 'Enable', 'off'); set(handles.nFactors, 'Enable', 'off'); set(handles.Similarity, 'Enable', 'off'); +set(handles.LSARadio, 'Enable', 'on'); set(handles.LSARadio, 'Value', 1); +set(handles.LSAMethod, 'Enable', 'on'); set(handles.LSAMethod, 'String', handles.methods); set(handles.LSAMethod, 'Value', 1); +set(handles.svdsRadio, 'Visible', 'on'); set(handles.propackRadio, 'Visible', 'on'); set(handles.sp_text3, 'Visible', 'on'); +set(handles.svdsRadio, 'Enable', 'on'); set(handles.propackRadio, 'Enable', 'on'); + +function FQuery_Callback(hObject, eventdata, handles) +% hObject handle to FQuery (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of FQuery as text +% str2double(get(hObject,'String')) returns contents of FQuery as a double +s=get(hObject,'String'); +if isempty(s) & isfield(handles, 'filename'), + handles=rmfield(handles, 'filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end + +handles.filename=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function FQuery_CreateFcn(hObject, eventdata, handles) +% hObject handle to FQuery (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in FQueryButton. +function FQueryButton_Callback(hObject, eventdata, handles) +% hObject handle to FQueryButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +flname=open_file(0); +set(handles.FQuery, 'String', flname); +if isempty(flname) & isfield(handles, 'filename'), + handles=rmfield(handles, 'filename'); + guidata(hObject, handles); + return; +end +if isempty(flname), return; end + +handles.filename=flname; +guidata(hObject, handles); + +% --- Executes on button press in SQueryRadio. +function SQueryRadio_Callback(hObject, eventdata, handles)%Single Query +% hObject handle to SQueryRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of SQueryRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.FQueryRadio, 'Value', 0); +end +set(handles.FQuery, 'Visible', 'off'); set(handles.FQueryButton, 'Visible', 'off'); +set(handles.Delimiter, 'Visible', 'off'); set(handles.sp_text4, 'Visible', 'off'); +set(handles.sp_text5, 'Visible', 'off'); set(handles.sp_text6, 'Visible', 'on'); +set(handles.LineDelimiter, 'Visible', 'off'); set(handles.LineDelimiter, 'Enable', 'off'); +set(handles.SQuery, 'Visible', 'on'); +set(handles.RemoveAl, 'Visible', 'off');set(handles.RemoveNum, 'Visible', 'off');set(handles.ParseSubd, 'Visible', 'off'); + +% --- Executes on button press in FQueryRadio. +function FQueryRadio_Callback(hObject, eventdata, handles) %File Query Button +% hObject handle to FQueryRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of FQueryRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.SQueryRadio, 'Value', 0); +end + +set(handles.FQuery, 'Visible', 'on'); set(handles.FQueryButton, 'Visible', 'on'); +set(handles.FQuery, 'Enable', 'on'); set(handles.FQueryButton, 'Enable', 'on'); set(handles.FQuery, 'BackgroundColor', 'white'); +set(handles.Delimiter, 'Visible', 'on'); set(handles.sp_text4, 'Visible', 'on'); +set(handles.sp_text5, 'Visible', 'on'); set(handles.sp_text6, 'Visible', 'off'); +set(handles.Delimiter, 'Enable', 'on'); set(handles.Delimiter, 'BackgroundColor', 'white'); +set(handles.SQuery, 'Visible', 'off'); +set(handles.LineDelimiter, 'Visible', 'on'); set(handles.LineDelimiter, 'Enable', 'on'); +set(handles.RemoveNum, 'Visible', 'on');set(handles.RemoveAl, 'Visible', 'on');set(handles.ParseSubd, 'Visible', 'on'); +set(handles.RemoveNum, 'Enable', 'on');set(handles.RemoveAl, 'Enable', 'on');set(handles.ParseSubd, 'Enable', 'on'); +handles.OPTIONS.delimiter='none_delimiter'; +%states=zeros(39, 1);states([(35:39)])=1; +guidata(hObject, handles); + +% --- Executes on button press in UseThresholds. +function UseThresholds_Callback(hObject, eventdata, handles) +% hObject handle to UseThresholds (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of UseThresholds +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.ComputeThresholds, 'Value', 0); +end +set(handles.Thresholds, 'BackgroundColor', 'white'); +set(handles.Thresholds, 'Enable', 'on'); set(handles.ThresholdsButton, 'Enable', 'on'); +set(handles.Fvalue, 'BackgroundColor', handles.light_gray); set(handles.Fvalue, 'Enable', 'off'); + +% --- Executes on button press in ComputeThresholds. +function ComputeThresholds_Callback(hObject, eventdata, handles) +% hObject handle to ComputeThresholds (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of ComputeThresholds +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.UseThresholds, 'Value', 0); +end +set(handles.Thresholds, 'BackgroundColor', handles.light_gray); +set(handles.Thresholds, 'Enable', 'off'); set(handles.ThresholdsButton, 'Enable', 'off'); +set(handles.Fvalue, 'BackgroundColor', 'white'); set(handles.Fvalue, 'Enable', 'on'); + + +function Thresholds_Callback(hObject, eventdata, handles) +% hObject handle to Thresholds (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of Thresholds as text +% str2double(get(hObject,'String')) returns contents of Thresholds as a double +s=get(hObject, 'String'); +if ~isempty(s), + an=new_sprintf('Use the Browse button in order to set the thresholds variable...'); + msgbox(an, 'Error', 'modal'); + set(hObject, 'String', ''); + return; +end + +% --- Executes during object creation, after setting all properties. +function Thresholds_CreateFcn(hObject, eventdata, handles) +% hObject handle to Thresholds (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in ThresholdsButton. +function ThresholdsButton_Callback(hObject, eventdata, handles) +% hObject handle to ThresholdsButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s=open_file(3); +set(handles.Thresholds, 'String', s); +guidata(hObject, handles); + + +function Fvalue_Callback(hObject, eventdata, handles) +% hObject handle to Fvalue (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of Fvalue as text +% str2double(get(hObject,'String')) returns contents of Fvalue as a double + + +% --- Executes during object creation, after setting all properties. +function Fvalue_CreateFcn(hObject, eventdata, handles) +% hObject handle to Fvalue (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function nFactorsLLSF_Callback(hObject, eventdata, handles) +% hObject handle to nFactorsLLSF (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of nFactorsLLSF as text +% str2double(get(hObject,'String')) returns contents of nFactorsLLSF as a double + + +% --- Executes during object creation, after setting all properties. +function nFactorsLLSF_CreateFcn(hObject, eventdata, handles) +% hObject handle to nFactorsLLSF (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in svdsRadio. +function svdsRadio_Callback(hObject, eventdata, handles) +% hObject handle to svdsRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of svdsRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.propackRadio, 'Value', 0); +end + +% --- Executes on button press in propackRadio. +function propackRadio_Callback(hObject, eventdata, handles) +% hObject handle to propackRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of propackRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.svdsRadio, 'Value', 0); +end + + + +function Delimiter_Callback(hObject, eventdata, handles) +% hObject handle to Delimiter (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of Delimiter as text +% str2double(get(hObject,'String')) returns contents of Delimiter as a double +s=get(hObject,'String'); +if ~isempty(s), + handles.OPTIONS.delimiter=s; + guidata(hObject, handles); +else, + handles.OPTIONS.delimiter='emptyline'; + guidata(hObject, handles); +end + +% --- Executes during object creation, after setting all properties. +function Delimiter_CreateFcn(hObject, eventdata, handles) +% hObject handle to Delimiter (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in LineDelimiter. +function LineDelimiter_Callback(hObject, eventdata, handles) +% hObject handle to LineDelimiter (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of LineDelimiter +state=get(hObject, 'Value'); +if state==0, + OPT=handles.OPTIONS; + OPT.line_delimiter=0; + handles.OPTIONS=OPT; +else, + OPT=handles.OPTIONS; + OPT.line_delimiter=1; + handles.OPTIONS=OPT; +end +guidata(hObject, handles); + + +% -------------------------------------------------------------------- +function NNMFMenu_Callback(hObject, eventdata, handles) +% hObject handle to NNMFMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + + +% --- Executes on button press in RemoveNum. +function RemoveNum_Callback(hObject, eventdata, handles) +% hObject handle to RemoveNum (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, OPT.remove_num=1; else, OPT.remove_num=0; end +handles.OPTIONS=OPT; +guidata(hObject, handles); +% Hint: get(hObject,'Value') returns toggle state of RemoveNum + + +% --- Executes on button press in RemoveAl. +function RemoveAl_Callback(hObject, eventdata, handles) +% hObject handle to RemoveAl (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, OPT.remove_al=1; else, OPT.remove_al=0; end +handles.OPTIONS=OPT; +guidata(hObject, handles); +% Hint: get(hObject,'Value') returns toggle state of RemoveAl + + +% --- Executes on button press in ParseSubd. +function ParseSubd_Callback(hObject, eventdata, handles) +% hObject handle to ParseSubd (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, OPT.parse_subd=1; else, OPT.parse_subd=0; end +handles.OPTIONS=OPT; +guidata(hObject, handles); +% Hint: get(hObject,'Value') returns toggle state of ParseSubd diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clean_filters.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clean_filters.m new file mode 100644 index 0000000000000000000000000000000000000000..7a7031246857ca383c7d1e4828334e27f7ec537b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clean_filters.m @@ -0,0 +1,7 @@ +function clean_filters() +% CLEAN_FILTERS-cleans the directory containing the filters for any text +% filters for any text garbagges left from previous tmg runnings. +% +% Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, Efstratios Gallopoulos + +clean_filters_p; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clean_filters_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clean_filters_p.p new file mode 100644 index 0000000000000000000000000000000000000000..8cb78407e5940d2f55ed94567bb214b80fbe8431 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clean_filters_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/cleanup.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/cleanup.m new file mode 100644 index 0000000000000000000000000000000000000000..a6c8c560c22170026819b0fd9b7dcfa687169cf0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/cleanup.m @@ -0,0 +1,13 @@ +function cleanup(filename,direct) +% CLEANUP - This function can be used in order to clean up the directories +% [TEXT_RESULTS],[TEXT_RESULTS_U] or [TEXT_RESULTS_Q] from any other text outputs, +% from previous runnings of tmg. +% CLEANUP(FILENAME,DIRECT) defines the actual path of the directory we want to clean up. +% and the directory we want to cleanup. +% +%Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, Efstratios Gallopoulos + + +error(nargchk(2, 2, nargin)); + +cleanup_p(filename,direct); diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/cleanup_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/cleanup_p.p new file mode 100644 index 0000000000000000000000000000000000000000..9a411d9f774ab88e7ff23af4f5f7243842a35518 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/cleanup_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/compute_scat.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/compute_scat.m new file mode 100644 index 0000000000000000000000000000000000000000..a5f36c311b2a1282239f7b50296ba7e3ac709988 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/compute_scat.m @@ -0,0 +1,10 @@ +function scat=compute_scat(A, c) +% COMPUTE_SCAT - computes the cluster selection criterion value +% of PDDP +% SCAT=COMPUTE_SCAT(A, C) returns the square of the frobenius +% norm of A-C*ones(1, size(A, 2)). +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +scat=compute_scat_p(A, c); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/compute_scat_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/compute_scat_p.p new file mode 100644 index 0000000000000000000000000000000000000000..daa8ed8c54f1d5a2d2715b6392664724143d65fb Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/compute_scat_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/ekmeans.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/ekmeans.m new file mode 100644 index 0000000000000000000000000000000000000000..2ce2ffdca4e82ee6180dd54d0d346d80cca480d4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/ekmeans.m @@ -0,0 +1,36 @@ +function varargout=ekmeans(varargin) +% EKMEANS - Euclidean k-Means Clustering Algorithm +% EKMEANS clusters a term-document matrix using the standard +% k-means clustering algorithm. CLUSTERS=EKMEANS(A, C, K, +% TERMINATION) returns a cluster structure with K clusters +% for the term-document matrix A using as initial centroids +% the columns of C (initialized randomly when it is empty). +% TERMINATION defines the termination method used in k-means +% ('epsilon' stops iteration when objective function decrease +% falls down a user defined threshold - see OPTIONS input +% argument - while 'n_iter' stops iteration when a user +% defined number of iterations has been reached). +% [CLUSTERS, Q]=EKMEANS(A, C, K, TERMINATION) returns also +% the vector of objective function values for each iteration +% and [CLUSTERS, Q, C]=EKMEANS(A, C, K, TERMINATION) returns +% the final centroid vectors. +% EKMEANS(A, C, K, TERMINATION, OPTIONS) defines optional +% parameters: +% - OPTIONS.iter: Number of iterations (default 10). +% - OPTIONS.epsilon: Value for epsilon convergence +% criterion (default 1). +% - OPTIONS.dsp: Displays results (default 1) or +% not (0) to the command window. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 5, nargin)); +if nargin==4, + if nargout==1, varargout{1}=ekmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==2, [varargout{1}, varargout{2}]=ekmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=ekmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end +else, + if nargout==1, varargout{1}=ekmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==2, [varargout{1}, varargout{2}]=ekmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=ekmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/ekmeans_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/ekmeans_p.p new file mode 100644 index 0000000000000000000000000000000000000000..ed48961dc612f26b15f79f54cc4f7869d3988105 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/ekmeans_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/get_node_scat.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/get_node_scat.m new file mode 100644 index 0000000000000000000000000000000000000000..576ede8a1731b6096df9a5dfc31ba6ff8e122d45 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/get_node_scat.m @@ -0,0 +1,12 @@ +function varargout=get_node_scat(tree_struct, splitted) +% GET_NODE_SCAT - returns the PDDP node with the maximum scatter +% value (see PDDP) +% [MAX_SCAT_IND, M_SCAT]=GET_NODE_SCAT(TREE_STRUCT, SPLITTED) +% returns the node index and the scatter value of the PDDP +% tree defined by TREE_STRUCT. SPLITTED is a vector that +% determines the active nodes. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +if nargout==1, varargout{1}=get_node_scat_p(tree_struct, splitted); else, [varargout{1}, varargout{2}]=get_node_scat_p(tree_struct, splitted); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/get_node_scat_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/get_node_scat_p.p new file mode 100644 index 0000000000000000000000000000000000000000..6ed0db5a26b40e7957a497133e6830ec578074df Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/get_node_scat_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/myperms.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/myperms.m new file mode 100644 index 0000000000000000000000000000000000000000..b729c19e1708ca19f93b9b412ae11f3c0cf77757 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/myperms.m @@ -0,0 +1,9 @@ +function v=myperms(p, l) +% MYPERMS - computes all possible combinations of the input +% V=MYPERMS[P, L] returns all possible combinations of the +% input vector of integers with L numbers. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +v=myperms_p(p, l); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/myperms_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/myperms_p.p new file mode 100644 index 0000000000000000000000000000000000000000..9279aa2a661a38897f1abf0ce5994e740c51f6d9 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/myperms_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/opt_2means.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/opt_2means.m new file mode 100644 index 0000000000000000000000000000000000000000..8efbc268877874207f5d22df37e15c3aac7827c5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/opt_2means.m @@ -0,0 +1,12 @@ +function [clusters, s]=opt_2means(A, x) +% OPT_2MEANS - a special case of k-means for k=2 +% OPT_2MEANS(A, X) returns the clustering that optimizes the +% objective function of the k-means algorithm based on the +% ordering of vector X. +% [CLUSTERS, S]=OPT_2MEANS(A, X) returns the cluster +% structure as well as the value of the objective function. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +[clusters, s]=opt_2means_p(A, x); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/opt_2means_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/opt_2means_p.p new file mode 100644 index 0000000000000000000000000000000000000000..380a27fe9be95ecc78778be8dfe01e9852cfe642 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/opt_2means_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp.m new file mode 100644 index 0000000000000000000000000000000000000000..9ebceab8f18567e09c0d1400e98ae7843bf53d78 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp.m @@ -0,0 +1,43 @@ +function varargout=pddp(varargin) +% PDDP - Principal Direction Divisive Partitioning Clustering +% Algorithm +% PDDP clusters a term-document matrix (tdm) using the +% Principal Direction Divisive Partitioning clustering +% algorithm [1, 2]. +% CLUSTERS=PDDP(A, K, L) returns a cluster structure with +% K clusters for the tdm A formed using information from +% the first L principal components of the tdm. +% [CLUSTERS, TREE_STRUCT]=PDDP(A, K, L) returns also the +% full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]=PDDP(A, +% K, L) returns the objective function of PDDP. +% PDDP(A, K, L, SVD_METHOD) defines the method used for the +% computation of the PCA (svds - default - or propack), while +% PDDP(A, K, L, SVD_METHOD, DSP) defines if results are to be +% displayed to the command window (default 1) or not (0). +% +% REFERENCES: +% [1] D.Boley, Principal Direction Divisive Partitioning, Data +% Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. +% [2] D.Zeimpekis, E.Gallopoulos, PDDP(l): Towards a Flexible +% Principal Direction Divisive Partitioning Clustering +% Algorithmm, Proc. IEEE ICDM'03 Workshop on Clustering Large +% Data Sets (Melbourne, Florida), 2003. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(3, 5, nargin)); +if nargin==3, + if nargout==1, varargout{1}=pddp_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_p(varargin{1}, varargin{2}, varargin{3}); end +end +if nargin==4, + if nargout==1, varargout{1}=pddp_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end +end +if nargin==5, + if nargout==1, varargout{1}=pddp_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_2means.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_2means.m new file mode 100644 index 0000000000000000000000000000000000000000..84c9da3b3aa3d0c78ed213f90a9aefc76645394a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_2means.m @@ -0,0 +1,48 @@ +function varargout=pddp_2means(varargin) +% PDDP_2MEANS - Hybrid Principal Direction Divisive Partitioning +% Clustering Algorithm and k-means +% PDDP_2MEANS clusters a term-document matrix (tdm) using a +% combination of the Principal Direction Divisive Partitioning +% clustering algorithm [1] and k-means [2]. +% CLUSTERS=PDDP_2MEANS(A, K) returns a cluster structure with K +% clusters for the tdm A. +% [CLUSTERS, TREE_STRUCT]=PDDP_2MEANS(A, K) returns also the +% full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]=PDDP_2MEANS(A, +% K) returns the objective function of PDDP. +% PDDP_2MEANS(A, K, SVD_METHOD) defines the method used for the +% computation of the PCA (svds - default - or propack). +% PDDP_2MEANS(A, K, SVD_METHOD, DSP) defines if results are to +% be displayed to the command window (default 1) or not (0). +% Finally, PDDP_2MEANS(A, K, SVD_METHOD, DSP, EPSILON)defines +% the termination criterion value for the k-means algorithm. +% +% REFERENCES: +% [1] D.Boley, Principal Direction Divisive Partitioning, Data +% Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. +% [2] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral +% Divisive Clustering Algorithms, Proc. of Text Mining Workshop, +% Minneapolis, 2007. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 5, nargin)); +if nargin==2, + if nargout==1, varargout{1}=pddp_2means_p(varargin{1}, varargin{2}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_2means_p(varargin{1}, varargin{2}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_2means_p(varargin{1}, varargin{2}); end +end +if nargin==3, + if nargout==1, varargout{1}=pddp_2means_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_2means_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_2means_p(varargin{1}, varargin{2}, varargin{3}); end +end +if nargin==4, + if nargout==1, varargout{1}=pddp_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end +end +if nargin==5, + if nargout==1, varargout{1}=pddp_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_2means_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_2means_p.p new file mode 100644 index 0000000000000000000000000000000000000000..a3e488b94cea9f9d82c1c0d62f3c68f608379591 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_2means_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut.m new file mode 100644 index 0000000000000000000000000000000000000000..984c3312e4ce27225d6f682364a48ab22af334e1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut.m @@ -0,0 +1,43 @@ +function varargout=pddp_optcut(varargin) +% PDDP_OPTCUT - Hybrid Principal Direction Divisive +% Partitioning Clustering Algorithm and k-means +% PDDP_OPTCUT clusters a term-document matrix (tdm) using +% a combination of the Principal Direction Divisive +% Partitioning clustering algorithm [1] and k-means [2]. +% CLUSTERS=PDDP_OPTCUT(A, K) returns a cluster structure +% with K clusters for the tdm A. +% [CLUSTERS, TREE_STRUCT]=PDDP_OPTCUT(A, K) returns also the +% full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]=PDDP_OPTCUT(A, +% K) returns the objective function of PDDP. +% PDDP_OPTCUT(A, K, SVD_METHOD) defines the method used for the +% computation of the PCA (svds - default - or propack). +% PDDP_OPTCUT(A, K, SVD_METHOD, DSP) defines if results are to be +% displayed to the command window (default 1) or not (0). Finally, +% PDDP_OPTCUT(A, K, SVD_METHOD, DSP, EPSILON) defines the +% termination criterion value for the k-means algorithm. +% +% REFERENCES: +% [1] D.Boley, Principal Direction Divisive Partitioning, Data +% Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. +% [2] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral +% Divisive Clustering Algorithms, Proc. of Text Mining Workshop, +% Minneapolis, 2007. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 4, nargin)); +if nargin==2, + if nargout==1, varargout{1}=pddp_optcut_p(varargin{1}, varargin{2}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcut_p(varargin{1}, varargin{2}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcut_p(varargin{1}, varargin{2}); end +end +if nargin==3, + if nargout==1, varargout{1}=pddp_optcut_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcut_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcut_p(varargin{1}, varargin{2}, varargin{3}); end +end +if nargin==4, + if nargout==1, varargout{1}=pddp_optcut_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcut_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcut_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut_2means.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut_2means.m new file mode 100644 index 0000000000000000000000000000000000000000..db9c294786b7776714b58d1e61830f1d99ffae40 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut_2means.m @@ -0,0 +1,50 @@ +function varargout=pddp_optcut_2means(varargin) +% PDDP_OPTCUT_2MEANS - Hybrid Principal Direction Divisive +% Partitioning Clustering Algorithm and k-means +% PDDP_OPTCUT_2MEANS clusters a term-document matrix (tdm) +% using a combination of the Principal Direction Divisive +% Partitioning clustering algorithm [1] and k-means [2]. +% CLUSTERS=PDDP_OPTCUT_OPTCUT_2MEANS(A, K) returns a cluster +% structure with K clusters for the tdm A. +% [CLUSTERS, TREE_STRUCT]=PDDP_OPTCUT_2MEANS(A, K) returns also +% the full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]= +% PDDP_OPTCUT_2MEANS(A, K) returns the objective function of +% PDDP. +% PDDP_OPTCUT_2MEANS(A, K, SVD_METHOD) defines the method used +% for the computation of the PCA (svds - default - or propack). +% PDDP_OPTCUT_2MEANS(A, K, SVD_METHOD, DSP) defines if results +% are to be displayed to the command window (default 1) or not +% (0). Finally, PDDP_OPTCUT_2MEANS(A, K, SVD_METHOD, DSP, EPSILON) +% defines the termination criterion value for the k-means +% algorithm. +% +% REFERENCES: +% [1] D.Boley, Principal Direction Divisive Partitioning, Data +% Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. +% [2] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral +% Divisive Clustering Algorithms, Proc. of Text Mining Workshop, +% Minneapolis, 2007. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 5, nargin)); +if nargin==2, + if nargout==1, varargout{1}=pddp_optcut_2means_p(varargin{1}, varargin{2}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcut_2means_p(varargin{1}, varargin{2}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcut_2means_p(varargin{1}, varargin{2}); end +end +if nargin==3, + if nargout==1, varargout{1}=pddp_optcut_2means_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcut_2means_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcut_2means_p(varargin{1}, varargin{2}, varargin{3}); end +end +if nargin==4, + if nargout==1, varargout{1}=pddp_optcut_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcut_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcut_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end +end +if nargin==5, + if nargout==1, varargout{1}=pddp_optcut_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcut_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcut_2means_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut_2means_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut_2means_p.p new file mode 100644 index 0000000000000000000000000000000000000000..0ec02bdb58677de96f2f6c45f5fc98355b7c41dc Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut_2means_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut_p.p new file mode 100644 index 0000000000000000000000000000000000000000..9779376e0a3278bf0c64842d844f7b64b11f1b12 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcut_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcutpd.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcutpd.m new file mode 100644 index 0000000000000000000000000000000000000000..70ec2b675fe55341ccdfedd9a60d3c77f38b113e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcutpd.m @@ -0,0 +1,49 @@ +function varargout=pddp_optcutpd(varargin) +% PDDP_OPTCUTPD - Hybrid Principal Direction Divisive +% Partitioning Clustering Algorithm and k-means +% PDDP_OPTCUTPD clusters a term-document matrix (tdm) using +% a combination of the Principal Direction Divisive +% Partitioning clustering algorithm [1, 2] and k-means [3]. +% CLUSTERS=PDDP_OPTCUT_OPTCUTPD(A, K, L) returns a cluster +% structure with K clusters for the tdm A formed using +% information from the first L principal components of the +% tdm. +% [CLUSTERS, TREE_STRUCT]=PDDP_OPTCUTPD(A, K, L) returns +% also the full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]= +% PDDP_OPTCUTPD(A, K, L) returns the objective function of +% PDDP. +% PDDP_OPTCUTPD(A, K, L, SVD_METHOD) defines the method used +% for the computation of the PCA (svds - default - or +% propack). Finally, PDDP_OPTCUTPD(A, K, L, SVD_METHOD, DSP) +% defines if results are to be displayed to the command window +% (default 1) or not (0). +% +% REFERENCES: +% [1] D.Boley, Principal Direction Divisive Partitioning, Data +% Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. +% [2] D.Zeimpekis, E.Gallopoulos, PDDP(l): Towards a Flexible +% Principal Direction Divisive Partitioning Clustering +% Algorithmm, Proc. IEEE ICDM'03 Workshop on Clustering Large +% Data Sets (Melbourne, Florida), 2003. +% [3] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral +% Divisive Clustering Algorithms, Proc. of Text Mining Workshop, +% Minneapolis, 2007. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(3, 5, nargin)); +if nargin==3, + if nargout==1, varargout{1}=pddp_optcutpd_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcutpd_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcutpd_p(varargin{1}, varargin{2}, varargin{3}); end +end +if nargin==4, + if nargout==1, varargout{1}=pddp_optcutpd_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcutpd_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcutpd_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end +end +if nargin==5, + if nargout==1, varargout{1}=pddp_optcutpd_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==2, [varargout{1}, varargout{2}]=pddp_optcutpd_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=pddp_optcutpd_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcutpd_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcutpd_p.p new file mode 100644 index 0000000000000000000000000000000000000000..97d296b74f5180237a9a4eb965a0d935fe9d198e Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_optcutpd_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_p.p new file mode 100644 index 0000000000000000000000000000000000000000..f5f047294c88fb23cfe65f01039f000d6deb3ba9 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/pddp_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/skmeans.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/skmeans.m new file mode 100644 index 0000000000000000000000000000000000000000..cf9b9d4baa20c314992a41d50d5faee9476590b6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/skmeans.m @@ -0,0 +1,41 @@ +function varargout=skmeans(varargin) +% SKMEANS - Spherical k-Means Clustering Algorithm +% SKMEANS clusters a term-document matrix using the Spherical +% k-means clustering algorithm [1]. CLUSTERS=SKMEANS(A, C, K, +% TERMINATION) returns a cluster structure with K clusters +% for the term-document matrix A using as initial centroids +% the columns of C (initialized randomly when it is empty). +% TERMINATION defines the termination method used in spherical +% k-means ('epsilon' stops iteration when objective function +% increase falls down a user defined threshold - see OPTIONS +% input argument - while 'n_iter' stops iteration when a user +% defined number of iterations has been reached). +% [CLUSTERS, Q]=SKMEANS(A, C, K, TERMINATION) returns also +% the vector of objective function values for each iteration +% and [CLUSTERS, Q, C]=SKMEANS(A, C, K, TERMINATION) returns +% the final centroid vectors. +% SKMEANS(A, C, K, TERMINATION, OPTIONS) defines optional +% parameters: +% - OPTIONS.iter: Number of iterations (default 10). +% - OPTIONS.epsilon: Value for epsilon convergence +% criterion (default 1). +% - OPTIONS.dsp: Displays results (default 1) or not (0) +% to the command window. +% +% REFERENCES: +% [1] I. S. Dhillon and D. M. Modha, "Concept Decompositions +% for Large Sparse Text Data using Clustering", Machine +% Learning, 42:1, pages 143-175, Jan, 2001. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 5, nargin)); +if nargin==4, + if nargout==1, varargout{1}=skmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==2, [varargout{1}, varargout{2}]=skmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=skmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}); end +else, + if nargout==1, varargout{1}=skmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==2, [varargout{1}, varargout{2}]=skmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=skmeans_p(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/skmeans_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/skmeans_p.p new file mode 100644 index 0000000000000000000000000000000000000000..21f98a992f841241eabe41f26652a2822bac21e3 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/skmeans_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/two_means_1d.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/two_means_1d.m new file mode 100644 index 0000000000000000000000000000000000000000..f4f9b37340433d82312040d85568ea3f02c27a3c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/two_means_1d.m @@ -0,0 +1,18 @@ +function varargout=two_means_1d(A) +% TWO_MEANS_1D - returns the clustering that optimizes the +% objective function of the k-means algorithm for the input +% vector. +% [CUTOFF, CLUSTERS, DISTANCE, OF, MEAN1, MEAN2]= +% TWO_MEANS_1D(A) returns the cutoff value of the clustering, +% the cluster structure, the separation distance, the value +% of the objective function and the two mean values. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +if nargout==1, varargout{1}=two_means_1d_p(A); end +if nargout==2, [varargout{1}, varargout{3}]=two_means_1d_p(A); end +if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=two_means_1d_p(A); end +if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=two_means_1d_p(A); end +if nargout==5, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}]=two_means_1d_p(A); end +if nargout==6, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}]=two_means_1d_p(A); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/two_means_1d_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/two_means_1d_p.p new file mode 100644 index 0000000000000000000000000000000000000000..dd9d41915811565c5665911fb21744fef26eb9bf Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering/two_means_1d_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering_gui.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering_gui.fig new file mode 100644 index 0000000000000000000000000000000000000000..6930dde840f9fc3c0d407b9e39bbec84ed1c1f88 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering_gui.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering_gui.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering_gui.m new file mode 100644 index 0000000000000000000000000000000000000000..91fda6ad46b734daa293712f50eca0265c75b63e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/clustering_gui.m @@ -0,0 +1,637 @@ +function varargout = clustering_gui(varargin) +% CLUSTERING_GUI +% CLUSTERING_GUI is a graphical user interface for all +% the clustering functions of the Text to Matrix Generator +% (TMG) Toolbox. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @clustering_gui_OpeningFcn, ... + 'gui_OutputFcn', @clustering_gui_OutputFcn, ... + 'gui_LayoutFcn', [], ... + 'gui_Callback', []); +if nargin && ischar(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + +% --- Executes just before clustering_gui is made visible. +function clustering_gui_OpeningFcn(hObject, eventdata, handles, varargin) +% This function has no output args, see OutputFcn. +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +% varargin unrecognized PropertyName/PropertyValue pairs from the +% command line (see VARARGIN) + +% Choose default command line output for clustering_gui +handles.output = hObject; + +handles.light_gray=[0.8824 0.8824 0.8824]; +handles.gray=[0.9255 0.9137 0.8471]; +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=14.5410; +wdth=15.7572; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +handles.objects=[handles.svdsRadio;handles.propackRadio;handles.kmeansRadio;handles.skmeansRadio;... + handles.PDDPRadio;handles.nClusters;handles.CentroidInit;handles.CentroidsVar;handles.CentroidsVarButton;... + handles.Termination;handles.TerminationValue;handles.DispRes;handles.lPDDP;handles.PDDPVariant;... + handles.maxlPDDP]; + +states=ones(length(handles.objects), 1); states([1 2 8 9 13 14 15])=0; +handles=activate_uicontrol(states, handles); +% Update handles structure +guidata(hObject, handles); + +% UIWAIT makes clustering_gui wait for user response (see UIRESUME) +% uiwait(handles.figure1); + + +% --- Outputs from this function are returned to the command line. +function varargout = clustering_gui_OutputFcn(hObject, eventdata, handles) +% varargout cell array for returning output args (see VARARGOUT); +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Get default command line output from handles structure +varargout{1} = handles.output; + + +% --- Executes on selection change in DatasetMenu. +function DatasetMenu_Callback(hObject, eventdata, handles) +% hObject handle to DatasetMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns DatasetMenu contents as cell array +% contents{get(hObject,'Value')} returns selected item from DatasetMenu + + +% --- Executes during object creation, after setting all properties. +function DatasetMenu_CreateFcn(hObject, eventdata, handles) +% hObject handle to DatasetMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end +datasets=cell(1, 1); datasets{1, 1}=''; +n_datasets=0; +str=fileparts(mfilename('fullpath')); +dirs=dir(strcat(str, filesep, 'data')); +for i=1:size(dirs, 1), + cur=dirs(i); + if isequal(cur.name, '.') | isequal(cur.name, '..') | ~isdir(strcat(str, filesep, 'data', filesep, cur.name)), continue; end + if exist(strcat(str, filesep, 'data', filesep, cur.name, filesep, 'A.mat')), n_datasets=n_datasets+1; datasets{n_datasets+1, 1}=strcat(str, filesep, 'data', filesep, cur.name); end +end +set(hObject, 'String', datasets); +guidata(hObject, handles); + +% --- Executes on button press in svdsRadio. +function svdsRadio_Callback(hObject, eventdata, handles) +% hObject handle to svdsRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of svdsRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.propackRadio, 'Value', 0); +end +guidata(hObject, handles); + + +% --- Executes on button press in propackRadio. +function propackRadio_Callback(hObject, eventdata, handles) +% hObject handle to propackRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of propackRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.svdsRadio, 'Value', 0); +end +guidata(hObject, handles); + + +% --- Executes on button press in StoreRes. +function StoreRes_Callback(hObject, eventdata, handles) +% hObject handle to StoreRes (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of StoreRes + + +% --- Executes on button press in ContinueButton. +function ContinueButton_Callback(hObject, eventdata, handles) +% hObject handle to ContinueButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +datasets=get(handles.DatasetMenu, 'String'); +id=get(handles.DatasetMenu, 'Value'); +if isequal(datasets{id}, ''), msgbox('You have to provide a dataset...', 'Error', 'modal'); return; end +load(strcat(datasets{id}, filesep, 'A.mat')); +try, load(strcat(datasets{id}, filesep, 'titles.mat')); catch, titles=cell(size(A, 2), 1); end + +nc=get(handles.nClusters, 'String'); +if isempty(nc), msgbox('You have to provide the number of clusters...', 'Error', 'modal'); return; end +nc=str2double(nc); +if ~isnumeric(nc), msgbox('You have to provide the number of clusters...', 'Error', 'modal'); return; end +if mod(nc, 1)~=0, msgbox('You have to provide an integer number of clusters...', 'Error', 'modal'); return; end + +clust_method=''; +if get(handles.kmeansRadio, 'Value')==1, clust_method='kmeans'; elseif get(handles.skmeansRadio, 'Value')==1, clust_method='skmeans'; else, clust_method='pddp'; end +if ~isequal(clust_method, 'pddp'), + centroids=get(handles.CentroidInit, 'Value'); + if centroids==1, + C=[]; + else, + s=get(handles.CentroidsVar, 'String'); + if isempty(s), msgbox('You have to provide the centroids variable. Use the Browse button...', 'Error', 'modal'); return; end + C=evalin('base', s); + [m, n]=size(C); if m~=size(A, 1) | n~=nc, msgbox('The centroid variable you provided has incorrect dimensions...', 'Error', 'modal'); return; end + end + + term_method=get(handles.Termination, 'Value'); + s=get(handles.TerminationValue, 'String'); + if term_method==1, + term_method='epsilon'; + if isempty(s), + r=questdlg('You didn''t provide the epsilon value. Using the default value...', 'Genie Question', 'OK', 'CANCEL', 'OK'); + if ~isequal(r, 'OK'), return; end + else, + s=str2double(s); + if ~isnumeric(s), msgbox('You have to provide the epsilon value...', 'Error', 'modal'); return; end + opts.epsilon=s; + end + else, + term_method='n_iter'; + if isempty(s), + r=questdlg('You didn''t provide the ''number of iterations'' value. Using the default value...', 'Genie Question', 'OK', 'CANCEL', 'OK'); + if ~isequal(r, 'OK'), return; end + else, + s=str2double(s); + if ~isnumeric(s), msgbox('You have to provide the number of iterations...', 'Error', 'modal'); return; end + if mod(s, 1)~=0, msgbox('You have to provide an integer number of iterations...', 'Error', 'modal'); return; end + opts.iter=s; + end + end + if get(handles.DispRes, 'Value')==1, opts.dsp=1; else, opts.dsp=0; end + if isequal(clust_method, 'kmeans'), + clusters_kmeans=ekmeans(A, C, nc, term_method, opts); + assignin('base', 'clusters_kmeans', clusters_kmeans); + else, + clusters_skmeans=skmeans(A, C, nc, term_method, opts); + assignin('base', 'clusters_skmeans', clusters_skmeans); + end +else, + if get(handles.svdsRadio, 'Value')==1, svd_method='svds'; else, svd_method='propack'; end + if get(handles.maxlPDDP, 'Value')==1, + v=get(handles.PDDPVariant, 'Value'); + if v==1, + [clusters_pddp, tree_struct]=pddp(A, nc, 'max', svd_method, get(handles.DispRes, 'Value')); + else, + [clusters_pddp, tree_struct]=pddp_optcutpd(A, nc, 'max', svd_method, get(handles.DispRes, 'Value')); + end + else, + l=get(handles.lPDDP, 'String'); + if isempty(l), msgbox('You have to provide the number of principal directions for PDDP...', 'Error', 'modal'); return; end + v=get(handles.PDDPVariant, 'Value'); + if str2double(l)>1, + if v==1, + [clusters_pddp, tree_struct]=pddp(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + else, + [clusters_pddp, tree_struct]=pddp_optcutpd(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + end + else, + if v==1, + [clusters_pddp, tree_struct]=pddp(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + elseif v==2, + [clusters_pddp, tree_struct]=pddp_2means(A, nc, svd_method, get(handles.DispRes, 'Value'), 0); + elseif v==3, + [clusters_pddp, tree_struct]=pddp_optcut(A, nc, svd_method, get(handles.DispRes, 'Value')); + elseif v==4, + [clusters_pddp, tree_struct]=pddp_optcut_2means(A, nc, svd_method, get(handles.DispRes, 'Value'), 0); + else, + [clusters_pddp, tree_struct]=pddp_optcutpd(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + end + end + end + if size(clusters_pddp, 1)-1~=nc, nc=size(clusters_pddp, 1)-1; end + assignin('base', 'clusters_pddp', clusters_pddp); +end +assignin('base', 'A', A); assignin('base', 'nclusters', nc); + +if get(handles.StoreRes, 'Value')==1, + datasets=get(handles.DatasetMenu, 'String'); v=get(handles.DatasetMenu, 'Value'); dataset=datasets{v}; + if get(handles.kmeansRadio, 'Value')==1, + str=strcat(dataset, filesep, 'kmeans'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(nc)); + if ~exist(str), + mkdir(str); + else, + str1=strcat(str, filesep, 'clusters_kmeans.mat'); + if exist(str1), delete(str1); end; + end + str1=strcat(str, filesep, 'clusters_kmeans'); + save(str1, 'clusters_kmeans'); + end + if get(handles.skmeansRadio, 'Value')==1, + str=strcat(dataset, filesep, 'skmeans'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(nc)); + if ~exist(str), + mkdir(str); + else, + str1=strcat(str, filesep, 'clusters_skmeans.mat'); + if exist(str1), delete(str1); end; + end + str1=strcat(str, filesep, 'clusters_skmeans'); + save(str1, 'clusters_skmeans'); + end + if get(handles.PDDPRadio, 'Value')==1, + str=strcat(dataset, filesep, 'pddp'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(nc)); + if ~exist(str), + mkdir(str); + else, + str1=strcat(str, filesep, 'clusters_pddp.mat'); + if exist(str1), delete(str1); end; + end + str1=strcat(str, filesep, 'clusters_pddp'); + save(str1, 'clusters_pddp'); + end +end +if get(handles.kmeansRadio, 'Value')==1, create_kmeans_response(clusters_kmeans, titles); end +if get(handles.skmeansRadio, 'Value')==1, create_kmeans_response(clusters_skmeans, titles, 'skmeans'); end +if get(handles.PDDPRadio, 'Value')==1, + if get(handles.maxlPDDP, 'Value')==1, + l=1; while 2^l<=nc, l=l+1; end; l=l-1; + else, + l=str2num(get(handles.lPDDP, 'String')); + end + create_pddp_response(tree_struct, clusters_pddp, l, titles); +end + +guidata(hObject, handles); + +% --- Executes on button press in ClearBotton. +function ClearBotton_Callback(hObject, eventdata, handles) +% hObject handle to ClearBotton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +set(handles.DatasetMenu, 'Value', 1); +set(handles.svdsRadio, 'Value', 1); set(handles.propackRadio, 'Value', 0); +set(handles.kmeansRadio, 'Value', 1); set(handles.skmeansRadio, 'Value', 0); set(handles.PDDPRadio, 'Value', 0); +set(handles.CentroidInit, 'Value', 1); set(handles.CentroidsVar, 'String', ''); +set(handles.Termination, 'Value', 1); set(handles.TerminationValue, 'String', '1'); +set(handles.lPDDP, 'String', '1'); set(handles.maxlPDDP, 'Value', 0); +set(handles.nClusters, 'String', ''); +set(handles.DispRes, 'Value', 1); +set(handles.StoreRes, 'Value', 1); +s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; +set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); + +states=ones(length(handles.objects), 1); states([1 2 8 9 13 14 15])=0; +handles=activate_uicontrol(states, handles); +guidata(hObject, handles); + +% --- Executes on button press in ExitButton. +function ExitButton_Callback(hObject, eventdata, handles) +% hObject handle to ExitButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +delete(handles.figure1); + +% --- Executes on button press in kmeansRadio. +function kmeansRadio_Callback(hObject, eventdata, handles) +% hObject handle to kmeansRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of kmeansRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.skmeansRadio, 'Value', 0); + set(handles.PDDPRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); states([1 2 13 14 15])=0; states(8)=-1; +state=get(handles.CentroidInit, 'Value'); +if state==1, states([8 9])=0; end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in skmeansRadio. +function skmeansRadio_Callback(hObject, eventdata, handles) +% hObject handle to skmeansRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of skmeansRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.kmeansRadio, 'Value', 0); + set(handles.PDDPRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); states([1 2 13 14 15])=0; states(8)=-1; +state=get(handles.CentroidInit, 'Value'); +if state==1, states([8 9])=0; end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in PDDPRadio. +function PDDPRadio_Callback(hObject, eventdata, handles) +% hObject handle to PDDPRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of PDDPRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.kmeansRadio, 'Value', 0); + set(handles.skmeansRadio, 'Value', 0); +end + +states=zeros(length(handles.objects), 1); states([1 2 3 4 5 6 12 13 14 15 16])=1; +state=get(handles.maxlPDDP, 'Value'); +if state==1, + set(handles.lPDDP, 'String', ''); + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +else, + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + + +function nClusters_Callback(hObject, eventdata, handles) +% hObject handle to nClusters (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of nClusters as text +% str2double(get(hObject,'String')) returns contents of nClusters as a double + + +% --- Executes during object creation, after setting all properties. +function nClusters_CreateFcn(hObject, eventdata, handles) +% hObject handle to nClusters (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on selection change in CentroidInit. +function CentroidInit_Callback(hObject, eventdata, handles) +% hObject handle to CentroidInit (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns CentroidInit contents as cell array +% contents{get(hObject,'Value')} returns selected item from CentroidInit +state=get(hObject, 'Value'); +if state==1, + set(handles.CentroidsVarButton, 'Enable', 'off'); +else, + set(handles.CentroidsVarButton, 'Enable', 'on'); +end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function CentroidInit_CreateFcn(hObject, eventdata, handles) +% hObject handle to CentroidInit (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function CentroidsVar_Callback(hObject, eventdata, handles) +% hObject handle to CentroidsVar (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of CentroidsVar as text +% str2double(get(hObject,'String')) returns contents of CentroidsVar as a double +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function CentroidsVar_CreateFcn(hObject, eventdata, handles) +% hObject handle to CentroidsVar (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in CentroidsVarButton. +function CentroidsVarButton_Callback(hObject, eventdata, handles) +% hObject handle to CentroidsVarButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s=open_file(3); +set(handles.CentroidsVar, 'String', s); +guidata(hObject, handles); + +% --- Executes on selection change in Termination. +function Termination_Callback(hObject, eventdata, handles) +% hObject handle to Termination (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns Termination contents as cell array +% contents{get(hObject,'Value')} returns selected item from Termination +state=get(hObject, 'Value'); s=get(handles.TerminationValue, 'String'); +if state==1 & isempty(s), set(handles.TerminationValue, 'String', 1); end +if state==2 & isempty(s), set(handles.TerminationValue, 'String', 10); end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Termination_CreateFcn(hObject, eventdata, handles) +% hObject handle to Termination (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function TerminationValue_Callback(hObject, eventdata, handles) +% hObject handle to TerminationValue (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of TerminationValue as text +% str2double(get(hObject,'String')) returns contents of TerminationValue as a double +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function TerminationValue_CreateFcn(hObject, eventdata, handles) +% hObject handle to TerminationValue (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in DispRes. +function DispRes_Callback(hObject, eventdata, handles) +% hObject handle to DispRes (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of DispRes +guidata(hObject, handles); + + +function lPDDP_Callback(hObject, eventdata, handles) +% hObject handle to lPDDP (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of lPDDP as text +% str2double(get(hObject,'String')) returns contents of lPDDP as a double +l=get(hObject, 'String'); +if isempty(l), return; end +l=str2double(l); +if ~isnumeric(l), msgbox('You have to provide the number of principal directions...', 'Error', 'modal'); return; end +if mod(l, 1)~=0, msgbox('You have to provide an integer number of principal directions...', 'Error', 'modal'); return; end +state=get(handles.maxlPDDP, 'Value'); +if state==1, + set(handles.maxlPDDP, 'Value', 0); + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; + set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +end +if l>1, + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +else, + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function lPDDP_CreateFcn(hObject, eventdata, handles) +% hObject handle to lPDDP (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on selection change in PDDPVariant. +function PDDPVariant_Callback(hObject, eventdata, handles) +% hObject handle to PDDPVariant (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns PDDPVariant contents as cell array +% contents{get(hObject,'Value')} returns selected item from PDDPVariant +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function PDDPVariant_CreateFcn(hObject, eventdata, handles) +% hObject handle to PDDPVariant (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in maxlPDDP. +function maxlPDDP_Callback(hObject, eventdata, handles) +% hObject handle to maxlPDDP (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of maxlPDDP +state=get(hObject, 'Value'); +if state==1, + set(handles.lPDDP, 'String', ''); + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +else, + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +end +guidata(hObject, handles); + +%-------------------------------------------------------------------------- +%set Active and BackgroundColor field of each uicontrol item depending on +%the Radio Button that is pressed (called by the corresponding callback) +function handles=activate_uicontrol(states, handles) +sz=size(handles.objects, 1); +for i=1:sz, + if states(i)==1, tmp='on'; elseif states(i)==0, tmp='off'; else, tmp='inactive'; end + set(handles.objects(i), 'Enable', tmp); + if states(i)~=1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', handles.light_gray);continue; + end + if states(i)==1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', 'white'); + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/common_words b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/common_words new file mode 100644 index 0000000000000000000000000000000000000000..2d40fc0238119eaf8c9d2b86c3e7cb9f5e920c1e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/common_words @@ -0,0 +1,439 @@ +a +about +above +accordingly +across +after +afterwards +again +against +all +allows +almost +alone +along +already +also +although +always +am +among +amongst +an +and +another +any +anybody +anyhow +anyone +anything +anywhere +apart +appear +appropriate +are +around +as +aside +associated +at +available +away +awfully +b +back +be +became +because +become +becomes +becoming +been +before +beforehand +behind +being +below +beside +besides +best +better +between +beyond +both +brief +but +by +c +came +can +cannot +cant +cause +causes +certain +changes +co +come +consequently +contain +containing +contains +corresponding +could +currently +d +day +described +did +different +do +does +doing +done +down +downwards +during +e +each +eg +eight +either +else +elsewhere +enough +et +etc +even +ever +every +everybody +everyone +everything +everywhere +ex +example +except +f +far +few +fifth +first +five +followed +following +for +former +formerly +forth +four +from +further +furthermore +g +get +gets +given +gives +go +gone +good +got +great +h +had +hardly +has +have +having +he +hence +her +here +hereafter +hereby +herein +hereupon +hers +herself +him +himself +his +hither +how +howbeit +however +i +ie +if +ignored +immediate +in +inasmuch +inc +indeed +indicate +indicated +indicates +inner +insofar +instead +into +inward +is +it +its +itself +j +just +k +keep +kept +know +l +last +latter +latterly +least +less +lest +life +like +little +long +ltd +m +made +make +man +many +may +me +meanwhile +men +might +more +moreover +most +mostly +mr +much +must +my +myself +n +name +namely +near +necessary +neither +never +nevertheless +new +next +nine +no +nobody +none +noone +nor +normally +not +nothing +novel +now +nowhere +o +of +off +often +oh +old +on +once +one +ones +only +onto +or +other +others +otherwise +ought +our +ours +ourselves +out +outside +over +overall +own +p +particular +particularly +people +per +perhaps +placed +please +plus +possible +probably +provides +q +que +quite +r +rather +really +relatively +respectively +right +s +said +same +second +secondly +see +seem +seemed +seeming +seems +self +selves +sensible +sent +serious +seven +several +shall +she +should +since +six +so +some +somebody +somehow +someone +something +sometime +sometimes +somewhat +somewhere +specified +specify +specifying +state +still +sub +such +sup +t +take +taken +than +that +the +their +theirs +them +themselves +then +thence +there +thereafter +thereby +therefore +therein +thereupon +these +they +third +this +thorough +thoroughly +those +though +three +through +throughout +thru +thus +time +to +together +too +toward +towards +twice +two +u +under +unless +until +unto +up +upon +us +use +used +useful +uses +using +usually +v +value +various +very +via +viz +vs +w +was +way +we +well +went +were +what +whatever +when +whence +whenever +where +whereafter +whereas +whereby +wherein +whereupon +wherever +whether +which +while +whither +who +whoever +whole +whom +whose +why +will +with +within +without +work +world +would +x +y +year +years +yet +you +your +yours +yourself +yourselves +z +zero \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/count_freq_words.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/count_freq_words.m new file mode 100644 index 0000000000000000000000000000000000000000..d018deab617d013a6d0cd798fef2cfcf61f96a5f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/count_freq_words.m @@ -0,0 +1,11 @@ +function [words] = count_freq_words(A_tdm,dictionary,howmany) +% count_freq_words Summary of this function goes here +% return the top howmany most frequent words in the documents of +% A_tdm indexing dictionary +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +%[m,n]=size(A_tdm); +[TERMS,I]=sort(sum(A_tdm,2),'descend'); +words = dictionary(I(1:howmany),:); +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_kmeans_response.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_kmeans_response.m new file mode 100644 index 0000000000000000000000000000000000000000..2963acdfcd5bb0784bd5442c01bbe36b38beb07f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_kmeans_response.m @@ -0,0 +1,16 @@ +function create_kmeans_response(varargin) +% CREATE_KMEANS_RESPONSE returns an html response for k-means +% CREATE_KMEANS_RESPONSE(CLUSTERS, TITLES) creates a summary +% html file containing information for the result of the +% k-means algorithm, defined by CLUSTERS, when applied to +% the dataset with document titles defined in the TITLES +% cell array. +% CREATE_KMEANS_RESPONSE(CLUSTERS, TITLES, VARIANT) defines +% additionaly the k-means variant (possible values 'k-means' +% and 'skmeans'). The result is stored in the "results" +% directory and displayed using the default web browser. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 3, nargin)); +if nargin==2, create_kmeans_response_p(varargin{1}, varargin{2}); else, create_kmeans_response_p(varargin{1}, varargin{2}, varargin{3}); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_kmeans_response_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_kmeans_response_p.p new file mode 100644 index 0000000000000000000000000000000000000000..71f8359276f07e0d1ccb69fb5e8e13e279468752 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_kmeans_response_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_pddp_response.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_pddp_response.m new file mode 100644 index 0000000000000000000000000000000000000000..a74a76efd0c1b9a79ec55258d9cc999327a8b185 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_pddp_response.m @@ -0,0 +1,15 @@ +function create_pddp_response(tree_struct, clusters, l, titles) +% CREATE_PDDP_RESPONSE returns an html response for PDDP +% CREATE_PDDP_RESPONSE(TREE_STRUCT, CLUSTERS, L, TITLES) +% creates a summary html file containing information for +% the result of the PDDP algorithm, defined by TREE_STRUCT +% and CLUSTERS, when applied to the dataset with document +% titles defined in the TITLES cell array. L defines the +% maximum number of principal directions used by PDDP. +% The result is stored in the "results" directory and +% displayed using the default web browser. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +create_pddp_response_p(tree_struct, clusters, l, titles); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_pddp_response_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_pddp_response_p.p new file mode 100644 index 0000000000000000000000000000000000000000..995443022b132ed4b43e343cd40a638c02059d47 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_pddp_response_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_retrieval_response.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_retrieval_response.m new file mode 100644 index 0000000000000000000000000000000000000000..9eaf4bd7e89ca19870791e695e44a2b024a9d2e5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_retrieval_response.m @@ -0,0 +1,13 @@ +function html_file=create_retrieval_response(dataset, ids, similarity, query) +% CREATE_RETRIEVAL_RESPONSE returns an html response for a query +% CREATE_RETRIEVAL_RESPONSE(DATASET, IDS, SIMILARITY, QUERY) +% creates an html file containing information for the text of +% documents of DATASET stored in MySQL defined by IDS and +% having SIMILARITY similarity coefficients against QUERY. +% The result is stored in the "results" directory and displayed +% using the default web browser. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +html_file=create_retrieval_response_p(dataset, ids, similarity, query); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_retrieval_response_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_retrieval_response_p.p new file mode 100644 index 0000000000000000000000000000000000000000..1cd66a13139e6be63403daa7f7194b07b107b3d0 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/create_retrieval_response_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/diff_vector.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/diff_vector.m new file mode 100644 index 0000000000000000000000000000000000000000..34e5b92230594ad8ec1a9ba693c9a6dee948a927 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/diff_vector.m @@ -0,0 +1,9 @@ +function d=diff_vector(x) +% DIFF_VECTOR +% DIFF_VECTOR returns the vector of differences between +% consecutive elements of the input vector. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +d=diff_vector_p(x); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/diff_vector_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/diff_vector_p.p new file mode 100644 index 0000000000000000000000000000000000000000..2c5c3838c6cdc05c19e75c1776149aa2ab1cd284 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/diff_vector_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/doc2ascii.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/doc2ascii.m new file mode 100644 index 0000000000000000000000000000000000000000..84e67fc6c8f2236c8ba33d3a837ecab8bef4cd35 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/doc2ascii.m @@ -0,0 +1,16 @@ +function result=doc2ascii(filename,directory) +% DOC2ASCII - converts the input doc or docx or +% pdf or rtf or html or odt file to ASCII +% RESULT = DOC2ASCII(FILENAME,DIRECTORY) converts the input +% files to ASCII, using the Apache POI which is a Java +% api for text conversion and move the resulted file into directory. +% RESULT returns a success indicator, e.g. -2 if the input +% file does not exist or has a wrong format, -1 if JRE is not +% installed or the path isn't set, 0 if the api didn't +% work properly, and 1 if the conversion was successful. +% +% Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); + +result=doc2ascii_p(filename,directory); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/doc2ascii_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/doc2ascii_p.p new file mode 100644 index 0000000000000000000000000000000000000000..320ab53b95f1144e825d1751af85d93c75a0d936 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/doc2ascii_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/TMG_6.0R7_release_notes.pdf b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/TMG_6.0R7_release_notes.pdf new file mode 100644 index 0000000000000000000000000000000000000000..9ee4d1a6d24becf83bf86e4be246f975c0f7922e Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/TMG_6.0R7_release_notes.pdf differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification.html new file mode 100644 index 0000000000000000000000000000000000000000..aa8d9e9e186ca429077e6c702756c9c1a1973b95 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification.html @@ -0,0 +1,439 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Classification Module (tmg_gui)</h2> + <p align="center"> + <img src="images/classification_gui.jpg" width="604" height="598" /><br /> + </p> + </td> + </tr> + <tr> + <td> + <p align="justify"> + classification_gui is a graphical user interface for "Text to Matrix Generator" that can be + used for applying a set of classification algorithms to term-document + matrices (TDM's) constructed from tmg_gui. + </p> + <p align="justify"> + See a <a href="classification1.html">demonstration</a> of classification_gui. + </p> + <p align="justify"> + For complete up-to-date documentation visit the TMG Wiki: + </p> + <p align="center"> + <a href="http://scgroup6.ceid.upatras.gr:8000/wiki/"> + http://scgroup6.ceid.upatras.gr:8000/wiki/ + </a> + </p> + </td> + </tr> + <tr> + <td> + <table align="left" width="100%" border="2" cellpadding="2" cellspacing="2"> + <tr> + <td align="center"> + <strong>Field Name</strong> + </td> + <td align="center"> + <strong>Default</strong> + </td> + <td align="center"> + <strong>Description</strong> + </td> + </tr> + <tr> + <td align="left"> + Training Dataset + </td> + <td align="center"> + - + </td> + <td align="left"> + The training dataset. + </td> + </tr> + <tr> + <td align="left"> + Training Labels + </td> + <td align="center"> + - + </td> + <td align="left"> + The labels of the training dataset. + </td> + </tr> + <tr> + <td align="left"> + Use Stored Labels + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use the stored vector of labels of training documents in the container folder. + </td> + </tr> + <tr> + <td align="left"> + Insert query + </td> + <td align="center"> + ● + </td> + <td align="left"> + The test document(s). + </td> + </tr> + <tr> + <td align="left"> + Single doc. (string) + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check if a single test document is to be inserted. + </td> + </tr> + <tr> + <td align="left"> + Multiple docs (file) + </td> + <td align="center"> + - + </td> + <td align="left"> + Check if multiple test document are to be inserted. + </td> + </tr> + <tr> + <td align="left"> + Filename + </td> + <td align="center"> + - + </td> + <td align="left"> + In 'Multiple docs (file)' is checked, insert the filename containing the test documents. + </td> + </tr> + <tr> + <td align="left"> + Delimiter + </td> + <td align="center"> + - + </td> + <td align="left"> + In 'Multiple docs (file)' is checked, insert the delimiter o be used for the test documents. + </td> + </tr> + <tr> + <td align="left"> + Line Delimiter + </td> + <td align="center"> + ● + </td> + <td align="left"> + In 'Multiple docs (file)' is checked, check if delimiter of test documents' file takes a whole line of text. + </td> + </tr> + <tr> + <td align="left"> + Alternative Global Weights + </td> + <td align="center"> + - + </td> + <td align="left"> + Global weights vector used for the construction of the test documents' vectors. + </td> + </tr> + <tr> + <td align="left"> + Use Stored Global Weights + </td> + <td align="center"> + ● + </td> + <td align="left"> + Use the global weights vector found on the container directory of the training dataset. + </td> + </tr> + <tr> + <td align="left"> + Stoplist + </td> + <td align="center"> + - + </td> + <td align="left"> + Use a stoplist. + </td> + </tr> + <tr> + <td align="left"> + Local Term Weighting + </td> + <td align="center"> + Term Frequency + </td> + <td align="left"> + The local term weighting to be used. + </td> + </tr> + <tr> + <td align="left"> + k-Nearest Neighboors (kNN) + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check if the kNN classifier is to be applied. + </td> + </tr> + <tr> + <td align="left"> + Num. of NNs + </td> + <td align="center"> + - + </td> + <td align="left"> + Number of Nearest Neighboors in kNN classifier. + </td> + </tr> + <tr> + <td align="left"> + Rocchio + </td> + <td align="center"> + - + </td> + <td align="left"> + Check if Rocchio classifier is to be applied. + </td> + </tr> + <tr> + <td align="left"> + Weight of Positive Examples + </td> + <td align="center"> + - + </td> + <td align="left"> + The weight of the positive examples in the formation of the centroids vectors in Rocchio. + </td> + </tr> + <tr> + <td align="left"> + Weight of Negative Examples + </td> + <td align="center"> + - + </td> + <td align="left"> + The weight of the negative examples in the formation of the centroids vectors in Rocchio. + </td> + </tr> + <tr> + <td align="left"> + Linear Least Squares Fit (LLSF) + </td> + <td align="center"> + - + </td> + <td align="left"> + Check if LLSF classifier is to be applied. + </td> + </tr> + <tr> + <td align="left"> + Number of Factors + </td> + <td align="center"> + - + </td> + <td align="left"> + Number of factors used in the course of LLSF. + </td> + </tr> + <tr> + <td align="left"> + Multi-Label + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check if classifier is to be applied for a multi-label collection. + </td> + </tr> + <tr> + <td align="left"> + Single-Label + </td> + <td align="center"> + - + </td> + <td align="left"> + Check is classifier is to be applied for a single-label collection. + </td> + </tr> + <tr> + <td align="left"> + Use Thresholds + </td> + <td align="center"> + ● + </td> + <td align="left"> + If 'Multi-Label' radio button is checked, use a stored vector of thresholds. + </td> + </tr> + <tr> + <td align="left"> + Compute Thresholds + </td> + <td align="center"> + - + </td> + <td align="left"> + If 'Multi-Label' radio button is checked, compute thresholds. + </td> + </tr> + <tr> + <td align="left"> + Thresholds + </td> + <td align="center"> + - + </td> + <td align="left"> + If 'Multi-Label' and 'Use Thresholds' radio buttons are checked, supply a stored vector of thresholds. + </td> + </tr> + <tr> + <td align="left"> + Min. F-value + </td> + <td align="center"> + - + </td> + <td align="left"> + If 'Multi-Label' and 'Compute Thresholds' radio buttons are checked, supply minimum F1 value used in the thresholding algorithm. + </td> + </tr> + <tr> + <td align="left"> + Vector Space Model + </td> + <td align="center"> + ● + </td> + <td align="left"> + Use the basic Vector Space Model. + </td> + </tr> + <tr> + <td align="left"> + Preprocessing by + </td> + <td align="center"> + - + </td> + <td align="left"> + Use preprocessed training data with: 'Singular Value Decomposition', 'Principal Component Analysis', 'Clusteredd Latent Semantic Analysis', 'Centroid Mathod', 'Semidiscrete Decomposition', 'SPQR'. + </td> + </tr> + <tr> + <td align="left"> + Number of Factors + </td> + <td align="center"> + - + </td> + <td align="left"> + Number of factors for preprocessed training data. + </td> + </tr> + <tr> + <td align="left"> + Similarity Measure + </td> + <td align="center"> + Cosine + </td> + <td align="left"> + The similarity measure to be used. + </td> + </tr> + <tr> + <td align="left"> + Continue + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the selected operation. + </td> + </tr> + <tr> + <td align="left"> + Reset + </td> + <td align="center"> + - + </td> + <td align="left"> + Reset window to default values. + </td> + </tr> + <tr> + <td align="left"> + Exit + </td> + <td align="center"> + - + </td> + <td align="left"> + Exit window. + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification1.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification1.html new file mode 100644 index 0000000000000000000000000000000000000000..59bf1a9dd72f03f12ed8f128883d39dfc7573c5f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification1.html @@ -0,0 +1,90 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Classification Module (classification_gui)</h2> + </td> + </tr> + <tr> + <td> + <p align="justify"> + Assume we have processed a collection with tmg_gui, construct + a TDM with 6,495 documents and 21,764 terms (a single label dataset + corresponding to the well-known modapte split of the Reuters-21578 + collection) and store the results to "TMG_HOME/data/reuters". Assume + then, we want to classify the test part of the modapte split,using + the k-Nearest Neighboors classifier for the following input: + </p> + <ul> + <li> + <p>Multiple docs (file): yes </p> + </li> + <li> + <p>filename: sample_document/reuters.test</p> + </li> + <li> + <p>delimiter: </reuters></p> + </li> + <li> + <p>line delimiter: yes </p> + </li> + <li> + <p>use stored global weights: yes </p> + </li> + <li> + <p>stoplist: common_words </p> + </li> + <li> + <p>local term weighting: Term Frequency </p> + </li> + <li> + <p>classification method: k Nearest Neighboors (kNN) </p> + </li> + <li> + <p>num. of NNs: 10 </p> + </li> + <li> + <p>collection type: Single-Label </p> + </li> + <li> + <p>preprocessed by: Clustered Latent Semantic Indexing </p> + </li> + <li> + <p>number of factors: 100 </p> + </li> + <li> + <p>similarity measure: Cosine </p> + </li> + </ul> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="classification2.html">Step 2</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification2.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification2.html new file mode 100644 index 0000000000000000000000000000000000000000..6694c57d10d214f7fdb3bbd9fab8862499f13702 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification2.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Classification Module (classification_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Initially select the classification algorithm you want to apply, by pressing the corresponding radio button at the left frame. </p> + </li> + <li> + <p align="justify">The selection of a radio button activates the required fields in the GUI, while deactivating the rest fields. </p> + </li> + </ul> + <p align="center"> + <img src="images/classification_gui1.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="classification3.html">Step 3</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification3.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification3.html new file mode 100644 index 0000000000000000000000000000000000000000..fbb0570cefa382a9a58d38b6ca387674b1523ec1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification3.html @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Classification Module (classification_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Fill in the required fields, by pressing the check buttons, editing the edit boxes or selecting the appropriate files/variables by pressing the Browse button. </p> + </li> + </ul> + <p align="center"> + <img src="images/classification_gui2.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="classification4.html">Step 4</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification4.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification4.html new file mode 100644 index 0000000000000000000000000000000000000000..2bef2dda6e4c0f81982e49457ba53eab0ae07c84 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/classification4.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Classification Module (classification_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Press the "Continue" button in order to perform selected operation. </p> + </li> + <li> + <p align="justify">Results will be saved to the workspace. </p> + </li> + <li> + <p align="justify">Press the Reset button in order to change the input. </p> + </li> + </ul> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="classification1.html">Start Page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering.html new file mode 100644 index 0000000000000000000000000000000000000000..180c6a9d3fc763697b98106dde4e87876a1d0c12 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering.html @@ -0,0 +1,263 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Clustering Module (tmg_gui)</h2> + <p align="center"> + <img src="images/clustering_gui.jpg" width="604" height="598" /><br /> + </p> + </td> + </tr> + <tr> + <td> + <p align="justify"> + clustering_gui is a graphical user interface for "Text to Matrix Generator" that can be + used for applying a set of clustering algorithms to term-document + matrices (TDM's) constructed from tmg_gui. + </p> + <p align="justify"> + See a <a href="clustering1.html">demonstration</a> of clustering_gui. + </p> + <p align="justify"> + For complete up-to-date documentation visit the TMG Wiki: + </p> + <p align="center"> + <a href="http://scgroup6.ceid.upatras.gr:8000/wiki/"> + http://scgroup6.ceid.upatras.gr:8000/wiki/ + </a> + </p> + </td> + </tr> + <tr> + <td> + <table align="left" width="100%" border="2" cellpadding="2" cellspacing="2"> + <tr> + <td align="center"> + <strong>Field Name</strong> + </td> + <td align="center"> + <strong>Default</strong> + </td> + <td align="center"> + <strong>Description</strong> + </td> + </tr> + <tr> + <td align="left"> + Select Dataset + </td> + <td align="center"> + - + </td> + <td align="left"> + Select the dataset. + </td> + </tr> + <tr> + <td align="left"> + Euclidean k-means + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to use the euclidean k-means clustering algorithm. + </td> + </tr> + <tr> + <td align="left"> + Spherical k-means + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use the spherical k-means clustering algorithm. + </td> + </tr> + <tr> + <td align="left"> + PDDP + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use the PDDP clustering algorithm. + </td> + </tr> + <tr> + <td align="left"> + Initialize Centroids + </td> + <td align="center"> + At random + </td> + <td align="left"> + Defines the method used for the initialization of the centroid vector in the course of k-means. Possibilities are: initialize at random and supplly a variable of '.mat' file with the centroids matrix. + </td> + </tr> + <tr> + <td align="left"> + Termination Criterion + </td> + <td align="center"> + Epsilon (1) + </td> + <td align="left"> + Defines the termination criterion used in the course of k-means. Possibilities are: use an epsilon value (default 1) and stop iteration when the objective function improvement does not exceed epsilon or perform a specific number of iterations (default 10). + </td> + </tr> + <tr> + <td align="left"> + Principal Directions + </td> + <td align="center"> + 1 + </td> + <td align="left"> + Number of principal directions used in PDDP. + </td> + </tr> + <tr> + <td align="left"> + Maximum num. of PCs + </td> + <td align="center"> + - + </td> + <td align="left"> + Check if the PDDP(max-l) variant is to be applied. + </td> + </tr> + <tr> + <td align="left"> + Variant + </td> + <td align="center"> + Basic + </td> + <td align="left"> + A set of PDDP variants. Possibe values: 'Basic', 'Split with k-means', 'Optimat Split', 'Optimal Split with k-means', 'Optimal Split on Projection'. + </td> + </tr> + <tr> + <td align="left"> + MATLAB (svds) + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to use MATLAB function svds for the computation of the SVD in the course of PDDP. + </td> + </tr> + <tr> + <td align="left"> + Propack + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use PROPACK package for the computation of the SVD in the course of PDDP. + </td> + </tr> + <tr> + <td align="left"> + Number of Clusters + </td> + <td align="center"> + - + </td> + <td align="left"> + Number of clusters computed. + </td> + </tr> + <tr> + <td align="left"> + Display Results + </td> + <td align="center"> + ● + </td> + <td align="left"> + Display results or not to the command windows. + </td> + </tr> + <tr> + <td align="left"> + Store Results + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to store results. + </td> + </tr> + <tr> + <td align="left"> + Continue + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the selected operation. + </td> + </tr> + <tr> + <td align="left"> + Reset + </td> + <td align="center"> + - + </td> + <td align="left"> + Reset window to default values. + </td> + </tr> + <tr> + <td align="left"> + Exit + </td> + <td align="center"> + - + </td> + <td align="left"> + Exit window. + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering1.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering1.html new file mode 100644 index 0000000000000000000000000000000000000000..9df6e0a66a1845280515374d0c30070f59b27b84 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering1.html @@ -0,0 +1,65 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Clustering Module (clustering_gui)</h2> + </td> + </tr> + <tr> + <td> + <p align="justify"> + Assume we have processed a collection with tmg_gui, construct a TDM + with 1,033 documents and 12,184 terms (corresponding to the well-known + MEDLINE collection) and store the results to "TMG_HOME/data/medline". + Assume then, we want to cluster the TDM, using the PDDP clustering + algorithm with the following input: + </p> + <ul> + <li> + <p>principal directions: 1</p> + </li> + <li> + <p>maximum number of PCs: - </p> + </li> + <li> + <p>variant: basic </p> + </li> + <li> + <p>number of clusters: 5 </p> + </li> + </ul> + <p align="justify"> + and you want to store results to directory "medline". + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="clustering2.html">Step 2</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering2.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering2.html new file mode 100644 index 0000000000000000000000000000000000000000..3dbce01fd532248015ec83fe1d8cba8ab86bf09e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering2.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Clustering Module (clustering_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Initially select the clustering algorithm you want to apply, by pressing the corresponding radio button. </p> + </li> + <li> + <p align="justify">The selection of a radio button activates the required fields in the GUI, while deactivating the rest fields. </p> + </li> + </ul> + <p align="center"> + <img src="images/clustering_gui.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="clustering3.html">Step 3</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering3.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering3.html new file mode 100644 index 0000000000000000000000000000000000000000..e3a98bcc8adf2e252122314cdf1bab240e0b0e73 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering3.html @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Clustering Module (clustering_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Fill in the required fields, by pressing the check buttons, editing the edit boxes or selecting the appropriate files/variables by pressing the Browse button. </p> + </li> + </ul> + <p align="center"> + <img src="images/clustering_gui2.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="clustering4.html">Step 4</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering4.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering4.html new file mode 100644 index 0000000000000000000000000000000000000000..b8f9933febe047200b8b52cdb49cd40b30fccd1b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/clustering4.html @@ -0,0 +1,60 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Clustering Module (clustering_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Press the "Continue" button in order to perform selected operation.</p> + </li> + <li> + <p align="justify">Results will be saved to the workspace and directory "pddp/k_5" will be created under "TMG_HOME/data/medline" with each output variable stored to a single ".mat" file. </p> + </li> + </ul> + <p align="center"> + <img src="images/clustering_gui3.jpg" width="635" height="454" /> + </p> + <ul> + <li> + <p align="justify">Furthermore, in case data have been stored to MySQL, the user gets an <a href="pddp_response.html" target="_blank">html response</a>.</p> + </li> + <li> + <p align="justify">Press the Reset button in order to change the input. </p> + </li> + </ul> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="clustering1.html">Start Page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr.html new file mode 100644 index 0000000000000000000000000000000000000000..d3bfa40b0a32dce4b1bf98bbe119013c624af6c0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr.html @@ -0,0 +1,362 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Dimensionality Reduction Module (tmg_gui)</h2> + <p align="center"> + <img src="images/dr_gui.jpg" width="604" height="598" /><br /> + </p> + </td> + </tr> + <tr> + <td> + <p align="justify"> + dr_gui is a graphical user interface for "Text to Matrix Generator" that can be + used for applying a set of dimensionality reduction techniques to term-document + matrices (TDM's) constructed from tmg_gui. + </p> + <p align="justify"> + See a <a href="dr1.html">demonstration</a> of dr_gui. + </p> + <p align="justify"> + For complete up-to-date documentation visit the TMG Wiki: + </p> + <p align="center"> + <a href="http://scgroup6.ceid.upatras.gr:8000/wiki/"> + http://scgroup6.ceid.upatras.gr:8000/wiki/ + </a> + </p> + </td> + </tr> + <tr> + <td> + <table align="left" width="100%" border="2" cellpadding="2" cellspacing="2"> + <tr> + <td align="center"> + <strong>Field Name</strong> + </td> + <td align="center"> + <strong>Default</strong> + </td> + <td align="center"> + <strong>Description</strong> + </td> + </tr> + <tr> + <td align="left"> + Select Dataset + </td> + <td align="center"> + - + </td> + <td align="left"> + Select the dataset. + </td> + </tr> + <tr> + <td align="left"> + Singular Value Decomposition (SVD) + </td> + <td align="center"> + ● + </td> + <td align="left"> + Apply the SVD method. + </td> + </tr> + <tr> + <td align="left"> + Principal Component Analysis (PCA) + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the PCA method. + </td> + </tr> + <tr> + <td align="left"> + Clustered Latent Semantic Indexing (CLSI) + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the CLSI method. + </td> + </tr> + <tr> + <td align="left"> + Centroid Method (CM) + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the CM method. + </td> + </tr> + <tr> + <td align="left"> + Semidiscrete Decomposition (SDD) + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the SDD method. + </td> + </tr> + <tr> + <td align="left"> + SPQR + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the SPQR method. + </td> + </tr> + <tr> + <td align="left"> + MATLAB (svds) + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to use MATLAB function svds for the computation of the SVD or PCA. + </td> + </tr> + <tr> + <td align="left"> + Propack + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use PROPACK package for the computation of the SVD or PCA. + </td> + </tr> + <tr> + <td align="left"> + Euclidean k-means + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to use the euclidean k-means clustering algorithm in the course of CLSI or CM. + </td> + </tr> + <tr> + <td align="left"> + Spherical k-means + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use the spherical k-means clustering algorithm in the course of CLSI or CM. + </td> + </tr> + <tr> + <td align="left"> + PDDP + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use the PDDP clustering algorithm in the course of CLSI or CM. + </td> + </tr> + <tr> + <td align="left"> + Initialize Centroids + </td> + <td align="center"> + At random + </td> + <td align="left"> + Defines the method used for the initialization of the centroid vector in the course of k-means. Possibilities are: initialize at random and supplly a variable of '.mat' file with the centroids matrix. + </td> + </tr> + <tr> + <td align="left"> + Termination Criterion + </td> + <td align="center"> + Epsilon (1) + </td> + <td align="left"> + Defines the termination criterion used in the course of k-means. Possibilities are: use an epsilon value (default 1) and stop iteration when the objective function improvement does not exceed epsilon or perform a specific number of iterations (default 10). + </td> + </tr> + <tr> + <td align="left"> + Principal Directions + </td> + <td align="center"> + 1 + </td> + <td align="left"> + Number of principal directions used in PDDP. + </td> + </tr> + <tr> + <td align="left"> + Maximum num. of PCs + </td> + <td align="center"> + - + </td> + <td align="left"> + Check if the PDDP(max-l) variant is to be applied. + </td> + </tr> + <tr> + <td align="left"> + Variant + </td> + <td align="center"> + Basic + </td> + <td align="left"> + A set of PDDP variants. Possibe values: 'Basic', 'Split with k-means', 'Optimat Split', 'Optimal Split with k-means', 'Optimal Split on Projection'. + </td> + </tr> + <tr> + <td align="left"> + Automatic Determination of Num. of factors for each cluster + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to apply a heuristic for the determination of the number of factors computed from each cluster in the course of the CLSI algorithm. + </td> + </tr> + <tr> + <td align="left"> + Number of Clusters + </td> + <td align="center"> + - + </td> + <td align="left"> + Number of clusters computed in the course of the CLSI algorithm. + </td> + </tr> + <tr> + <td align="left"> + Display Results + </td> + <td align="center"> + ● + </td> + <td align="left"> + Display results or not to the command windows. + </td> + </tr> + <tr> + <td align="left"> + Select at least one factor from each cluster + </td> + <td align="center"> + - + </td> + <td align="left"> + Use this option in case low-rank data are to be used in the course of classification. + </td> + </tr> + <tr> + <td align="left"> + Number of factors + </td> + <td align="center"> + - + </td> + <td align="left"> + Rank of approximation. + </td> + </tr> + <tr> + <td align="left"> + Store Results + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to store results. + </td> + </tr> + <tr> + <td align="left"> + Continue + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the selected operation. + </td> + </tr> + <tr> + <td align="left"> + Reset + </td> + <td align="center"> + - + </td> + <td align="left"> + Reset window to default values. + </td> + </tr> + <tr> + <td align="left"> + Exit + </td> + <td align="center"> + - + </td> + <td align="left"> + Exit window. + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr1.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr1.html new file mode 100644 index 0000000000000000000000000000000000000000..228098acfe1e708aab8cf487d81ba4647aa52b13 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr1.html @@ -0,0 +1,77 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Dimensionality Reduction Module (dr_gui)</h2> + </td> + </tr> + <tr> + <td> + <p align="justify"> + Assume we have processed a collection with tmg_gui, construct a TDM with + 1,033 documents and 12,184 terms (corresponding to the well-known MEDLINE collection) + and store the results to "TMG_HOME/data/medline". Assume then, we want to construct a + low-rank approximation of the TDM, using the Clustered Latent Semantic Indexing (CLSI) + technique for the following input: + </p> + <ul> + <li> + <p>compute SVD with: MATLAB (svds)</p> + </li> + <li> + <p>clustering algorithm: PDDP </p> + </li> + <li> + <p>principal directions: 1</p> + </li> + <li> + <p>maximum number of PCs: - </p> + </li> + <li> + <p>variant: basic </p> + </li> + <li> + <p>automatic determination of num. of factors from each cluster: yes </p> + </li> + <li> + <p>number of clusters: 10 </p> + </li> + <li> + <p>number of factors: 100 </p> + </li> + </ul> + <p align="justify"> + and you want to store results at directory "medline". + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="dr2.html">Step 2</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr2.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr2.html new file mode 100644 index 0000000000000000000000000000000000000000..f5040649be24649f0d2665821b6982dced12d73a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr2.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Dimensionality Reduction Module (dr_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Initially select the operation you want to perform, by pressing the corresponding radio button at the upper left frame. </p> + </li> + <li> + <p align="justify">The selection of a radio button activates the required fields in the GUI, while deactivating the rest fields. </p> + </li> + </ul> + <p align="center"> + <img src="images/dr_gui1.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="dr3.html">Step 3</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr3.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr3.html new file mode 100644 index 0000000000000000000000000000000000000000..a6b5b4c63aa6d60a5153426b793fc2a4d6e383a2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr3.html @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Dimensionality Reduction Module (dr_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Fill in the required fields, by pressing the check buttons, editing the edit boxes or selecting the appropriate files/variables by pressing the Browse button. </p> + </li> + </ul> + <p align="center"> + <img src="images/dr_gui2.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="dr4.html">Step 4</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr4.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr4.html new file mode 100644 index 0000000000000000000000000000000000000000..9ea0dd6d92e1eeb6b882dd6eb3158b991664c5d0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/dr4.html @@ -0,0 +1,57 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Dimensionality Reduction Module (dr_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Press the "Continue" button in order to perform selected operation. </p> + </li> + <li> + <p align="justify">Results will be saved to the workspace. Furthermore, directory "clsi/k_100" will be created under "TMG_HOME/data/medline" with each output variable stored to a single ".mat" file. </p> + </li> + </ul> + <p align="center"> + <img src="images/dr_gui3.jpg" width="635" height="454" /> + </p> + <ul> + <li> + <p align="justify">Press the Reset button in order to change the input. </p> + </li> + </ul> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="dr1.html">Start Page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions.html new file mode 100644 index 0000000000000000000000000000000000000000..8abf5b302266bf2a62799e103dc94a0f50cfa8cc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions.html @@ -0,0 +1,374 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Function Reference</h2> + </td> + </tr> + <tr> + <td> + <table align="center" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/about_tmg_gui.html">about_tmg_gui</a> + </td> + <td width="30%" align="left"> + <a href="functions/bisecting_nndsvd.html">bisecting_nndsvd</a> + </td> + <td width="30%" align="left"> + <a href="functions/block_diagonalize.html">block_diagonalize</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/block_nndsvd.html">block_nndsvd</a> + </td> + <td width="30%" align="left"> + <a href="functions/classification_gui.html">classification_gui</a> + </td> + <td width="30%" align="left"> + <a href="functions/clean_filters.html">clean_filters</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/cleanup.html">cleanup</a> + </td> + <td width="30%" align="left"> + <a href="functions/clsi.html">clsi</a> + </td> + <td width="30%" align="left"> + <a href="functions/clustering_gui.html">clustering_gui</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/cm.html">cm</a> + </td> + <td width="30%" align="left"> + <a href="functions/col_normalization.html">col_normalization</a> + </td> + <td width="30%" align="left"> + <a href="functions/col_rearrange.html">col_rearrange</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + + <td width="30%" align="left"> + <a href="functions/column_norms.html">column_norms</a> + </td> + <td width="30%" align="left"> + <a href="functions/compute_fro_norm.html">compute_fro_norm</a> + </td> + <td width="30%" align="left"> + <a href="functions/compute_scat.html">compute_scat</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + + <td width="30%" align="left"> + <a href="functions/create_kmeans_response.html">create_kmeans_response</a> + </td> + <td width="30%" align="left"> + <a href="functions/create_pddp_response.html">create_pddp_response</a> + </td> + <td width="30%" align="left"> + <a href="functions/create_retrieval_response.html">create_retrieval_response</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/diff_vector.html">diff_vector</a> + </td> + <td width="30%" align="left"> + <a href="functions/doc2ascii.html">doc2ascii</a> + </td> + <td width="30%" align="left"> + <a href="functions/dr_gui.html">dr_gui</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/ekmeans.html">ekmeans</a> + </td> + <td width="30%" align="left"> + <a href="functions/entropy.html">entropy</a> + </td> + <td width="30%" align="left"> + <a href="functions/get_node_scat.html">get_node_scat</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/gui.html">gui</a> + </td> + <td width="30%" align="left"> + <a href="functions/init_tmg.html">init_tmg</a> + </td> + <td width="30%" align="left"> + <a href="functions/knn_multi.html">knn_multi</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/knn_single.html">knn_single</a> + </td> + <td width="30%" align="left"> + <a href="functions/ks_selection.html">ks_selection</a> + </td> + <td width="30%" align="left"> + <a href="functions/ks_selection1.html">ks_selection1</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/llsf_multi.html">llsf_multi</a> + </td> + <td width="30%" align="left"> + <a href="functions/llsf_single.html">llsf_single</a> + </td> + <td width="30%" align="left"> + <a href="functions/lsa.html">lsa</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/make_clusters_multi.html">make_clusters_multi</a> + </td> + <td width="30%" align="left"> + <a href="functions/make_clusters_single.html">make_clusters_single</a> + </td> + <td width="30%" align="left"> + <a href="functions/make_labels.html">make_labels</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/make_val_inds.html">make_val_inds</a> + </td> + <td width="30%" align="left"> + <a href="functions/merge_dictionary.html">merge_dictionary</a> + </td> + <td width="30%" align="left"> + <a href="functions/merge_tdms.html">merge_tdms</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/myperms.html">myperms</a> + </td> + <td width="30%" align="left"> + <a href="functions/nnmf_gui.html">nnmf_gui</a> + </td> + <td width="30%" align="left"> + <a href="functions/nnmf_mul_update.html">nnmf_mul_update</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/open_file.html">open_file</a> + </td> + <td width="30%" align="left"> + <a href="functions/opt_2means.html">opt_2means</a> + </td> + <td width="30%" align="left"> + <a href="functions/pca.html">pca</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/pca_mat.html">pca_mat</a> + </td> + <td width="30%" align="left"> + <a href="functions/pca_mat_afun.html">pca_mat_afun</a> + </td> + <td width="30%" align="left"> + <a href="functions/pca_propack.html">pca_propack</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/pca_propack_Atransfunc.html">pca_propack_Atransfunc</a> + </td> + <td width="30%" align="left"> + <a href="functions/pca_propack_afun.html">pca_propack_afun</a> + </td> + <td width="30%" align="left"> + <a href="functions/pca_update.html">pca_update</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/pca_update_afun.html">pca_update_afun</a> + </td> + <td width="30%" align="left"> + <a href="functions/pddp.html">pddp</a> + </td> + <td width="30%" align="left"> + <a href="functions/pddp_2means.html">pddp_2means</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/pddp_extract_centroids.html">pddp_extract_centroids</a> + </td> + <td width="30%" align="left"> + <a href="functions/pddp_optcut.html">pddp_optcut</a> + </td> + <td width="30%" align="left"> + <a href="functions/pddp_optcut_2means.html">pddp_optcut_2means</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/pddp_optcutpd.html">pddp_optcutpd</a> + </td> + <td width="30%" align="left"> + <a href="functions/ps_pdf2ascii.html">ps_pdf2ascii</a> + </td> + <td width="30%" align="left"> + <a href="functions/retrieval_gui.html">retrieval_gui</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/rocchio_multi.html">rocchio_multi</a> + </td> + <td width="30%" align="left"> + <a href="functions/rocchio_single.html">rocchio_single</a> + </td> + <td width="30%" align="left"> + <a href="functions/scut_knn.html">scut_knn</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/scut_llsf.html">scut_llsf</a> + </td> + <td width="30%" align="left"> + <a href="functions/scut_rocchio.html">scut_rocchio</a> + </td> + <td width="30%" align="left"> + <a href="functions/sdd_tmg.html">sdd_tmg</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/skmeans.html">skmeans</a> + </td> + <td width="30%" align="left"> + <a href="functions/stemmer.html">stemmer</a> + </td> + <td width="30%" align="left"> + <a href="functions/strip_html.html">strip_html</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/svd_tmg.html">svd_tmg</a> + </td> + <td width="30%" align="left"> + <a href="functions/svd_update.html">svd_update</a> + </td> + <td width="30%" align="left"> + <a href="functions/svd_update_afun.html">svd_update_afun</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/tdm_downdate.html">tdm_downdate</a> + </td> + <td width="30%" align="left"> + <a href="functions/tdm_update.html">tdm_update</a> + </td> + <td width="30%" align="left"> + <a href="functions/tmg.html">tmg</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/tmg_gui.html">tmg_gui</a> + </td> + <td width="30%" align="left"> + <a href="functions/tmg_query.html">tmg_query</a> + </td> + <td width="30%" align="left"> + <a href="functions/tmg_save_results.html">tmg_save_results</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/tmg_template.html">tmg_template</a> + </td> + <td width="30%" align="left"> + <a href="functions/two_means_1d.html">two_means_1d</a> + </td> + <td width="30%" align="left"> + <a href="functions/unique_elements.html">unique_elements</a> + </td> + </tr> + <tr> + <td width="10%" align="left"> </td> + <td width="30%" align="left"> + <a href="functions/unique_words.html">unique_words</a> + </td> + <td width="30%" align="left"> + <a href="functions/untex.html">untex</a> + </td> + <td width="30%" align="left"> + <a href="functions/vsm.html">vsm</a> + </td> + + </tr> + </table> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/about_tmg_gui.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/about_tmg_gui.html new file mode 100644 index 0000000000000000000000000000000000000000..70dc2cfa24ee674c3dee5c2c3dea595d12b9961f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/about_tmg_gui.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + ABOUT_TMG_GUI + ABOUT_TMG_GUI displays information for TMG. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/about_tmg_gui.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/about_tmg_gui.html~ new file mode 100644 index 0000000000000000000000000000000000000000..c99263697ae8f5bf2fcf166e06ff0071fa00430a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/about_tmg_gui.html~ @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + ABOUT_TMG_GUI + ABOUT_TMG_GUI displays information for TMG. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/bisecting_nndsvd.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/bisecting_nndsvd.html new file mode 100644 index 0000000000000000000000000000000000000000..c90616e708f1ae915f13ab835929159a6811a832 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/bisecting_nndsvd.html @@ -0,0 +1,59 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + BISECTING_NNDSVD - a bisecting form of the the Non-Negative Double + Singular Value Decomposition Method [2]. + BISECTING_NNDSVD applies a bisecting form of the the + Non-Negative Double Singular Value Decomposition Method [2] + using a PDDP-like [2] clustering Method. + [W, H]=BISECTING_NNDSVD(A, k, svd_method) returns a non-negative + rank-k approximation of the input matrix A using svd_method for + the SVD (possible values svds, propack). + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] C. Boutsidis and E. Gallopoulos. SVD-based initialization: + A head start on nonnegative matrix factorization. Pattern + Recognition, Volume 41, Issue 4, Pages 1350-1362, April 2008. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/bisecting_nndsvd.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/bisecting_nndsvd.html~ new file mode 100644 index 0000000000000000000000000000000000000000..805f06781da9bf8d508b345340aae23cec9fa65a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/bisecting_nndsvd.html~ @@ -0,0 +1,58 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + BISECTING_NNDSVD - a bisecting form of the the Non-Negative Double + Singular Value Decomposition Method [2]. + BISECTING_NNDSVD applies a bisecting form of the the + Non-Negative Double Singular Value Decomposition Method [2] + using a PDDP-like [2] clustering Method. + [W, H]=BISECTING_NNDSVD(A, k, svd_method) returns a non-negative + rank-k approximation of the input matrix A using svd_method for + the SVD (possible values svds, propack). + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] C. Boutsidis and E. Gallopoulos. SVD-based initialization: + A head start on nonnegative matrix factorization. Pattern + Recognition, Volume 41, Issue 4, Pages 1350-1362, April 2008. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_diagonalize.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_diagonalize.html new file mode 100644 index 0000000000000000000000000000000000000000..050a068ad62efe409d48a83f2f29a46144d64f19 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_diagonalize.html @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + BLOCK_DIAGONALIZE - reorders a matrix heuristically using a + clustering result + [A, N_ROWS, N_COLS, ROW_INDS, COL_INDS]=BLOCK_DIAGONALIZE(A, + CLUSTERS) reorders matrix A using the clustering result + represented by the structure CLUSTERS. N_ROWS and N_COLS + store the last row and column index for each row and column + block resprectively, while ROW_INDS and COL_INDS contain the + permuted row and column indices. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_diagonalize.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_diagonalize.html~ new file mode 100644 index 0000000000000000000000000000000000000000..f2728751e8fd9e48f3079023b4427d800231b96c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_diagonalize.html~ @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + BLOCK_DIAGONALIZE - reorders a matrix heuristically using a + clustering result + [A, N_ROWS, N_COLS, ROW_INDS, COL_INDS]=BLOCK_DIAGONALIZE(A, + CLUSTERS) reorders matrix A using the clustering result + represented by the structure CLUSTERS. N_ROWS and N_COLS + store the last row and column index for each row and column + block resprectively, while ROW_INDS and COL_INDS contain the + permuted row and column indices. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_nndsvd.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_nndsvd.html new file mode 100644 index 0000000000000000000000000000000000000000..c6088163887acf8d65eeea9c29a9184d28859c09 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_nndsvd.html @@ -0,0 +1,82 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + BLOCK_NNDSVD - computes a non-negative rank-L approximation + of the input matrix using the Clustered Latent Semantic + Indexing Method [2] and the Non-Negative Double Singular + Value Decomposition Method [1]. + [X, Y]=BLOCK_NNDSVD(A, CLUSTERS, L, FUNC, ALPHA_VAL, + SVD_METHOD) computes a non-negative rank-L approximation + X*Y of the input matrix A with the Clustered Latent + Semantic Indexing Method [2], and the Non-Negative Double + Singular Value Decomposition Method [1], + using the cluster structure information from CLUSTERS [3]. + FUNC denotes the method used for the selection of the + number of factors from each cluster. Possible values for + FUNC: + - 'f': Selection using a heuristic method from [2] + (see KS_SELECTION). + - 'f1': Same as 'f' but use at least one factor + from each cluster. + - 'equal': Use the same number of factors from + each cluster. + ALPHA_VAL is a value in [0, 1] used in the number of + factors selection heuristic [2]. Finally, SVD_METHOD + defines the method used for the computation of the SVD + (svds or propack). + + REFERENCES: + [1] C. Boutsidis and E. Gallopoulos. SVD-based + initialization: A head start on nonnegative matrix + factorization. Pattern Recognition, Volume 41, + Issue 4, Pages 1350-1362, April 2008. + [2] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible + Approximation Scheme from Clustered Term-Document + Matrices. In Proc. 5th SIAM International Conference + on Data Mining, pages 631–635, Newport Beach, California, + 2005. + [3] D. Zeimpekis and E. Gallopoulos. Document Clustering + using NMF based on Spectral Information. In Proc. Text Mining + Workshop 2008 held in conjunction with the 8th SIAM + International Conference on Data Mining, Atlanta, 2008. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_nndsvd.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_nndsvd.html~ new file mode 100644 index 0000000000000000000000000000000000000000..663875bb5f55bdf793fcbe88f4b23254f3b6a152 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/block_nndsvd.html~ @@ -0,0 +1,81 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + BLOCK_NNDSVD - computes a non-negative rank-L approximation + of the input matrix using the Clustered Latent Semantic + Indexing Method [2] and the Non-Negative Double Singular + Value Decomposition Method [1]. + [X, Y]=BLOCK_NNDSVD(A, CLUSTERS, L, FUNC, ALPHA_VAL, + SVD_METHOD) computes a non-negative rank-L approximation + X*Y of the input matrix A with the Clustered Latent + Semantic Indexing Method [2], and the Non-Negative Double + Singular Value Decomposition Method [1], + using the cluster structure information from CLUSTERS [3]. + FUNC denotes the method used for the selection of the + number of factors from each cluster. Possible values for + FUNC: + - 'f': Selection using a heuristic method from [2] + (see KS_SELECTION). + - 'f1': Same as 'f' but use at least one factor + from each cluster. + - 'equal': Use the same number of factors from + each cluster. + ALPHA_VAL is a value in [0, 1] used in the number of + factors selection heuristic [2]. Finally, SVD_METHOD + defines the method used for the computation of the SVD + (svds or propack). + + REFERENCES: + [1] C. Boutsidis and E. Gallopoulos. SVD-based + initialization: A head start on nonnegative matrix + factorization. Pattern Recognition, Volume 41, + Issue 4, Pages 1350-1362, April 2008. + [2] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible + Approximation Scheme from Clustered Term-Document + Matrices. In Proc. 5th SIAM International Conference + on Data Mining, pages 631–635, Newport Beach, California, + 2005. + [3] D. Zeimpekis and E. Gallopoulos. Document Clustering + using NMF based on Spectral Information. In Proc. Text Mining + Workshop 2008 held in conjunction with the 8th SIAM + International Conference on Data Mining, Atlanta, 2008. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/classification_gui.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/classification_gui.html new file mode 100644 index 0000000000000000000000000000000000000000..d9089b5b6ff00c1d70e7b01220a68115c61f7c4e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/classification_gui.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CLASSIFICATION_GUI + CLASSIFICATION_GUI is a graphical user interface for all + the classification functions of the Text to Matrix Generator + (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/classification_gui.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/classification_gui.html~ new file mode 100644 index 0000000000000000000000000000000000000000..671348c5fdf12eb6c7d9125bf532c9b18e4d58b9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/classification_gui.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CLASSIFICATION_GUI + CLASSIFICATION_GUI is a graphical user interface for all + the classification functions of the Text to Matrix Generator + (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clean_filters.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clean_filters.html new file mode 100644 index 0000000000000000000000000000000000000000..11f21f9c3d13de53961de0d46b64c0e740b096e4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clean_filters.html @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CLEAN_FILTERS-cleans the directory containing the + filters for any text filters for any text garbagges + left from previous tmg runnings. + + Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, + Efstratios Gallopoulos + + + + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clean_filters.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clean_filters.html~ new file mode 100644 index 0000000000000000000000000000000000000000..cb97cfb3a4fe3130e7b7e8c5aa00520adb1693c1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clean_filters.html~ @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CLEAN_FILTERS-cleans the directory containing the + filters for any text filters for any text garbagges + left from previous tmg runnings. + + Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, Efstratios Gallopoulos + + + + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cleanup.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cleanup.html new file mode 100644 index 0000000000000000000000000000000000000000..a4db518813cf09acb6c274edb45b9ed32ccf90a1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cleanup.html @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> +CLEANUP - This function can be used in order to clean + up the directory[TEXT_RESULTS] ,[TEXT_RESULTS_U] or [TEXT_RESULTS_Q] + from any other text outputs, from previous runnings of tmg. + CLEANUP(FILENAME,DIRECT) defines the actual path of the + directory we want to clean up and the directory we want to clean up. + + Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, + Efstratios Gallopoulos + + + + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cleanup.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cleanup.html~ new file mode 100644 index 0000000000000000000000000000000000000000..6eafec2c6b04b961efa8f6954e8f2bb54ac5fc00 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cleanup.html~ @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> +CLEANUP - This function can be used in order to clean + up the directory[TEXT_RESULTS] ,[TEXT_RESULTS_U] or [TEXT_RESULTS_Q] + from any other text outputs, from previous runnings of tmg. + CLEANUP(FILENAME,DIRECT) defines the actual path of the + directory we want to clean up and the directory we want to clean up. + + Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, Efstratios Gallopoulos + + + + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clsi.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clsi.html new file mode 100644 index 0000000000000000000000000000000000000000..ed5d22580e12e727f7ffefd175e11a3c50de3e5b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clsi.html @@ -0,0 +1,69 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CLSI - computes a rank-L approximation of the input matrix + using the Clustered Latent Semantic Indexing Method [1] + [X, Y]=CLSI(A, CLUSTERS, L, FUNC, ALPHA_VAL, SVD_METHOD) + computes the rank-L approximation X*Y of the input matrix + A with the Clustered Latent Semantic Indexing Method [1], + using the cluster structure information from CLUSTERS. + FUNC denotes the method used for the selection of the + number of factors from each cluster. Possible values for + FUNC: + - 'f': Selection using a heuristic method from [1] + (see KS_SELECTION). + - 'f1': Same as 'f' but use at least one factor + from each cluster. + - 'equal': Use the same number of factors from + each cluster. + ALPHA_VAL is a value in [0, 1] used in the number of + factors selection heuristic [1]. Finally, SVD_METHOD + defines the method used for the computation of the SVD + (svds or propack). + + REFERENCES: + [1] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible + Approximation Scheme from Clustered Term-Document Matrices. + In Proc. 5th SIAM International Conference on Data Mining, + pages 631–635, Newport Beach, California, 2005. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clsi.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clsi.html~ new file mode 100644 index 0000000000000000000000000000000000000000..9543ddb2025e7ba9910a3532d517b99ce01e2c17 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clsi.html~ @@ -0,0 +1,68 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CLSI - computes a rank-L approximation of the input matrix + using the Clustered Latent Semantic Indexing Method [1] + [X, Y]=CLSI(A, CLUSTERS, L, FUNC, ALPHA_VAL, SVD_METHOD) + computes the rank-L approximation X*Y of the input matrix + A with the Clustered Latent Semantic Indexing Method [1], + using the cluster structure information from CLUSTERS. + FUNC denotes the method used for the selection of the + number of factors from each cluster. Possible values for + FUNC: + - 'f': Selection using a heuristic method from [1] + (see KS_SELECTION). + - 'f1': Same as 'f' but use at least one factor + from each cluster. + - 'equal': Use the same number of factors from + each cluster. + ALPHA_VAL is a value in [0, 1] used in the number of + factors selection heuristic [1]. Finally, SVD_METHOD + defines the method used for the computation of the SVD + (svds or propack). + + REFERENCES: + [1] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible + Approximation Scheme from Clustered Term-Document Matrices. + In Proc. 5th SIAM International Conference on Data Mining, + pages 631–635, Newport Beach, California, 2005. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clustering_gui.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clustering_gui.html new file mode 100644 index 0000000000000000000000000000000000000000..c86750812790575d12ffa761238398f2d240c3b0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clustering_gui.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CLUSTERING_GUI + CLUSTERING_GUI is a graphical user interface for all + the clustering functions of the Text to Matrix Generator + (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clustering_gui.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clustering_gui.html~ new file mode 100644 index 0000000000000000000000000000000000000000..103c39b87f29dec770f1e2c7aa0403942004bd7b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/clustering_gui.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CLUSTERING_GUI + CLUSTERING_GUI is a graphical user interface for all + the clustering functions of the Text to Matrix Generator + (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cm.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cm.html new file mode 100644 index 0000000000000000000000000000000000000000..ffeaae6b50973df739e7c30c9e0af55cab06135e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cm.html @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CM - computes a rank-L approximation of the input matrix + using the Centroids Method [1] + [X, Y]=CM(A, CLUSTERS) computes the rank-K approximation + X*Y of the input matrix A with the Centroids Method [1], + using the cluster structure information from CLUSTERS. + + REFERENCES: + [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional Representation + of Text Data Based on Centroids and Least Squares. + BIT Numerical Mathematics, 43(2):427–448, 2003. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cm.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cm.html~ new file mode 100644 index 0000000000000000000000000000000000000000..104d889632033e0cd7d7901fbcc9bf67a092d399 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/cm.html~ @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CM - computes a rank-L approximation of the input matrix + using the Centroids Method [1] + [X, Y]=CM(A, CLUSTERS) computes the rank-K approximation + X*Y of the input matrix A with the Centroids Method [1], + using the cluster structure information from CLUSTERS. + + REFERENCES: + [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional Representation + of Text Data Based on Centroids and Least Squares. + BIT Numerical Mathematics, 43(2):427–448, 2003. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_normalization.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_normalization.html new file mode 100644 index 0000000000000000000000000000000000000000..a875b76e894d4020e3f476b781cab5f82697f0b2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_normalization.html @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COL_NORMALIZATION - normalizes the columns of the input + matrix. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_normalization.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_normalization.html~ new file mode 100644 index 0000000000000000000000000000000000000000..25de75beef0908280bcc4775c9e94d01c7cbd96d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_normalization.html~ @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COL_NORMALIZATION - normalizes the columns of the input + matrix. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_rearrange.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_rearrange.html new file mode 100644 index 0000000000000000000000000000000000000000..d7168112add63ea8484c5aa8eb4677c7a8d57f99 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_rearrange.html @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COL_REARRANGE - reorders a matrix using a clustering result + [A, N_COLS, COL_INDS]=COL_REARRANGE(A, CLUSTERS) reorders + the columns of matrix A using the clustering result represented + by the structure CLUSTERS. N_COLS stores the last column index + for each column block, while COL_INDS containes the permuted + column indices. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_rearrange.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_rearrange.html~ new file mode 100644 index 0000000000000000000000000000000000000000..ac2205802d788a9470c8c3585cae51f5f15169f9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/col_rearrange.html~ @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COL_REARRANGE - reorders a matrix using a clustering result + [A, N_COLS, COL_INDS]=COL_REARRANGE(A, CLUSTERS) reorders + the columns of matrix A using the clustering result represented + by the structure CLUSTERS. N_COLS stores the last column index + for each column block, while COL_INDS containes the permuted + column indices. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/column_norms.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/column_norms.html new file mode 100644 index 0000000000000000000000000000000000000000..887e843cd8ddfd2899f973f8d62c5dda4efd8652 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/column_norms.html @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COLUMN_NORMS - returns the column norms of a matrix + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/column_norms.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/column_norms.html~ new file mode 100644 index 0000000000000000000000000000000000000000..6d6985a7df9213b084117dd2de0b9ad1b021f832 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/column_norms.html~ @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COLUMN_NORMS - returns the column norms of a matrix + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_fro_norm.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_fro_norm.html new file mode 100644 index 0000000000000000000000000000000000000000..6a097b813e50a4799b5f61060914e344925d7768 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_fro_norm.html @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COMPUTE_FRO_NORM - returns the frobenius norm of a rank-l + matrix A - W * H + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_fro_norm.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_fro_norm.html~ new file mode 100644 index 0000000000000000000000000000000000000000..d29029f32da9aa5894e16c73c2305f8a329e326d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_fro_norm.html~ @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COMPUTE_FRO_NORM - returns the frobenius norm of a rank-l + matrix A - W * H + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_scat.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_scat.html new file mode 100644 index 0000000000000000000000000000000000000000..b80a912b6016cf1e68b7c7b7e5b6829771730c33 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_scat.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COMPUTE_SCAT - computes the cluster selection criterion value + of PDDP + SCAT=COMPUTE_SCAT(A, C) returns the square of the frobenius + norm of A-C*ones(1, size(A, 2)). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_scat.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_scat.html~ new file mode 100644 index 0000000000000000000000000000000000000000..d01e2e2c9ed68f888610227b34afdfdc709e3467 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/compute_scat.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + COMPUTE_SCAT - computes the cluster selection criterion value + of PDDP + SCAT=COMPUTE_SCAT(A, C) returns the square of the frobenius + norm of A-C*ones(1, size(A, 2)). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_kmeans_response.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_kmeans_response.html new file mode 100644 index 0000000000000000000000000000000000000000..844b2b3e932bbea0b121a44a80a5e9aac8bfb005 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_kmeans_response.html @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CREATE_KMEANS_RESPONSE returns an html response for k-means + CREATE_KMEANS_RESPONSE(CLUSTERS, TITLES) creates a summary + html file containing information for the result of the + k-means algorithm, defined by CLUSTERS, when applied to + the dataset with document titles defined in the TITLES + cell array. + CREATE_KMEANS_RESPONSE(CLUSTERS, TITLES, VARIANT) defines + additionaly the k-means variant (possible values 'k-means' + and 'skmeans'). The result is stored in the "results" + directory and displayed using the default web browser. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_kmeans_response.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_kmeans_response.html~ new file mode 100644 index 0000000000000000000000000000000000000000..02701a741850b3048092402ff1a77361a78d180c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_kmeans_response.html~ @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CREATE_KMEANS_RESPONSE returns an html response for k-means + CREATE_KMEANS_RESPONSE(CLUSTERS, TITLES) creates a summary + html file containing information for the result of the + k-means algorithm, defined by CLUSTERS, when applied to + the dataset with document titles defined in the TITLES + cell array. + CREATE_KMEANS_RESPONSE(CLUSTERS, TITLES, VARIANT) defines + additionaly the k-means variant (possible values 'k-means' + and 'skmeans'). The result is stored in the "results" + directory and displayed using the default web browser. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_pddp_response.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_pddp_response.html new file mode 100644 index 0000000000000000000000000000000000000000..06a996134007641e6936f641ec2871ad24c14771 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_pddp_response.html @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CREATE_PDDP_RESPONSE returns an html response for PDDP + CREATE_PDDP_RESPONSE(TREE_STRUCT, CLUSTERS, L, TITLES) + creates a summary html file containing information for + the result of the PDDP algorithm, defined by TREE_STRUCT + and CLUSTERS, when applied to the dataset with document + titles defined in the TITLES cell array. L defines the + maximum number of principal directions used by PDDP. + The result is stored in the "results" directory and + displayed using the default web browser. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_pddp_response.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_pddp_response.html~ new file mode 100644 index 0000000000000000000000000000000000000000..ca2c22d28e96cd61c271eb9b6907faa4f4eb5d52 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_pddp_response.html~ @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CREATE_PDDP_RESPONSE returns an html response for PDDP + CREATE_PDDP_RESPONSE(TREE_STRUCT, CLUSTERS, L, TITLES) + creates a summary html file containing information for + the result of the PDDP algorithm, defined by TREE_STRUCT + and CLUSTERS, when applied to the dataset with document + titles defined in the TITLES cell array. L defines the + maximum number of principal directions used by PDDP. + The result is stored in the "results" directory and + displayed using the default web browser. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_retrieval_response.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_retrieval_response.html new file mode 100644 index 0000000000000000000000000000000000000000..26b552548c496eef676952e52a7a8e096c1964f4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_retrieval_response.html @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CREATE_RETRIEVAL_RESPONSE returns an html response for a query + CREATE_RETRIEVAL_RESPONSE(DATASET, IDS, SIMILARITY, QUERY) + creates an html file containing information for the text of + documents of DATASET stored in MySQL defined by IDS and + having SIMILARITY similarity coefficients against QUERY. + The result is stored in the "results" directory and displayed + using the default web browser. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_retrieval_response.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_retrieval_response.html~ new file mode 100644 index 0000000000000000000000000000000000000000..76f96ff88cf306b7b745eb9a9ddbe06e511f2e3f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/create_retrieval_response.html~ @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + CREATE_RETRIEVAL_RESPONSE returns an html response for a query + CREATE_RETRIEVAL_RESPONSE(DATASET, IDS, SIMILARITY, QUERY) + creates an html file containing information for the text of + documents of DATASET stored in MySQL defined by IDS and + having SIMILARITY similarity coefficients against QUERY. + The result is stored in the "results" directory and displayed + using the default web browser. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/diff_vector.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/diff_vector.html new file mode 100644 index 0000000000000000000000000000000000000000..c2973d4422f8f54aa51cd519fa34ecf9408ccb0c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/diff_vector.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + DIFF_VECTOR + DIFF_VECTOR returns the vector of differences between + consecutive elements of the input vector. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/diff_vector.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/diff_vector.html~ new file mode 100644 index 0000000000000000000000000000000000000000..ceb244486cc360c3d8d885a5263eb49c60e48baf --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/diff_vector.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + DIFF_VECTOR + DIFF_VECTOR returns the vector of differences between + consecutive elements of the input vector. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/doc2ascii.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/doc2ascii.html new file mode 100644 index 0000000000000000000000000000000000000000..08e355f36d901795dcbdfa9d48d16cbdc223b5fe --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/doc2ascii.html @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + DOC2ASCII - converts the input doc or docx or + rtf or html or odt file to ASCII + RESULT = DOC2ASCII(FILENAME,DIRECTORY) converts the input + files to ASCII, using the Apache POI which is a Java + api for text conversion and moves the converted file into directory. + RESULT returns a success indicator, e.g. -2 if the input + file does not exist or has a wrong format, -1 if JRE is not + installed or the path isn't set, 0 if the api didn't + work properly, and 1 if the conversion was successful. + + Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/doc2ascii.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/doc2ascii.html~ new file mode 100644 index 0000000000000000000000000000000000000000..08e355f36d901795dcbdfa9d48d16cbdc223b5fe --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/doc2ascii.html~ @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + DOC2ASCII - converts the input doc or docx or + rtf or html or odt file to ASCII + RESULT = DOC2ASCII(FILENAME,DIRECTORY) converts the input + files to ASCII, using the Apache POI which is a Java + api for text conversion and moves the converted file into directory. + RESULT returns a success indicator, e.g. -2 if the input + file does not exist or has a wrong format, -1 if JRE is not + installed or the path isn't set, 0 if the api didn't + work properly, and 1 if the conversion was successful. + + Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/dr_gui.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/dr_gui.html new file mode 100644 index 0000000000000000000000000000000000000000..a1bea5205eda50fbc7110176e1c1496688b801ce --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/dr_gui.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + DR_GUI + DR_GUI is a graphical user interface for all + the dimensionality reduction functions of the Text + to Matrix Generator (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/dr_gui.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/dr_gui.html~ new file mode 100644 index 0000000000000000000000000000000000000000..560db4c96f233a551e7e14453a806655130cacdf --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/dr_gui.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + DR_GUI + DR_GUI is a graphical user interface for all + the dimensionality reduction functions of the Text + to Matrix Generator (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ekmeans.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ekmeans.html new file mode 100644 index 0000000000000000000000000000000000000000..3bf51fe145b24b80a6c5c0c61160069eb652e008 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ekmeans.html @@ -0,0 +1,66 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + EKMEANS - Euclidean k-Means Clustering Algorithm + EKMEANS clusters a term-document matrix using the standard + k-means clustering algorithm. CLUSTERS=EKMEANS(A, C, K, + TERMINATION) returns a cluster structure with K clusters + for the term-document matrix A using as initial centroids + the columns of C (initialized randomly when it is empty). + TERMINATION defines the termination method used in k-means + ('epsilon' stops iteration when objective function decrease + falls down a user defined threshold - see OPTIONS input + argument - while 'n_iter' stops iteration when a user + defined number of iterations has been reached). + [CLUSTERS, Q]=EKMEANS(A, C, K, TERMINATION) returns also + the vector of objective function values for each iteration + and [CLUSTERS, Q, C]=EKMEANS(A, C, K, TERMINATION) returns + the final centroid vectors. + EKMEANS(A, C, K, TERMINATION, OPTIONS) defines optional + parameters: + - OPTIONS.iter: Number of iterations (default 10). + - OPTIONS.epsilon: Value for epsilon convergence + criterion (default 1). + - OPTIONS.dsp: Displays results (default 1) or + not (0) to the command window. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ekmeans.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ekmeans.html~ new file mode 100644 index 0000000000000000000000000000000000000000..9316adcfd9e96a07cab0890981cbff658867a414 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ekmeans.html~ @@ -0,0 +1,65 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + EKMEANS - Euclidean k-Means Clustering Algorithm + EKMEANS clusters a term-document matrix using the standard + k-means clustering algorithm. CLUSTERS=EKMEANS(A, C, K, + TERMINATION) returns a cluster structure with K clusters + for the term-document matrix A using as initial centroids + the columns of C (initialized randomly when it is empty). + TERMINATION defines the termination method used in k-means + ('epsilon' stops iteration when objective function decrease + falls down a user defined threshold - see OPTIONS input + argument - while 'n_iter' stops iteration when a user + defined number of iterations has been reached). + [CLUSTERS, Q]=EKMEANS(A, C, K, TERMINATION) returns also + the vector of objective function values for each iteration + and [CLUSTERS, Q, C]=EKMEANS(A, C, K, TERMINATION) returns + the final centroid vectors. + EKMEANS(A, C, K, TERMINATION, OPTIONS) defines optional + parameters: + - OPTIONS.iter: Number of iterations (default 10). + - OPTIONS.epsilon: Value for epsilon convergence + criterion (default 1). + - OPTIONS.dsp: Displays results (default 1) or + not (0) to the command window. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/entropy.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/entropy.html new file mode 100644 index 0000000000000000000000000000000000000000..e194143f5572589679a447287297530ccb074e28 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/entropy.html @@ -0,0 +1,56 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + ENTROPY - computes the entropy of a clustering result + [VENTROPY, CONFUSION_MATRIX, MISTAKES]=ENTROPY(CLUSTERS, + LABELS) computes the entropy value of a clustering result + represented by the CLUSTERS structure. LABELS is a vector + of integers containing the true labeling of the objects. + The entropy value is stored in VENTOPY, while + CONFUSION_MATRIX is a k x r matrix, where k is the number + of clusters and r the number of true classes, and + CONFUSION_MATRIX(i, j) records the number of objects + of class j assigned to cluster i. Finally, MISTAKES contains + the number of misassigned objects, measured by m1+...+mk, + where mi=sum(CONFUSION_MATRIX(i, j)), j~=i. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/entropy.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/entropy.html~ new file mode 100644 index 0000000000000000000000000000000000000000..16418cef8f14814164df560f71f6ef642bbd7bbe --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/entropy.html~ @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + ENTROPY - computes the entropy of a clustering result + [VENTROPY, CONFUSION_MATRIX, MISTAKES]=ENTROPY(CLUSTERS, + LABELS) computes the entropy value of a clustering result + represented by the CLUSTERS structure. LABELS is a vector + of integers containing the true labeling of the objects. + The entropy value is stored in VENTOPY, while + CONFUSION_MATRIX is a k x r matrix, where k is the number + of clusters and r the number of true classes, and + CONFUSION_MATRIX(i, j) records the number of objects + of class j assigned to cluster i. Finally, MISTAKES contains + the number of misassigned objects, measured by m1+...+mk, + where mi=sum(CONFUSION_MATRIX(i, j)), j~=i. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/get_node_scat.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/get_node_scat.html new file mode 100644 index 0000000000000000000000000000000000000000..3c5658d3b60a4ec0d8e86a9be53674870b8db613 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/get_node_scat.html @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + GET_NODE_SCAT - returns the PDDP node with the maximum scatter + value (see PDDP) + [MAX_SCAT_IND, M_SCAT]=GET_NODE_SCAT(TREE_STRUCT, SPLITTED) + returns the node index and the scatter value of the PDDP + tree defined by TREE_STRUCT. SPLITTED is a vector that + determines the active nodes. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/get_node_scat.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/get_node_scat.html~ new file mode 100644 index 0000000000000000000000000000000000000000..1b1a1a82aaf1a55f8632fbeac237ceb05f07c0d5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/get_node_scat.html~ @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + GET_NODE_SCAT - returns the PDDP node with the maximum scatter + value (see PDDP) + [MAX_SCAT_IND, M_SCAT]=GET_NODE_SCAT(TREE_STRUCT, SPLITTED) + returns the node index and the scatter value of the PDDP + tree defined by TREE_STRUCT. SPLITTED is a vector that + determines the active nodes. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/gui.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/gui.html new file mode 100644 index 0000000000000000000000000000000000000000..c0c88a5bfd83b912f8cd7cf3ac931c59c56eb433 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/gui.html @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + GUI + GUI is a simple, top graphical user interface of the Text to + Matrix Generator (TMG) Toolbox. Using GUI, the user can + select any of the four GUI modules (indexing, dimensionality + reduction, clustering, classification) of TMG. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/gui.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/gui.html~ new file mode 100644 index 0000000000000000000000000000000000000000..234fb13c23ee193052e13aa36871ebd45b00becf --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/gui.html~ @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + GUI + GUI is a simple, top graphical user interface of the Text to + Matrix Generator (TMG) Toolbox. Using GUI, the user can + select any of the four GUI modules (indexing, dimensionality + reduction, clustering, classification) of TMG. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/init_tmg.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/init_tmg.html new file mode 100644 index 0000000000000000000000000000000000000000..5eb5b793dd27f223a406fac5900617f8f87b4252 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/init_tmg.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + INIT_TMG - Installation script of TMG + INIT_TMG is the installation script of the Text to Matrix + Generator (TMG) Toolbox. INIT_TMG creates the MySQL + database and adds all TMG directories to the path. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/init_tmg.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/init_tmg.html~ new file mode 100644 index 0000000000000000000000000000000000000000..f674492371da4e7d47e8f972a48f50446f2a7dc1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/init_tmg.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + INIT_TMG - Installation script of TMG + INIT_TMG is the installation script of the Text to Matrix + Generator (TMG) Toolbox. INIT_TMG creates the MySQL + database and adds all TMG directories to the path. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_multi.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_multi.html new file mode 100644 index 0000000000000000000000000000000000000000..0ddfd9bc8bb784b8cb8f75a436f01468fc142e8c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_multi.html @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + KNN_MULTI - k-Nearest Neighboors classifier for multi-label + collections + LABELS_AS=KNN_MULTI(A, Q, K, LABELS, NORMALIZED_DOCS, + THRESHOLDS) classifies the columns of Q with the K-Nearest + Neighboors classifier using the pre-classified columns of + matrix A with labels LABELS (cell array of vectors of + integers). THRESHOLDS is a vector of class threshold + values. NORMALIZED_DOCS defines if cosine (1) or euclidean + distance (0) similarity measure is to be used. LABELS_AS + contains the assigned labels for the columns of Q. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_multi.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_multi.html~ new file mode 100644 index 0000000000000000000000000000000000000000..e5f6aafacd1ea5d0aed3d3979d5ddea6871b6af4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_multi.html~ @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + KNN_MULTI - k-Nearest Neighboors classifier for multi-label + collections + LABELS_AS=KNN_MULTI(A, Q, K, LABELS, NORMALIZED_DOCS, + THRESHOLDS) classifies the columns of Q with the K-Nearest + Neighboors classifier using the pre-classified columns of + matrix A with labels LABELS (cell array of vectors of + integers). THRESHOLDS is a vector of class threshold + values. NORMALIZED_DOCS defines if cosine (1) or euclidean + distance (0) similarity measure is to be used. LABELS_AS + contains the assigned labels for the columns of Q. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_single.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_single.html new file mode 100644 index 0000000000000000000000000000000000000000..e17bcc41398014c769388aeebbb3ff694cd214b3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_single.html @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + KNN_SINGLE - k-Nearest Neighboors classifier for single-label + collections + LABELS_AS=KNN_SINGLE(A, Q, K, LABELS, NORMALIZED_DOCS) + classifies the columns of Q with the K-Nearest Neighboors + classifier using the pre-classified columns of matrix A + with labels LABELS (vector of integers). NORMALIZED_DOCS + defines if cosine (1) or euclidean distance (0) similarity + measure is to be used. LABELS_AS contains the assigned + labels for the columns of Q. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_single.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_single.html~ new file mode 100644 index 0000000000000000000000000000000000000000..53190fd61def0e6e4f3d3e761d1b63118799b3e3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/knn_single.html~ @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + KNN_SINGLE - k-Nearest Neighboors classifier for single-label + collections + LABELS_AS=KNN_SINGLE(A, Q, K, LABELS, NORMALIZED_DOCS) + classifies the columns of Q with the K-Nearest Neighboors + classifier using the pre-classified columns of matrix A + with labels LABELS (vector of integers). NORMALIZED_DOCS + defines if cosine (1) or euclidean distance (0) similarity + measure is to be used. LABELS_AS contains the assigned + labels for the columns of Q. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection.html new file mode 100644 index 0000000000000000000000000000000000000000..e9dfc27e4643d440aef74d4c594ab71fd9f31953 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection.html @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + KS_SELECTION - implements the heuristic method from [2] for + the selection of the number of factors from each cluster + used in the Clustered Latent Semantic Indexing method [1]. + N_ST=KS_SELECTION(A, N_COLS, ALPHA_VAL, L) returns in N_ST + a vector of integers denoting the number of factors (sum + equals L) selected from each cluster of the tdm A. N_COLS + is a vector containing the last column index for each column + block, while ALPHA_VAL is a value in [0, 1]. + + REFERENCES: + [1] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible + Approximation Scheme from Clustered Term-Document Matrices. + In Proc. 5th SIAM International Conference on Data Mining, + pages 631–635, Newport Beach, California, 2005. + [2] D. Zeimpekis and E. Gallopoulos, "Linear and Non-Linear + Dimensional Reduction via Class Representatives for Text + Classification", In Proc. of the 2006 IEEE International + Conference on Data Mining, pp. 1172-1177, December 2006, + Hong Kong. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection.html~ new file mode 100644 index 0000000000000000000000000000000000000000..f9176ba640423a9e949ef2dbc49c2ade3809aae2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection.html~ @@ -0,0 +1,62 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + KS_SELECTION - implements the heuristic method from [2] for + the selection of the number of factors from each cluster + used in the Clustered Latent Semantic Indexing method [1]. + N_ST=KS_SELECTION(A, N_COLS, ALPHA_VAL, L) returns in N_ST + a vector of integers denoting the number of factors (sum + equals L) selected from each cluster of the tdm A. N_COLS + is a vector containing the last column index for each column + block, while ALPHA_VAL is a value in [0, 1]. + + REFERENCES: + [1] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible + Approximation Scheme from Clustered Term-Document Matrices. + In Proc. 5th SIAM International Conference on Data Mining, + pages 631–635, Newport Beach, California, 2005. + [2] D. Zeimpekis and E. Gallopoulos, "Linear and Non-Linear + Dimensional Reduction via Class Representatives for Text + Classification", In Proc. of the 2006 IEEE International + Conference on Data Mining, pp. 1172-1177, December 2006, + Hong Kong. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection1.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection1.html new file mode 100644 index 0000000000000000000000000000000000000000..849a7fd6717c72cf78095924d04c29819f78c5b7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection1.html @@ -0,0 +1,64 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + KS_SELECTION1 - implements the heuristic method from [2] for + the selection of the number of factors from each cluster used + in the Clustered Latent Semantic Indexing method [1]. The + number of factors from each cluster is at least 1. + N_ST=KS_SELECTION1(A, N_COLS, ALPHA_VAL, L) returns in N_ST + a vector of integers denoting the number of factors + (sum equals L) selected from each cluster of the tdm A. + N_COLS is a vector containing the last column index for + each column block, while ALPHA_VAL is a value in [0, 1]. + + REFERENCES: + [1] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible + Approximation Scheme from Clustered Term-Document Matrices. + In Proc. 5th SIAM International Conference on Data Mining, + pages 631–635, Newport Beach, California, 2005. + [2] D. Zeimpekis and E. Gallopoulos, "Linear and Non-Linear + Dimensional Reduction via Class Representatives for Text + Classification", In Proc. of the 2006 IEEE International + Conference on Data Mining, pp. 1172-1177, December 2006, + Hong Kong. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection1.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection1.html~ new file mode 100644 index 0000000000000000000000000000000000000000..4b5356ad80e7dacde3226eec16bd85b96e8cca20 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ks_selection1.html~ @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + KS_SELECTION1 - implements the heuristic method from [2] for + the selection of the number of factors from each cluster used + in the Clustered Latent Semantic Indexing method [1]. The + number of factors from each cluster is at least 1. + N_ST=KS_SELECTION1(A, N_COLS, ALPHA_VAL, L) returns in N_ST + a vector of integers denoting the number of factors + (sum equals L) selected from each cluster of the tdm A. + N_COLS is a vector containing the last column index for + each column block, while ALPHA_VAL is a value in [0, 1]. + + REFERENCES: + [1] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible + Approximation Scheme from Clustered Term-Document Matrices. + In Proc. 5th SIAM International Conference on Data Mining, + pages 631–635, Newport Beach, California, 2005. + [2] D. Zeimpekis and E. Gallopoulos, "Linear and Non-Linear + Dimensional Reduction via Class Representatives for Text + Classification", In Proc. of the 2006 IEEE International + Conference on Data Mining, pp. 1172-1177, December 2006, + Hong Kong. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_multi.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_multi.html new file mode 100644 index 0000000000000000000000000000000000000000..2af0276af207263a3d54c166400a5dbd36af65ed --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_multi.html @@ -0,0 +1,76 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + LLSF_MULTI - Linear Least Squares Fit for multi-label + collections [2] + LABELS_AS=LLSF_MULTI(A, Q, CLUSTERS, LABELS, L, METHOD, + THRESHOLDS, SVD_METHOD, CLSI_METHOD) classifies the + columns of Q with the Linear Least Squares Fit classifier + [2] using the pre-classified columns of matrix A with + labels LABELS (cell array of vectors of integers). + THRESHOLDS is a vector of class threshold values, while + CLUSTERS is a structure defining the classes. METHOD + is the method used for the approximation of the rank-l + truncated SVD, with possible values: + - 'clsi': Clustered Latent Semantic Indexing [3]. + - 'cm': Centroids Method [1]. + - 'svd': Singular Value Decomosition. + SVD_METHOD defines the method used for the computation + of the SVD, while CLSI_METHOD defines the method used + for the determination of the number of factors from each + class used in Clustered Latent Semantic Indexing in case + METHOD equals 'clsi'. + + REFERENCES: + [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional + Representation of Text Data Based on Centroids and Least + Squares. BIT Numerical Mathematics, 43(2):427–448, 2003. + [2] Y. Yang and C. Chute. A Linear Least Squares Fit + Mapping Method for Information Retrieval from Natural + Language Texts. In Proc. 14th Conference on Computational + Linguistics, pages 447–453, Morristown, NJ, USA, 1992. + [3] D. Zeimpekis and E. Gallopoulos, "Linear and + Non-Linear Dimensional Reduction via Class Representatives + for Text Classification". In Proc. 2006 IEEE International + Conference on Data Mining (ICDM'06), Hong Kong, Dec. 2006. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_multi.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_multi.html~ new file mode 100644 index 0000000000000000000000000000000000000000..fd6255ae59046fd3e0f1ea42ee567debb0fd1ea1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_multi.html~ @@ -0,0 +1,75 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + LLSF_MULTI - Linear Least Squares Fit for multi-label + collections [2] + LABELS_AS=LLSF_MULTI(A, Q, CLUSTERS, LABELS, L, METHOD, + THRESHOLDS, SVD_METHOD, CLSI_METHOD) classifies the + columns of Q with the Linear Least Squares Fit classifier + [2] using the pre-classified columns of matrix A with + labels LABELS (cell array of vectors of integers). + THRESHOLDS is a vector of class threshold values, while + CLUSTERS is a structure defining the classes. METHOD + is the method used for the approximation of the rank-l + truncated SVD, with possible values: + - 'clsi': Clustered Latent Semantic Indexing [3]. + - 'cm': Centroids Method [1]. + - 'svd': Singular Value Decomosition. + SVD_METHOD defines the method used for the computation + of the SVD, while CLSI_METHOD defines the method used + for the determination of the number of factors from each + class used in Clustered Latent Semantic Indexing in case + METHOD equals 'clsi'. + + REFERENCES: + [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional + Representation of Text Data Based on Centroids and Least + Squares. BIT Numerical Mathematics, 43(2):427–448, 2003. + [2] Y. Yang and C. Chute. A Linear Least Squares Fit + Mapping Method for Information Retrieval from Natural + Language Texts. In Proc. 14th Conference on Computational + Linguistics, pages 447–453, Morristown, NJ, USA, 1992. + [3] D. Zeimpekis and E. Gallopoulos, "Linear and + Non-Linear Dimensional Reduction via Class Representatives + for Text Classification". In Proc. 2006 IEEE International + Conference on Data Mining (ICDM'06), Hong Kong, Dec. 2006. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_single.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_single.html new file mode 100644 index 0000000000000000000000000000000000000000..112c24ee9e23ecf1e4d1c1128ba83200881be9ca --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_single.html @@ -0,0 +1,75 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + LLSF_SINGLE - Linear Least Squares Fit for single-label + collections [2] + LABELS_AS=LLSF_SINGLE(A, Q, CLUSTERS, LABELS, L, METHOD, + SVD_METHOD, CLSI_METHOD) classifies the columns of Q + with the Linear Least Squares Fit classifier [2] using + the pre-classified columns of matrix A with labels LABELS + (cell array of vectors of integers). CLUSTERS is a + structure defining the classes. METHOD is the method + used for the approximation of the rank-l truncated SVD, + with possible values: + - 'clsi': Clustered Latent Semantic Indexing [3]. + - 'cm': Centroids Method [1]. + - 'svd': Singular Value Decomosition. + SVD_METHOD defines the method used for the computation + of the SVD, while CLSI_METHOD defines the method used for + the determination of the number of factors from each class + used in Clustered Latent Semantic Indexing in case METHOD + equals 'clsi'. + + REFERENCES: + [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional + Representation of Text Data Based on Centroids and Least + Squares. BIT Numerical Mathematics, 43(2):427–448, 2003. + [2] Y. Yang and C. Chute. A Linear Least Squares Fit + Mapping Method for Information Retrieval from Natural + Language Texts. In Proc. 14th Conference on Computational + Linguistics, pages 447–453, Morristown, NJ, USA, 1992. + [3] D. Zeimpekis and E. Gallopoulos, "Non-Linear Dimensional + Reduction via Class Representatives for Text Classification". + In Proc. 2006 IEEE International Conference on Data Mining + (ICDM'06), Hong Kong, Dec. 2006. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_single.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_single.html~ new file mode 100644 index 0000000000000000000000000000000000000000..35f63b497b4787478eaf5cf32c84bcdab0a4fbc1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/llsf_single.html~ @@ -0,0 +1,74 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + LLSF_SINGLE - Linear Least Squares Fit for single-label + collections [2] + LABELS_AS=LLSF_SINGLE(A, Q, CLUSTERS, LABELS, L, METHOD, + SVD_METHOD, CLSI_METHOD) classifies the columns of Q + with the Linear Least Squares Fit classifier [2] using + the pre-classified columns of matrix A with labels LABELS + (cell array of vectors of integers). CLUSTERS is a + structure defining the classes. METHOD is the method + used for the approximation of the rank-l truncated SVD, + with possible values: + - 'clsi': Clustered Latent Semantic Indexing [3]. + - 'cm': Centroids Method [1]. + - 'svd': Singular Value Decomosition. + SVD_METHOD defines the method used for the computation + of the SVD, while CLSI_METHOD defines the method used for + the determination of the number of factors from each class + used in Clustered Latent Semantic Indexing in case METHOD + equals 'clsi'. + + REFERENCES: + [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional + Representation of Text Data Based on Centroids and Least + Squares. BIT Numerical Mathematics, 43(2):427–448, 2003. + [2] Y. Yang and C. Chute. A Linear Least Squares Fit + Mapping Method for Information Retrieval from Natural + Language Texts. In Proc. 14th Conference on Computational + Linguistics, pages 447–453, Morristown, NJ, USA, 1992. + [3] D. Zeimpekis and E. Gallopoulos, "Non-Linear Dimensional + Reduction via Class Representatives for Text Classification". + In Proc. 2006 IEEE International Conference on Data Mining + (ICDM'06), Hong Kong, Dec. 2006. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/lsa.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/lsa.html new file mode 100644 index 0000000000000000000000000000000000000000..9ea745b08fa660f1d59606a416cb9b1d134e9e14 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/lsa.html @@ -0,0 +1,59 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + LSA - Applies the Latent Semantic Analysis Model to a + document collection + [SC, DOCS_INDS] = LSA(D, P, Q, NORMALIZE_DOCS) applies + LSA to the text collection represented by the latent + semantic factors D, P of the collection's term - document + matrix, for the query defined by the vector Q [1]. + NORMALIZE_DOCS defines if the document vectors are to be + normalized (1) or not (0). SC contains the sorted + similarity coefficients, while DOC_INDS contains the + corresponding document indices. + + REFERENCES: + [1] M.Berry and M.Browne, Understanding Search Engines, + Mathematical Modeling and Text Retrieval, Philadelphia, + PA: Society for Industrial and Applied Mathematics, 1999. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/lsa.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/lsa.html~ new file mode 100644 index 0000000000000000000000000000000000000000..03d0586c52b1c10d1df494e95b49aa773532b691 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/lsa.html~ @@ -0,0 +1,58 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + LSA - Applies the Latent Semantic Analysis Model to a + document collection + [SC, DOCS_INDS] = LSA(D, P, Q, NORMALIZE_DOCS) applies + LSA to the text collection represented by the latent + semantic factors D, P of the collection's term - document + matrix, for the query defined by the vector Q [1]. + NORMALIZE_DOCS defines if the document vectors are to be + normalized (1) or not (0). SC contains the sorted + similarity coefficients, while DOC_INDS contains the + corresponding document indices. + + REFERENCES: + [1] M.Berry and M.Browne, Understanding Search Engines, + Mathematical Modeling and Text Retrieval, Philadelphia, + PA: Society for Industrial and Applied Mathematics, 1999. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_multi.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_multi.html new file mode 100644 index 0000000000000000000000000000000000000000..7124fc4a3a6d74bb21bf85f15b3f4b2ffe8a19fb --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_multi.html @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MAKE_CLUSTERS_MULTI - auxiliary function for the classification + algorithms + CLUSTERS=MAKE_CLUSTERS_MULTI(LABELS) forms the cluster + structure of a multi-label collection with document + classes defined by LABELS (cell array of vectors of + integers). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_multi.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_multi.html~ new file mode 100644 index 0000000000000000000000000000000000000000..a80eed6637201001d78d55989de6344dd5eebbe2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_multi.html~ @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MAKE_CLUSTERS_MULTI - auxiliary function for the classification + algorithms + CLUSTERS=MAKE_CLUSTERS_MULTI(LABELS) forms the cluster + structure of a multi-label collection with document + classes defined by LABELS (cell array of vectors of + integers). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_single.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_single.html new file mode 100644 index 0000000000000000000000000000000000000000..595fa56d9228a6e4a45b2f997f295479dd419b8c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_single.html @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MAKE_CLUSTERS_SINGLE - auxiliary function for the classification + algorithms + CLUSTERS=MAKE_CLUSTERS_SINGLE(LABELS) forms the cluster + structure of a single-label collection with document classes + defined by LABELS (vector of integers). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_single.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_single.html~ new file mode 100644 index 0000000000000000000000000000000000000000..00dbba10971f640017b21755176ca560e5cd60e4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_clusters_single.html~ @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MAKE_CLUSTERS_SINGLE - auxiliary function for the classification + algorithms + CLUSTERS=MAKE_CLUSTERS_SINGLE(LABELS) forms the cluster + structure of a single-label collection with document classes + defined by LABELS (vector of integers). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_labels.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_labels.html new file mode 100644 index 0000000000000000000000000000000000000000..37752d62517dbdb1318149ea3d18f8d5ce95d49e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_labels.html @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MAKE_LABELS - creates a label vector of integers for the input + cell array of string + [LABELS, UNIQUE_LABELS]=MAKE_LABELS(INPUT_LABELS) creates a + vector of integer labels (LABELS) for the input cell array + of strings INPUT_LABELS. UNIQUE_LABELS contains the strings + of unique labels of the input cell array. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_labels.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_labels.html~ new file mode 100644 index 0000000000000000000000000000000000000000..10d2c91802db60621cb3025e9f5457b35357bbaf --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_labels.html~ @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MAKE_LABELS - creates a label vector of integers for the input + cell array of string + [LABELS, UNIQUE_LABELS]=MAKE_LABELS(INPUT_LABELS) creates a + vector of integer labels (LABELS) for the input cell array + of strings INPUT_LABELS. UNIQUE_LABELS contains the strings + of unique labels of the input cell array. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_val_inds.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_val_inds.html new file mode 100644 index 0000000000000000000000000000000000000000..e570795f3d9a0ca4f244f6070392ec89dc251552 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_val_inds.html @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MAKE_VAL_INDS - auxiliary function for the classification + algorithms + INDS=MAKE_VAL_INDS(LABELS) constructs an index vector used + during the thresholding phase of any classifier for the + multi-label collection with document classes defined by + LABELS (cell array of vectors of integers). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_val_inds.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_val_inds.html~ new file mode 100644 index 0000000000000000000000000000000000000000..9f75fde76eb8451ff8d149db426eabefcebad0cc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/make_val_inds.html~ @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MAKE_VAL_INDS - auxiliary function for the classification + algorithms + INDS=MAKE_VAL_INDS(LABELS) constructs an index vector used + during the thresholding phase of any classifier for the + multi-label collection with document classes defined by + LABELS (cell array of vectors of integers). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_dictionary.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_dictionary.html new file mode 100644 index 0000000000000000000000000000000000000000..03f2e3e91e8cc58b1dd0ba168cce576686907237 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_dictionary.html @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MERGE_DICTIONARY - merges two cell arrays of chars and returns + only the distinct elements of their union (used by tmg.m, + tmg_query.m, tdm_update.m) + [ALL_WORDS, ALL_DOC_IDS]=MERGE_DICTIONARY(ALL_WORDS, NEW_WORDS, + ALL_DOC_IDS, NEW_DOC_IDS) returns in ALL_WORDS all distinct + elements of the union of the cell arrays of chars ALL_WORDS, + NEW_WORDS corresponding to two document collections. ALL_DOC_IDS + and NEW_DOC_IDS contain the inverted indices of the two + collections. Output argument ALL_DOC_IDS contains the inverted + index of the whole collection. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_dictionary.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_dictionary.html~ new file mode 100644 index 0000000000000000000000000000000000000000..255184699b7c8b56433f0ee68cbd16e734449d92 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_dictionary.html~ @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MERGE_DICTIONARY - merges two cell arrays of chars and returns + only the distinct elements of their union (used by tmg.m, + tmg_query.m, tdm_update.m) + [ALL_WORDS, ALL_DOC_IDS]=MERGE_DICTIONARY(ALL_WORDS, NEW_WORDS, + ALL_DOC_IDS, NEW_DOC_IDS) returns in ALL_WORDS all distinct + elements of the union of the cell arrays of chars ALL_WORDS, + NEW_WORDS corresponding to two document collections. ALL_DOC_IDS + and NEW_DOC_IDS contain the inverted indices of the two + collections. Output argument ALL_DOC_IDS contains the inverted + index of the whole collection. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_tdms.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_tdms.html new file mode 100644 index 0000000000000000000000000000000000000000..85f1c12b02ccf91ffd11fb76b5149ae33f33c7a8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_tdms.html @@ -0,0 +1,77 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MERGE_TDMS - Merges two document collections + [A, DICTIONARY]=MERGE_TDMS(A1, DICTIONARY1, A2, DICTIONARY2] + merges the tdms A1 and A2 with corresponding dictionaries + DICTIONARY1 and DICTIONARY2. + MERGE_TDS(A1, DICTIONARY1, A2, DICTIONARY2, OPTIONS) defines + optional parameters: + - OPTIONS.min_local_freq: The minimum local frequency for + a term (default 1) + - OPTIONS.max_local_freq: The maximum local frequency for + a term (default inf) + - OPTIONS.min_global_freq: The minimum global frequency + for a term (default 1) + - OPTIONS.max_global_freq: The maximum global frequency + for a term (default inf) + - OPTIONS.local_weight: The local term weighting function + (default 't'). Possible values (see [1, 2]): + 't': Term Frequency + 'b': Binary + 'l': Logarithmic + 'a': Alternate Log + 'n': Augmented Normalized Term Frequency + - OPTIONS.global_weight: The global term weighting function + (default 'x'). Possible values (see [1, 2]): + 'x': None + 'e': Entropy + 'f': Inverse Document Frequency (IDF) + 'g': GfIdf + 'n': Normal + 'p': Probabilistic Inverse + - OPTIONS.normalization: Indicates if we normalize the + document vectors (default 'x'). Possible values: + 'x': None + 'c': Cosine + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_tdms.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_tdms.html~ new file mode 100644 index 0000000000000000000000000000000000000000..58085a53803f5897ebaba820386dd248b03a23b9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/merge_tdms.html~ @@ -0,0 +1,76 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MERGE_TDMS - Merges two document collections + [A, DICTIONARY]=MERGE_TDMS(A1, DICTIONARY1, A2, DICTIONARY2] + merges the tdms A1 and A2 with corresponding dictionaries + DICTIONARY1 and DICTIONARY2. + MERGE_TDS(A1, DICTIONARY1, A2, DICTIONARY2, OPTIONS) defines + optional parameters: + - OPTIONS.min_local_freq: The minimum local frequency for + a term (default 1) + - OPTIONS.max_local_freq: The maximum local frequency for + a term (default inf) + - OPTIONS.min_global_freq: The minimum global frequency + for a term (default 1) + - OPTIONS.max_global_freq: The maximum global frequency + for a term (default inf) + - OPTIONS.local_weight: The local term weighting function + (default 't'). Possible values (see [1, 2]): + 't': Term Frequency + 'b': Binary + 'l': Logarithmic + 'a': Alternate Log + 'n': Augmented Normalized Term Frequency + - OPTIONS.global_weight: The global term weighting function + (default 'x'). Possible values (see [1, 2]): + 'x': None + 'e': Entropy + 'f': Inverse Document Frequency (IDF) + 'g': GfIdf + 'n': Normal + 'p': Probabilistic Inverse + - OPTIONS.normalization: Indicates if we normalize the + document vectors (default 'x'). Possible values: + 'x': None + 'c': Cosine + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/myperms.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/myperms.html new file mode 100644 index 0000000000000000000000000000000000000000..e9e19cab57ae58c6184f951379b0423142a575b1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/myperms.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MYPERMS - computes all possible combinations of the input + V=MYPERMS[P, L] returns all possible combinations of the + input vector of integers with L numbers. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/myperms.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/myperms.html~ new file mode 100644 index 0000000000000000000000000000000000000000..d7262564cdb6a554a882463adfc1209d157519e8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/myperms.html~ @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + MYPERMS - computes all possible combinations of the input + V=MYPERMS[P, L] returns all possible combinations of the + input vector of integers with L numbers. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_gui.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_gui.html new file mode 100644 index 0000000000000000000000000000000000000000..1c2d4ba4d5c393d4142529fa6038da18d9116c27 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_gui.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + nnmf_gui + nnmf_gui is a graphical user interface for all + non-negative dimensionality reduction techniques implemented + in the Text to Matrix Generator (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_gui.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_gui.html~ new file mode 100644 index 0000000000000000000000000000000000000000..142701dcd4bc82b6d9e860db9bc921ec740b87a3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_gui.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + nnmf_gui + nnmf_gui is a graphical user interface for all + non-negative dimensionality reduction techniques implemented + in the Text to Matrix Generator (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_mul_update.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_mul_update.html new file mode 100644 index 0000000000000000000000000000000000000000..2e20341b5bc0f58dff34a831a9eb669017ac71a2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_mul_update.html @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + NNMF_MUL_UPDATE - Applies the multiplicative update algorithm + of Lee and Seung. + NNMF_MUL_UPDATE applies the multiplicative update algorithm + of Lee and Seung for non-negative factorizations. [W, H, S] + = nnmf_mul_update(A, W, H, NIT, DSP) produces a non-negative + factorization of A, W*H, using as initial factors W and H, + applying NIT iterations. + + REFERENCES: + [1] D. Lee, S. Seung, Algorithms for Non-negative Matrix + Factorization, NIPS (2000), 556-562. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_mul_update.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_mul_update.html~ new file mode 100644 index 0000000000000000000000000000000000000000..c706606d6462be82f01cf40331ed024d4fc4dba7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/nnmf_mul_update.html~ @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + NNMF_MUL_UPDATE - Applies the multiplicative update algorithm + of Lee and Seung. + NNMF_MUL_UPDATE applies the multiplicative update algorithm + of Lee and Seung for non-negative factorizations. [W, H, S] + = nnmf_mul_update(A, W, H, NIT, DSP) produces a non-negative + factorization of A, W*H, using as initial factors W and H, + applying NIT iterations. + + REFERENCES: + [1] D. Lee, S. Seung, Algorithms for Non-negative Matrix + Factorization, NIPS (2000), 556-562. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/open_file.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/open_file.html new file mode 100644 index 0000000000000000000000000000000000000000..c217c95e90567bac49876eb9808d866c5fc33702 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/open_file.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + OPEN_FILE + OPEN_FILE is a graphical user interface for selecting a file, + directory or variable from the workspace. The function returns + the name of the selected file, directory or variable. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/open_file.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/open_file.html~ new file mode 100644 index 0000000000000000000000000000000000000000..0f7542017dbbcfb7c5f461a136b3fea8a4e814d3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/open_file.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + OPEN_FILE + OPEN_FILE is a graphical user interface for selecting a file, + directory or variable from the workspace. The function returns + the name of the selected file, directory or variable. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/opt_2means.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/opt_2means.html new file mode 100644 index 0000000000000000000000000000000000000000..377db7aae2ba5606a8d3609b314c1f780f437b0d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/opt_2means.html @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + OPT_2MEANS - a special case of k-means for k=2 + OPT_2MEANS(A, X) returns the clustering that optimizes the + objective function of the k-means algorithm based on the + ordering of vector X. + [CLUSTERS, S]=OPT_2MEANS(A, X) returns the cluster + structure as well as the value of the objective function. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/opt_2means.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/opt_2means.html~ new file mode 100644 index 0000000000000000000000000000000000000000..43a0944665b8e0848fa27a5effddf1e45b0ae9d5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/opt_2means.html~ @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + OPT_2MEANS - a special case of k-means for k=2 + OPT_2MEANS(A, X) returns the clustering that optimizes the + objective function of the k-means algorithm based on the + ordering of vector X. + [CLUSTERS, S]=OPT_2MEANS(A, X) returns the cluster + structure as well as the value of the objective function. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca.html new file mode 100644 index 0000000000000000000000000000000000000000..c2b9cb7270b83559adc7b4b4d71e32f08d3e50e0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca.html @@ -0,0 +1,56 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA - Principal Component Analysis + [U, S, V]=PCA(A, C, K, METHOD) computes the K-factor + Principal Component Analysis of A, i.e. SVD of + A-C*ones(size(A, 2), 1), using either the svds function + of MATLAB or the PROPACK package [1]. + + REFERENCES: + [1] R.M.Larsen, PROPACK: A Software Package for the + Symmetric Eigenvalue Problem and Singular Value Problems + on Lanczos and Lanczos Bidiagonalization + with Partial Reorthogonalization, Stanford University, + http://sun.stanford.edu/~rmunk/PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca.html~ new file mode 100644 index 0000000000000000000000000000000000000000..59561f529d34090fe72ad36e78a3afeb8e3fd180 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca.html~ @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA - Principal Component Analysis + [U, S, V]=PCA(A, C, K, METHOD) computes the K-factor + Principal Component Analysis of A, i.e. SVD of + A-C*ones(size(A, 2), 1), using either the svds function + of MATLAB or the PROPACK package [1]. + + REFERENCES: + [1] R.M.Larsen, PROPACK: A Software Package for the + Symmetric Eigenvalue Problem and Singular Value Problems + on Lanczos and Lanczos Bidiagonalization + with Partial Reorthogonalization, Stanford University, + http://sun.stanford.edu/~rmunk/PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat.html new file mode 100644 index 0000000000000000000000000000000000000000..b791694ee2c6e7630e217a8995bc34f279b89f02 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_MAT - Principal Component Analysis with MATLAB (svds) + [U, S, V]=PCA_MAT(A, C, K) computes the K-factor Principal + Component Analysis of A, i.e. SVD of A-C*ones(size(A, 2), + 1), using the svds function of MATLAB. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat.html~ new file mode 100644 index 0000000000000000000000000000000000000000..737140c08e94f61bce5962b14240b2c8e2192285 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_MAT - Principal Component Analysis with MATLAB (svds) + [U, S, V]=PCA_MAT(A, C, K) computes the K-factor Principal + Component Analysis of A, i.e. SVD of A-C*ones(size(A, 2), + 1), using the svds function of MATLAB. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat_afun.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat_afun.html new file mode 100644 index 0000000000000000000000000000000000000000..e603a76e6b26ccfd2ee13cc3e79d5194931f4833 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat_afun.html @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_MAT_AFUN - Auxiliary function used in PCA_MAT. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat_afun.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat_afun.html~ new file mode 100644 index 0000000000000000000000000000000000000000..c6b963e528b1263dcea4e95d1b9115f82f041e09 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_mat_afun.html~ @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_MAT_AFUN - Auxiliary function used in PCA_MAT. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack.html new file mode 100644 index 0000000000000000000000000000000000000000..e6e0721ea3b50646f756f5c9d8e69dfbd9251098 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack.html @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_PROPACK - Principal Component Analysis with PROPACK + [U, S, V]=PCA_PROPACK(A, C, K) computes the K-factor + Principal Component Analysis of A, i.e. SVD of + A-C*ones(size(A, 2), 1), using the PROPACK package [1]. + + REFERENCES: + [1] R.M.Larsen, PROPACK: A Software Package for the + Symmetric Eigenvalue Problem and Singular Value Problems + on Lanczos and Lanczos Bidiagonalization + with Partial Reorthogonalization, Stanford University, + http://sun.stanford.edu/~rmunk/PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack.html~ new file mode 100644 index 0000000000000000000000000000000000000000..8c33b1d70c9a14703aee4f666d766572e06dfc2e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack.html~ @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_PROPACK - Principal Component Analysis with PROPACK + [U, S, V]=PCA_PROPACK(A, C, K) computes the K-factor + Principal Component Analysis of A, i.e. SVD of + A-C*ones(size(A, 2), 1), using the PROPACK package [1]. + + REFERENCES: + [1] R.M.Larsen, PROPACK: A Software Package for the + Symmetric Eigenvalue Problem and Singular Value Problems + on Lanczos and Lanczos Bidiagonalization + with Partial Reorthogonalization, Stanford University, + http://sun.stanford.edu/~rmunk/PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_Atransfunc.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_Atransfunc.html new file mode 100644 index 0000000000000000000000000000000000000000..1a47cae3be233900d1b41878d311130c12c02404 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_Atransfunc.html @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_PROPACK_ATRANSFUNC - Auxiliary function used in PCA_PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_Atransfunc.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_Atransfunc.html~ new file mode 100644 index 0000000000000000000000000000000000000000..f33713b899ab652bc52c36702558b0eb0d9004c8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_Atransfunc.html~ @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_PROPACK_ATRANSFUNC - Auxiliary function used in PCA_PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_afun.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_afun.html new file mode 100644 index 0000000000000000000000000000000000000000..aa2ebd352d7f0cff88dbacfd23c8b100d83d75c3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_afun.html @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_PROPACK_AFUN - Auxiliary function used in TMG_PCA_PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_afun.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_afun.html~ new file mode 100644 index 0000000000000000000000000000000000000000..e10a19cd01112af9966351d46ad2708e98846bf3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_propack_afun.html~ @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_PROPACK_AFUN - Auxiliary function used in TMG_PCA_PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update.html new file mode 100644 index 0000000000000000000000000000000000000000..232476dfa3aff93951f8fcc7953aef9ffbfa5ec6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update.html @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_UPDATE - Principal Component Analysis of a rank-l + updated matrix with MATLAB (eigs) + [U, S, V]=PCA_UPDATE(A, W, H, C, K) computes the K-factor + Principal Component Analysis of A - W * H, i.e. SVD of + (A - W * H) - C * ones(size(A, 2), 1), using the svds + function of MATLAB. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update.html~ new file mode 100644 index 0000000000000000000000000000000000000000..ac5ed15d26b955375a30f6795e50414036e0bc1d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update.html~ @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_UPDATE - Principal Component Analysis of a rank-l + updated matrix with MATLAB (eigs) + [U, S, V]=PCA_UPDATE(A, W, H, C, K) computes the K-factor + Principal Component Analysis of A - W * H, i.e. SVD of + (A - W * H) - C * ones(size(A, 2), 1), using the svds + function of MATLAB. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update_afun.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update_afun.html new file mode 100644 index 0000000000000000000000000000000000000000..fe38671a311060279209cc74ce5751bd25bac201 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update_afun.html @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_UPDATE_AFUN - Auxiliary function used in PCA_UPDATE. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update_afun.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update_afun.html~ new file mode 100644 index 0000000000000000000000000000000000000000..786293d57ac31efc5e3b1ba280a1ebe5e8707d7f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pca_update_afun.html~ @@ -0,0 +1,44 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PCA_UPDATE_AFUN - Auxiliary function used in PCA_UPDATE. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp.html new file mode 100644 index 0000000000000000000000000000000000000000..dfd274eed13fe633064e7f4fc4a2af8ab2ee4657 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp.html @@ -0,0 +1,67 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP - Principal Direction Divisive Partitioning Clustering + Algorithm + PDDP clusters a term-document matrix (tdm) using the + Principal Direction Divisive Partitioning clustering + algorithm [1, 2]. + CLUSTERS=PDDP(A, K, L) returns a cluster structure with + K clusters for the tdm A formed using information from + the first L principal components of the tdm. + [CLUSTERS, TREE_STRUCT]=PDDP(A, K, L) returns also the + full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]=PDDP(A, + K, L) returns the objective function of PDDP. + PDDP(A, K, L, SVD_METHOD) defines the method used for the + computation of the PCA (svds - default - or propack), while + PDDP(A, K, L, SVD_METHOD, DSP) defines if results are to be + displayed to the command window (default 1) or not (0). + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, PDDP(l): Towards a Flexible + Principal Direction Divisive Partitioning Clustering + Algorithmm, Proc. IEEE ICDM'03 Workshop on Clustering Large + Data Sets (Melbourne, Florida), 2003. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp.html~ new file mode 100644 index 0000000000000000000000000000000000000000..414cbd9adc9cf179d4a7ce568f624d9ec387226e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp.html~ @@ -0,0 +1,66 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP - Principal Direction Divisive Partitioning Clustering + Algorithm + PDDP clusters a term-document matrix (tdm) using the + Principal Direction Divisive Partitioning clustering + algorithm [1, 2]. + CLUSTERS=PDDP(A, K, L) returns a cluster structure with + K clusters for the tdm A formed using information from + the first L principal components of the tdm. + [CLUSTERS, TREE_STRUCT]=PDDP(A, K, L) returns also the + full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]=PDDP(A, + K, L) returns the objective function of PDDP. + PDDP(A, K, L, SVD_METHOD) defines the method used for the + computation of the PCA (svds - default - or propack), while + PDDP(A, K, L, SVD_METHOD, DSP) defines if results are to be + displayed to the command window (default 1) or not (0). + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, PDDP(l): Towards a Flexible + Principal Direction Divisive Partitioning Clustering + Algorithmm, Proc. IEEE ICDM'03 Workshop on Clustering Large + Data Sets (Melbourne, Florida), 2003. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_2means.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_2means.html new file mode 100644 index 0000000000000000000000000000000000000000..edd8ba378f078aa5440d4b3cf18452afb23a7f5e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_2means.html @@ -0,0 +1,67 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_2MEANS - Hybrid Principal Direction Divisive Partitioning + Clustering Algorithm and k-means + PDDP_2MEANS clusters a term-document matrix (tdm) using a + combination of the Principal Direction Divisive Partitioning + clustering algorithm [1] and k-means [2]. + CLUSTERS=PDDP_2MEANS(A, K) returns a cluster structure with K + clusters for the tdm A. + [CLUSTERS, TREE_STRUCT]=PDDP_2MEANS(A, K) returns also the + full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]=PDDP_2MEANS(A, + K) returns the objective function of PDDP. + PDDP_2MEANS(A, K, SVD_METHOD) defines the method used for the + computation of the PCA (svds - default - or propack). + PDDP_2MEANS(A, K, SVD_METHOD, DSP) defines if results are to + be displayed to the command window (default 1) or not (0). + Finally, PDDP_2MEANS(A, K, SVD_METHOD, DSP, EPSILON)defines + the termination criterion value for the k-means algorithm. + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral + Divisive Clustering Algorithms, Proc. of Text Mining Workshop, + Minneapolis, 2007. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_2means.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_2means.html~ new file mode 100644 index 0000000000000000000000000000000000000000..8937d5059b1e90122262c650d5124153ed2cdd38 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_2means.html~ @@ -0,0 +1,66 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_2MEANS - Hybrid Principal Direction Divisive Partitioning + Clustering Algorithm and k-means + PDDP_2MEANS clusters a term-document matrix (tdm) using a + combination of the Principal Direction Divisive Partitioning + clustering algorithm [1] and k-means [2]. + CLUSTERS=PDDP_2MEANS(A, K) returns a cluster structure with K + clusters for the tdm A. + [CLUSTERS, TREE_STRUCT]=PDDP_2MEANS(A, K) returns also the + full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]=PDDP_2MEANS(A, + K) returns the objective function of PDDP. + PDDP_2MEANS(A, K, SVD_METHOD) defines the method used for the + computation of the PCA (svds - default - or propack). + PDDP_2MEANS(A, K, SVD_METHOD, DSP) defines if results are to + be displayed to the command window (default 1) or not (0). + Finally, PDDP_2MEANS(A, K, SVD_METHOD, DSP, EPSILON)defines + the termination criterion value for the k-means algorithm. + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral + Divisive Clustering Algorithms, Proc. of Text Mining Workshop, + Minneapolis, 2007. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_extract_centroids.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_extract_centroids.html new file mode 100644 index 0000000000000000000000000000000000000000..32cd34533297867d991bc6aa9aa399177bd8101d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_extract_centroids.html @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_EXTRACT_CENTROIDS - returns the cluster centroids of a + PDDP clustering result + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_extract_centroids.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_extract_centroids.html~ new file mode 100644 index 0000000000000000000000000000000000000000..e8186bb4c8c6c6e2496c33ccda328da6d94b1405 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_extract_centroids.html~ @@ -0,0 +1,46 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_EXTRACT_CENTROIDS - returns the cluster centroids of a + PDDP clustering result + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut.html new file mode 100644 index 0000000000000000000000000000000000000000..d11d25d7192bb1a1b0e0dd86af122c9259be8351 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut.html @@ -0,0 +1,67 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_OPTCUT - Hybrid Principal Direction Divisive + Partitioning Clustering Algorithm and k-means + PDDP_OPTCUT clusters a term-document matrix (tdm) using + a combination of the Principal Direction Divisive + Partitioning clustering algorithm [1] and k-means [2]. + CLUSTERS=PDDP_OPTCUT(A, K) returns a cluster structure + with K clusters for the tdm A. + [CLUSTERS, TREE_STRUCT]=PDDP_OPTCUT(A, K) returns also the + full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]=PDDP_OPTCUT(A, + K) returns the objective function of PDDP. + PDDP_OPTCUT(A, K, SVD_METHOD) defines the method used for the + computation of the PCA (svds - default - or propack). + PDDP_OPTCUT(A, K, SVD_METHOD, DSP) defines if results are to be + displayed to the command window (default 1) or not (0). Finally, + PDDP_OPTCUT(A, K, SVD_METHOD, DSP, EPSILON) defines the + termination criterion value for the k-means algorithm. + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral + Divisive Clustering Algorithms, Proc. of Text Mining Workshop, + Minneapolis, 2007. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut.html~ new file mode 100644 index 0000000000000000000000000000000000000000..2bd143971cd9a658f26dc5e3d612271148920959 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut.html~ @@ -0,0 +1,66 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_OPTCUT - Hybrid Principal Direction Divisive + Partitioning Clustering Algorithm and k-means + PDDP_OPTCUT clusters a term-document matrix (tdm) using + a combination of the Principal Direction Divisive + Partitioning clustering algorithm [1] and k-means [2]. + CLUSTERS=PDDP_OPTCUT(A, K) returns a cluster structure + with K clusters for the tdm A. + [CLUSTERS, TREE_STRUCT]=PDDP_OPTCUT(A, K) returns also the + full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]=PDDP_OPTCUT(A, + K) returns the objective function of PDDP. + PDDP_OPTCUT(A, K, SVD_METHOD) defines the method used for the + computation of the PCA (svds - default - or propack). + PDDP_OPTCUT(A, K, SVD_METHOD, DSP) defines if results are to be + displayed to the command window (default 1) or not (0). Finally, + PDDP_OPTCUT(A, K, SVD_METHOD, DSP, EPSILON) defines the + termination criterion value for the k-means algorithm. + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral + Divisive Clustering Algorithms, Proc. of Text Mining Workshop, + Minneapolis, 2007. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut_2means.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut_2means.html new file mode 100644 index 0000000000000000000000000000000000000000..dac231d4f0ffe62bfc405cf852786d0196e57b75 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut_2means.html @@ -0,0 +1,70 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_OPTCUT_2MEANS - Hybrid Principal Direction Divisive + Partitioning Clustering Algorithm and k-means + PDDP_OPTCUT_2MEANS clusters a term-document matrix (tdm) + using a combination of the Principal Direction Divisive + Partitioning clustering algorithm [1] and k-means [2]. + CLUSTERS=PDDP_OPTCUT_OPTCUT_2MEANS(A, K) returns a cluster + structure with K clusters for the tdm A. + [CLUSTERS, TREE_STRUCT]=PDDP_OPTCUT_2MEANS(A, K) returns also + the full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]= + PDDP_OPTCUT_2MEANS(A, K) returns the objective function of + PDDP. + PDDP_OPTCUT_2MEANS(A, K, SVD_METHOD) defines the method used + for the computation of the PCA (svds - default - or propack). + PDDP_OPTCUT_2MEANS(A, K, SVD_METHOD, DSP) defines if results + are to be displayed to the command window (default 1) or not + (0). Finally, PDDP_OPTCUT_2MEANS(A, K, SVD_METHOD, DSP, EPSILON) + defines the termination criterion value for the k-means + algorithm. + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral + Divisive Clustering Algorithms, Proc. of Text Mining Workshop, + Minneapolis, 2007. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut_2means.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut_2means.html~ new file mode 100644 index 0000000000000000000000000000000000000000..c43f2e68dc647de95ccc9523b2e56a4173869b23 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcut_2means.html~ @@ -0,0 +1,69 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_OPTCUT_2MEANS - Hybrid Principal Direction Divisive + Partitioning Clustering Algorithm and k-means + PDDP_OPTCUT_2MEANS clusters a term-document matrix (tdm) + using a combination of the Principal Direction Divisive + Partitioning clustering algorithm [1] and k-means [2]. + CLUSTERS=PDDP_OPTCUT_OPTCUT_2MEANS(A, K) returns a cluster + structure with K clusters for the tdm A. + [CLUSTERS, TREE_STRUCT]=PDDP_OPTCUT_2MEANS(A, K) returns also + the full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]= + PDDP_OPTCUT_2MEANS(A, K) returns the objective function of + PDDP. + PDDP_OPTCUT_2MEANS(A, K, SVD_METHOD) defines the method used + for the computation of the PCA (svds - default - or propack). + PDDP_OPTCUT_2MEANS(A, K, SVD_METHOD, DSP) defines if results + are to be displayed to the command window (default 1) or not + (0). Finally, PDDP_OPTCUT_2MEANS(A, K, SVD_METHOD, DSP, EPSILON) + defines the termination criterion value for the k-means + algorithm. + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral + Divisive Clustering Algorithms, Proc. of Text Mining Workshop, + Minneapolis, 2007. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcutpd.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcutpd.html new file mode 100644 index 0000000000000000000000000000000000000000..84bb2e77453008fe4a50494779fdcf7db706642d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcutpd.html @@ -0,0 +1,73 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_OPTCUTPD - Hybrid Principal Direction Divisive + Partitioning Clustering Algorithm and k-means + PDDP_OPTCUTPD clusters a term-document matrix (tdm) using + a combination of the Principal Direction Divisive + Partitioning clustering algorithm [1, 2] and k-means [3]. + CLUSTERS=PDDP_OPTCUT_OPTCUTPD(A, K, L) returns a cluster + structure with K clusters for the tdm A formed using + information from the first L principal components of the + tdm. + [CLUSTERS, TREE_STRUCT]=PDDP_OPTCUTPD(A, K, L) returns + also the full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]= + PDDP_OPTCUTPD(A, K, L) returns the objective function of + PDDP. + PDDP_OPTCUTPD(A, K, L, SVD_METHOD) defines the method used + for the computation of the PCA (svds - default - or + propack). Finally, PDDP_OPTCUTPD(A, K, L, SVD_METHOD, DSP) + defines if results are to be displayed to the command window + (default 1) or not (0). + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, PDDP(l): Towards a Flexible + Principal Direction Divisive Partitioning Clustering + Algorithmm, Proc. IEEE ICDM'03 Workshop on Clustering Large + Data Sets (Melbourne, Florida), 2003. + [3] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral + Divisive Clustering Algorithms, Proc. of Text Mining Workshop, + Minneapolis, 2007. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcutpd.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcutpd.html~ new file mode 100644 index 0000000000000000000000000000000000000000..904be7f91c50f51ec7e7ab7771bb258c410129ba --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/pddp_optcutpd.html~ @@ -0,0 +1,72 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PDDP_OPTCUTPD - Hybrid Principal Direction Divisive + Partitioning Clustering Algorithm and k-means + PDDP_OPTCUTPD clusters a term-document matrix (tdm) using + a combination of the Principal Direction Divisive + Partitioning clustering algorithm [1, 2] and k-means [3]. + CLUSTERS=PDDP_OPTCUT_OPTCUTPD(A, K, L) returns a cluster + structure with K clusters for the tdm A formed using + information from the first L principal components of the + tdm. + [CLUSTERS, TREE_STRUCT]=PDDP_OPTCUTPD(A, K, L) returns + also the full PDDP tree, while [CLUSTERS, TREE_STRUCT, S]= + PDDP_OPTCUTPD(A, K, L) returns the objective function of + PDDP. + PDDP_OPTCUTPD(A, K, L, SVD_METHOD) defines the method used + for the computation of the PCA (svds - default - or + propack). Finally, PDDP_OPTCUTPD(A, K, L, SVD_METHOD, DSP) + defines if results are to be displayed to the command window + (default 1) or not (0). + + REFERENCES: + [1] D.Boley, Principal Direction Divisive Partitioning, Data + Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. + [2] D.Zeimpekis, E.Gallopoulos, PDDP(l): Towards a Flexible + Principal Direction Divisive Partitioning Clustering + Algorithmm, Proc. IEEE ICDM'03 Workshop on Clustering Large + Data Sets (Melbourne, Florida), 2003. + [3] D.Zeimpekis, E.Gallopoulos, k-means Steering of Spectral + Divisive Clustering Algorithms, Proc. of Text Mining Workshop, + Minneapolis, 2007. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ps_pdf2ascii.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ps_pdf2ascii.html new file mode 100644 index 0000000000000000000000000000000000000000..dfe3bc8b8eb28cdf522396afabb76c6fa5737b7d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ps_pdf2ascii.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PS_PDF2ASCII - converts the input ps or pdf file to ASCII + RESULT = PS_PDF2ASCII(FILENAME,DIRECTORY) converts the + input ps or pdf files to ASCII, using ghostscript's + utility 'ps2ascii' and moves the converted file into directory. + RESULT returns a success indicator, e.g. -2 if the input + file does not exist or has a wrong format, -1 if gs is not + installed or the path isn't set, 0 if 'ps2ascii' didn't + work properly, and 1 if the conversion was successful. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ps_pdf2ascii.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ps_pdf2ascii.html~ new file mode 100644 index 0000000000000000000000000000000000000000..826d50abf3de2e0919719c9b896d63ee69259ec7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/ps_pdf2ascii.html~ @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + PS_PDF2ASCII - converts the input ps or pdf file to ASCII + RESULT = PS_PDF2ASCII(FILENAME,DIRECTORY) converts the + input ps or pdf files to ASCII, using ghostscript's + utility 'ps2ascii' and moves the converted file into directory. + RESULT returns a success indicator, e.g. -2 if the input + file does not exist or has a wrong format, -1 if gs is not + installed or the path isn't set, 0 if 'ps2ascii' didn't + work properly, and 1 if the conversion was successful. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/retrieval_gui.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/retrieval_gui.html new file mode 100644 index 0000000000000000000000000000000000000000..7a77dc3e33b7d1741cef3bdd63daa82b802d710e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/retrieval_gui.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + RETRIEVAL_GUI + RETRIEVAL_GUI is a graphical user interface for all the retrieval + functions of the Text to Matrix Generator (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/retrieval_gui.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/retrieval_gui.html~ new file mode 100644 index 0000000000000000000000000000000000000000..0c724d75f4547657fb6bfa658b93e620cca77239 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/retrieval_gui.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + RETRIEVAL_GUI + RETRIEVAL_GUI is a graphical user interface for all the retrieval + functions of the Text to Matrix Generator (TMG) Toolbox. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_multi.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_multi.html new file mode 100644 index 0000000000000000000000000000000000000000..8fc62c8808c9710874e07b681b89c7efed979ab0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_multi.html @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + ROCCHIO_MULTI - Rocchio classifier for multi-label collections + LABELS_AS=KNN_MULTI(A, CLUSTERS, BETA, GAMMA, Q, LABELS, + NORMALIZED_DOCS, THRESHOLDS) classifies the columns of Q + with the Rocchio classifier using the pre-classified columns + of matrix A with labels LABELS (vector of integers). + THRESHOLDS is a vector of class threshold values. BETA and + GAMMA define the weight of positive and negative examples in + the formation of each class centroid. NORMALIZED_DOCS defines + if cosine (1) or euclidean distance (0) similarity measure is + to be used. LABELS_AS contains the assigned labels for the + columns of Q. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_multi.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_multi.html~ new file mode 100644 index 0000000000000000000000000000000000000000..4a7ccc13cc35681fd7115c3b4bc8a8024cb2b158 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_multi.html~ @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + ROCCHIO_MULTI - Rocchio classifier for multi-label collections + LABELS_AS=KNN_MULTI(A, CLUSTERS, BETA, GAMMA, Q, LABELS, + NORMALIZED_DOCS, THRESHOLDS) classifies the columns of Q + with the Rocchio classifier using the pre-classified columns + of matrix A with labels LABELS (vector of integers). + THRESHOLDS is a vector of class threshold values. BETA and + GAMMA define the weight of positive and negative examples in + the formation of each class centroid. NORMALIZED_DOCS defines + if cosine (1) or euclidean distance (0) similarity measure is + to be used. LABELS_AS contains the assigned labels for the + columns of Q. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_single.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_single.html new file mode 100644 index 0000000000000000000000000000000000000000..0dfce28a099e593f71a89ae9e100e1b018d2fa70 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_single.html @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + ROCCHIO_SINGLE - Rocchio classifier for single-label collections + LABELS_AS=KNN_SINGLE(A, CLUSTERS, BETA, GAMMA, Q, LABELS, + NORMALIZED_DOCS) classifies the columns of Q with the + Rocchio classifier using the pre-classified columns of + matrix A with labels LABELS (vector of integers). + BETA and GAMMA define the weight of positive and negative + examples in the formation of each class centroid. + NORMALIZED_DOCS defines if cosine (1) or euclidean distance + (0) similarity measure is to be used. LABELS_AS contains + the assigned labels for the columns of Q. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_single.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_single.html~ new file mode 100644 index 0000000000000000000000000000000000000000..5898a9a505d0e6d207a9b1b3505097ee4b1ed872 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/rocchio_single.html~ @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + ROCCHIO_SINGLE - Rocchio classifier for single-label collections + LABELS_AS=KNN_SINGLE(A, CLUSTERS, BETA, GAMMA, Q, LABELS, + NORMALIZED_DOCS) classifies the columns of Q with the + Rocchio classifier using the pre-classified columns of + matrix A with labels LABELS (vector of integers). + BETA and GAMMA define the weight of positive and negative + examples in the formation of each class centroid. + NORMALIZED_DOCS defines if cosine (1) or euclidean distance + (0) similarity measure is to be used. LABELS_AS contains + the assigned labels for the columns of Q. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_knn.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_knn.html new file mode 100644 index 0000000000000000000000000000000000000000..bcb31486a22c4a1bf871eecf67aa1d1056a833cd --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_knn.html @@ -0,0 +1,65 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SCUT_KNN - implements the Scut thresholding technique from [1] + for the k-Nearest Neighboors classifier + THRESHOLD=SCUT_KNN(A, Q, K, LABELS_TR, LABELS_TE, MINF1, + NORMALIZE, STEPS) returns the vector of thresholds for + the k-Nearest Neighboors classifier for the collection + [A Q]. A and Q define the training and test parts of + the validation set with labels LABELS_TR and LABELS_TE + respectively. MINF1 defines the minimum F1 value and + NORMALIZE defines if cosine (1) or euclidean distance (0) + measure of similarity is to be used. Finally, STEPS + defines the number of steps used during thresholding. + [THRESHOLD, F, THRESHOLDS]=SCUT_KNN(A, Q, K, LABELS_TR, + LABELS_TE, MINF1, NORMALIZE, STEPS) returns also the best + F1 value as well as the matrix of thresholds for each step + (row i corresponds to step i). + + REFERENCES: + [1] Y. Yang. A Study of Thresholding Strategies for Text + Categorization. In Proc. 24th ACM SIGIR, pages 137–145, + New York, NY, USA, 2001. ACM Press. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_knn.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_knn.html~ new file mode 100644 index 0000000000000000000000000000000000000000..013f91905c185adc6798df81d509ff4ab7879998 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_knn.html~ @@ -0,0 +1,64 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SCUT_KNN - implements the Scut thresholding technique from [1] + for the k-Nearest Neighboors classifier + THRESHOLD=SCUT_KNN(A, Q, K, LABELS_TR, LABELS_TE, MINF1, + NORMALIZE, STEPS) returns the vector of thresholds for + the k-Nearest Neighboors classifier for the collection + [A Q]. A and Q define the training and test parts of + the validation set with labels LABELS_TR and LABELS_TE + respectively. MINF1 defines the minimum F1 value and + NORMALIZE defines if cosine (1) or euclidean distance (0) + measure of similarity is to be used. Finally, STEPS + defines the number of steps used during thresholding. + [THRESHOLD, F, THRESHOLDS]=SCUT_KNN(A, Q, K, LABELS_TR, + LABELS_TE, MINF1, NORMALIZE, STEPS) returns also the best + F1 value as well as the matrix of thresholds for each step + (row i corresponds to step i). + + REFERENCES: + [1] Y. Yang. A Study of Thresholding Strategies for Text + Categorization. In Proc. 24th ACM SIGIR, pages 137–145, + New York, NY, USA, 2001. ACM Press. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_llsf.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_llsf.html new file mode 100644 index 0000000000000000000000000000000000000000..19e8e0f02e28b54c504a826f370eb0473b518cae --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_llsf.html @@ -0,0 +1,86 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SCUT_LLSF - implements the Scut thresholding technique from [2] + for the Linear Least Squares Fit classifier [3] + THRESHOLD=SCUT_LLSF(A, Q, CLUSTERS, K, LABELS_TR, LABELS_TE, + MINF1, L, METHOD, STEPS, SVD_METHOD, CLSI_METHOD) returns + the vector of thresholds for the Linear Least Squares Fit + classifier for the collection [A Q]. A and Q define the + training and test parts of the validation set with labels + LABELS_TR and LABELS_TE respectively. CLUSTERS is a + structure defining the classes, while MINF1 defines the + minimum F1 value and STEPS defines the number of steps + used during thresholding. + METHOD is the method used for the approximation of the + rank-l truncated SVD, with possible values: + - 'clsi': Clustered Latent Semantic Indexing [4]. + - 'cm': Centroids Method [1]. + - 'svd': Singular Value Decomosition. + SVD_METHOD defines the method used for the computation of + the SVD, while CLSI_METHOD defines the method used for the + determination of the number of factors from each class used + in Clustered Latent Semantic Indexing in case METHOD equals + 'clsi'. + [THRESHOLD, F, THRESHOLDS]=SCUT_LLSF(A, Q, CLUSTERS, K, + LABELS_TR, LABELS_TE, MINF1, L, METHOD, STEPS, SVD_METHOD, + CLSI_METHOD) returns also the best F1 value as well as the + matrix of thresholds for each step (row i corresponds to + step i). + + REFERENCES: + [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional + Representation of Text Data Based on Centroids and Least + Squares. BIT Numerical Mathematics, 43(2):427–448, 2003. + [2] Y. Yang. A Study of Thresholding Strategies for Text + Categorization. In Proc. 24th ACM SIGIR, pages 137–145, + New York, NY, USA, 2001. ACM Press. + [3] Y. Yang and C. Chute. A Linear Least Squares Fit + Mapping Method for Information Retrieval from Natural + Language Texts. In Proc. 14th Conference on Computational + Linguistics, pages 447–453, Morristown, NJ, USA, 1992. + [4] D. Zeimpekis and E. Gallopoulos, "Non-Linear Dimensional + Reduction via Class Representatives for Text Classification". + In Proc. 2006 IEEE International Conference on Data Mining + (ICDM'06), Hong Kong, Dec. 2006. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_llsf.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_llsf.html~ new file mode 100644 index 0000000000000000000000000000000000000000..a0be63c9b22e679c8a8ee9e4a1ca5c0447b99b6b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_llsf.html~ @@ -0,0 +1,85 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SCUT_LLSF - implements the Scut thresholding technique from [2] + for the Linear Least Squares Fit classifier [3] + THRESHOLD=SCUT_LLSF(A, Q, CLUSTERS, K, LABELS_TR, LABELS_TE, + MINF1, L, METHOD, STEPS, SVD_METHOD, CLSI_METHOD) returns + the vector of thresholds for the Linear Least Squares Fit + classifier for the collection [A Q]. A and Q define the + training and test parts of the validation set with labels + LABELS_TR and LABELS_TE respectively. CLUSTERS is a + structure defining the classes, while MINF1 defines the + minimum F1 value and STEPS defines the number of steps + used during thresholding. + METHOD is the method used for the approximation of the + rank-l truncated SVD, with possible values: + - 'clsi': Clustered Latent Semantic Indexing [4]. + - 'cm': Centroids Method [1]. + - 'svd': Singular Value Decomosition. + SVD_METHOD defines the method used for the computation of + the SVD, while CLSI_METHOD defines the method used for the + determination of the number of factors from each class used + in Clustered Latent Semantic Indexing in case METHOD equals + 'clsi'. + [THRESHOLD, F, THRESHOLDS]=SCUT_LLSF(A, Q, CLUSTERS, K, + LABELS_TR, LABELS_TE, MINF1, L, METHOD, STEPS, SVD_METHOD, + CLSI_METHOD) returns also the best F1 value as well as the + matrix of thresholds for each step (row i corresponds to + step i). + + REFERENCES: + [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional + Representation of Text Data Based on Centroids and Least + Squares. BIT Numerical Mathematics, 43(2):427–448, 2003. + [2] Y. Yang. A Study of Thresholding Strategies for Text + Categorization. In Proc. 24th ACM SIGIR, pages 137–145, + New York, NY, USA, 2001. ACM Press. + [3] Y. Yang and C. Chute. A Linear Least Squares Fit + Mapping Method for Information Retrieval from Natural + Language Texts. In Proc. 14th Conference on Computational + Linguistics, pages 447–453, Morristown, NJ, USA, 1992. + [4] D. Zeimpekis and E. Gallopoulos, "Non-Linear Dimensional + Reduction via Class Representatives for Text Classification". + In Proc. 2006 IEEE International Conference on Data Mining + (ICDM'06), Hong Kong, Dec. 2006. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_rocchio.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_rocchio.html new file mode 100644 index 0000000000000000000000000000000000000000..ea34f69340f807fdc15454511fd4cbdf559f3f3c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_rocchio.html @@ -0,0 +1,68 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SCUT_ROCCHIO - implements the Scut thresholding technique + from [1] for the Rocchio classifier + THRESHOLD=SCUT_ROCCHIO(A, CLUSTERS, BETA, GAMMA, Q, + LABELS_TR, LABELS_TE, MINF1, NORMALIZE, STEPS) returns + the vector of thresholds for the Rocchio classifier + for the collection [A Q]. A and Q define the training + and test parts of the validation set with labels + LABELS_TR and LABELS_TE respectively. MINF1 defines + the minimum F1 value, while NORMALIZE defines if cosine + (1) or euclidean distance (0) measure of similarity is + to be used, CLUSTERS is a structure defining the classes + and STEPS defines the number of steps used during + thresholding. BETA and GAMMA define the weight of positive + and negative examples in the formation of each class + centroid. + [THRESHOLD, F, THRESHOLDS]=SCUT_ROCCHIO(A, CLUSTERS, BETA, + GAMMA, Q, LABELS_TR, LABELS_TE, MINF1, NORMALIZE, STEPS) + returns also the best F1 value as well as the matrix of + thresholds for each step (row i corresponds to step i). + + REFERENCES: + [1] Y. Yang. A Study of Thresholding Strategies for Text + Categorization. In Proc. 24th ACM SIGIR, pages 137–145, + New York, NY, USA, 2001. ACM Press. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_rocchio.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_rocchio.html~ new file mode 100644 index 0000000000000000000000000000000000000000..b0ffd53866207e8b80b078c7955b08a5ad510e77 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/scut_rocchio.html~ @@ -0,0 +1,67 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SCUT_ROCCHIO - implements the Scut thresholding technique + from [1] for the Rocchio classifier + THRESHOLD=SCUT_ROCCHIO(A, CLUSTERS, BETA, GAMMA, Q, + LABELS_TR, LABELS_TE, MINF1, NORMALIZE, STEPS) returns + the vector of thresholds for the Rocchio classifier + for the collection [A Q]. A and Q define the training + and test parts of the validation set with labels + LABELS_TR and LABELS_TE respectively. MINF1 defines + the minimum F1 value, while NORMALIZE defines if cosine + (1) or euclidean distance (0) measure of similarity is + to be used, CLUSTERS is a structure defining the classes + and STEPS defines the number of steps used during + thresholding. BETA and GAMMA define the weight of positive + and negative examples in the formation of each class + centroid. + [THRESHOLD, F, THRESHOLDS]=SCUT_ROCCHIO(A, CLUSTERS, BETA, + GAMMA, Q, LABELS_TR, LABELS_TE, MINF1, NORMALIZE, STEPS) + returns also the best F1 value as well as the matrix of + thresholds for each step (row i corresponds to step i). + + REFERENCES: + [1] Y. Yang. A Study of Thresholding Strategies for Text + Categorization. In Proc. 24th ACM SIGIR, pages 137–145, + New York, NY, USA, 2001. ACM Press. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/sdd_tmg.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/sdd_tmg.html new file mode 100644 index 0000000000000000000000000000000000000000..96af1bb6b6ade230379ae92a49eb9c93b0565761 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/sdd_tmg.html @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SDD_TMG - interface for SDDPACK + [X, D, Y]=SDD_TMG(A, K) computes a rank-K Semidiscrete + Decomposition of A using the SDDPACK [1]. + + REFERENCES: + Tamara G. Kolda and Dianne P. O'Leary, Computation and + Uses of the Semidiscrete Matrix Decomposition, Computer + Science Department Report CS-TR-4012 Institute for Advanced + Computer Studies Report UMIACS-TR-99-22, University of + Maryland, April 1999. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/sdd_tmg.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/sdd_tmg.html~ new file mode 100644 index 0000000000000000000000000000000000000000..746eefdd65e819e739f06849a7da5a88a66c6701 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/sdd_tmg.html~ @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SDD_TMG - interface for SDDPACK + [X, D, Y]=SDD_TMG(A, K) computes a rank-K Semidiscrete + Decomposition of A using the SDDPACK [1]. + + REFERENCES: + Tamara G. Kolda and Dianne P. O'Leary, Computation and + Uses of the Semidiscrete Matrix Decomposition, Computer + Science Department Report CS-TR-4012 Institute for Advanced + Computer Studies Report UMIACS-TR-99-22, University of + Maryland, April 1999. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/skmeans.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/skmeans.html new file mode 100644 index 0000000000000000000000000000000000000000..31b648e033e24626b7bf8bcf24dad4c63e3f3d9d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/skmeans.html @@ -0,0 +1,71 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SKMEANS - Spherical k-Means Clustering Algorithm + SKMEANS clusters a term-document matrix using the Spherical + k-means clustering algorithm [1]. CLUSTERS=SKMEANS(A, C, K, + TERMINATION) returns a cluster structure with K clusters + for the term-document matrix A using as initial centroids + the columns of C (initialized randomly when it is empty). + TERMINATION defines the termination method used in spherical + k-means ('epsilon' stops iteration when objective function + increase falls down a user defined threshold - see OPTIONS + input argument - while 'n_iter' stops iteration when a user + defined number of iterations has been reached). + [CLUSTERS, Q]=SKMEANS(A, C, K, TERMINATION) returns also + the vector of objective function values for each iteration + and [CLUSTERS, Q, C]=SKMEANS(A, C, K, TERMINATION) returns + the final centroid vectors. + SKMEANS(A, C, K, TERMINATION, OPTIONS) defines optional + parameters: + - OPTIONS.iter: Number of iterations (default 10). + - OPTIONS.epsilon: Value for epsilon convergence + criterion (default 1). + - OPTIONS.dsp: Displays results (default 1) or not (0) + to the command window. + + REFERENCES: + [1] I. S. Dhillon and D. M. Modha, "Concept Decompositions + for Large Sparse Text Data using Clustering", Machine + Learning, 42:1, pages 143-175, Jan, 2001. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/skmeans.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/skmeans.html~ new file mode 100644 index 0000000000000000000000000000000000000000..b4812a9af8110cee90ddb67e1e0dbd2d958e41b9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/skmeans.html~ @@ -0,0 +1,70 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SKMEANS - Spherical k-Means Clustering Algorithm + SKMEANS clusters a term-document matrix using the Spherical + k-means clustering algorithm [1]. CLUSTERS=SKMEANS(A, C, K, + TERMINATION) returns a cluster structure with K clusters + for the term-document matrix A using as initial centroids + the columns of C (initialized randomly when it is empty). + TERMINATION defines the termination method used in spherical + k-means ('epsilon' stops iteration when objective function + increase falls down a user defined threshold - see OPTIONS + input argument - while 'n_iter' stops iteration when a user + defined number of iterations has been reached). + [CLUSTERS, Q]=SKMEANS(A, C, K, TERMINATION) returns also + the vector of objective function values for each iteration + and [CLUSTERS, Q, C]=SKMEANS(A, C, K, TERMINATION) returns + the final centroid vectors. + SKMEANS(A, C, K, TERMINATION, OPTIONS) defines optional + parameters: + - OPTIONS.iter: Number of iterations (default 10). + - OPTIONS.epsilon: Value for epsilon convergence + criterion (default 1). + - OPTIONS.dsp: Displays results (default 1) or not (0) + to the command window. + + REFERENCES: + [1] I. S. Dhillon and D. M. Modha, "Concept Decompositions + for Large Sparse Text Data using Clustering", Machine + Learning, 42:1, pages 143-175, Jan, 2001. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/stemmer.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/stemmer.html new file mode 100644 index 0000000000000000000000000000000000000000..18af376ac9fd7315ca6a25c3926921b1dd46608b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/stemmer.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + STEMMER - applies the Porter's Stemming algorithm [1] + S = STEMMER(TOKEN, DSP) returns in S the stemmed word of + TOKEN. DSP indicates if the function displays the result + of each stem (1). + + REFERENCES: + [1] M.F.Porter, An algorithm for suffix stripping, Program, + 14(3): 130-137, 1980. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/stemmer.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/stemmer.html~ new file mode 100644 index 0000000000000000000000000000000000000000..413465597a8d5dd2e709304f13e89e6d6d035283 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/stemmer.html~ @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + STEMMER - applies the Porter's Stemming algorithm [1] + S = STEMMER(TOKEN, DSP) returns in S the stemmed word of + TOKEN. DSP indicates if the function displays the result + of each stem (1). + + REFERENCES: + [1] M.F.Porter, An algorithm for suffix stripping, Program, + 14(3): 130-137, 1980. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/strip_html.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/strip_html.html new file mode 100644 index 0000000000000000000000000000000000000000..bad8e751558ffeaa17afbee3b4eb4c41f58196f4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/strip_html.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + STRIP_HTML - removes html entities from an htm file + S = STRIP_HTML(FILENAME) parses the file FILENAME and removes + the html entities, while the result is stored in S as a + cell array and written in file "FILENAME.TXT". + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/strip_html.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/strip_html.html~ new file mode 100644 index 0000000000000000000000000000000000000000..da4c1716d4267e70ccefc32cecc483b10b1d24e6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/strip_html.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + STRIP_HTML - removes html entities from an htm file + S = STRIP_HTML(FILENAME) parses the file FILENAME and removes + the html entities, while the result is stored in S as a + cell array and written in file "FILENAME.TXT". + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_tmg.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_tmg.html new file mode 100644 index 0000000000000000000000000000000000000000..f5d6a7ce76b04eacbbc6697d10f475aec1e72331 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_tmg.html @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SVD_TMG - Singular Value Decomposition + [U, S, V]=SVD_TMG(A, K, METHOD) computes the K-factor + truncated Singular Value Decomposition of A using either + the svds function of MATLAB or the PROPACK package [1]. + + REFERENCES: + [1] R.M.Larsen, PROPACK: A Software Package for the + Symmetric Eigenvalue Problem and Singular Value Problems + on Lanczos and Lanczos Bidiagonalization + with Partial Reorthogonalization, Stanford University, + http://sun.stanford.edu/~rmunk/PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_tmg.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_tmg.html~ new file mode 100644 index 0000000000000000000000000000000000000000..7a7c74e8d576960a6cee607dd31cd47e51084c4c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_tmg.html~ @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SVD_TMG - Singular Value Decomposition + [U, S, V]=SVD_TMG(A, K, METHOD) computes the K-factor + truncated Singular Value Decomposition of A using either + the svds function of MATLAB or the PROPACK package [1]. + + REFERENCES: + [1] R.M.Larsen, PROPACK: A Software Package for the + Symmetric Eigenvalue Problem and Singular Value Problems + on Lanczos and Lanczos Bidiagonalization + with Partial Reorthogonalization, Stanford University, + http://sun.stanford.edu/~rmunk/PROPACK. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update.html new file mode 100644 index 0000000000000000000000000000000000000000..113f3169282d12fa0c012797858a7a8cb8ab375e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update.html @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SVD_UPDATE - Singular Value Decomposition of a + rank-l update matrix with MATLAB (eigs) + [U, S, V]=SVD_UPDATE(A, X, Y, K) computes the + K-factor SVD of A-X*Y, using the eigs function of MATLAB. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update.html~ new file mode 100644 index 0000000000000000000000000000000000000000..65ea8ac375c83adb46d3d82b9707b264190bfa40 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update.html~ @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SVD_UPDATE - Singular Value Decomposition of a + rank-l update matrix with MATLAB (eigs) + [U, S, V]=SVD_UPDATE(A, X, Y, K) computes the + K-factor SVD of A-X*Y, using the eigs function of MATLAB. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update_afun.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update_afun.html new file mode 100644 index 0000000000000000000000000000000000000000..bb3523a46b447b9db8fb38f53c81510ca5450c6c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update_afun.html @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SVD_UPDATE_AFUN - Auxiliary function used in SVD_UPDATE. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update_afun.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update_afun.html~ new file mode 100644 index 0000000000000000000000000000000000000000..98597937704ad1a839084055c7e59594e56811f6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/svd_update_afun.html~ @@ -0,0 +1,44 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + SVD_UPDATE_AFUN - Auxiliary function used in SVD_UPDATE. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_downdate.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_downdate.html new file mode 100644 index 0000000000000000000000000000000000000000..9420415bd6f0985220bc7a9cc1fe7b053cf0f45b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_downdate.html @@ -0,0 +1,77 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TDM_DOWNDATE - renews a text collection by downdating the + correspoding term-document matrix + A = TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns the new + term - document matrix of the downdated collection. + UPDATE_STRUCT defines the update structure returned by TMG, + while REMOVED_DOCS defines the indices of the documents that + is to be be removed. + [A, DICTIONARY] = TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) + returns also the dictionary for the updated collection, while + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZED_FACTORS] + = TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns the + vectors of global weights for the dictionary and the + normalization factor for each document in case such a factor + is used. If normalization is not used TDM_DOWNDATE returns a + vector of all ones. [A, DICTIONARY, GLOBAL_WEIGHTS, + NORMALIZATION_FACTORS, WORDS_PER_DOC] = + TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns statistics + for each document, i.e. the number of terms for each document. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES] = TDM_DOWNDATE(UPDATE_STRUCT, + REMOVED_DOCS) returns in FILES the filenames containing the + collection's documents and a cell array (TITLES) that contains + a declaratory title for each document, as well as the document's + first line. + Finally [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES, UPDATE_STRUCT] = + TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns the update + structure that keeps the essential information for the + collection' s update (or downdate). + TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS, OPTIONS) defines + optional parameters: + - OPTIONS.dsp: Displays results (default 1) or not (0) + to the command window. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_downdate.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_downdate.html~ new file mode 100644 index 0000000000000000000000000000000000000000..2c356bb3958c086bf005845ccd7b8866c4f35cd7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_downdate.html~ @@ -0,0 +1,76 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TDM_DOWNDATE - renews a text collection by downdating the + correspoding term-document matrix + A = TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns the new + term - document matrix of the downdated collection. + UPDATE_STRUCT defines the update structure returned by TMG, + while REMOVED_DOCS defines the indices of the documents that + is to be be removed. + [A, DICTIONARY] = TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) + returns also the dictionary for the updated collection, while + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZED_FACTORS] + = TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns the + vectors of global weights for the dictionary and the + normalization factor for each document in case such a factor + is used. If normalization is not used TDM_DOWNDATE returns a + vector of all ones. [A, DICTIONARY, GLOBAL_WEIGHTS, + NORMALIZATION_FACTORS, WORDS_PER_DOC] = + TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns statistics + for each document, i.e. the number of terms for each document. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES] = TDM_DOWNDATE(UPDATE_STRUCT, + REMOVED_DOCS) returns in FILES the filenames containing the + collection's documents and a cell array (TITLES) that contains + a declaratory title for each document, as well as the document's + first line. + Finally [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES, UPDATE_STRUCT] = + TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns the update + structure that keeps the essential information for the + collection' s update (or downdate). + TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS, OPTIONS) defines + optional parameters: + - OPTIONS.dsp: Displays results (default 1) or not (0) + to the command window. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_update.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_update.html new file mode 100644 index 0000000000000000000000000000000000000000..38f4f8eecdd4a05a2d56bc05dfd2b248cbf1e3c4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_update.html @@ -0,0 +1,99 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TDM_UPDATE renews a text collection by updating the + correspoding term-document matrix. + A = TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns the new + term - document matrix of the updated collection. FILENAME + defines the file (or files in case a directory is supplied) + containing the new documents, while UPDATE_STRUCT defines + the update structure returned by TMG. In case FILENAME + variable is empty, the collection is simply updated using + the options defined by UPDATE_STRUCT (for example, use + another term-weighting scheme). + [A, DICTIONARY] = TDM_UPDATE(FILENAME, UPDATE_STRUCT) + returns also the dictionary for the updated collection, + while [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZED_FACTORS] + = TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns the vectors + of global weights for the dictionary and the normalization + factor for each document in case such a factor is used. + If normalization is not used TDM_UPDATE returns a vector + of all ones. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC] = TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns + statistics for each document, i.e. the number of terms for + each document. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES] = TDM_UPDATE(FILENAME, + UPDATE_STRUCT) returns in FILES the filenames contained in + directory (or file) FILENAME and a cell array (TITLES) that + containes a declaratory title for each document, as well as + the document's first line. + Finally [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES, UPDATE_STRUCT] = + TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns the update + structure that keeps the essential information for the + collection' s update (or downdate). + TDM_UPDATE(FILENAME, UPDATE_STRUCT, OPTIONS) defines optional + parameters: + - OPTIONS.delimiter: The delimiter between documents within + the same file. Possible values are 'emptyline' (default), + 'none_delimiter' (treats each file as a single document) + or any other string. + - OPTIONS.line_delimiter: Defines if the delimiter takes a + whole line of text (default, 1) or not. + - OPTIONS.update_step: The step used for the incremental + built of the inverted index (default 10,000). + - OPTIONS.dsp: Displays results (default 1) or not (0) to + the command window. + - OPTIONS.remove_num: Indicates if we remove the numbers from the + dictionary (value 1) or not (value 0- default). + - OPTIONS.remove_al: Indicates if we remove the alphanumerics from + the dictionary (value 1) or not (value 0- default). + - OPTIONS.parse_subd: Indicates if we parse all the subdirectories + without be questioned (value 1), or we are asked which + subdirectories to parse (value 0-default). This option is + recommended for large collections with many subdirectories + so that they can be run in batch mode. Setting this options we + are avoiding questions during the parsing. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_update.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_update.html~ new file mode 100644 index 0000000000000000000000000000000000000000..fd0a559549062cb4efc7f95ace8948ffd89d84db --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tdm_update.html~ @@ -0,0 +1,98 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TDM_UPDATE renews a text collection by updating the + correspoding term-document matrix. + A = TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns the new + term - document matrix of the updated collection. FILENAME + defines the file (or files in case a directory is supplied) + containing the new documents, while UPDATE_STRUCT defines + the update structure returned by TMG. In case FILENAME + variable is empty, the collection is simply updated using + the options defined by UPDATE_STRUCT (for example, use + another term-weighting scheme). + [A, DICTIONARY] = TDM_UPDATE(FILENAME, UPDATE_STRUCT) + returns also the dictionary for the updated collection, + while [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZED_FACTORS] + = TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns the vectors + of global weights for the dictionary and the normalization + factor for each document in case such a factor is used. + If normalization is not used TDM_UPDATE returns a vector + of all ones. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC] = TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns + statistics for each document, i.e. the number of terms for + each document. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES] = TDM_UPDATE(FILENAME, + UPDATE_STRUCT) returns in FILES the filenames contained in + directory (or file) FILENAME and a cell array (TITLES) that + containes a declaratory title for each document, as well as + the document's first line. + Finally [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES, UPDATE_STRUCT] = + TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns the update + structure that keeps the essential information for the + collection' s update (or downdate). + TDM_UPDATE(FILENAME, UPDATE_STRUCT, OPTIONS) defines optional + parameters: + - OPTIONS.delimiter: The delimiter between documents within + the same file. Possible values are 'emptyline' (default), + 'none_delimiter' (treats each file as a single document) + or any other string. + - OPTIONS.line_delimiter: Defines if the delimiter takes a + whole line of text (default, 1) or not. + - OPTIONS.update_step: The step used for the incremental + built of the inverted index (default 10,000). + - OPTIONS.dsp: Displays results (default 1) or not (0) to + the command window. + - OPTIONS.remove_num: Indicates if we remove the numbers from the + dictionary (value 1) or not (value 0- default). + - OPTIONS.remove_al: Indicates if we remove the alphanumerics from + the dictionary (value 1) or not (value 0- default). + - OPTIONS.parse_subd: Indicates if we parse all the subdirectories + without be questioned (value 1), or we are asked which + subdirectories to parse (value 0-default). This option is + recommended for large collections with many subdirectories + so that they can be run in batch mode. Setting this options we + are avoiding questions during the parsing. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg.html new file mode 100644 index 0000000000000000000000000000000000000000..ff5624b6ab3cbbea1fb971bc0a6fae0fcd518eae --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg.html @@ -0,0 +1,142 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TMG - Text to Matrix Generator + TMG parses a text collection and generates the term - + document matrix. + A = TMG(FILENAME) returns the term - document matrix, + that corresponds to the text collection contained in + files of directory (or file) FILENAME. + Each document must be separeted by a blank line (or + another delimiter that is defined by OPTIONS argument) + in each file. + [A, DICTIONARY] = TMG(FILENAME) returns also the + dictionary for the collection, while [A, DICTIONARY, + GLOBAL_WEIGHTS, NORMALIZED_FACTORS] = TMG(FILENAME) + returns the vectors of global weights for the dictionary + and the normalization factor for each document in case + such a factor is used. If normalization is not used TMG + returns a vector of all ones. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC] = TMG(FILENAME) returns statistics for + each document, i.e. the number of terms for each document. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES] = TMG(FILENAME) returns in + FILES the filenames contained in directory (or file) + FILENAME and a cell array (TITLES) that containes a + declaratory title for each document, as well as the + document's first line. Finally [A, DICTIONARY, + GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, WORDS_PER_DOC, + TITLES, FILES, UPDATE_STRUCT] = TMG(FILENAME) returns a + structure that keeps the essential information for the + collection' s update (or downdate). + + TMG(FILENAME, OPTIONS) defines optional parameters: + - OPTIONS.use_mysql: Indicates if results are to be + stored in MySQL. + - OPTIONS.db_name: The name of the directory where + the results are to be saved. + - OPTIONS.delimiter: The delimiter between documents + within the same file. Possible values are 'emptyline' + (default), 'none_delimiter' (treats each file as a + single document) or any other string. + - OPTIONS.line_delimiter: Defines if the delimiter + takes a whole line of text (default, 1) or not. + - OPTIONS.stoplist: The filename for the stoplist, + i.e. a list of common words that we don't use for + the indexing (default no stoplist used). + - OPTIONS.stemming: Indicates if the stemming algorithm + is used (1) or not (0 - default). + - OPTIONS.update_step: The step used for the incremental + built of the inverted index (default 10,000). + - OPTIONS.min_length: The minimum length for a term + (default 3). + - OPTIONS.max_length: The maximum length for a term + (default 30). + - OPTIONS.min_local_freq: The minimum local frequency for + a term (default 1). + - OPTIONS.max_local_freq: The maximum local frequency for + a term (default inf). + - OPTIONS.min_global_freq: The minimum global frequency + for a term (default 1). + - OPTIONS.max_global_freq: The maximum global frequency + for a term (default inf). + - OPTIONS.local_weight: The local term weighting function + (default 't'). Possible values (see [1, 2]): + 't': Term Frequency + 'b': Binary + 'l': Logarithmic + 'a': Alternate Log + 'n': Augmented Normalized Term Frequency + - OPTIONS.global_weight: The global term weighting function + (default 'x'). Possible values (see [1, 2]): + 'x': None + 'e': Entropy + 'f': Inverse Document Frequency (IDF) + 'g': GfIdf + 'n': Normal + 'p': Probabilistic Inverse + - OPTIONS.normalization: Indicates if we normalize the + document vectors (default 'x'). Possible values: + 'x': None + 'c': Cosine + - OPTIONS.dsp: Displays results (default 1) or not (0) to + the command window. + - OPTIONS.remove_num: Indicates if we remove the numbers from the + dictionary (value 1) or not (value 0- default). + - OPTIONS.remove_al: Indicates if we remove the alphanumerics from + the dictionary (value 1) or not (value 0- default). + - OPTIONS.parse_subd: Indicates if we parse all the subdirectories + without be questioned (value 1), or we are asked which + subdirectories to parse (value 0-default). This option is + recommended for large collections with many subdirectories + so that they can be run in batch mode. Setting this options we + are avoiding questions during the parsing. + + REFERENCES: + [1] M.Berry and M.Browne, Understanding Search Engines, Mathematical + Modeling and Text Retrieval, Philadelphia, PA: Society for Industrial + and Applied Mathematics, 1999. + [2] T.Kolda, Limited-Memory Matrix Methods with Applications, + Tech.Report CS-TR-3806, 1997. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg.html~ new file mode 100644 index 0000000000000000000000000000000000000000..7342909f3f9e42b5ff9664a4c65da7a6100abed6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg.html~ @@ -0,0 +1,141 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TMG - Text to Matrix Generator + TMG parses a text collection and generates the term - + document matrix. + A = TMG(FILENAME) returns the term - document matrix, + that corresponds to the text collection contained in + files of directory (or file) FILENAME. + Each document must be separeted by a blank line (or + another delimiter that is defined by OPTIONS argument) + in each file. + [A, DICTIONARY] = TMG(FILENAME) returns also the + dictionary for the collection, while [A, DICTIONARY, + GLOBAL_WEIGHTS, NORMALIZED_FACTORS] = TMG(FILENAME) + returns the vectors of global weights for the dictionary + and the normalization factor for each document in case + such a factor is used. If normalization is not used TMG + returns a vector of all ones. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC] = TMG(FILENAME) returns statistics for + each document, i.e. the number of terms for each document. + [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + WORDS_PER_DOC, TITLES, FILES] = TMG(FILENAME) returns in + FILES the filenames contained in directory (or file) + FILENAME and a cell array (TITLES) that containes a + declaratory title for each document, as well as the + document's first line. Finally [A, DICTIONARY, + GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, WORDS_PER_DOC, + TITLES, FILES, UPDATE_STRUCT] = TMG(FILENAME) returns a + structure that keeps the essential information for the + collection' s update (or downdate). + + TMG(FILENAME, OPTIONS) defines optional parameters: + - OPTIONS.use_mysql: Indicates if results are to be + stored in MySQL. + - OPTIONS.db_name: The name of the directory where + the results are to be saved. + - OPTIONS.delimiter: The delimiter between documents + within the same file. Possible values are 'emptyline' + (default), 'none_delimiter' (treats each file as a + single document) or any other string. + - OPTIONS.line_delimiter: Defines if the delimiter + takes a whole line of text (default, 1) or not. + - OPTIONS.stoplist: The filename for the stoplist, + i.e. a list of common words that we don't use for + the indexing (default no stoplist used). + - OPTIONS.stemming: Indicates if the stemming algorithm + is used (1) or not (0 - default). + - OPTIONS.update_step: The step used for the incremental + built of the inverted index (default 10,000). + - OPTIONS.min_length: The minimum length for a term + (default 3). + - OPTIONS.max_length: The maximum length for a term + (default 30). + - OPTIONS.min_local_freq: The minimum local frequency for + a term (default 1). + - OPTIONS.max_local_freq: The maximum local frequency for + a term (default inf). + - OPTIONS.min_global_freq: The minimum global frequency + for a term (default 1). + - OPTIONS.max_global_freq: The maximum global frequency + for a term (default inf). + - OPTIONS.local_weight: The local term weighting function + (default 't'). Possible values (see [1, 2]): + 't': Term Frequency + 'b': Binary + 'l': Logarithmic + 'a': Alternate Log + 'n': Augmented Normalized Term Frequency + - OPTIONS.global_weight: The global term weighting function + (default 'x'). Possible values (see [1, 2]): + 'x': None + 'e': Entropy + 'f': Inverse Document Frequency (IDF) + 'g': GfIdf + 'n': Normal + 'p': Probabilistic Inverse + - OPTIONS.normalization: Indicates if we normalize the + document vectors (default 'x'). Possible values: + 'x': None + 'c': Cosine + - OPTIONS.dsp: Displays results (default 1) or not (0) to + the command window. + - OPTIONS.remove_num: Indicates if we remove the numbers from the + dictionary (value 1) or not (value 0- default). + - OPTIONS.remove_al: Indicates if we remove the alphanumerics from + the dictionary (value 1) or not (value 0- default). + - OPTIONS.parse_subd: Indicates if we parse all the subdirectories + without be questioned (value 1), or we are asked which + subdirectories to parse (value 0-default). This option is + recommended for large collections with many subdirectories + so that they can be run in batch mode. Setting this options we + are avoiding questions during the parsing. + + REFERENCES: + [1] M.Berry and M.Browne, Understanding Search Engines, Mathematical + Modeling and Text Retrieval, Philadelphia, PA: Society for Industrial + and Applied Mathematics, 1999. + [2] T.Kolda, Limited-Memory Matrix Methods with Applications, + Tech.Report CS-TR-3806, 1997. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_gui.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_gui.html new file mode 100644 index 0000000000000000000000000000000000000000..d5434394371f696d182c1ebbcc14bfc7f884a68e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_gui.html @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TMG_GUI + TMG_GUI is a graphical user interface for all the indexing + routines of the Text to Matrix Generator (TMG) Toolbox. + For a full documentation type 'help tmg', 'help tmg_query', + 'help tdm_update' or 'help tdm_downdate'. + For a full documentation of the GUI's usage, select the + help tab to the GUI. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_gui.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_gui.html~ new file mode 100644 index 0000000000000000000000000000000000000000..b3a6718a1789ec6f81d2476c3ae042103ce8f022 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_gui.html~ @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TMG_GUI + TMG_GUI is a graphical user interface for all the indexing + routines of the Text to Matrix Generator (TMG) Toolbox. + For a full documentation type 'help tmg', 'help tmg_query', + 'help tdm_update' or 'help tdm_downdate'. + For a full documentation of the GUI's usage, select the + help tab to the GUI. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_query.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_query.html new file mode 100644 index 0000000000000000000000000000000000000000..ae349ef42ad3baea5adb90da74232105c0627ca5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_query.html @@ -0,0 +1,104 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TMG_QUERY - Text to Matrix Generator, query vector constructor + TMG_QUERY parses a query text collection and generates the + query vectors corresponding to the supplied dictionary. + Q = TMG_QUERY(FILENAME, DICTIONARY) returns the query + vectors, that corresponds to the text collection contained + in files of directory FILENAME. DICTIONARY is the array of + terms corresponding to a text collection. + Each query must be separeted by a blank line (or another + delimiter that is defined by OPTIONS argument) in each file. + [Q, WORDS_PER_QUERY] = TMG_QUERY(FILENAME, DICTIONARY) + returns statistics for each query, i.e. the number of terms + for each query. + Finally, [Q, WORDS_PER_QUERY, TITLES, FILES] = + TMG_QUERY(FILENAME) returns in FILES the filenames contained + in directory (or file) FILENAME and a cell array (TITLES) + that containes a declaratory title for each query, as well + as the query's first line. + + TMG_QUERY(FILENAME, DICTIONARY, OPTIONS) defines optional + parameters: + - OPTIONS.delimiter: The delimiter between queries within + the same file. Possible values are 'emptyline' (default), + 'none_delimiter' (treats each file as a single query) + or any other string. + - OPTIONS.line_delimiter: Defines if the delimiter takes a + whole line of text (default, 1) or not. + - OPTIONS.stoplist: The filename for the stoplist, i.e. a + list of common words that we don't use for the indexing + (default no stoplist used). + - OPTIONS.stemming: Indicates if the stemming algorithm is + used (1) or not (0 - default). + - OPTIONS.update_step: The step used for the incremental + built of the inverted index (default 10,000). + - OPTIONS.local_weight: The local term weighting function + (default 't'). Possible values (see [1, 2]): + 't': Term Frequency + 'b': Binary + 'l': Logarithmic + 'a': Alternate Log + 'n': Augmented Normalized Term Frequenct + - OPTIONS.global_weights: The vector of term global + weights (returned by tmg). + - OPTIONS.dsp: Displays results (default 1) or not (0). + - OPTIONS.remove_num: Indicates if we remove the numbers from the + dictionary (value 1) or not (value 0- default). + - OPTIONS.remove_al: Indicates if we remove the alphanumerics from + the dictionary (value 1) or not (value 0- default). + - OPTIONS.parse_subd: Indicates if we parse all the subdirectories + without be questioned (value 1), or we are asked which + subdirectories to parse (value 0-default). This option is + recommended for large collections with many subdirectories + so that they can be run in batch mode. Setting this options we + are avoiding questions during the parsing. + + REFERENCES: + [1] M.Berry and M.Browne, Understanding Search Engines, + Mathematical Modeling and Text Retrieval, Philadelphia, + PA: Society for Industrial and Applied Mathematics, 1999. + [2] T.Kolda, Limited-Memory Matrix Methods with Applications, + Tech.Report CS-TR-3806, 1997. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_query.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_query.html~ new file mode 100644 index 0000000000000000000000000000000000000000..f99cb93674a8230a78f858c674fa6ee732d5d5c4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_query.html~ @@ -0,0 +1,103 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TMG_QUERY - Text to Matrix Generator, query vector constructor + TMG_QUERY parses a query text collection and generates the + query vectors corresponding to the supplied dictionary. + Q = TMG_QUERY(FILENAME, DICTIONARY) returns the query + vectors, that corresponds to the text collection contained + in files of directory FILENAME. DICTIONARY is the array of + terms corresponding to a text collection. + Each query must be separeted by a blank line (or another + delimiter that is defined by OPTIONS argument) in each file. + [Q, WORDS_PER_QUERY] = TMG_QUERY(FILENAME, DICTIONARY) + returns statistics for each query, i.e. the number of terms + for each query. + Finally, [Q, WORDS_PER_QUERY, TITLES, FILES] = + TMG_QUERY(FILENAME) returns in FILES the filenames contained + in directory (or file) FILENAME and a cell array (TITLES) + that containes a declaratory title for each query, as well + as the query's first line. + + TMG_QUERY(FILENAME, DICTIONARY, OPTIONS) defines optional + parameters: + - OPTIONS.delimiter: The delimiter between queries within + the same file. Possible values are 'emptyline' (default), + 'none_delimiter' (treats each file as a single query) + or any other string. + - OPTIONS.line_delimiter: Defines if the delimiter takes a + whole line of text (default, 1) or not. + - OPTIONS.stoplist: The filename for the stoplist, i.e. a + list of common words that we don't use for the indexing + (default no stoplist used). + - OPTIONS.stemming: Indicates if the stemming algorithm is + used (1) or not (0 - default). + - OPTIONS.update_step: The step used for the incremental + built of the inverted index (default 10,000). + - OPTIONS.local_weight: The local term weighting function + (default 't'). Possible values (see [1, 2]): + 't': Term Frequency + 'b': Binary + 'l': Logarithmic + 'a': Alternate Log + 'n': Augmented Normalized Term Frequenct + - OPTIONS.global_weights: The vector of term global + weights (returned by tmg). + - OPTIONS.dsp: Displays results (default 1) or not (0). + - OPTIONS.remove_num: Indicates if we remove the numbers from the + dictionary (value 1) or not (value 0- default). + - OPTIONS.remove_al: Indicates if we remove the alphanumerics from + the dictionary (value 1) or not (value 0- default). + - OPTIONS.parse_subd: Indicates if we parse all the subdirectories + without be questioned (value 1), or we are asked which + subdirectories to parse (value 0-default). This option is + recommended for large collections with many subdirectories + so that they can be run in batch mode. Setting this options we + are avoiding questions during the parsing. + + REFERENCES: + [1] M.Berry and M.Browne, Understanding Search Engines, + Mathematical Modeling and Text Retrieval, Philadelphia, + PA: Society for Industrial and Applied Mathematics, 1999. + [2] T.Kolda, Limited-Memory Matrix Methods with Applications, + Tech.Report CS-TR-3806, 1997. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_save_results.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_save_results.html new file mode 100644 index 0000000000000000000000000000000000000000..5cef7fb371ebef15345f1b2f6199ad9c49dd2356 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_save_results.html @@ -0,0 +1,48 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TMG_SAVE_RESULTS + TMG_SAVE_RESULTS is a graphical user interface used from + TMG_GUI, for saving the results to a (or multiple) .mat + file(s). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_save_results.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_save_results.html~ new file mode 100644 index 0000000000000000000000000000000000000000..b39bfef548dd55c0bc4778ab23f631a65515c109 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_save_results.html~ @@ -0,0 +1,47 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TMG_SAVE_RESULTS + TMG_SAVE_RESULTS is a graphical user interface used from + TMG_GUI, for saving the results to a (or multiple) .mat + file(s). + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_template.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_template.html new file mode 100644 index 0000000000000000000000000000000000000000..463bed453e890b824d07e7cb88fe79afd3bb4290 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_template.html @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TDM_TEMPLATE - demo script + This is a template script demonstrating the use of TMG, + as well as the application of the resulting TDM'S in + two IR tasks, quering and clustering. The quering models + used is the Vector Space Model (see vsm.m) and LSI + (see lsi.m), while two versions of the k-means algorithm + (euclidean and spherical, see ekmeans.m and skmeans.m) + cluster the resulting matrix (see also pddp.m). The user can + edit this code in order to change the default OPTIONS of + TMG, as well as to apply other IR tasks or use his own + implementations regarding these tasks. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_template.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_template.html~ new file mode 100644 index 0000000000000000000000000000000000000000..c48d74929e77e970d07e40f1b41bdb1f3e3d4a53 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/tmg_template.html~ @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TDM_TEMPLATE - demo script + This is a template script demonstrating the use of TMG, + as well as the application of the resulting TDM'S in + two IR tasks, quering and clustering. The quering models + used is the Vector Space Model (see vsm.m) and LSI + (see lsi.m), while two versions of the k-means algorithm + (euclidean and spherical, see ekmeans.m and skmeans.m) + cluster the resulting matrix (see also pddp.m). The user can + edit this code in order to change the default OPTIONS of + TMG, as well as to apply other IR tasks or use his own + implementations regarding these tasks. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/two_means_1d.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/two_means_1d.html new file mode 100644 index 0000000000000000000000000000000000000000..32f57c395209f5602a51ee364c2ccf72a4db2d10 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/two_means_1d.html @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TWO_MEANS_1D - returns the clustering that optimizes the + objective function of the k-means algorithm for the input + vector. + [CUTOFF, CLUSTERS, DISTANCE, OF, MEAN1, MEAN2]= + TWO_MEANS_1D(A) returns the cutoff value of the clustering, + the cluster structure, the separation distance, the value + of the objective function and the two mean values. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/two_means_1d.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/two_means_1d.html~ new file mode 100644 index 0000000000000000000000000000000000000000..e1072b2faeed8c80b8ce87eb9f5158e3f5b39b87 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/two_means_1d.html~ @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + TWO_MEANS_1D - returns the clustering that optimizes the + objective function of the k-means algorithm for the input + vector. + [CUTOFF, CLUSTERS, DISTANCE, OF, MEAN1, MEAN2]= + TWO_MEANS_1D(A) returns the cutoff value of the clustering, + the cluster structure, the separation distance, the value + of the objective function and the two mean values. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_elements.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_elements.html new file mode 100644 index 0000000000000000000000000000000000000000..b5d5bd9fe8917c20fbee9d14de13c51d4fc4190e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_elements.html @@ -0,0 +1,51 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + UNIQUE_ELEMENTS - detects all distinct elements of a vector + [ELEMENTS, N] = UNIQUE_ELEMENTS(X) returns in ELEMENTS all + distinct elements of vector X, and in N the number of times + each element appears in X. A value is repeated if it appears + in non-consecutive elements. For no repetitive elements sort + the input vector. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_elements.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_elements.html~ new file mode 100644 index 0000000000000000000000000000000000000000..a84728ee20fb759cc740adfa62cf181aaa359e42 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_elements.html~ @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + UNIQUE_ELEMENTS - detects all distinct elements of a vector + [ELEMENTS, N] = UNIQUE_ELEMENTS(X) returns in ELEMENTS all + distinct elements of vector X, and in N the number of times + each element appears in X. A value is repeated if it appears + in non-consecutive elements. For no repetitive elements sort + the input vector. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_words.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_words.html new file mode 100644 index 0000000000000000000000000000000000000000..8e34dffc5bb379a21f338456dffd185554596a8f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_words.html @@ -0,0 +1,53 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + UNIQUE_WORDS - detects all distinct elements of a cell array of + chars (used by tmg.m, tmg_query.m, tdm_update.m) + [NEW_WORDS, NEW_DOC_IDS]=UNIQUE_WORDS(WORDS, DOC_IDS, N_DOCS) + returns in NEW_WORDS all distinct elements of the cell array + of chars WORDS. DOC_IDS is the vector of the document identifiers + containing the corresponding words, while N_DOCS is the total + number of documents contained to the collection. NEW_DOC_IDS + contains the inverted index of the collection as a cell array + of 2 x N_DOCS arrays. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_words.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_words.html~ new file mode 100644 index 0000000000000000000000000000000000000000..bb6bc2f36f86317cf68228f3e4a12c0b8a17001d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/unique_words.html~ @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + UNIQUE_WORDS - detects all distinct elements of a cell array of + chars (used by tmg.m, tmg_query.m, tdm_update.m) + [NEW_WORDS, NEW_DOC_IDS]=UNIQUE_WORDS(WORDS, DOC_IDS, N_DOCS) + returns in NEW_WORDS all distinct elements of the cell array + of chars WORDS. DOC_IDS is the vector of the document identifiers + containing the corresponding words, while N_DOCS is the total + number of documents contained to the collection. NEW_DOC_IDS + contains the inverted index of the collection as a cell array + of 2 x N_DOCS arrays. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/untex.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/untex.html new file mode 100644 index 0000000000000000000000000000000000000000..dff624bd332cf1abc48f75d83db068ea4081f836 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/untex.html @@ -0,0 +1,59 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + + UNTEX - converts the input tex file to ASCII + RESULT = UNTEX(FILENAME,DIRECTORY) converts the input tex + files to ASCII, using untex filters suitable for unix systems + or microsoft windows systems and moves the converted + file into directory. + RESULT returns a success indicator, e.g. -2 if the + input file does not exist or has a wrong format, -1 + if untex is not installed for unix users or + the untex.exe is missing for windows users, 0 if + untexing didn't work properly, and 1 if the + conversion was successful. + + Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, + Efstratios Gallopoulos + + + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/untex.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/untex.html~ new file mode 100644 index 0000000000000000000000000000000000000000..f7c7b9c34d49226dbebdb9e774d3505830646f46 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/untex.html~ @@ -0,0 +1,58 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + + UNTEX - converts the input tex file to ASCII + RESULT = UNTEX(FILENAME,DIRECTORY) converts the input tex + files to ASCII, using untex filters suitable for unix systems + or microsoft windows systems and moves the converted + file into directory. + RESULT returns a success indicator, e.g. -2 if the + input file does not exist or has a wrong format, -1 + if untex is not installed for unix users or + the untex.exe is missing for windows users, 0 if + untexing didn't work properly, and 1 if the + conversion was successful. + + Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, Efstratios Gallopoulos + + + + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/vsm.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/vsm.html new file mode 100644 index 0000000000000000000000000000000000000000..f7a11758c8cff12f661d538572ac9b0488fa3c2f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/vsm.html @@ -0,0 +1,57 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + VSM - Applies the Vector Space Model to a document collection + [SC, DOCS_INDS] = VSM(D, Q, NORMALIZE_DOCS) applies the + Vector Space Model to the text collection represented by + the term - document matrix D for the query defined by the + vector Q [1]. NORMALIZE_DOCS defines if the document + vectors are to be normalized (1) or not (0). SC contains + the sorted similarity coefficients, while DOC_INDS contains + the corresponding document indices. + + REFERENCES: + [1] M.Berry and M.Browne, Understanding Search Engines, + Mathematical Modeling and Text Retrieval, Philadelphia, + PA: Society for Industrial and Applied Mathematics, 1999. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, + Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/vsm.html~ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/vsm.html~ new file mode 100644 index 0000000000000000000000000000000000000000..53e40327bd69069e2415ccc63b2838eca50ca3d6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/functions/vsm.html~ @@ -0,0 +1,56 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="../styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <div class="content"> + <pre class="codeinput"> + <span class="comment"> + VSM - Applies the Vector Space Model to a document collection + [SC, DOCS_INDS] = VSM(D, Q, NORMALIZE_DOCS) applies the + Vector Space Model to the text collection represented by + the term - document matrix D for the query defined by the + vector Q [1]. NORMALIZE_DOCS defines if the document + vectors are to be normalized (1) or not (0). SC contains + the sorted similarity coefficients, while DOC_INDS contains + the corresponding document indices. + + REFERENCES: + [1] M.Berry and M.Browne, Understanding Search Engines, + Mathematical Modeling and Text Retrieval, Philadelphia, + PA: Society for Industrial and Applied Mathematics, 1999. + + Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + </span> + </pre> + </div> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="../intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/Caratheodory_2.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/Caratheodory_2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5fa2e77574eb81c864b94f7f01eed02b55ece03c Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/Caratheodory_2.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/classification_gui.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/classification_gui.jpg new file mode 100644 index 0000000000000000000000000000000000000000..041885f649db10cbc49f4c499d18467c50f1b533 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/classification_gui.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/classification_gui1.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/classification_gui1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..372b64058fa67781d426c22e202245579aa533e5 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/classification_gui1.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/classification_gui2.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/classification_gui2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f75458a819a4c4dd3f57c092f8c25dfa5e0abe9c Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/classification_gui2.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/clustering_gui.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/clustering_gui.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2f5e4fbdac3e5719dcc91049733488cbedcbef4a Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/clustering_gui.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/clustering_gui2.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/clustering_gui2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..67becf6f54a54ebb5e9feebbaa58f5149f95185a Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/clustering_gui2.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/clustering_gui3.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/clustering_gui3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..947b38a1546f8bd71dcc25bbe8e6eb1a48f0cab2 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/clustering_gui3.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dd9de993bd759981023f4f8e2b927578e7f2d9a7 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui1.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3c3c2bd5c038cc8b419728986533ece7b9d61927 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui1.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui2.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b8ad4d8a22d64dd16bc338f0e75b53c41cefc888 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui2.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui3.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3a56bc952863df0359c392169f892025f8ecc4a8 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/dr_gui3.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/header.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/header.jpg new file mode 100644 index 0000000000000000000000000000000000000000..83cdbdbbad9a65a42e0e9bb9449226e8e9112567 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/header.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/indexing_1.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/indexing_1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9910d581fda31b8cf1cc3f6a86518da3c6e2a977 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/indexing_1.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/logo-panepistimiouen.gif b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/logo-panepistimiouen.gif new file mode 100644 index 0000000000000000000000000000000000000000..bfc8e85a8b1130ec6a92b147cd06b039c1b95dc5 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/logo-panepistimiouen.gif differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/logo-upatras.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/logo-upatras.jpg new file mode 100644 index 0000000000000000000000000000000000000000..360adcb042628e7b2d6af1300fc55e6ff2ac3a1a Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/logo-upatras.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/main_bg.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/main_bg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..781391579a6dda0fc4b55e3ba5bfaca12b69eac3 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/main_bg.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/menu_bg.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/menu_bg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..592ac9dd7b9a7f6a15c90c2618d189e05734a168 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/menu_bg.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/mysql.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/mysql.jpg new file mode 100644 index 0000000000000000000000000000000000000000..89658de29916fb603e389b0349912ce5545156b7 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/mysql.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/nnmf_gui.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/nnmf_gui.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b23a435facdf9395bb3f87ae6236859a18499b3a Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/nnmf_gui.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/nnmf_gui1.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/nnmf_gui1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..32e426b38fb8e7b206e64b3f0b601b887a7857cb Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/nnmf_gui1.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/nnmf_gui2.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/nnmf_gui2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a715b2743b30b9986e761c1048ead052c5163193 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/nnmf_gui2.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/open_file.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/open_file.jpg new file mode 100644 index 0000000000000000000000000000000000000000..28b6d5768303bbc0abef3cc550e5bd57a696a0f2 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/open_file.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/retrieval_gui.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/retrieval_gui.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ba94446286cbc2fd314e10654ad7ee0951cb7d71 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/retrieval_gui.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/retrieval_gui1.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/retrieval_gui1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ebd8dfea7a30080f346e3a6a3de5d3785223bb06 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/retrieval_gui1.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/retrieval_gui2.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/retrieval_gui2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..81eb80e050eddecd00e44e3250b3f19ac5b0770c Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/retrieval_gui2.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/sample_db.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/sample_db.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0120d14ab867a3fa80eecd8adca40782ff0757e9 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/sample_db.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/sample_workspace.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/sample_workspace.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a2f04c96bb1f06aaf3b02b6ab91340b24162d81f Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/sample_workspace.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/table_bottom.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/table_bottom.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c2888f9fd2c8c14a6b84e4f53bf7afeaf9f22bff Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/table_bottom.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cdfe70ed0d559f997d3eafd9196edd9aacd8a389 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_dir_structure.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_dir_structure.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aa7e4e2a2277f572b757b3df33b17e8bf06422ba Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_dir_structure.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bca24b7d6c842f4d8afeeae524fd2f09e92838b7 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui1.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e20f6d4e8c97e00acf0acdf836276c146d23ffaa Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui1.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui2.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f5e58c7b0ba55ad375f9e263b99d3d67769630db Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui2.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui3.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..91671b6242c687ea8747c941b7a9bc64988055d6 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_gui3.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_indexing_documentation.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_indexing_documentation.jpg new file mode 100644 index 0000000000000000000000000000000000000000..465d3da46c1627c8cc1e96ef51bcc5124b8e78fd Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_indexing_documentation.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_new_gui.jpg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_new_gui.jpg new file mode 100644 index 0000000000000000000000000000000000000000..933a7977d6b859a0791e17bdecf717a7d878d8e0 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/images/tmg_new_gui.jpg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/index.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/index.html new file mode 100644 index 0000000000000000000000000000000000000000..99f9e109c8205bacfd2a0b13e63b7daea906c69d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/index.html @@ -0,0 +1,95 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator</title> +</head> +<body> + <table id="t" class="main_table" align="center" width="920" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center" background="images/header.jpg" width="920" height="132"> + <span class="header">Text to Matrix Generator</span> + </td> + </tr> + <tr> + <td background="images/main_bg.jpg"> + <table class="main_table" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="25%" valign="top"> + <div id="menu"> + <dt> + <a href="intro.html" target="content_frame">Introduction</a> + </dt> + <dt> + <a href="indexing.html" target="content_frame">Indexing</a> + </dt> + <dt> + <a href="dr.html" target="content_frame">Dimensionality Reduction</a> + </dt> + <dt> + <a href="nnmf.html" target="content_frame">Non-Negative Factorizations</a> + </dt> + <dt> + <a href="retrieval.html" target="content_frame">Retrieval</a> + </dt> + <dt> + <a href="clustering.html" target="content_frame">Clustering</a> + </dt> + <dt> + <a href="classification.html" target="content_frame">Classification</a> + </dt> + <dt> + <a href="functions.html" target="content_frame">Function Reference</a> + </dt> + <dt> + <a href="http://scgroup20.ceid.upatras.gr:8000/tmg/" target="_blank">TMG Website</a> + </dt> + </div> + </td> + <td width="75%" valign="top"> + <iframe src="intro.html" id="content_frame_id" width="680" height="200" scrolling="no" name="content_frame" frameborder="0"> + </iframe> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td background="images/main_bg.jpg" align="center"> + + </td> + </tr> + <tr> + <td background="images/main_bg.jpg" align="center"> + <table class="footer" width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="20"> </td> + <td> + <!--<hr size="3" color="#acbce7" />--> + <hr> + </td> + <td width="30"> </td> + </tr> + <tr> + <td width="20"> </td> + <td> + Research supported in part by the University of Patras K. Karatheodori B120 and a Bodossaki foundation scholarship.<br /> + <img height="62" src="images/logo-panepistimiouen.gif" width="154" /> + <img height="61" src="images/Caratheodory_2.jpg" width="50" /><br /> + Copyright © 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou and Efstratios Gallopoulos<br /> + <!--Send comments to zeimpekis (at) gmail (dot) com or stratis (at) ceid (dot) upatras (dot) gr.--> + </td> + <td width="30"> </td> + </tr> + </table> + </td> + + </tr> + <tr> + <td background="images/table_bottom.jpg" width="920" height="30" > + </td> + </tr> + </table> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing.html new file mode 100644 index 0000000000000000000000000000000000000000..0a4c43fbb718db3e08768b3a02c6bc09ffea81f9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing.html @@ -0,0 +1,417 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Indexing Module (tmg_gui)</h2> + <p align="center"> + <img src="images/tmg_new_gui.jpg" width="604" height="598" /><br /> + </p> + </td> + </tr> + <tr> + <td> + <p align="justify"> + tmg_gui is a graphical user interface for "Text to Matrix Generator" that can be used to create + or update term-document matrices (TDM's) or create term-query matrices. + </p> + <p align="justify"> + See a <a href="indexing1.html">demonstration</a> of tmg_gui. + </p> + <p align="justify"> + For complete up-to-date documentation visit the TMG Website: + </p> + <p align="center"> + <a href="http://scgroup20.ceid.upatras.gr:8000/tmg/"> + http://scgroup20.ceid.upatras.gr:8000/tmg/ + </a> + </p> + </td> + </tr> + <tr> + <td> + <table align="left" width="100%" border="2" cellpadding="2" cellspacing="2"> + <tr> + <td align="center"> + <strong>Field Name</strong> + </td> + <td align="center"> + <strong>Default</strong> + </td> + <td align="center"> + <strong>Description</strong> + </td> + </tr> + <tr> + <td align="left"> + Input File/Directory + </td> + <td align="center"> + - + </td> + <td align="left"> + Files to be parsed with resulting documents separated by "Delimiter". Alternatively, each file in the input directory contains a single document. + </td> + </tr> + <tr> + <td align="left"> + Create New tdm + </td> + <td align="center"> + ● + </td> + <td align="left"> + Checked if new tdm is to be created (default checked). + </td> + </tr> + <tr> + <td align="left"> + Create Query Matrix + </td> + <td align="center"> + - + </td> + <td align="left"> + Checked if new query matrix is to be created (default checked). + </td> + </tr> + <tr> + <td align="left"> + Update tdm + </td> + <td align="center"> + - + </td> + <td align="left"> + Checked if an existing tdm is to be updated with new documents. Alternatively, ckecked if an existing tdm is to be updated using different options (change update_struct). + </td> + </tr> + <tr> + <td align="left"> + Downdate tdm + </td> + <td align="center"> + - + </td> + <td align="left"> + Checked if an existing tdm is to be downdated according to the "Document Indices" field. + </td> + </tr> + <tr> + <td align="left"> + Dictionary + </td> + <td align="center"> + - + </td> + <td align="left"> + Name of .mat file or workspace variable containing the dictionary to be used by tmg_query function if the "Create Query Matrix" radio button is checked. + </td> + </tr> + <tr> + <td align="left"> + Global Weights + </td> + <td align="center"> + - + </td> + <td align="left"> + Name of .mat file or workspace variable containing the vector of global weights to be used by tmg_query function if the "Create Query Matrix" radio button is checked. + </td> + </tr> + <tr> + <td align="left"> + Update Struct + </td> + <td align="center"> + - + </td> + <td align="left"> + Name of .mat file or workspace variable containing the structure to be updated or downdated by tdm_update (or tdm_downdate) function if the "Udpate tdm" or "Downdate tdm" radio button is checked. + </td> + </tr> + <tr> + <td align="left"> + Document Indices + </td> + <td align="center"> + - + </td> + <td align="left"> + Name of .mat file or workspace variable containing the document indices marked for deletion when the "Downdate tdm" radio button is checked. + </td> + </tr> + <tr> + <td align="left"> + Delimiter + </td> + <td align="center"> + emptyline + </td> + <td align="left"> + The delimiter between tmg's view of documents. Possible values are 'emptyline', 'none_delimiter' (treats each file as single document) or any other string. + </td> + </tr> + <tr> + <td align="left"> + Line Delimiter + </td> + <td align="center"> + ● + </td> + <td align="left"> + Checked if the "Delimiter" takes a whole line of text. + </td> + </tr> + <tr> + <td align="left"> + Stoplist + </td> + <td align="center"> + - + </td> + <td align="left"> + Name of file containing stopwords, i.e. common words not used in indexing. + </td> + </tr> + <tr> + <td align="left"> + Min Length + </td> + <td align="center"> + 3 + </td> + <td align="left"> + Minimum term length. + </td> + </tr> + <tr> + <td align="left"> + Max Length + </td> + <td align="center"> + 30 + </td> + <td align="left"> + Maximum term length. + </td> + </tr> + <tr> + <td align="left"> + Min Local Frequency + </td> + <td align="center"> + 1 + </td> + <td align="left"> + Minimum local term frequency. + </td> + </tr> + <tr> + <td align="left"> + Max Local Frequency + </td> + <td align="center"> + inf + </td> + <td align="left"> + Maximum local term frequency. + </td> + </tr> + <tr> + <td align="left"> + Min Global Frequency + </td> + <td align="center"> + 1 + </td> + <td align="left"> + Minimum global term frequency. + </td> + </tr> + <tr> + <td align="left"> + Max Global Frequency + </td> + <td align="center"> + inf + </td> + <td align="left"> + Maximum global term frequency. + </td> + </tr> + <tr> + <td align="left"> + Local Term Weighting + </td> + <td align="center"> + Term Frequency + </td> + <td align="left"> + Local term weighting function. Possible values: 'Term Frequency', 'Binary', 'Logarithmic', 'Alternate Log', 'Augmented Normalized Term Frequency'. + </td> + </tr> + <tr> + <td align="left"> + Global Term Weighting + </td> + <td align="center"> + None + </td> + <td align="left"> + Global term weighting function. Possible values: 'None', 'Entropy', 'Inverse Document Frequency (IDF)', 'GfIdf', 'Normal', 'Probabilistic Inverse'. + </td> + </tr> + <tr> + <td align="left"> + Database Name + </td> + <td align="center"> + - + </td> + <td align="left"> + The name of the folder (under 'data' directory) where data are to be saved (currently supported only for the 'Create New tdm' module). + </td> + </tr> + <tr> + <td align="left"> + Store in MySQL + </td> + <td align="center"> + - + </td> + <td align="left"> + Checked if results are to be saved into MySQL (currently supported only for the 'Create New tdm' module). + </td> + </tr> + <tr> + <td align="left"> + use Normalization + </td> + <td align="center"> + - + </td> + <td align="left"> + Indicates normalization method. Possible values: 'None', 'Cosine'. + </td> + </tr> + <tr> + <td align="left"> + use Stemming + </td> + <td align="center"> + - + </td> + <td align="left"> + Indicates if stemming is to be applied. The algorithm currrently supported is due to Porter. + </td> + </tr> + <tr> + <td align="left"> + Display Results + </td> + <td align="center"> + ● + </td> + <td align="left"> + Display results or not to the command windows. + </td> + </tr> + <tr> + <td align="left"> + Remove Numbers + </td> + <td align="center"> + - + </td> + <td align="left"> + Checked if dictionary should not include numeric words. + </td> + </tr> + <tr> + <td align="left"> + Remove Alphanumerics + </td> + <td align="center"> + - + </td> + <td align="left"> + Checked if dictionary should not include alphanumeric words. + </td> + </tr> + <tr> + <td align="left"> + Parse All Subdirectories + </td> + <td align="center"> + - + </td> + <td align="left"> + Checked if subdirectories should be parsed in batch mode (recommended for large collections + to avoid repeated user interaction). + </td> + </tr> + <tr> + <td align="left"> + Continue + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the selected operation. + </td> + </tr> + <tr> + <td align="left"> + Reset + </td> + <td align="center"> + - + </td> + <td align="left"> + Reset window to default values. + </td> + </tr> + <tr> + <td align="left"> + Exit + </td> + <td align="center"> + - + </td> + <td align="left"> + Exit window. + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing1.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing1.html new file mode 100644 index 0000000000000000000000000000000000000000..3fee399e744dc23a88a1935ed43fb585b90c89ef --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing1.html @@ -0,0 +1,101 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Indexing Module (tmg_gui)</h2> + </td> + </tr> + <tr> + <td> + <p align="justify"> + Assume you want to run tmg.m for the following input: + </p> + <ul> + <li> + <p>filename: sample_documents/sample1</p> + </li> + <li> + <p>delimiter: none_delimiter</p> + </li> + <li> + <p>line_delimiter: yes</p> + </li> + <li> + <p>stoplist: common_words</p> + </li> + <li> + <p>minimum length: 3</p> + </li> + <li> + <p>maximum length: 30</p> + </li> + <li> + <p>minimum local frequency: 1</p> + </li> + <li> + <p>maximum local frequency: inf</p> + </li> + <li> + <p>minimum global frequency: 1</p> + </li> + <li> + <p>maximum global frequency: inf</p> + </li> + <li> + <p>local term weighting: logarithmic</p> + </li> + <li> + <p>global term weighting: IDF</p> + </li> + <li> + <p>normalization: cosine</p> + </li> + <li> + <p>stemming: -</p> + </li> + <li> + <p>remove alphanumerics: -</p> + </li> + <li> + <p>remove numbers: -</p> + </li> + <li> + <p>parse all subdirectories: -</p> + </li> + + </ul> + <p align="justify"> + and store results in directory "sample1" and MySQL. + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="indexing2.html">Step 2</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing2.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing2.html new file mode 100644 index 0000000000000000000000000000000000000000..6009e26ddaeb0f6153df9cf19708107df5ddc2ae --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing2.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Indexing Module (tmg_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Initially select the operation you want to perform, by pressing the corresponding radio button at the upper frame. </p> + </li> + <li> + <p align="justify">The selection of a radio button activates the required fields in the GUI, while deactivating the rest fields.</p> + </li> + </ul> + <p align="center"> + <img src="images/tmg_new_gui.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="indexing3.html">Step 3</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing3.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing3.html new file mode 100644 index 0000000000000000000000000000000000000000..0e2ebcfc66638e78ff59fd56b5862707877bb082 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing3.html @@ -0,0 +1,57 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Indexing Module (tmg_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Fill in the required fields, by pressing the check buttons, editing the edit boxes or selecting the appropriate files/variables by pressing the Browse button. </p> + </li> + </ul> + <p align="center"> + <img src="images/indexing_1.jpg" width="604" height="598" /> + </p> + <ul> + <li> + <p align="justify">The user can select a file or a variable by pressing the corresponding browse button. </p> + </li> + </ul> + <p align="center"> + <img src="images/open_file.jpg" width="567" height="282" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="indexing4.html">Step 4</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing4.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing4.html new file mode 100644 index 0000000000000000000000000000000000000000..0af930b22b097250bd85f75612b9d7bddb4e84a0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing4.html @@ -0,0 +1,65 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Indexing Module (tmg_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Press the "Continue" button in order to perform selected the operation. </p> + </li> + <li> + <p align="justify">Results will be saved to the workspace. Furthermore, directory "sample1" will be created under TMG_HOME/data with each output variable stored to a single ".mat" file. </p> + </li> + </ul> + <p align="center"> + <img src="images/sample_workspace.jpg" width="635" height="454" /> + </p> + <ul> + <li> + <p align="justify">Results will also be saved to MySQL (can be used for further processing, e.g. retrieval_gui). </p> + </li> + </ul> + <p align="center"> + <img src="images/sample_db.jpg" width="668" height="379" /> + </p> + <ul> + <li> + <p align="justify">Press the Reset button in order to change the input. </p> + </li> + </ul> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="indexing5.html">Step 5</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing5.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing5.html new file mode 100644 index 0000000000000000000000000000000000000000..80ecfba90483e0f1ef8a3e6c184ffd6efa6718d5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/indexing5.html @@ -0,0 +1,60 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Indexing Module (tmg_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">For further documentation type 'help tmg_gui' at the MATLAB command window, or select the Documentation tab from the Help menu. </p> + </li> + </ul> + <p align="center"> + <img src="images/tmg_indexing_documentation.jpg" width="604" height="596" /> + </p> + <ul> + <li> + <p align="justify">In order to update a tdm, give the "input file/directory" and the update_struct corresponding to the initial collection. In case you just want to alter some options, give a blank "input file/direcory" and change the corresponding fields of update_struct. </p> + </li> + <li> + <p align="justify">In order to downdate a tdm, give the update_struct corresponding to the initial collection and the document indices vector you want to remove. </p> + </li> + <li> + <p align="justify">In order to construct a term-query matrix, give the dictionary char array of the initial collection and the corresponding vector of global weights (optional). </p> + </li> + </ul> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="indexing1.html">Start Page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/intro.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/intro.html new file mode 100644 index 0000000000000000000000000000000000000000..7cb4d84239b890d403499031aafd7f4194f92931 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/intro.html @@ -0,0 +1,499 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <p align="justify"> + Text to Matrix Generator (TMG) is a MATLAB Toolbox that can be used for various + Data Mining (DM) and Information Retrieval (IR) tasks. TMG uses the sparse + matrix infrastracture of MATLAB that is especially suited for Text Mining (TM) applications + where data are extremely sparse. Initially built as a preprocessing tool, + TMG offers now a wide range of DM tools. In particular, TMG is composed of + six Graphical User Interface (GUI) modules, presented in Figure 1 (arrows + show modules dependencies). + </p> + <p align="center"> + <img src="images/tmg.jpg" width="565" height="229" /><br /> + <strong>Figure 1:</strong> Structure and dependencies of GUI modules of TMG. + </p> + </td> + </tr> + <tr> + <td> + <h2>Installation</h2> + <p align="justify"> + Installation of TMG is straightforward by means of the init_tmg script. In + particular, the user has to perform the following steps: + </p> + <ul> + <li> + <p align="justify"> + For MySQL functionality, install MySQL and Java Connector. + </p> + </li> + <li> + <p align="justify"> + Download TMG by filling the form from: + </p> + <p align="center"> + <a href="http://scgroup20.ceid.upatras.gr:8000/tmg/index.php?option=com_content&view=article&id=118&Itemid=14"> + http://scgroup20.ceid.upatras.gr:8000/tmg/index.php?option=com_content&view=article&id=118&Itemid=14 + </a> + </p> + </li> + <li> + <p align="justify"> + Unzip TMG_X.XRX.zip and start MATLAB. Figure 2 depicts the directory structure + of the TMG root directory. + </p> + </li> + <li> + <p align="justify"> + Change path to the TMG root directory. + </p> + </li> + <li> + <p align="justify"> + Run init_tmg. Give the MySQL login and password as well as the root directory + of the MySQL Java Connector. The installation script creates all necessary + information (including MySQL database tmg) and adds to the MATLAB path all + necessary directories. + </p> + </li> + <li> + <p align="justify"> + Run gui. Alternatively, use the command line interface, type "help tmg". + </p> + </li> + </ul> + <p align="justify"> + TMG 6.0R7 requires the following third party software packages: + </p> + <ul> + <li> + <p align="justify"> + MySQL: <a href="http://www.mysql.com/">http://www.mysql.com/</a>, + <a href="http://dev.mysql.com/downloads/connector/j/5.0.html">http://dev.mysql.com/downloads/connector/j/5.0.html</a> + </p> + </li> + <li> + <p align="justify"> + JRE: <a href="http://www.java.com/en/download/index.jsp">http://www.java.com/en/download/index.jsp</a> + </p> + </li> + <li> + <p align="justify"> + ANLS: <a href="http://compbio.med.harvard.edu/hkim/nmf/index.html">http://compbio.med.harvard.edu/hkim/nmf/index.html</a> + </p> + </li> + <li> + <p align="justify"> + NNDSVD: <a href="http://www.cs.rpi.edu/~boutsc/paper1.html">http://www.cs.rpi.edu/~boutsc/paper1.html</a> + </p> + </li> + <li> + <p align="justify"> + PROPACK: <a href="http://soi.stanford.edu/~rmunk/PROPACK/index.html">http://soi.stanford.edu/~rmunk/PROPACK/index.html</a> + </p> + </li> + <li> + <p align="justify"> + SDDPACK: <a href="http://www.cs.umd.edu/~oleary/SDDPACK/README.html">http://www.cs.umd.edu/~oleary/SDDPACK/README.html</a> + </p> + </li> + <li> + <p align="justify"> + SPQR: <a href="http://portal.acm.org/citation.cfm?id=1067972">http://portal.acm.org/citation.cfm?id=1067972</a> + </p> + </li> + + + </ul> + <p align="justify"> + ANLS, NNDSVD, PROPACK, SDDPACK and SPQR packages are included into TMG, while the user has + to download MySQL and JRE. However, we note that MySQL related software is necessary + only if the user intends to use the database support utilized by TMG. + Ordinary TMG will run without any problem on a Matlab 7.0 environment without + any other special software. + </p> + <p align="center"> + <img src="images/tmg_dir_structure.jpg" width="517" height="669" /><br /> + <strong>Figure 2:</strong> Structure of TMG root directory. + </p> + </td> + </tr> + <tr> + <td> + <h2>Indexing Module (tmg_gui)</h2> + <p align="justify"> + TMG can be used for the construction of new and the update of existing term-document + matrices (tdms) from text collections, in the form of MATLAB sparse arrays. To this + end, TMG implements various steps such as: + </p> + <ul> + <li> + <p align="justify"> + Removal of stopwords. + </p> + </li> + <li> + <p align="justify"> + Stemming (currently Porter stemming algorithm [11]). + </p> + </li> + <li> + <p align="justify"> + Removal of alphanumeric terms (optionally). + </p> + </li> + <li> + <p align="justify"> + Removal of numeric terms (optionally). + </p> + </li> + <li> + <p align="justify"> + Removal of short/long terms. + </p> + </li> + <li> + <p align="justify"> + Removal of frequent/infrequent terms (locally or globally). + </p> + </li> + <li> + <p align="justify"> + Term weighting and normalization. + </p> + </li> + <li> + <p align="justify"> + Html filtering, processing of Postscript, PDF, Microsoft Office Documents (doc,docx,rtf), Open + Office Documents (odt) and Latex Documents (tex). + </p> + </li> + <li> + <p align="justify"> + Store in MySQL (optionally). + </p> + </li> + <li> + <p align="justify"> + Selective Parsing of Subdirectories. + </p> + </li> + </ul> + <p align="justify"> + The resulting tdms can be stored as "mat" files, while text can also be stored + to MySQL for further procesing. TMG can also update existing tdms by efficient + incremental updating or downdating operations. Finally, TMG can also construct + query vectors using the existing dictionary that can be used by the retrieval + and classification modules. + </p> + <p align="center"> + <img src="images/tmg_new_gui.jpg" width="604" height="598" /><br /> + <strong>Figure 3:</strong> tmg_gui. + </p> + <p align="justify"> + See <a href="indexing.html">details</a> and a <a href="indexing1.html">demostration</a> of tmg_gui. + </p> + </td> + </tr> + <tr> + <td> + <h2>Dimensionality Reduction module (dr_gui)</h2> + <p align="justify"> + This module deploys a variety of powerful techniques designed to efficiently handle + high dimensional data. Dimensionality Reduction (DR) is a common technique that + is widely used. The target is dual: (a) more economical representation of data, + and (b) better semantic representation. TMG implements six DR techniques. + </p> + <ul> + <li> + <p align="justify"> + Singular Value Decomposition (SVD). + </p> + </li> + <li> + <p align="justify"> + Principal Component Analysis (PCA). + </p> + </li> + <li> + <p align="justify"> + Clustered Latent Semantic Indexing (CLSI) [16, 17]. + </p> + </li> + <li> + <p align="justify"> + Centroids Method (CM) [10]. + </p> + </li> + <li> + <p align="justify"> + Semidiscrete Decomposition (SDD) [8]. + </p> + </li> + <li> + <p align="justify"> + SPQR Decomposition [2]. + </p> + </li> + </ul> + <p align="justify"> + DR data can be stored as "mat" files and used for further processing. + </p> + <p align="center"> + <img src="images/dr_gui.jpg" width="604" height="598" /><br /> + <strong>Figure 4:</strong> dr_gui. + </p> + <p align="justify"> + See <a href="dr.html">details</a> and a <a href="dr1.html">demostration</a> of dr_gui. + </p> + </td> + </tr> + <tr> + <td> + <h2>Non-Negative Factorizations module (nnmf_gui)</h2> + <p align="justify"> + This module deploys a set of Non-Negative Matrix Factorization (NNMF) techniques. + Since these techniques are iterative, the final result depends on the initialization. + A common approach is the random initialization of the non-negative factors, however + new approaches appear to result in higher quality approximations. TMG implements four + initialization techniques: + </p> + <ul> + <li> + <p align="justify"> + Non-Negative Double Singular Value Decomposition (NNDSVD) [4]. + </p> + </li> + <li> + <p align="justify"> + Block NNDSVD [20]. + </p> + </li> + <li> + <p align="justify"> + Bisecting NNDSVD [20]. + </p> + </li> + <li> + <p align="justify"> + By clustering [12]. + </p> + </li> + </ul> + <p align="justify"> + Resulting factors can be further refined by means of two NNMF algorithms: + </p> + <ul> + <li> + <p align="justify"> + Multiplicative Update algorithm by Lee and Seung [9]. + </p> + </li> + <li> + <p align="justify"> + Alternating Non-negativity-constrained Least Squares (NMF/ANLS) [7]. + </p> + </li> + </ul> + <p align="center"> + <img src="images/nnmf_gui.jpg" width="604" height="598" /><br /> + <strong>Figure 7:</strong> nnmf_gui. + </p> + <p align="justify"> + See <a href="nnmf.html">details</a> and a <a href="nnmf1.html">demostration</a> of nnmf_gui. + </p> + </td> + </tr> + <tr> + <td> + <h2>Retrieval module (retrieval_gui)</h2> + <p align="justify"> + TMG offers two alternatives for Text Mining. + </p> + <ul> + <li> + <p align="justify"> + Vector Space Model (VSM) [12]. + </p> + </li> + <li> + <p align="justify"> + Latent Semantic Analysis (LSA) [1, 5], + </p> + </li> + </ul> + <p align="justify"> + using a combination of any DR technique and Latent Semantic Indexing (LSI). + Using the corresponding GUI, the user can apply a question to an existing dataset + using any of the aforementioned techniques and get HTML response. + </p> + <p align="center"> + <img src="images/retrieval_gui.jpg" width="604" height="598" /><br /> + <strong>Figure 5:</strong> retrieval_gui. + </p> + <p align="justify"> + See <a href="retrieval.html">details</a> and a <a href="retrieval1.html">demostration</a> of retrieval_gui. + </p> + </td> + </tr> + <tr> + <td> + <h2>Clustering module (clustering_gui)</h2> + <p align="justify"> + TMG implements three clustering algorithms. + </p> + <ul> + <li> + <p align="justify"> + k-means. + </p> + </li> + <li> + <p align="justify"> + Spherical k-means [6]. + </p> + </li> + <li> + <p align="justify"> + Principal Direction Divisive Partitioning (PDDP) [3,15]. + </p> + </li> + </ul> + <p align="justify"> + Regarding PDDP, TMG implements the basic algorithm as well as the PDDP(l) [15] + and some hybrid variants of PDDP and kmeans [19]. + </p> + <p align="center"> + <img src="images/clustering_gui.jpg" width="604" height="598" /><br /> + <strong>Figure 6:</strong> clustering_gui. + </p> + <p align="justify"> + See <a href="clustering.html">details</a> and a <a href="clustering1.html">demostration</a> of clustering_gui. + </p> + </td> + </tr> + <tr> + <td> + <h2>Classification module (classification_gui)</h2> + <p align="justify"> + TMG implements three classification algorithms. + </p> + <ul> + <li> + <p align="justify"> + k-Nearest Neighboors (kNN). + </p> + </li> + <li> + <p align="justify"> + Rocchio. + </p> + </li> + <li> + <p align="justify"> + Linear Least Squares Fit (LLSF) [14]. + </p> + </li> + </ul> + <p align="justify"> + All these algorithms can be combined with CLSI, CM and SVD DR techniques. + </p> + <p align="center"> + <img src="images/classification_gui.jpg" width="604" height="598" /><br /> + <strong>Figure 7:</strong> classification_gui. + </p> + <p align="justify"> + See <a href="classification.html">details</a> and a <a href="classification1.html">demostration</a> of classification_gui. + </p> + </td> + </tr> + <tr> + <td> + <h2>Acknowledgements</h2> + <p align="justify"> + TMG was conceived after a motivating discussion with Andrew Knyazev regarding + a collection of MATLAB tools we had put together to aid in our clustering + experiments. We thank our collegues Ioannis Antonellis, Anastasios Zouzias, + Efi Kokiopoulou and Constantine Bekas for many helpful suggestions, Jacob + Kogan and Charles Nicholas for inviting us to contribute to [18], Elias + Houstis for his help in the initial phases of this research and Michael Berry, + Tamara Kolda Rasmus Munk Larsen, Christos Boutsidis and Haesun Park for letting us use and distribute SPQR, + SDDPACK, PROPACK, NNDSVD and ANLS software respectively. Special thanks are due to many of + the users for their constructive comments regarding TMG. This research was + supported in part by a University of Patras "Karatheodori" grant. The + first author was also supported by a Bodossaki Foundation graduate + fellowship. + </p> + </td> + </tr> + <tr> + <td> + <h2>References</h2> + <p align="justify"> + [1] M. Berry, Z. Drmac, and E. Jessup, Matrices, vector spaces, and information retrieval, SIAM Review 41 (1998), 335–362.<br /><br /> + + [2] M. W. Berry, S. A. Pulatova, and G. W. Stewart, Computing sparse reduced-rank approximations to sparse matrices, ACM TOMS 31 (2005), no. 2.<br /><br /> + + [3] D. Boley, Principal direction divisive partitioning, Data Mining and Knowledge Discovery 2 (1998), no. 4, 325–344.<br /><br /> + + [4] C. Boutsidis and E. Gallopoulos, SVD-based initialization: A head start on nonnegative matrix factorization, Pattern Recognition, Volume 41, Issue 4, Pages 1350-1362, April 2008.<br /><br /> + + [5] S. Deerwester, S. Dumais, G. Furnas, T. Landauer, and Harshman R., Indexing by Latent Semantic Analysis, Journal of the American Society for Information Science 41 (1990), no. 6, 391–407.<br /><br /> + + [6] I. S. Dhillon and D. S. Modha, Concept decompositions for large sparse text data using clustering, Machine Learning 42 (2001), no. 1, 143–175.<br /><br /> + + [7] H. Kim and H. Park, Non-negative matrix factorization based on alternating non-negativity-constrained least squares and the active set method, SIAM Journal of Matrix Analysis and Applications, to appear, 2008.<br /><br /> + + [8] T. Kolda and D. O’Leary, Algorithm 805: computation and uses of the semidiscrete matrix decomposition, ACM TOMS 26 (2000), no. 3.<br /><br /> + + [9] D. Lee, S. Seung, Algorithms for Non-negative Matrix Factorization, NIPS (2000), 556-562.<br /><br/> + + [10] H. Park, M. Jeon, and J. Rosen, Lower dimensional representation of text data based on centroids and least squares, BIT 43 (2003).<br /><br /> + + [11] M.F. Porter, An algorithm for suffix stripping, Program (1980), no. 3, 130–137.<br /><br /> + + [12] G. Salton, C. Yang, and A. Wong, A Vector-Space Model for Automatic Indexing, Communications of the ACM 18 (1975), no. 11, 613–620.<br /><br /> + + [13] S. Wild, J. Curry, and A. Dougherty, Improving non-negative matrix factorizations through structured initializations, Pattern Recognition, 37:2217-2232, 2004. <br /><br /> + + [14] Y. Yang and C. Chute, A linear least squares fit mapping method for information retrieval from natural language texts, In 14th Conf. Comp. Linguistics, 1992.<br /><br /> + + [15] D. Zeimpekis and E. Gallopoulos, PDDP(l): Towards a Flexing Principal Direction Divisive Partitioning Clustering Algorithms, Proc. IEEE ICDM ’03 Workshop on Clustering Large Data Sets (Melbourne, Florida) (D. Boley, I. Dhillon, J. Ghosh, and J. Kogan, eds.), 2003, pp. 26–35.<br /><br /> + + [16] D. Zeimpekis and E. Gallopoulos, CLSI: A flexible approximation scheme from clustered term-document matrices, In Proc. SIAM 2005 Data Mining Conf. (Newport Beach, California) (H. Kargupta, J. Srivastava, C. Kamath, and A. Goodman, eds.), April 2005, pp. 631–635.<br /><br /> + + [17] D. Zeimpekis and E. Gallopoulos, Linear and non-linear dimensional reduction via class representatives for text classification, In Proc. of the 2006 IEEE International Conference on DataMining (Hong Kong), December 2006, pp. 1172–1177.<br /><br /> + + [18] D. Zeimpekis and E. Gallopoulos, TMG: A MATLAB toolbox for generating term document matrices from text collections, Grouping Multidimensional Data: Recent Advances in Clustering (J. Kogan, C. Nicholas, and M. Teboulle, eds.), Springer, Berlin, 2006, pp. 187–210.<br /><br /> + + [19] D. Zeimpekis and E. Gallopoulos, k-means steering of spectral divisive clustering algorithms, In Proc. of Text Mining Workshop (Minneapolis), 2007.<br /><br /> + + [20] D. Zeimpekis and E. Gallopoulos, Document Clustering using NMF based on Spectral Information. In Proc. Text Mining Workshop 2008 held in conjunction with the 8th SIAM International Conference on Data Mining, Atlanta, 2008.<br /><br /> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf.html new file mode 100644 index 0000000000000000000000000000000000000000..7f8c61e1ef27609728e2a21c899cde677ef8ea8f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf.html @@ -0,0 +1,362 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Non-Negative Factorizations Module (tmg_gui)</h2> + <p align="center"> + <img src="images/nnmf_gui.jpg" width="604" height="598" /><br /> + </p> + </td> + </tr> + <tr> + <td> + <p align="justify"> + nnmf_gui is a graphical user interface for "Text to Matrix Generator" that can be + used for applying a set of non-negative factorizations to term-document + matrices (TDM's) constructed from tmg_gui. + </p> + <p align="justify"> + See a <a href="nnmf1.html">demonstration</a> of nnmf_gui. + </p> + <p align="justify"> + For complete up-to-date documentation visit the TMG Wiki: + </p> + <p align="center"> + <a href="http://scgroup6.ceid.upatras.gr:8000/wiki/"> + http://scgroup6.ceid.upatras.gr:8000/wiki/ + </a> + </p> + </td> + </tr> + <tr> + <td> + <table align="left" width="100%" border="2" cellpadding="2" cellspacing="2"> + <tr> + <td align="center"> + <strong>Field Name</strong> + </td> + <td align="center"> + <strong>Default</strong> + </td> + <td align="center"> + <strong>Description</strong> + </td> + </tr> + <tr> + <td align="left"> + Select Dataset + </td> + <td align="center"> + - + </td> + <td align="left"> + Select the dataset. + </td> + </tr> + <tr> + <td align="left"> + Random + </td> + <td align="center"> + ● + </td> + <td align="left"> + Initialize at random. + </td> + </tr> + <tr> + <td align="left"> + Nonnegative Double SVD (NNDSVD) + </td> + <td align="center"> + - + </td> + <td align="left"> + Initialize by NNDSVD. + </td> + </tr> + <tr> + <td align="left"> + Block NNDSVD + </td> + <td align="center"> + - + </td> + <td align="left"> + Initialize by block NNDSVD. + </td> + </tr> + <tr> + <td align="left"> + Bisecting NNDSVD + </td> + <td align="center"> + - + </td> + <td align="left"> + Initialize by bisecting NNDSVD. + </td> + </tr> + <tr> + <td align="left"> + By Clustering + </td> + <td align="center"> + - + </td> + <td align="left"> + Initialize by clustering. + </td> + </tr> + <tr> + <td align="left"> + Refine factors + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to run refinement algorithm. + </td> + </tr> + <tr> + <td align="left"> + Method + </td> + <td align="center"> + - + </td> + <td align="left"> + Refinement method (default Multiplicative Update). + </td> + </tr> + <tr> + <td align="left"> + Number of iterations + </td> + <td align="center"> + - + </td> + <td align="left"> + Refine by the Multiplicative Update algorithm. + </td> + </tr> + <tr> + <td align="left"> + Display Results + </td> + <td align="center"> + ● + </td> + <td align="left"> + Display results of refinement method. + </td> + </tr> + <tr> + <td align="left"> + Euclidean k-means + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to use the euclidean k-means clustering algorithm. + </td> + </tr> + <tr> + <td align="left"> + Spherical k-means + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use the spherical k-means clustering algorithm. + </td> + </tr> + <tr> + <td align="left"> + PDDP + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use the PDDP clustering algorithm. + </td> + </tr> + <tr> + <td align="left"> + Initialize Centroids + </td> + <td align="center"> + At random + </td> + <td align="left"> + Defines the method used for the initialization of the centroid vector in the course of k-means. Possibilities are: initialize at random and supplly a variable of '.mat' file with the centroids matrix. + </td> + </tr> + <tr> + <td align="left"> + Termination Criterion + </td> + <td align="center"> + Epsilon (1) + </td> + <td align="left"> + Defines the termination criterion used in the course of k-means. Possibilities are: use an epsilon value (default 1) and stop iteration when the objective function improvement does not exceed epsilon or perform a specific number of iterations (default 10). + </td> + </tr> + <tr> + <td align="left"> + Principal Directions + </td> + <td align="center"> + 1 + </td> + <td align="left"> + Number of principal directions used in PDDP. + </td> + </tr> + <tr> + <td align="left"> + Maximum num. of PCs + </td> + <td align="center"> + - + </td> + <td align="left"> + Check if the PDDP(max-l) variant is to be applied. + </td> + </tr> + <tr> + <td align="left"> + Variant + </td> + <td align="center"> + Basic + </td> + <td align="left"> + A set of PDDP variants. Possibe values: 'Basic', 'Split with k-means', 'Optimat Split', 'Optimal Split with k-means', 'Optimal Split on Projection'. + </td> + </tr> + <tr> + <td align="left"> + MATLAB (svds) + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to use MATLAB function svds for the computation of the SVD in the course of PDDP. + </td> + </tr> + <tr> + <td align="left"> + Propack + </td> + <td align="center"> + - + </td> + <td align="left"> + Check to use PROPACK package for the computation of the SVD in the course of PDDP. + </td> + </tr> + <tr> + <td align="left"> + Number of Clusters + </td> + <td align="center"> + - + </td> + <td align="left"> + Number of clusters computed. + </td> + </tr> + <tr> + <td align="left"> + Display Results + </td> + <td align="center"> + ● + </td> + <td align="left"> + Display results or not to the command windows. + </td> + </tr> + <tr> + <td align="left"> + Store Results + </td> + <td align="center"> + ● + </td> + <td align="left"> + Check to store results. + </td> + </tr> + <tr> + <td align="left"> + Continue + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the selected operation. + </td> + </tr> + <tr> + <td align="left"> + Reset + </td> + <td align="center"> + - + </td> + <td align="left"> + Reset window to default values. + </td> + </tr> + <tr> + <td align="left"> + Exit + </td> + <td align="center"> + - + </td> + <td align="left"> + Exit window. + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf1.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf1.html new file mode 100644 index 0000000000000000000000000000000000000000..11513a4169efd5baae3bb0fd88ea7c5542afcb27 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf1.html @@ -0,0 +1,86 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Non-Negative Factorizations Module (nnmf_gui)</h2> + </td> + </tr> + <tr> + <td> + <p align="justify"> + Assume we have processed a collection with tmg_gui, construct a TDM with + 1,033 documents and 12,184 terms (corresponding to the well-known MEDLINE collection) + and store the results to "TMG_HOME/data/medline". Assume then, we want to construct a + non-negative factorization of the TDM, using the Multiplicative Update + algorithm initializing by the block NNDSVD technique for the following input: + </p> + <ul> + <li> + <p>initialization: Block NNDSVD</p> + </li> + <li> + <p>refine factors: yes</p> + </li> + <li> + <p>method: Multiplicative update</p> + </li> + <li> + <p>number of iterations: 10</p> + </li> + <li> + <p>compute SVD with: Propack</p> + </li> + <li> + <p>clustering algorithm: PDDP </p> + </li> + <li> + <p>principal directions: 1</p> + </li> + <li> + <p>maximum number of PCs: - </p> + </li> + <li> + <p>variant: basic </p> + </li> + <li> + <p>number of clusters: 10 </p> + </li> + <li> + <p>number of factors: 10 </p> + </li> + </ul> + <p align="justify"> + and you want to store results at directory "medline". + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="nnmf2.html">Step 2</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf2.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf2.html new file mode 100644 index 0000000000000000000000000000000000000000..7f97736896f2e17ba0605073d413d11e71addae7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf2.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Non-Negative Factorizations Module (nnmf_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Initially select the operation you want to perform, by pressing the corresponding radio button at the upper left frame. </p> + </li> + <li> + <p align="justify">The selection of a radio button activates the required fields in the GUI, while deactivating the rest fields. </p> + </li> + </ul> + <p align="center"> + <img src="images/nnmf_gui.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="nnmf3.html">Step 3</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf3.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf3.html new file mode 100644 index 0000000000000000000000000000000000000000..0bc5cbddb5e71535c2597356a82cd70c1906806c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf3.html @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Non-Negative Factorizations Module (dr_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Fill in the required fields, by pressing the check buttons, editing the edit boxes or selecting the appropriate files/variables by pressing the Browse button. </p> + </li> + </ul> + <p align="center"> + <img src="images/nnmf_gui1.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="nnmf4.html">Step 4</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf4.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf4.html new file mode 100644 index 0000000000000000000000000000000000000000..b951a7d7edc2f669b632002aa8a328c8e9063e7f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/nnmf4.html @@ -0,0 +1,57 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Non-Negative Factorizations Module (dr_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Press the "Continue" button in order to perform selected operation. </p> + </li> + <li> + <p align="justify">Results will be saved to the workspace. Furthermore, directory "nnmf/k_10/mlup" will be created under "TMG_HOME/data/medline" with each output variable stored to a single ".mat" file. </p> + </li> + </ul> + <p align="center"> + <img src="images/nnmf_gui2.jpg" width="635" height="454" /> + </p> + <ul> + <li> + <p align="justify">Press the Reset button in order to change the input. </p> + </li> + </ul> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="nnmf1.html">Start Page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/pddp_response.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/pddp_response.html new file mode 100644 index 0000000000000000000000000000000000000000..07c573a4aa986a5f3792c7082826b2239c9d3b97 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/pddp_response.html @@ -0,0 +1,2650 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" > +<head> +<title>TMG: PDDP response</title> +<link href="tmgstyle.css" rel="../documentation/stylesheet" type="text/css" /> +</head> +<body> + <center> + <span style="font-size: 24pt"> + <hr />TMG: PDDP Response<br /> + <hr /> + </span> + </center> +<center><table> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center; border-style: solid; border-width: 1px"> + Node 1 + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: right"> + ______ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: center"> + _____|_____ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: left"> + ______ + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center"> + | + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center"> + | + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center; border-style: solid; border-width: 1px"> + Node 2 + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center; border-style: solid; border-width: 1px"> + Node 3 + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: right"> + ______ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: center"> + _____|_____ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: left"> + ______ + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: right"> + ______ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: center"> + _____|_____ + </td> + <td style="width: 100px; text-align: center"> + ____________ + </td> + <td style="width: 100px; text-align: left"> + ______ + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center"> + | + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center"> + | + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center"> + | + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center"> + | + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center; border-style: solid; border-width: 1px"> + <a href="#b1">Cluster 1</a> + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center; border-style: solid; border-width: 1px"> + Node 7 + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center; border-style: solid; border-width: 1px"> + <a href="#b2">Cluster 2</a> + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center; border-style: solid; border-width: 1px"> + <a href="#b3">Cluster 3</a> + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: right"> + ______ + </td> + <td style="width: 100px; text-align: center"> + _____|_____ + </td> + <td style="width: 100px; text-align: left"> + ______ + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center"> + | + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center"> + | + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center; border-style: solid; border-width: 1px"> + <a href="#b4">Cluster 4</a> + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px; text-align: center; border-style: solid; border-width: 1px"> + <a href="#b5">Cluster 5</a> + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + </tr> + <tr> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + <td style="width: 100px"> + + </td> + </tr> +</table></center><br><br><br><p><a name="b1">Cluster 1 (306 documents): </a><br> + Document 18: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.18 + bilateral popliteal cysts in a patient with rheumatoid arthritis <br> + Document 23: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.23 + renal amyloidosis a clinicopathological study <br> + Document 27: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.27 + amyloid goitre a case report <br> + Document 31: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.31 + a case of interventricular septal defect with dextrocardia and situs <br> + Document 33: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.33 + the localizing significance of limited simultaneous visual form <br> + Document 34: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.34 + visual anosognosia in cortical blindness anton s symptom <br> + Document 35: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.35 + the development of social attachments in infancy <br> + Document 36: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.36 + separation anxiety as a cause of early emotional problems in children <br> + Document 49: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.49 + the effect of selenium on the upper respiratory passages <br> + Document 53: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.53 + hypothermia physiologic effects and clinical application <br> + Document 57: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.57 + hyperglycemic coronary perfusion effect of hypothermia on myocardial <br> + Document 75: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.75 + postural changes in blood distribution and its relation to the change in <br> + Document 76: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.76 + comparative studies of the glycogen content of heart liver and brain <br> + Document 80: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.80 + rate of change of carbon dioxide tension in arterial blood jugular <br> + Document 84: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.84 + heparin levels during and after hypothermic perfusion <br> + Document 86: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.86 + acute leukemia associated with phenylbutazone treatment a review of <br> + Document 87: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.87 + absorbed radiation dose and excretion of cesium in humans <br> + Document 88: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.88 + radiocardiography principles and methods <br> + Document 97: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.97 + attitudinal factors in congenital heart disease <br> + Document 98: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.98 + maternal anxiety during pregnancy and adequacy of mother and child <br> + Document 100: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.100 + the ophthalmologist s role in the management of dyslexia <br> + Document 101: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.101 + unusual course of internal carotid artery accompanied by bitemporal <br> + Document 102: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.102 + frontal lobes and vision <br> + Document 103: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.103 + physiologic bitemporal hemianopsia in pregnancy <br> + Document 106: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.106 + anaphylactoid shock induced by oral penicillin and resulting in <br> + Document 107: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.107 + disturbances of the verbal body image a particular syndrome of sensory <br> + Document 112: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.112 + cardiac malformations associated with ventricular septal defect <br> + Document 113: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.113 + anatomic types of single or common ventricle in man morphologic and <br> + Document 116: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.116 + ventricular septal defect and aortic regurgitation clinical hemodynamic <br> + Document 120: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.120 + early effects of digitalis on central hemodynamics in normal subjects <br> + Document 122: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.122 + aneurysm of the membranous septum <br> + Document 124: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.124 + factors limiting survival after circulatory occlusion under hypothermia <br> + Document 125: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.125 + the effect of hypothermia on circulatory reflexes in the human <br> + Document 139: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.139 + surgical aspects of heart disease in pregnancy <br> + Document 157: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.157 + comparison of central aortic and peripheral artery pressure curves <br> + Document 193: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.193 + the spectrum of lupus nephritis <br> + Document 200: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.200 + psychology of children s dental treatment <br> + Document 201: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.201 + relation of emotional changes during pregnancy to obstetric <br> + Document 202: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.202 + stranger and separation anxiety in infancy <br> + Document 203: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.203 + mental retardation related to hypercalcaemia <br> + Document 204: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.204 + psychological effects of circumcision <br> + Document 205: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.205 + changes in children s behavior after hospitalization some dimensions of <br> + Document 217: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.217 + see saw nystagmus an unusual sign of lesions near the third ventricle <br> + Document 220: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.220 + cerebro vascular lesions and livedo reticularis <br> + Document 221: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.221 + seesaw nystagmus case report elucidating the mechanism <br> + Document 222: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.222 + supratentorial paratransversal meningiomas <br> + Document 227: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.227 + prostatic cancer of a young person with primary hypogonadism <br> + Document 238: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.238 + ventricular septal defect with prolapsed aortic valve and outflow tract <br> + Document 240: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.240 + mitral atresia associated with pulmonary venous anomalies <br> + Document 242: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.242 + surgical treatment of ventricular septal defect <br> + Document 243: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.243 + some hemodynamic observations in congenital heart disease with special <br> + Document 244: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.244 + a study on the direction of inscription of the vectorcardiographic <br> + Document 249: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.249 + multivariate comparison of results of treatment in chronic lymphocytic <br> + Document 251: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.251 + drugs and neonatal jaundice <br> + Document 253: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.253 + radical operation for ventricular septal defect in infancy <br> + Document 260: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.260 + ventricular septal defect with aortic insufficiency a clinical and <br> + Document 261: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.261 + radioisotope photoscanning as a diagnostic aid in cardiovascular disease <br> + Document 268: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.268 + internal cooling for general hypothermia <br> + Document 271: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.271 + the response of dogs to perfusion and arrest of circulation at near zero <br> + Document 272: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.272 + effects of graded hemorrhage on cardiopulmonary functions of hypothermic <br> + Document 273: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.273 + hypothermia in management of acute renal failure <br> + Document 279: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.279 + differentiation of exfoliative broncho alveolar disease from desquamative <br> + Document 289: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.289 + cisternal fluid oxygen tension in man <br> + Document 292: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.292 + cerebral hemodynamics blood gases and electrolytes <br> + Document 293: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.293 + respiratory and cardiovascular changes during rapid spon <br> + Document 309: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.309 + interventricular septal defects with aortic insufficiency <br> + Document 311: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.311 + aortico left ventricular tunnel a cause of massive aortic regurgitation <br> + Document 312: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.312 + the haemodynamic implications of the bisferiens pulse <br> + Document 314: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.314 + pulmonary atresia with intact ventricular septum <br> + Document 315: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.315 + intra atrial pressure measurement and electrocardiography in the <br> + Document 316: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.316 + ventricular septal aneurysms a report of two cases <br> + Document 317: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.317 + electrode catheters and the diagnosis of ebstein s anomaly <br> + Document 318: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.318 + unusual aneurysm of the membranous interventricular septum <br> + Document 319: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.319 + laevocardia with situs inversus a case report and a review of literature <br> + Document 323: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.323 + left ventricular angiocardiography in the study of ventricular <br> + Document 338: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.338 + hand eczema <br> + Document 340: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.340 + the pathogenesis of contact eczema due <br> + Document 349: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.349 + agnostic alexia and constructive apraxia with regressive evolution in <br> + Document 350: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.350 + the symptomatology of the parietal cerebral syndrome of the dominant <br> + Document 351: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.351 + observations on colour agnosia <br> + Document 352: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.352 + bitemporal hemianopia <br> + Document 353: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.353 + ophthalmic manifestations of bilateral non occipital cerebral lesions <br> + Document 354: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.354 + the speed of reading basis for a clinical function test <br> + Document 355: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.355 + the problem of visual agnosia <br> + Document 356: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.356 + dysbarism among hyperbaric personnel <br> + Document 357: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.357 + visual static agnosia with special reference to literal agnosic alexia <br> + Document 358: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.358 + optic agnosia semeiological and pathogenetic aspects <br> + Document 359: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.359 + clinical observations on hemianopia japanese <br> + Document 360: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.360 + importance of campimetry and carotid and vertebral angiography in <br> + Document 361: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.361 + hemianopsia and glaucoma <br> + Document 365: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.365 + the nature of collagen disease particularly of systemic lupus <br> + Document 366: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.366 + therapy of lupus nephropathies by mercaptopurine <br> + Document 367: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.367 + lupus erythematosus with fatal hemorrhage into the liver and lesions <br> + Document 371: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.371 + chronic renal diseases and pregnancy a review <br> + Document 379: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.379 + myocardial toxicity of contrast agents used in angiography <br> + Document 381: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.381 + radioactive isotope determination of myocardial blood <br> + Document 382: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.382 + risa ventriculography and risa cisternography <br> + Document 384: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.384 + aberrant left coronary artery <br> + Document 387: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.387 + demonstration of myocardial infarction by photoscans of <br> + Document 388: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.388 + y angiocardiography <br> + Document 391: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.391 + the use of 99m tc pertechnetate in cardiac scanning <br> + Document 392: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.392 + the use of technetium 99m as a clinical tracer element <br> + Document 407: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.407 + pitfalls in the clinical and histologic diagnosis of broncho <br> + Document 409: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.409 + the simultaneous use of extracorporal circulation and hypothermia in the <br> + Document 410: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.410 + cardiac performance in hypothermia an experimental study of left <br> + Document 411: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.411 + tolerance of dogs to deep hypothermia controlled and maintained with a <br> + Document 412: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.412 + bleeding tendencies associated with profound hypothermia technics in <br> + Document 413: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.413 + the use of hypothermia and dehydration in the treatment of severe <br> + Document 414: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.414 + selective cerebral hypothermia physiology and technic <br> + Document 415: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.415 + cardiac activity in cranio cerebral hypothermia <br> + Document 418: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.418 + flow considerations in regional cerebral hypothermia <br> + Document 419: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.419 + selective brain cooling produced by cerebral ventricular perfusion <br> + Document 420: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.420 + optimal coronary flow in the bypassed normothermic and hypothermic heart <br> + Document 421: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.421 + extracorporeal hypothermia without thoracotomy an ex <br> + Document 422: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.422 + profound hypothermia <br> + Document 423: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.423 + systemic hypothermia via gastric cooling <br> + Document 456: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.456 + diffuse tracheo bronchial amyloidosis a rare variant of a protean disease <br> + Document 461: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.461 + development of amylosis in less than months in the course of a primary <br> + Document 464: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.464 + tumoral amyloidosis of the lung <br> + Document 484: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.484 + death anxiety in children with a fatal illness <br> + Document 485: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.485 + the theory and practice of the family diagnostic ii theoretical <br> + Document 487: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.487 + early indicators of outcome in schizophrenia <br> + Document 488: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.488 + on the formation of object relations and identifications of the <br> + Document 490: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.490 + the death of a parent <br> + Document 491: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.491 + the child s concept of death <br> + Document 492: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.492 + mother child interaction during separation individuation <br> + Document 493: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.493 + the emotional needs of children in hospital <br> + Document 494: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.494 + early childhood separations <br> + Document 495: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.495 + changes in developmental quotient under two conditions of maternal <br> + Document 497: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.497 + separation experiences and health records in a group of normal adults <br> + Document 514: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.514 + selenium content of fish flour in relation to kwashiorkor and dental <br> + Document 528: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.528 + selenium toxicity in domestic animals <br> + Document 550: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.550 + control of idiopathic hypercalciuria <br> + Document 559: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.559 + mediastinal parathyroid adenoma <br> + Document 572: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.572 + pheochromocytoma <br> + Document 604: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.604 + on language disorders in young children a reorganization of thinking <br> + Document 605: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.605 + therapy for hearing impaired children <br> + Document 608: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.608 + stimulus overload action cycles and the completion gradient <br> + Document 609: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.609 + children at kelbourne <br> + Document 610: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.610 + deafness <br> + Document 611: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.611 + pharyngoplasty in speech <br> + Document 612: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.612 + verbal effects in the intermediate size transportation problem <br> + Document 613: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.613 + the acquisition of formal features of language <br> + Document 614: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.614 + mongolism some clinical aspects <br> + Document 615: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.615 + learning problems in children ii emotional aspects <br> + Document 616: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.616 + management of communication problems in infants and children <br> + Document 617: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.617 + the formation of a cleft palate unit a preliminary report <br> + Document 618: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.618 + acquisition of language <br> + Document 619: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.619 + the speech production and spoken language of the deaf <br> + Document 620: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.620 + cognitive functioning in early infantile autism an examination of four cases <br> + Document 622: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.622 + congenital heart disease deaf mutism and associated somatic malformations <br> + Document 623: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.623 + histidinemia <br> + Document 625: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.625 + evolution of a characteristic speech disorder in <br> + Document 626: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.626 + relation of crying activity in early infancy to speech and intellectual <br> + Document 629: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.629 + cineradiographic comparison of normal to noncleft subjects with velopharyngeal <br> + Document 630: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.630 + spontaneous verbal rehearsal in a memory task as a function of age <br> + Document 631: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.631 + early experience and the socialization of cognitive modes in children <br> + Document 633: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.633 + pneumonia due to mycoplasma pneumoniae <br> + Document 650: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.650 + epidemiology of mycoplasma pneumoniae <br> + Document 651: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.651 + case of salpingitis due to pleuro pneumonalike <br> + Document 661: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.661 + problems of disease of <br> + Document 669: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.669 + renal factors in the pathogenesis of hypertension <br> + Document 679: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.679 + hyperaldosteronism hyperplasia of the <br> + Document 696: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.696 + the treatment of pituitary responsive <br> + Document 699: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.699 + antidiuretic properties of chlorothiazide <br> + Document 701: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.701 + fibrin and thrombosis in the central nervous system <br> + Document 702: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.702 + hydrocephalus due to unrecognized cerebellar <br> + Document 703: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.703 + hydrocephalus <br> + Document 704: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.704 + a case of unilateral hydrocephalus secondary to occlusion of <br> + Document 705: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.705 + calcification within congenital aneurysms <br> + Document 707: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.707 + congenital malformations of c n s <br> + Document 708: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.708 + experimental studies on cerebrospinal <br> + Document 709: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.709 + the dandy walker syndrome <br> + Document 710: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.710 + a probable epidemic of congenital <br> + Document 712: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.712 + hydrocephalus changes in formation and absorption <br> + Document 714: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.714 + intraventricular papilloma <br> + Document 715: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.715 + five year comparative study of hydrocephalus in <br> + Document 716: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.716 + hydrocephalus <br> + Document 718: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.718 + congenital malformations <br> + Document 719: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.719 + the family history of spina bifida cystica <br> + Document 722: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.722 + bilateral papilloma of the choroid plexus <br> + Document 723: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.723 + the diagnosis of hydrocephalus <br> + Document 724: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.724 + infantile hydrocephalus and hematoma in the posterior fossa <br> + Document 725: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.725 + urinary excretion of i131 diodrast injected intraventricularly <br> + Document 726: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.726 + gastrointestinal <br> + Document 740: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.740 + biliary tract morphology and prognosis <br> + Document 742: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.742 + congenital atresia of <br> + Document 744: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.744 + extrahepatic biliary atresia comments on the <br> + Document 749: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.749 + congenital anomalies of the cystic duct <br> + Document 754: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.754 + trisomy syndrome with congenital <br> + Document 757: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.757 + les icteres du nouveau ne en dehors <br> + Document 759: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.759 + galactosemie congenitale <br> + Document 766: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.766 + jaundice in infancy <br> + Document 767: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.767 + absence of the cystic duct <br> + Document 768: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.768 + familial extrahepatic biliary atresia <br> + Document 769: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.769 + linfangiografia no estudo da filariase linfatica <br> + Document 778: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.778 + pelvic perfusion and carcinoma <br> + Document 790: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.790 + carcinoma of the middle ear <br> + Document 797: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.797 + toilet training of an autistic eight year old through <br> + Document 799: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.799 + eeg abnormalities in early childhood schizophrenia <br> + Document 800: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.800 + on early infantile psychosis <br> + Document 801: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.801 + autopathy follow up of cases <br> + Document 802: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.802 + sensory dominance <br> + Document 803: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.803 + dreaming sleep in autistic twins <br> + Document 804: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.804 + twins discordant <br> + Document 805: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.805 + evaluation and treatment planning <br> + Document 807: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.807 + group psychotherapy with preschool <br> + Document 808: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.808 + autistic reactions in early childhood <br> + Document 809: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.809 + infantile autism a family approach <br> + Document 810: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.810 + an analysis of the language of fourteen <br> + Document 811: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.811 + a behavioural and electroencephalographic <br> + Document 812: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.812 + the autistic child in the school and the <br> + Document 813: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.813 + the autistic child <br> + Document 814: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.814 + shadow therapy <br> + Document 815: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.815 + language training in the treatment <br> + Document 817: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.817 + infantile autism and the schizophrenias <br> + Document 818: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.818 + autistic children <br> + Document 819: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.819 + gilles de la tourette syndrome in an autistic child <br> + Document 820: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.820 + psychodrama for disturbed children <br> + Document 821: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.821 + the speech and language abilities of <br> + Document 822: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.822 + a study of childhood schizophrenia <br> + Document 823: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.823 + discussion sur les pseudo tumeurs osseuses <br> + Document 824: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.824 + the effect of joint position on the pressure <br> + Document 827: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.827 + osteopatia in emofilia <br> + Document 828: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.828 + la plasmatherapie a minima dans le traitement de la <br> + Document 829: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.829 + effet analgesique immediat des injections de plasma <br> + Document 830: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.830 + hip disarticulation in a <br> + Document 833: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.833 + discussion sur les donnees radiologiques <br> + Document 834: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.834 + etude radiographique des genoux de hemophiles <br> + Document 835: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.835 + blood vascular disorders in <br> + Document 837: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.837 + klinik der polyarthrosen <br> + Document 838: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.838 + major surgical procedures <br> + Document 839: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.839 + the prevention of crippling <br> + Document 849: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.849 + early infantile autism and receptor processes <br> + Document 853: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.853 + a genetic study of neonatal obstructive jaundice <br> + Document 864: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.864 + sudden hypocalcemia in normal and hypoparathyroid subjects <br> + Document 867: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.867 + acute hyperparathyroidism a surgical emergency <br> + Document 871: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.871 + radiation necrosis of the brain in acromegaly <br> + Document 877: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.877 + the development of bilateral adenomatous adrenal hyperplasia <br> + Document 884: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.884 + clinical features of the alalies russian <br> + Document 885: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.885 + an unusual form of acquired aphasia in children <br> + Document 886: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.886 + childhood echolalia in delayed psychotic and neuropathologic <br> + Document 887: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.887 + speech as a landmark in development <br> + Document 888: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.888 + the applicability of individualized programed instruction <br> + Document 889: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.889 + the impact of individual differences on language learning <br> + Document 890: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.890 + the oral language performance of premature children and controls <br> + Document 891: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.891 + speech and reading problems in childhood <br> + Document 892: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.892 + disorders of communication in young children <br> + Document 893: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.893 + acquired aphasia in children <br> + Document 894: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.894 + the causes of delayed development of speech <br> + Document 895: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.895 + concept learning in culturally disadvantaged children as <br> + Document 896: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.896 + concept development and language instruction <br> + Document 897: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.897 + formal speech characteristics as a diagnostic aid in childhood <br> + Document 898: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.898 + cerebral dominance and speech acquistion in deaf children <br> + Document 901: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.901 + serologic epidemiologic studies with m pneumoniae ii prevalence of <br> + Document 912: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.912 + immunopathologic changes in rheumatoid arthritis synovium <br> + Document 914: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.914 + long term prognosis and the response of schizophrenic children <br> + Document 915: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.915 + the long term treatment of a psychotic child in a psychiatric hospital <br> + Document 916: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.916 + comments on a case of infantile psychosis <br> + Document 917: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.917 + the problems of infantile autism and psychiatric nosology <br> + Document 918: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.918 + families of children with early childhood schizophrenia <br> + Document 919: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.919 + childhood psychosis <br> + Document 920: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.920 + psychotic reactions of childhood experiences of a mental retardation <br> + Document 921: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.921 + modification of autistic behavior with lsd <br> + Document 922: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.922 + the influence of organic and emotional factors on the origins nature <br> + Document 923: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.923 + compliance and resistance in the conditioning of autistic children <br> + Document 924: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.924 + the etiology of autistic syndromes of children <br> + Document 925: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.925 + acquisition of imitative speech by schizophrenic children <br> + Document 926: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.926 + hallucinations in children at a state hospital <br> + Document 927: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.927 + treatment of childhood schizophrenia a three year comparison of day <br> + Document 928: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.928 + visual versus tactual receptor preference in normal and schizophrenic <br> + Document 931: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.931 + hypertensive vascular disease produced by homologous renin <br> + Document 934: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.934 + some speculations on the nature and significance of developmentally <br> + Document 937: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.937 + bilateral renal hypoplasia of the pig <br> + Document 946: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.946 + diabetes insipidus treated with synthetic lysine vasopressin <br> + Document 948: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.948 + pituitary diabetes insipidus associated with progressive urinary <br> + Document 949: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.949 + the antidiuretic effect of angiotensin in diabetes insipidus <br> + Document 950: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.950 + polyuria in children <br> + Document 956: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.956 + congenital hydronephrosis <br> + Document 958: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.958 + familial renal diabetes insipidus <br> + Document 959: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.959 + evaluation of years experience with the treatment of hydrocephalus <br> + Document 961: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.961 + coexistent cranial and spinal defects with hydrocephalus in five <br> + Document 964: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.964 + pneumoencephalographic changes in the cavum septi pellucidi and their <br> + Document 965: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.965 + posterior scalloping of vertebral bodies in uncontrolled hydrocephalus <br> + Document 966: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.966 + electroencephalographic picture of the infantile hydrocephalus <br> + Document 968: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.968 + fanconi s anaemia with hydrocephalus and thyroid abnormality <br> + Document 969: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.969 + dandy walker taggart syndrome a case report <br> + Document 970: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.970 + hydrocephalus due to smallpox occurring in the fetal period <br> + Document 971: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.971 + air pantopaque ventriculography in congenital hydrocephalus and <br> + Document 972: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.972 + two cases of dandy walker s syndrome <br> + Document 973: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.973 + incidence and treatment of post meningitic hydrocephalus in the newborn <br> + Document 976: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.976 + a polyethylene tube culture method for the diagnosis of parasitic <br> + Document 981: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.981 + a review of immunologic methods for the diagnosis of filariasis <br> + Document 1004: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1004 + congenital extrahepatic biliary atresia a successful operated case on <br> + Document 1006: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1006 + the importance of steroid hormones in hyperbilirubinemia and icterus <br> + Document 1010: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1010 + the surgery of infantile obstructive jaundice <br> + Document 1014: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1014 + spherocytic anemia with early deglobulisation crisis and avitaminosis a <br> + Document 1015: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1015 + neonatal hepatitis or familial neonatal obstructive jaundice <br> + Document 1021: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1021 + haemophilic pseudotumours cases <br> + Document 1023: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1023 + bilateral hemophilic pseudotumors of the calcaneus and cuboid treated <br> + Document 1025: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1025 + studies of the antihemophilic factor ahf factor viii produced in von <br> + Document 1026: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1026 + tumor like bone lesions in hemophilia <br> + Document 1027: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1027 + concurrent hemophilia and christmas disease in one family <br> + Document 1029: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1029 + major surgery in classic hemophilia using fraction i experience in <br> + Document 1030: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1030 + lengthening of the thrombin time by an anti equine antithrombin in a <br> + Document 1032: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1032 + femoral neuropathy in hemophilia <br> +</p><p><a name="b2">Cluster 2 (214 documents): </a><br> + Document 7: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.7 + lipid metabolism in toxemia and normal pregnancy <br> + Document 16: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.16 + treatment of active chronic hepatitis and lupoid hepatitis with <br> + Document 17: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.17 + treatment of collagen diseases with cytostatics <br> + Document 19: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.19 + systemic lupus erythematosus and renal transplantation report of two <br> + Document 20: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.20 + arteritis and localised periosteal new bone formation <br> + Document 25: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.25 + corticosteroid therapy of amyloid nephrotic syndrome <br> + Document 26: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.26 + renal amyloidosis a biopsy study <br> + Document 28: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.28 + amyloid starch gel electrophoretic analysis of some proteins extracted <br> + Document 29: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.29 + selectivity of protein excretion in patients with the nephrotic syndrome <br> + Document 30: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.30 + some aspects of haemostasis after open heart surgery <br> + Document 32: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.32 + excretion patterns of urinary metabolites of estradiol c14 in <br> + Document 40: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.40 + intradermal test using cobalt chloride <br> + Document 56: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.56 + current status of hypothermia <br> + Document 62: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.62 + pneumocystis carinii pneumonia case studies with electron microscopy <br> + Document 63: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.63 + the effect of dehydroepiandrosterone on the dehydroxycorticosteroids in <br> + Document 66: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.66 + urinary steroid estimations in the prediction of response to <br> + Document 77: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.77 + altered immunologic activity in sarcoidosis <br> + Document 82: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.82 + cesium uptake and distribution in the human heart an analysis of <br> + Document 92: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.92 + demonstration of ventricular aneurysms by radioisotope scanning <br> + Document 95: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.95 + rapid transformation of human fibroblast cultures by simian virus <br> + Document 104: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.104 + evoked response in visual disorders <br> + Document 105: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.105 + optokinetic nystagmus and occipital lesions <br> + Document 110: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.110 + visual neglect <br> + Document 111: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.111 + respiratory changes after open heart surgery <br> + Document 114: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.114 + congenital heart disease in the adult <br> + Document 115: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.115 + a study of ventricular septal defect associated with aortic <br> + Document 117: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.117 + current techniques in the surgical approach to aortic and mitral <br> + Document 118: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.118 + effects of aortic regurgitation on left ventricular performance direct <br> + Document 121: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.121 + measurement of pericardial fluid correlated with the i cholografin and <br> + Document 140: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.140 + traumatic lesions of the optic chiasma a report of four cases <br> + Document 141: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.141 + lung cancer an evolutionary approach <br> + Document 148: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.148 + plasma hydroxycorticosteroids and oxosteroids in patients with <br> + Document 149: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.149 + hormone therapy in metastatic breast cancer clinical response and <br> + Document 150: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.150 + plasma androgens in women i normal and non hirsute females <br> + Document 151: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.151 + oophorectomy and cortisone treatment as a method of eliminating <br> + Document 192: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.192 + moderate hypothermia in man haemodynamic and metabolic effects <br> + Document 214: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.214 + studies in sickle cell anemia xxi clinico pathological aspects of <br> + Document 215: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.215 + attenuation curves of the human eye under normal and pathological <br> + Document 216: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.216 + central nervous system manifestations of periarteritis nodosa <br> + Document 218: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.218 + implications of gerstmann s syndrome <br> + Document 219: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.219 + alterations of visual evoked response in the presence of homonymous <br> + Document 225: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.225 + progynon a depot preparation with oestrogenic action in the treatment <br> + Document 226: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.226 + urinary ketosteroid excretion study in radiation induced menopause <br> + Document 228: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.228 + urinary excretion of neutral ketosteroids and pregnanediol by <br> + Document 229: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.229 + i urinary excretion of neutral ketosteroids and pregnanediol by <br> + Document 239: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.239 + functional adaptations of the right ventricular outflow tract in <br> + Document 241: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.241 + basal metabolic rate after cardiovascular surgery <br> + Document 245: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.245 + pulmonary vascular plexiform lesion pathogenetic studies <br> + Document 246: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.246 + renal hemosiderosis blue kidney in patients with valvular heart <br> + Document 247: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.247 + tumor scanning with radioactive cesium <br> + Document 252: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.252 + amputation in patients over years of age <br> + Document 258: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.258 + the determinants of cerebrospinal fluid po2 the effects of oxygen and <br> + Document 267: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.267 + surgical treatment of atrial septal defect under hypothermia <br> + Document 299: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.299 + oxygen tension in human malignant disease under hyperbaric <br> + Document 303: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.303 + hypoxic hypercapnic interaction in subjects with bilateral <br> + Document 306: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.306 + analytic study of the a and b lipoprotein micellar groups <br> + Document 310: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.310 + measurement of aortic regurgitation by upstream sampling with continuous <br> + Document 313: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.313 + left ventricular function following replacement of the <br> + Document 320: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.320 + postoperative aneurysm of the right ventricle <br> + Document 321: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.321 + ventricular septal defect with aortic regurgitation <br> + Document 322: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.322 + the natural history of arrhythmias following septal defect reapir <br> + Document 328: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.328 + epinephrine infusions in normal and toxemic pregnancies <br> + Document 339: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.339 + steroid aerosol spray in contact dermatitis <br> + Document 362: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.362 + disorders of oculomotor functions in lesions of the optic pathway at the <br> + Document 363: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.363 + binocularity in anomalous retinal correspondence <br> + Document 364: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.364 + thioguanine in the treatment of certain autoimmune immunologic and <br> + Document 368: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.368 + early experiences with azathioprine in ulcerative colitis a note of <br> + Document 369: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.369 + effect of fluoropyrimidines on delayed cutaneous hypersensitivity <br> + Document 370: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.370 + data on etiology pathogenesis treatment results and survival period in <br> + Document 372: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.372 + the occurrence to cytomegalovirus infections in childhood leukemia <br> + Document 373: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.373 + on chorea lupus erythematosus and cerebral arteritis <br> + Document 376: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.376 + autoimmune hepatitis <br> + Document 377: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.377 + a comparison of the effects of selected cytotoxic agents on the primary <br> + Document 380: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.380 + studies on cardiac dimensions in intact <br> + Document 383: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.383 + measurement of the cardiac output and ventricular <br> + Document 385: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.385 + detection of heart shunts by means of i <br> + Document 386: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.386 + clinical applications of quantitative radiocardiography i <br> + Document 389: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.389 + the value of quantitative radiocardiography in the study <br> + Document 390: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.390 + the localization of aortic shunts developed by a precordial <br> + Document 393: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.393 + a study of central arteriovenous shunts by <br> + Document 406: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.406 + the value of fluorescence cytology for the cytodiagnosis <br> + Document 439: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.439 + the free and glucuronic acid bound <br> + Document 440: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.440 + reduced estriol excretion in patients <br> + Document 441: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.441 + urinary excretion of estrone <br> + Document 442: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.442 + systemic effects of androgenic <br> + Document 443: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.443 + the effect of dehydroepiandrosterone <br> + Document 444: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.444 + urinary excretion of estrone <br> + Document 445: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.445 + enzymic synthesis of steroid <br> + Document 446: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.446 + steroid excretion in early breast cancer <br> + Document 447: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.447 + the excretion of oestrone pregnanediol <br> + Document 448: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.448 + the excretion of oestrone <br> + Document 449: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.449 + estimation of the urinary <br> + Document 450: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.450 + influence of small doses of corticosteroids <br> + Document 451: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.451 + urinary ii deoxy oxosteroids <br> + Document 452: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.452 + the plasma ketosteroids and <br> + Document 453: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.453 + urinary porter silber chromogens <br> + Document 454: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.454 + amyloidosis in the autopsy material of the pathology department of <br> + Document 455: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.455 + certain features of the haemogram in patients with pulmonary tuberculosis <br> + Document 457: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.457 + modern methods of treatment of visceral amyloidosis in patients with <br> + Document 458: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.458 + the use of needle biopsy of the liver in the diagnosis of visceral <br> + Document 459: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.459 + the role of certain additional factors in the development of amyloidosis <br> + Document 460: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.460 + the decrease of the steroids in the urine in the course of lung tb <br> + Document 462: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.462 + the relations between lupus erythematosus and diseases of the <br> + Document 463: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.463 + value and significance of the prednisolone test in diseases of the kidney <br> + Document 467: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.467 + morphology and development of infectious toxic affections of the kidneys <br> + Document 496: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.496 + separation anxiety a factor in the object relations of <br> + Document 498: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.498 + separation and attempted suicide <br> + Document 535: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.535 + antigen analysis of sera from patients with malignant <br> + Document 545: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.545 + vergleichende renale phosphatelearance untersuchungen <br> + Document 546: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.546 + the unreliability of the titan yellow method <br> + Document 552: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.552 + the treatment of phosphatic encrusted cystitis <br> + Document 560: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.560 + clinical experience with <br> + Document 565: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.565 + decrease in serum and urinary phosphorus in man <br> + Document 577: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.577 + acromegaly <br> + Document 587: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.587 + growth retardation accompanying diabetes insipidus an additional <br> + Document 590: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.590 + effects of short term administration of <br> + Document 593: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.593 + studies with human growth hormone <br> + Document 603: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.603 + increased stature <br> + Document 607: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.607 + speech therapy with selected patients with <br> + Document 621: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.621 + otologic care of cleft palate cases <br> + Document 624: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.624 + interpretation within the metaphor <br> + Document 646: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.646 + studies on mycoplasma pneumoniae <br> + Document 655: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.655 + microbiological studies of reiter s disease <br> + Document 673: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.673 + concurrence of hyperplasia and <br> + Document 687: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.687 + the antidiuretic mechanism of hydrochlorothia <br> + Document 688: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.688 + the action of oral diuretics <br> + Document 689: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.689 + investigations into the thiazide induced antidiuresis in <br> + Document 690: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.690 + salt and water <br> + Document 691: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.691 + nephrogenic diabetes insipidus <br> + Document 692: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.692 + fluid and electrolyte metabolism in nephrogenic diabetes insipidus <br> + Document 693: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.693 + diuretics in pediatric practice <br> + Document 694: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.694 + the role of aldosterone and vasopressin in the postural <br> + Document 695: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.695 + the use and mode of action of ethacrynic acid <br> + Document 697: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.697 + antidiuretic effect of hydrochlorothiazide <br> + Document 698: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.698 + the effect of hydrochlorothiazide on water intake <br> + Document 706: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.706 + ventriculo venous shunts for infantile hydrocephalus <br> + Document 717: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.717 + recognition and treatment of hydrocephalus following <br> + Document 720: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.720 + pulmonary vascular changes complicating <br> + Document 741: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.741 + current concepts in the management <br> + Document 743: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.743 + neuroaxonal dystrophy in congenital <br> + Document 770: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.770 + adjuvant chemotherapy in cancer of the <br> + Document 771: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.771 + cancer chemotherapy by prolonged arterial <br> + Document 772: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.772 + the montgomery tube to palliate <br> + Document 773: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.773 + adjuvant cancer chemotherapy <br> + Document 774: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.774 + surgical palliation for lung cancer <br> + Document 775: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.775 + management of advanced endometrial <br> + Document 776: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.776 + chemotherapy of breast cancer <br> + Document 777: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.777 + clinical experience with palliation <br> + Document 779: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.779 + carcinoma of the esophagus <br> + Document 780: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.780 + carcinoma of bladder cobalt therapy <br> + Document 781: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.781 + polyposis of colon <br> + Document 782: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.782 + systemic chemotherapy <br> + Document 783: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.783 + combined fluorouracil and supervoltage <br> + Document 785: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.785 + chlorambucil prednisolone therapy <br> + Document 786: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.786 + recent advances in the treatment of <br> + Document 787: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.787 + cyclophosphamide in the management of <br> + Document 788: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.788 + esophageal obstruction <br> + Document 789: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.789 + palliative radiation therapy <br> + Document 791: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.791 + sustained palliation in <br> + Document 792: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.792 + clues in dealing with <br> + Document 793: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.793 + radon and radioactive seed volume implants <br> + Document 794: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.794 + terminal cancer nursed at home <br> + Document 795: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.795 + advanced cancer of the breast <br> + Document 796: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.796 + the management of disseminated <br> + Document 798: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.798 + incidence of symptoms of early infantile autism in <br> + Document 806: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.806 + a twenty five year view of <br> + Document 826: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.826 + treatment and prevention of chronic haemorrhagic <br> + Document 831: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.831 + haemophilia in sweden <br> + Document 832: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.832 + interet de la radiotherapie dans les hemarthroses <br> + Document 840: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.840 + throat and nose surgery <br> + Document 841: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.841 + hemophilic arthropathy <br> + Document 842: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.842 + prevention and treatment of joint deformity in haemophilia <br> + Document 848: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.848 + the regulation of growth hormone secretion <br> + Document 861: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.861 + j clin endocr <br> + Document 865: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.865 + parathyroid function in chronic renal failure a statistical survey <br> + Document 870: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.870 + a comparison of human placental lactogen hpl and human growth hormone <br> + Document 872: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.872 + experiences with hgh treatment of twelve hypopituitary <br> + Document 876: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.876 + treatment of short stature in children and adolescents <br> + Document 878: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.878 + hypopituitarism a study of growth <br> + Document 908: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.908 + isolation of mycoplasma pneumoniae from adults with respiratory <br> + Document 933: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.933 + extrarenal fibromuscular hyperplasia <br> + Document 944: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.944 + two brothers with nephrogenic diabetes insipidus <br> + Document 951: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.951 + treatment of diabetes insipidus synthetic lysine vasopressin <br> + Document 952: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.952 + synthetic lysine vasopressin nasal spray in the treatment <br> + Document 953: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.953 + diabetes insipidus treatment with lysine vasopressin in a nasal spray <br> + Document 960: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.960 + cerebrospinal fluid dynamics in the arnold chiari malformation <br> + Document 962: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.962 + hydrocephalus and myelomeningocele central nervous system infection <br> + Document 963: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.963 + myelomeningocele and hydrocephalus the first year of patients <br> + Document 967: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.967 + consecutive hydrocephalus report of cases <br> + Document 975: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.975 + filariasis in its relation to a a bo mn kell duffy and rhesus blood <br> + Document 982: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.982 + schultz dale reaction with sera of eosinophilic lung patients a <br> + Document 983: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.983 + an evaluation of the bentonite flocculation and indirect <br> + Document 985: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.985 + immunological studies on filariasis iii isolation and purification <br> + Document 987: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.987 + immunological studies on filariasis iii fractionation and <br> + Document 989: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.989 + chemotherapy of metastatic gastro intestinal cancer <br> + Document 990: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.990 + palliative treatment of osseous metastases from carcinoma of the breast <br> + Document 991: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.991 + regional chemotherapy by prolonged arterial infusions in head and neck <br> + Document 992: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.992 + intra arterial infusion emphasizing treatment of malignant neoplasms <br> + Document 993: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.993 + prolonged intra arterial chemotherapeutic infusion in cancer therapy <br> + Document 994: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.994 + intra arterial chemotherapy for cancer metastatic to liver <br> + Document 995: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.995 + cancer chemotherapy by continuous intra arterial infusion experience <br> + Document 996: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.996 + treatment of cancer by bacterial toxins <br> + Document 997: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.997 + radiotherapy of malignant rectal and anal tumors methods and results <br> + Document 998: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.998 + the management of advanced cancer <br> + Document 999: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.999 + evaluation of ileal conduit as a palliative procedure <br> + Document 1000: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1000 + cancer chemotherapy by continuous intra arterial infusion of <br> + Document 1001: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1001 + management of advanced ovarian carcinoma <br> + Document 1002: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1002 + liver resections for embolic metastases from cancer of the colon and <br> + Document 1003: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1003 + palliative treatment of nonresectable lung cancer by upper hemibody <br> + Document 1007: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1007 + problems in neonatal obstructive jaundice <br> + Document 1019: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1019 + major surgery on the severe hemophiliac lessons in management <br> + Document 1024: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1024 + some bone lesions in the course of blood diseases with special reference <br> + Document 1031: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1031 + epsilon aminocaproic acid e aca as a therapeutic agent based on <br> + Document 1033: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1033 + hemorrhagic episodes in hemophilia a year prospective study <br> +</p><p><a name="b3">Cluster 3 (170 documents): </a><br> + Document 14: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.14 + an autoradiographic study on cell migration in the eye lens epithelium <br> + Document 15: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.15 + lens development the differentiation of embryonic chick lens <br> + Document 44: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.44 + the influence of methemoglobinemia on the lethality of some toxic <br> + Document 47: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.47 + lesions of the islets of langerhans during injections of sodium selenite <br> + Document 52: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.52 + blood and bone marrow damage caused by drugs <br> + Document 54: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.54 + ehrlich ascites tumor cells agglutination the interference exerted by <br> + Document 55: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.55 + study on the behavior of tumor tissue in diffusion chambers against <br> + Document 58: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.58 + specific carcinoembryonic antigens of the human digestive system <br> + Document 59: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.59 + the course of influenza virus infection in mice organ tissues of <br> + Document 60: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.60 + comparative bone marrow study using two aspiration needles and two <br> + Document 61: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.61 + cell populations in the bone marrow of the normal guinea pig <br> + Document 67: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.67 + primary epidermoid cancer of the lung ultrastructural study <br> + Document 69: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.69 + acute experimental pneumococcal type i pneumonia in the mouse the <br> + Document 70: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.70 + a light and electron microscope study of developing respiratory tissue <br> + Document 71: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.71 + the pathogenesis of viral influenzal pneumonia in mice <br> + Document 73: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.73 + the role of alveolar inclusion bodies in the developing lung <br> + Document 78: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.78 + electron microscopy of cytoplasmic inclusions within macrophages of <br> + Document 79: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.79 + histological research on the lens in condition of hypoxia changes in <br> + Document 81: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.81 + studies on the compound lipids from x ray irradiated animal ii <br> + Document 91: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.91 + action of phytohaemagglutinin in vitro on the lymphocytes of chronic <br> + Document 93: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.93 + propagation of lactic dehydrogenase elevating virus in cell culture <br> + Document 94: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.94 + transformation of bovine cells in vitro after inoculation of simian <br> + Document 108: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.108 + chromosomal patterns in cancer patients during treatment <br> + Document 123: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.123 + distribution of transfused tritiated cytidine labeled leukocytes and red <br> + Document 130: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.130 + the inorganic constituents of human teeth and bone examined by x ray <br> + Document 137: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.137 + responses of b subtilis atcc to streptomycin <br> + Document 144: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.144 + on the mechanism of genetic recombination in transforming bacillus <br> + Document 147: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.147 + autolysis of bacillus subtilis by glucose depletion <br> + Document 152: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.152 + some reactions of cytotoxic antibodies against previously unknown mouse <br> + Document 154: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.154 + studies on the kinetics of transplantation immunity <br> + Document 155: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.155 + evidence for an immunological reaction of the host directed against its <br> + Document 156: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.156 + a comparison of the cytologic effects of leurosine methiodide and <br> + Document 160: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.160 + electron microscopy of the bovine lung the normal blood air barrier <br> + Document 166: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.166 + changes in dna rna and protein synthesis in the developing lens <br> + Document 172: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.172 + an electron microscopic study of wolffian lens regeneration in the adult <br> + Document 175: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.175 + the occurrence of biologic crystals in tumor and nontumor cultures of <br> + Document 176: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.176 + a comparison of the fine structure of cultured mac and hela cell <br> + Document 179: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.179 + bacteriophages that lyse mycobacteria and corynebacteria and show <br> + Document 185: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.185 + the identification of lysosomal enzymes in bovine lens epithelium <br> + Document 190: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.190 + on the mechanism of erythropoietin induced differentiation iv some <br> + Document 197: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.197 + transduction in bacillus subtilis <br> + Document 199: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.199 + infectivity of dna isolated from bacillus subtilis bacteriophage sp82 <br> + Document 206: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.206 + isozymes of lactic dehydrogenase sequential alterations during <br> + Document 207: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.207 + establishment of a cell line in vitro from a case of human lung cancer <br> + Document 209: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.209 + mitotic lymphocytes in primary tissue cultures of normal and neoplastic <br> + Document 210: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.210 + studies on transformation of syrian hamster cells by simian virus <br> + Document 213: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.213 + correlation between the mast cells and histamine content of the eye in <br> + Document 223: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.223 + life span and lymphoma incidence of mice injected at birth with spleen <br> + Document 230: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.230 + the morphologic demonstration of an alveolar lining layer and its <br> + Document 232: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.232 + alveolar lining cells and pulmonary reticuloendothelial system of the <br> + Document 233: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.233 + time course of changes in surface tension and morphology of alveolar <br> + Document 234: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.234 + cortisone and atypical pulmonary epithelial hyperplasia further <br> + Document 254: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.254 + specific suppression of tumor growth by isolated peritoneal macrophages <br> + Document 255: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.255 + effect of heterologous antiserum and complement on glycolysis of tumor <br> + Document 257: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.257 + the apparent immunofluorescence of tissue mast cells <br> + Document 259: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.259 + the behavior of lymphocytes in primary explants of human lung cancer in <br> + Document 262: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.262 + studies of hematology and bone marrow morphology in vitamin e deficient <br> + Document 263: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.263 + significance of blood groups in homotransplantation of marrow in the dog <br> + Document 264: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.264 + radioautographic studies of bone marrow lymphocytes in vivo and in <br> + Document 265: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.265 + autoradiographic study on the origin and fate of small lymphoid cells in <br> + Document 266: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.266 + the lymphocyte in guinea pig bone marrow <br> + Document 274: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.274 + effect of dosage on endotoxin induced changes in the reticuloendothelial <br> + Document 275: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.275 + vaccinia pneumonia in mice a light and electron microscopic and viral <br> + Document 276: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.276 + electron microscopy of the bovine lungs lattice and lamellar structures <br> + Document 277: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.277 + electron microscopy of the bovine lungs the blood air barrier in acute <br> + Document 278: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.278 + the ultrastructure of the lungs of lambs the relation of osmiophilic <br> + Document 280: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.280 + lysosomes in the rat sciatic nerve following crush <br> + Document 281: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.281 + histochemistry of surface epithelial and pleural mucins in mammalian <br> + Document 282: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.282 + maturation of postnatal human lung and the idiopathic respiratory distress <br> + Document 283: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.283 + lattice structures and osmiophilic bodies in the developing <br> + Document 284: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.284 + xanthogranuloma xanthoma of choroid plexus the origin of foamy <br> + Document 285: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.285 + mixed hematopoietic and pulmonary origin of alveolar macrophages as <br> + Document 286: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.286 + pulmonary alveolar proteinosis a study using enzyme histochemistry <br> + Document 287: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.287 + surface phenomena in lungs in health and disease <br> + Document 375: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.375 + chromosome aberrations in human cells following treatment with imuran <br> + Document 394: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.394 + information <br> + Document 395: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.395 + loss of neoplastic properties in vitro ii observations on <br> + Document 396: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.396 + establishment of a tissue culture strain jtc from actino <br> + Document 397: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.397 + microcinematographic study of the mechanism of cancerous <br> + Document 398: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.398 + the presence of lymphocytes in long term cultures of <br> + Document 399: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.399 + four separate tumour clones derived from a transplantable pleo <br> + Document 400: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.400 + in vitro culture of pulmonary tumors in hamsters caused by adenovirus <br> + Document 401: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.401 + demonstration purification and partial characterization of ab <br> + Document 402: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.402 + further comparative studies on two isogenic cell lines of autologous <br> + Document 403: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.403 + characteristics of human adenovirus type induced hamster tumor <br> + Document 405: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.405 + solitary mast cell granuloma histiocytoma of the lung <br> + Document 408: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.408 + effects of arginine deprivation ultraviolet radiation <br> + Document 424: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.424 + the dubious haemopoietic <br> + Document 425: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.425 + studies on growth and cytomorphosis <br> + Document 426: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.426 + the origin of macrophages <br> + Document 427: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.427 + studies of the <br> + Document 428: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.428 + relative ability of parental <br> + Document 429: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.429 + pluripotent stem cell function <br> + Document 430: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.430 + the effect of <br> + Document 431: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.431 + studies on intravenous transfusion <br> + Document 432: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.432 + studies on hypoxia iii the <br> + Document 433: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.433 + an investigation of lymphocyte <br> + Document 434: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.434 + repopulation of bone marrow <br> + Document 435: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.435 + hyperbasophilic cells as an <br> + Document 436: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.436 + autoradiographic <br> + Document 437: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.437 + lysozyme in bone <br> + Document 438: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.438 + proliferative activity of the <br> + Document 471: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.471 + the mechanism of messenger rna replication in bacteria <br> + Document 473: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.473 + symposium on the fine structure and replication of bacteria and their <br> + Document 474: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.474 + molecular mechanism of genetic recombination in bacterial transformation <br> + Document 476: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.476 + the mechanism of histidase induction and formation in bacillus subtilis <br> + Document 477: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.477 + the synthesis of phage and host dna in the establishment of lysogeny <br> + Document 478: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.478 + lag period characterizing the entry of transforming deoxyribonucleic acid <br> + Document 479: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.479 + configuration of transforming deoxyribonucleic acid during entry into <br> + Document 480: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.480 + chemical inactivation and reactivation of transforming dna russian <br> + Document 481: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.481 + separation of the transforming and viral deoxyribonucleic acids of a <br> + Document 482: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.482 + repair of damage induced by a monofunctional alkylating agent in a <br> + Document 512: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.512 + further autoradiographic studies of the lens epithelium <br> + Document 513: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.513 + chicken lens development epithelial cell production and <br> + Document 521: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.521 + cytotoxicity of organophosphorus compounds comparative activities of <br> + Document 529: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.529 + further studies on specific transplantation antigens in rous sarcoma of <br> + Document 531: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.531 + the effect of lymphoid cells from <br> + Document 533: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.533 + studies on protein and nucleic acid metabolism in virus in <br> + Document 534: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.534 + immunologic competence and induction of neoplasms by <br> + Document 539: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.539 + factors influencing the induction of enhancement and re <br> + Document 540: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.540 + antigenic properties of human tumours <br> + Document 541: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.541 + the incorporation of sv40 genetic material into adenovirus as <br> + Document 542: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.542 + fluorescent antibodies to human cancer specific dna and <br> + Document 543: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.543 + immunology of the cancer cell tumour specific antigens <br> + Document 637: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.637 + some intraspecies differences in antigens on <br> + Document 638: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.638 + coombs positive hemolytic anemia and generalized amyloidosis in <br> + Document 641: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.641 + mammalian cell cultures contaminated with <br> + Document 643: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.643 + a method for direct demonstration of pleuropneumonia like <br> + Document 644: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.644 + a fatal septicemic disease of infant puppies caused by <br> + Document 645: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.645 + chromosome changes in pplo infected fl human amnion cells <br> + Document 647: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.647 + spontane genetische veranderungen am zellstamm l earle <br> + Document 648: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.648 + chromosome changes in human diploid cell cultures infected <br> + Document 654: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.654 + further studies of agents isolated from tissue cultures inoculated <br> + Document 658: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.658 + further observations of the lymphomas <br> + Document 660: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.660 + pleuropneumonia like organisms <br> + Document 664: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.664 + the natural history of autoimmune <br> + Document 668: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.668 + cell proliferation <br> + Document 670: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.670 + cell proliferation in compensatory renal growth <br> + Document 674: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.674 + experimentelle nierenvergroberung nach unilateraler <br> + Document 678: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.678 + the role of age and x irradiation on kidney <br> + Document 680: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.680 + the juxtaglomerular cells of the kidney and the <br> + Document 681: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.681 + studies on eperythrozoon infection in sheep <br> + Document 682: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.682 + age differences in cellular <br> + Document 730: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.730 + experimental onchocercal ocular lesions in the chimpanzee <br> + Document 745: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.745 + metabolism and excretion of c14 labeled bilirubin in children <br> + Document 748: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.748 + an electron microscopic study of developing gall <br> + Document 750: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.750 + lesions of the liver in hereditary <br> + Document 756: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.756 + the inhibition of cell aggregation by a pure <br> + Document 758: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.758 + the immunological development of the human <br> + Document 763: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.763 + cytological and cytochemical study of <br> + Document 784: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.784 + palliation by radiotherapy <br> + Document 855: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.855 + actinomycin and erythropoiesis and the production of erythropoietin in <br> + Document 856: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.856 + the ultrastructure histopathology and <br> + Document 862: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.862 + tissue distribution of electrolytes ca and mg in experimental <br> + Document 900: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.900 + serologic epidemiologic studies with m pneumoniae i demonstration <br> + Document 903: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.903 + hela cells resistant to bromodeoxyuridine and deficient in thymidine <br> + Document 905: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.905 + chromosome studies of human cells infected in utero and <br> + Document 906: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.906 + fine structure of staphylococccal l forms <br> + Document 910: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.910 + effect of mycoplasma on interferon production and interferon assay in <br> + Document 911: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.911 + recovery and characterization of a herpes like virus from dog kidney <br> + Document 913: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.913 + electron microscopic studies of mycoplasma pplo strain in <br> + Document 935: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.935 + a study of induced renal hyperplasia using autoradiography <br> + Document 941: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.941 + kidney cell proliferation after unilateral nephrectomy as related <br> + Document 978: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.978 + preliminary report on the leucoconcentration technique applied to the <br> + Document 1008: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1008 + clinical study and histological study of the liver in hepatitis in <br> + Document 1009: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1009 + the pathology of giant cell hepatitis in early infancy <br> + Document 1013: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1013 + neonatal hepatitis liver biopsy findings and clinical features <br> + Document 1016: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1016 + hypoplasia of the intrahepatic bile ducts <br> + Document 1017: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1017 + fetal and neonatal hepatitis and its consequences <br> + Document 1028: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1028 + albinism associated with angiohemophilia report of a case <br> +</p><p><a name="b4">Cluster 4 (258 documents): </a><br> + Document 1: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1 + i <br> + Document 3: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.3 + surfactant in fetal lamb tracheal fluid <br> + Document 4: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.4 + placental and cord blood lipids comparison in a set of double ovum <br> + Document 5: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.5 + free fatty acid concentration in maternal plasma and fetal body fat <br> + Document 8: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.8 + essential fatty acids and acids with trans configuration in the <br> + Document 9: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.9 + acetoacetate formation by livers from human fetuses aged weeks <br> + Document 10: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.10 + changes in blood glucose and non esterified fatty acids in the foetal <br> + Document 11: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.11 + electron microscopic observatations on transference of fat through the <br> + Document 12: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.12 + the content of phosphatides triglycerides and cholesterol in placentas <br> + Document 13: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.13 + analysis of mammalian lens proteins by electrophoresis <br> + Document 21: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.21 + fine structure of subtilis phage sp <br> + Document 22: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.22 + genetic transcription during morphogenesis <br> + Document 24: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.24 + idiopathic autoimmune hemolytic anemia and idiopathic thrombocytopenic <br> + Document 37: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.37 + the production of malignant tumours by nickel in the rat <br> + Document 38: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.38 + studies of nickel carcinogenesis fractionations of nickel in <br> + Document 39: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.39 + a study of the inhibitory effect of ethylenediaminetetra acetic acid on <br> + Document 41: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.41 + measurements of nickel in biological materials by atomic absorption <br> + Document 42: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.42 + properties of activity of nucleotidase in human serum and <br> + Document 43: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.43 + some iminoselenazolidin ones and related compounds <br> + Document 45: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.45 + selenium as a trace element <br> + Document 48: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.48 + toxicity of sulfur selenium and tellurium to avian embryos <br> + Document 50: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.50 + the influence of small selenite doses upon the toxic fatty degeneration <br> + Document 51: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.51 + selenium caused tumours <br> + Document 64: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.64 + the meaning of ph at low temperatures during extra corporeal circulation <br> + Document 68: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.68 + biosynthesis of glycoproteins i incorporation of glucosamine c into <br> + Document 72: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.72 + studies on aging with horse crystalline lens gel as a contribution to <br> + Document 74: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.74 + retinal detachment cataract keratoconus as ocular symptom complex in <br> + Document 83: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.83 + oxygen consumption of paralysed men exposed to cold <br> + Document 85: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.85 + platelet sequestration in man i methods <br> + Document 89: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.89 + reaction of the adrenal cortex during controlled experimental <br> + Document 90: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.90 + use of a cross circulation technique in studying respiratory responses <br> + Document 96: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.96 + the tissue reaction to hyperbaric oxygen <br> + Document 99: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.99 + maternal separation in the rhesus monkey <br> + Document 109: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.109 + a few interesting neurologic manifestations of migraine <br> + Document 119: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.119 + the absorption and hepatic uptake of orally ingested radioactive vitamin <br> + Document 126: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.126 + studies in perfusion hypothermia with special reference to deep <br> + Document 127: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.127 + application of the emission spectrograph to the analytical needs of the <br> + Document 128: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.128 + nickel carbonyl its detection and potential for formation <br> + Document 129: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.129 + polarographic determination of heavy metals in air samples <br> + Document 131: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.131 + a kinetic study of nickel ii complexes of sulfur containing amino acid <br> + Document 132: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.132 + the action of metal ions on tobacco mosaic virus ribonucleic acid <br> + Document 133: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.133 + chromium lead cadmium nickel and titanium in mice effect on <br> + Document 134: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.134 + synergistic effects between antioxidants and selenium or vitamin e <br> + Document 135: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.135 + the expression of urine analysis results dash observations on the use <br> + Document 136: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.136 + activation and inactivation of p hydroxyphenylpyruvate hydroxylase <br> + Document 138: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.138 + phospholipids of the bovine rabbit and human lens <br> + Document 142: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.142 + the effects of electrophoretically separated lens proteins on lens <br> + Document 143: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.143 + enzymic synthesis of deoxyribonucleic acid xviii the repair of <br> + Document 145: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.145 + physical and biological studies on transforming dna <br> + Document 146: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.146 + comparison of mutation and inactivation rates induced in bacteriophage <br> + Document 153: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.153 + on the value of thymectomy in adult mice as a means of potentiating the <br> + Document 158: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.158 + changes in sphingosine and fatty acid components of the gangliosides in <br> + Document 159: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.159 + studies of the generalized shwartzman reaction induced by diet vi <br> + Document 161: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.161 + a sensitive and specific fluorescence assay for tissue serotonin <br> + Document 162: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.162 + effects of ruminal insufflation on cerebral circulation and metabolism <br> + Document 163: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.163 + a comparison between inhaled dust and the dust recovered from human <br> + Document 164: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.164 + dual cation activation of bovine lens autolysis <br> + Document 165: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.165 + nucleic acid metabolism in the lens iii effect of x radiation <br> + Document 167: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.167 + amino acid transport in the lens in relation to sugar cataracts <br> + Document 168: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.168 + visco elastic properties of the lens <br> + Document 169: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.169 + carbonic anhydrase distribution in rabbit lens <br> + Document 170: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.170 + changes in weight and adenosine triphosphate content in the lens of the <br> + Document 171: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.171 + identification of species specific and organ specific antigens in lens <br> + Document 177: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.177 + effect of parathyroid and other human tumors and tissues on bone <br> + Document 180: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.180 + gel filtration of the soluble proteins from normal and cataractous human <br> + Document 181: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.181 + the insoluble proteins of bovine crystalline lens <br> + Document 182: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.182 + glucose phosphate dehydrogenase and phosphogluconate dehydrogenase <br> + Document 183: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.183 + nucleic acid metabolism in the lens iii effect of x radiation <br> + Document 184: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.184 + an investigation of mitotic control in the rabbit lens epithelium <br> + Document 186: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.186 + protein synthesis and polyribosomes in the calf lens <br> + Document 187: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.187 + measurement of oxygen tensions in cerebral tissues of rats exposed to <br> + Document 188: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.188 + release of free fatty acids from adipose tissue obtained from newborn <br> + Document 189: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.189 + detection of pericardial effusion by radioisotope heart scanning <br> + Document 191: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.191 + the occurrence of megakaryocytes in the peripheral blood of dogs <br> + Document 194: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.194 + comparison of ultraviolet sensitivity of bacillus subtilis bacteriophage <br> + Document 195: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.195 + the isolation and morphology of some new bacteriophages specific for <br> + Document 198: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.198 + the carrier state of bacillus subtilis infected with the transducing <br> + Document 208: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.208 + factors influencing development of tumors in frogs <br> + Document 211: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.211 + eye and kidney tissue reactions to heterologous anti uveal antibodies <br> + Document 212: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.212 + experiments dealing with the role played by the aqueous humor and retina <br> + Document 224: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.224 + the heterogeneity of rheumatoid factors and the genetic control of <br> + Document 231: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.231 + experimental emphysema basis review and critique <br> + Document 235: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.235 + some observations on myelin glial relationships and on the etiology of <br> + Document 236: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.236 + lactate and pyruvate in the brain of rats during hyperventilation <br> + Document 237: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.237 + cisternal fluid oxygen tension in man <br> + Document 248: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.248 + lung scanning with colloidal risa <br> + Document 250: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.250 + oxacillin apparent hematologic and hepatic toxicity <br> + Document 256: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.256 + soluble tissue antigens in human brain tumor and cerebrospinal fluid <br> + Document 269: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.269 + late effects of regional renal hypothermia <br> + Document 270: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.270 + mesenteric vascular response to hypothermia <br> + Document 288: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.288 + alterations in pulmonary surface active lipids during ex <br> + Document 290: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.290 + cerebrospinal fluid in man native to high altitude <br> + Document 291: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.291 + na k ca mg and cl concentrations in choroid plexus fluid <br> + Document 294: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.294 + central nervous system lesions in rats <br> + Document 295: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.295 + electrode size and tissue po2 measurement in rats exposed <br> + Document 296: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.296 + adrenergic effects in splenic po2 of rats in air or oxygen <br> + Document 297: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.297 + the effects of antioxidants on high pressure oxygen toxicity <br> + Document 298: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.298 + glycolytic control mechanisms i inhibition of glycolysis <br> + Document 300: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.300 + cortical ph and the blood brain barrier <br> + Document 301: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.301 + brain damage and paralysis in animals exposed to high pressure oxygen <br> + Document 302: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.302 + the effect of hypoxia on oxygen consumption of cerebral <br> + Document 304: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.304 + plasma free fatty acid and blood sugar levels in newborn <br> + Document 305: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.305 + the essential fatty acid requirement of infants and the <br> + Document 307: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.307 + behavior of polyunsaturated fatty acids in physiological <br> + Document 308: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.308 + effects of nutritional deficiency of unsaturated fats on <br> + Document 324: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.324 + free fatty acid metabolism in chinese hamsters <br> + Document 325: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.325 + changes in serum non esterified fatty acid levels in spon <br> + Document 327: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.327 + glucose and nonesterified fatty acid levels in maternal <br> + Document 330: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.330 + metabolism of free fatty acids during perinatal life of lambs <br> + Document 331: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.331 + the effect of glucose infusions on the lipoid and the <br> + Document 332: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.332 + the plasma free fatty acid composition and blood glucose <br> + Document 333: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.333 + lipids of human placenta <br> + Document 334: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.334 + experimental study of sensitization to nickel <br> + Document 335: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.335 + some remarks on the nickel dermatitis <br> + Document 336: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.336 + studies on the binding of protein by nickel <br> + Document 337: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.337 + experimental nickel contact sensitization in man <br> + Document 341: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.341 + studies of nickel carcinogenesis <br> + Document 342: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.342 + studies of nickel carcinogenesis metastasizing pulmonary tumors in rats <br> + Document 343: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.343 + influence of age sex and glandular extirpation on muscle carcinogenesis <br> + Document 344: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.344 + studies of trace metal metabolism electron paramagnetic resonance of <br> + Document 345: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.345 + metal chelates as potential reactivators of organic phosphate poisoned <br> + Document 346: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.346 + effect of nicl2 on an isolated ranvier node <br> + Document 347: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.347 + the carcinogenic activities of n hydroxy acetylaminofluorene and its <br> + Document 348: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.348 + generation of action potentials in single ranvier s nodes of isolated <br> + Document 374: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.374 + pharmacologic actions on cellular immunity <br> + Document 378: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.378 + analysis of mechanism of immunosuppressive drugs in renal <br> + Document 404: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.404 + trials of heterotransplantation of human cancer in rabbits <br> + Document 416: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.416 + respiration in hypothermia i respiratory pattern and <br> + Document 417: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.417 + studies on blood viscosity and its significance in anesthesia <br> + Document 465: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.465 + experimental amyloidosis in immunity <br> + Document 466: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.466 + electron microscopic study of six cases of human renal amyloidosis <br> + Document 468: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.468 + diffuse nodular amyloidosis of the lungs <br> + Document 469: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.469 + the bacterial induction of homograft sensitivity ii effects of <br> + Document 470: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.470 + structure and function of cross linked dna i reversible denaturation and <br> + Document 472: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.472 + the molecular basis of histidase induction in bacillus subtilis <br> + Document 475: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.475 + multiplication of bacteriophages <br> + Document 483: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.483 + the biosynthesis of hydroxymethyldeoxyuridylic acid in <br> + Document 486: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.486 + studies in personality ii a bio psychological and experimental <br> + Document 489: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.489 + the meaning of crying <br> + Document 499: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.499 + investigations of lens protein and microelectrophoresis of <br> + Document 500: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.500 + studies on the soluble proteins of bovine lens immuno <br> + Document 501: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.501 + studies on y crystallin from calf lens ii purification and <br> + Document 502: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.502 + studies on the subunits of a crystallin and their recombi <br> + Document 503: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.503 + fractionation of b crystallin from calf lens by gel fil <br> + Document 504: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.504 + properties of a cold precipitable protein fraction in the <br> + Document 505: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.505 + the effect of radiation on lenticular epithelial enzymes <br> + Document 506: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.506 + conversion of a crystallin of bovine lens into insoluble <br> + Document 507: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.507 + structural studies of a crystallin <br> + Document 508: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.508 + on the subunits of a crystallin <br> + Document 509: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.509 + separation of the soluble proteins of bovine lenses on <br> + Document 510: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.510 + the deaggregation of bovine lens a crystallin <br> + Document 511: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.511 + the problem of albuminoid <br> + Document 515: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.515 + selenium content of fresh eggs <br> + Document 516: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.516 + selenium content of human milk possible effect on dental caries <br> + Document 517: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.517 + mode of action of selenium in relation to biological activity of <br> + Document 518: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.518 + effect of sodium selenate on acute poisoning with thallium <br> + Document 519: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.519 + inhibition of active transport of sugars through rat intestine in vitro <br> + Document 520: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.520 + analogs parasympathetic neuroeffectors ii comparative pharmacological <br> + Document 522: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.522 + poisoning with sodium selenite <br> + Document 523: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.523 + the tissue distribution of se75 selenouracil and se75 selenourea <br> + Document 524: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.524 + sodium selenate toxicosis pathology and pathogenesis of sodium <br> + Document 525: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.525 + sodium selenate toxicosis the distribution of selenium within the body <br> + Document 526: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.526 + studies on selenium toxicity and chondroitin sulfate and taurine <br> + Document 527: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.527 + reactions of seleno and sulfoamino acids with hydroperoxides <br> + Document 530: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.530 + anaphylactic tests in model tumour antigen investigations <br> + Document 547: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.547 + absorption and excretion of toxogonin an alkyl phosphate antidote <br> + Document 548: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.548 + the study of osteoporosis <br> + Document 553: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.553 + role of the liver in the glycoprotein mobilizing property of <br> + Document 554: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.554 + distribution and excretion of radioactivity after parenteral <br> + Document 557: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.557 + anodized aluminium grains labelled with radiophosphorus <br> + Document 561: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.561 + the dilution test as a measure of renal function in niobium poisoned rats <br> + Document 566: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.566 + relationship of maximal tubular phosphate <br> + Document 583: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.583 + hyperplastic lesions of mouse mammary <br> + Document 606: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.606 + baby habits genesis and ontogenesis <br> + Document 627: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.627 + labial supportive appliance <br> + Document 628: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.628 + heterogeneity of the cleft palate population and research designs <br> + Document 634: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.634 + establishment of a turkey flock free of n strain mycoplasma <br> + Document 635: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.635 + septicemia due to mycoplasma hominis type <br> + Document 636: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.636 + infectie door mycoplasma hominis bij een pasgeborene <br> + Document 639: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.639 + the ph antigen in strains of pasteurella pseudotuberculosis <br> + Document 640: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.640 + serological relationships among human mycoplasmas as shown <br> + Document 649: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.649 + evaluation of tylosin in <br> + Document 652: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.652 + the serological differentiation of mycoplasma strains pleuro <br> + Document 653: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.653 + spiramycin in the treatment of experimental <br> + Document 656: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.656 + recovery of a pleuropneumonia like organism <br> + Document 657: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.657 + chronic respiratory disease in mice and rats <br> + Document 659: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.659 + mycoplasma species of man <br> + Document 665: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.665 + the remaining kidney in irradiated <br> + Document 666: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.666 + cellular proliferation and deoxyribonucleic acid <br> + Document 671: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.671 + effects of adrenalectomy on <br> + Document 672: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.672 + pathogenesis of polycystic kidneys <br> + Document 676: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.676 + radiation effects renal enlargement in the mouse <br> + Document 677: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.677 + renal hyperplasia and neoplasia <br> + Document 683: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.683 + phospholipids of the sexual segment of the kidney of the <br> + Document 684: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.684 + on the erythropoietic effect of different <br> + Document 686: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.686 + chemical aspects of compensatory renal hypertrophy <br> + Document 700: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.700 + stable strontium in human bone geographical and age <br> + Document 713: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.713 + dural sinus pressure <br> + Document 721: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.721 + etiology of trypan blue induced antenatal <br> + Document 727: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.727 + mansonia crassipes as the natural vector of filarioids plasmodium gallinaceum <br> + Document 728: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.728 + filariasis in portuguese timor with observations on a new microfilaria <br> + Document 729: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.729 + dipetalonema obtusa mccoy comb n filarioidea <br> + Document 731: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.731 + the occurence of dirofilaria magnilarvatum price <br> + Document 732: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.732 + the filarial parasites of the eastern gorilla in the congo <br> + Document 733: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.733 + a pilot project for the control of filariasis <br> + Document 734: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.734 + studies on loiasis in monkeys <br> + Document 735: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.735 + development of dirofilaria immitis in anopheles quadri <br> + Document 736: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.736 + advances in filariasis <br> + Document 737: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.737 + attempts to transmit wuchereria bancrofti to cats and to a toque monkey <br> + Document 738: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.738 + the periodicity of microfilariae <br> + Document 739: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.739 + the periodicity of microfilariae <br> + Document 746: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.746 + central regulation of enzyme activity and synthesis <br> + Document 747: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.747 + ribonuclease activity in hepatic nuclei during development <br> + Document 751: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.751 + acid catabolic enzyme activity in relation <br> + Document 752: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.752 + neonatology <br> + Document 753: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.753 + red cell glucose phosphate dehydrogenase deficiency a newly <br> + Document 755: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.755 + differentiation of explanted fragments of <br> + Document 760: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.760 + postnatal changes in the portal circulation <br> + Document 761: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.761 + pattern of serum transaminase activity <br> + Document 762: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.762 + impaired development of rat liver enzyme activities at <br> + Document 764: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.764 + risk of severe jaundice in <br> + Document 765: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.765 + studies of b glucuronidase acti <br> + Document 816: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.816 + the convergence and interaction of visual <br> + Document 825: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.825 + haemophilic blood cyst <br> + Document 836: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.836 + volkmann s ischaemia <br> + Document 843: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.843 + the haemophilic pseudotumour <br> + Document 845: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.845 + aspects of circadian periodic changes in <br> + Document 846: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.846 + specificity of the inhibition of tubular <br> + Document 851: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.851 + studies of the changes in growth <br> + Document 852: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.852 + renal and adrenal relationships <br> + Document 857: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.857 + effect of heparin and parathyroid extract an acid phosphatase in bone <br> + Document 868: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.868 + actinomycin d inhibition of intestinal transport of calcium and <br> + Document 904: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.904 + a note on the taxonomic status of strains like campo <br> + Document 907: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.907 + respiratory virus vaccines ii mycoplasma pneumoniae eaton agent <br> + Document 909: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.909 + color test for the measurement of antibody to t strain mycoplasmas <br> + Document 930: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.930 + renal renin in unilaterally nephrectomized hypertensive rats <br> + Document 936: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.936 + compensatory structural and functional changes in the kidney <br> + Document 938: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.938 + the effect of nortestosterone phenylpropionate on compensatory <br> + Document 939: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.939 + thyroid and pituitary gland activity during compensatory renal <br> + Document 942: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.942 + influence of the adrenal glands on dna synthesis in normal <br> + Document 943: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.943 + auto radiographic studies of the protein metabolism of the single <br> + Document 945: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.945 + studies on the sweat in renal diabetes insipidus during <br> + Document 954: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.954 + salt and water distribution in hereditary and in induced hypothalamic <br> + Document 955: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.955 + antidiuresis induced by saluretics in diabetes insipidus <br> + Document 957: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.957 + neurohypophysial principles in rats with familial hypothalamic <br> + Document 974: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.974 + comparative values of thick drop and concentration methods detection <br> + Document 977: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.977 + some observations on the effects in vivo of varying ambient temperatures <br> + Document 979: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.979 + concentration techniques of sanguicolous microfilariae <br> + Document 980: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.980 + pathology of schistosoma japonicum in the taiwanese monkey <br> + Document 984: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.984 + filariasis in mountain province luzon republic of the philippines <br> + Document 986: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.986 + human filariasis identification of species on the basis of staining <br> + Document 988: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.988 + identification of canine microfilariae <br> + Document 1005: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1005 + icterus neonatorum simplex <br> + Document 1011: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1011 + transient familial neonatal hyperbilirubinemia <br> + Document 1012: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1012 + hepatitis virus in neonatal liver disease <br> + Document 1018: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1018 + metabolism and excretion of bilirubin c in experimental obstructive <br> + Document 1020: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1020 + immunological demonstration of factor viii protein in the plasma of <br> + Document 1022: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.1022 + protein losing enteropathy complicating prolonged bleeding in <br> +</p><p><a name="b5">Cluster 5 (85 documents): </a><br> + Document 2: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.2 + changes of the nucleic acid and phospholipid levels of the livers in the <br> + Document 6: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.6 + the concentration of non esterified fatty acids in maternal and fetal <br> + Document 46: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.46 + toxicity of inorganic selenium salts to chick embryos <br> + Document 65: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.65 + induced tumour resistance in rats <br> + Document 173: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.173 + growth of several human cell lines in newborn rats <br> + Document 174: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.174 + the human tumor egg host system iii tumor inhibitory properties of <br> + Document 178: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.178 + limited growth period of human lung cell lines transformed by simian <br> + Document 196: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.196 + characterization of bacillus subtilis bacteriophages <br> + Document 326: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.326 + the effect of combined glucose and insulin infusions on <br> + Document 329: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.329 + a lipid mobilizing substance in the serum of pregnant wo <br> + Document 532: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.532 + treatment of canine neoplasms with autogenous vaccinial preparations <br> + Document 536: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.536 + isoantigenic properties of tumors transgressing histocompatibility <br> + Document 537: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.537 + participation of 7s and 19s antibodies in enhancement and <br> + Document 538: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.538 + the effect of immunity against sex antigen on a tumour <br> + Document 544: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.544 + effets de la carence potassique <br> + Document 549: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.549 + the aetiology and treatment of <br> + Document 551: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.551 + effects of parathyroid hormone and other proteins in vitro <br> + Document 555: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.555 + study of phosphate excretion by the stop flow <br> + Document 556: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.556 + stupor hypercalcemia and carcinoma of the <br> + Document 558: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.558 + effect of parathyroidectomy and ferric dextrin <br> + Document 562: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.562 + influence of parathyroid activity on ion <br> + Document 563: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.563 + effects of alkalosis on plasma concentration and urinary <br> + Document 564: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.564 + the relationship between vitamin d and parathyroid <br> + Document 567: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.567 + human growth hormone <br> + Document 568: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.568 + obesity and plasma levels of insulin and <br> + Document 569: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.569 + hypophysectomy replacement therapy and the tolerance of the <br> + Document 570: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.570 + resistance to human growth hormone in pituitary dwarfism <br> + Document 571: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.571 + influence of alloxan diabetes on <br> + Document 573: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.573 + hypoglycemia growth retardation and probable <br> + Document 574: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.574 + production secretion and availability <br> + Document 575: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.575 + growth and growth retardation <br> + Document 576: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.576 + long term treatment of hypopituitary and of <br> + Document 578: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.578 + practical human growth hormone <br> + Document 579: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.579 + hypophysectomy and the lipolytic action of epinephrine in vitro <br> + Document 580: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.580 + c acetyl bovine growth hormone <br> + Document 581: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.581 + growth hormone <br> + Document 582: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.582 + recent advances in physiology of bone part i <br> + Document 584: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.584 + bone growth and metabolic studies of premature <br> + Document 585: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.585 + growth hormone action on rat liver rna <br> + Document 586: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.586 + mammary growth in rats treated with somatotropin during <br> + Document 588: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.588 + studies on growth hormone secretion <br> + Document 589: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.589 + the effect of human growth hormone in <br> + Document 591: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.591 + the effect of growth hormone <br> + Document 592: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.592 + influence of hormones on tumor growth and plasma prolactin levels in rats <br> + Document 594: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.594 + hormonal modification of the distribution of amino <br> + Document 595: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.595 + insulin and insulin antagonism <br> + Document 596: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.596 + relationships of growth hormone steroids and relaxin in the <br> + Document 597: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.597 + effect of testosterone propionate and growth hormone on <br> + Document 598: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.598 + growth hormone and diabetes mellitus <br> + Document 599: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.599 + experiments on the contribution of somatotrophin to prenatal growth in the rat <br> + Document 600: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.600 + insulin and protein metabolism <br> + Document 601: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.601 + the influence of blood glucose on the plasma <br> + Document 602: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.602 + failure to thrive the diencephalic syndrome of infancy and childhood <br> + Document 632: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.632 + recovery of mycoplasmas in the study of <br> + Document 642: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.642 + suppression of rous sarcoma virus growth in tissue <br> + Document 662: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.662 + the age factor in experimental hypertension <br> + Document 663: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.663 + response of a serum glycoprotein to tissue injury <br> + Document 667: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.667 + compensatory renal enlargement <br> + Document 675: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.675 + abscopal effects of whole body <br> + Document 685: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.685 + hemihypertrophy and medullary sponge kidney <br> + Document 711: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.711 + functional craniology an aid in <br> + Document 844: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.844 + actinomycin d and the response to parathyroid hormone <br> + Document 847: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.847 + localization of phosphaturic effect of <br> + Document 850: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.850 + studies on compensatory renal hypertrophy i effect of <br> + Document 854: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.854 + parathyroid extract induced changes in the oxidation of citrate <br> + Document 858: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.858 + the isolation of thyrocalcitonin and study of its effects in the rat <br> + Document 859: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.859 + the effect of actinomycin d on parathyroid induced <br> + Document 860: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.860 + inhibition by actinomycin d of bone resorption <br> + Document 863: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.863 + the inhibition of respiration and phosphorylation in kidney <br> + Document 866: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.866 + albright s hereditary osteodystrophy report of a family with studies <br> + Document 869: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.869 + studies on hydroxyproline excretion and corticosteroid induced <br> + Document 873: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.873 + treatment of retarded growth with human growth hormone <br> + Document 874: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.874 + genetic pituitary dwarfism with high serum concentration of growth <br> + Document 875: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.875 + growth hormone deficiency in man <br> + Document 879: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.879 + hypoglycemia and dwarfism associated with the isolated <br> + Document 880: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.880 + the effect of growth hormone in hypothalamo pituitary <br> + Document 881: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.881 + serum chorionic growth hormone prolactin and serum pituitary <br> + Document 882: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.882 + effect of abdominal operation on glucose tolerance and serum levels of <br> + Document 883: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.883 + plasma growth hormone concentration in the rat determined by <br> + Document 899: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.899 + a color test for the measurement of antibody to the non acid forming <br> + Document 902: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.902 + growth and survival of mycoplasma neurolyticum in liquid media <br> + Document 929: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.929 + the effect of folic acid on growth and deoxyribonucleic acid synthesis <br> + Document 932: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.932 + effects of hypophysectomy and growth hormone on renal compensatory <br> + Document 940: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.940 + the influence of thyroid hormone on renal function during the course <br> + Document 947: C:\Program Files\MATLAB\R2007a\work\TMG_working\sample_documents\retrieval\med_text.947 + the action of vasopressin in renal diabetes insipidus <br> +</p><hr align="center" size="2" width="100%"><span style="color: #552800; font-family:Tahoma; font-size:10pt">Research supported in part by the University of Patras K. Karatheodori B120 and a Bodossaki foundation scholarship.</span><br><br><img height="62" src="images/logo-panepistimiouen.gif" width="154"></img><img height="61" src="images/Caratheodory_2.jpg" width="50"></img><p><span style="font-size: 10pt; color: #552800; font-family: Tahoma">Copyright � 2008 Dimitrios Zeimpekis and Efstratios Gallopoulos<p><span style="font-size: 10pt; color: #552800; font-family: Tahoma">Please send comments to </span><span style="font-size: 10pt; color: #552800; font-family: Tahoma"><a href="mailto:dsz@hpclab.ceid.upatras.gr">dsz@hpclab.ceid.upatras.gr</a></span><span style="font-size: 10pt; color: #552800; font-family: Tahoma"> or stratis@ceid.upatras.gr</span></p></span></BODY></HTML> diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval.html new file mode 100644 index 0000000000000000000000000000000000000000..07e39e6f68f88828a6ddf5f8a01938dc01cbd7bc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval.html @@ -0,0 +1,241 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Retrieval Module (tmg_gui)</h2> + <p align="center"> + <img src="images/retrieval_gui.jpg" width="604" height="598" /><br /> + </p> + </td> + </tr> + <tr> + <td> + <p align="justify"> + retrieval_gui is a graphical user interface for "Text to Matrix Generator" that can be + used for applying a set of retrieval methods to term-document + matrices (TDM's) constructed from tmg_gui. + </p> + <p align="justify"> + See a <a href="retrieval1.html">demonstration</a> of retrieval_gui. + </p> + <p align="justify"> + For complete up-to-date documentation visit the TMG Wiki: + </p> + <p align="center"> + <a href="http://scgroup6.ceid.upatras.gr:8000/wiki/"> + http://scgroup6.ceid.upatras.gr:8000/wiki/ + </a> + </p> + </td> + </tr> + <tr> + <td> + <table align="left" width="100%" border="2" cellpadding="2" cellspacing="2"> + <tr> + <td align="center"> + <strong>Field Name</strong> + </td> + <td align="center"> + <strong>Default</strong> + </td> + <td align="center"> + <strong>Description</strong> + </td> + </tr> + <tr> + <td align="left"> + Select Dataset + </td> + <td align="center"> + - + </td> + <td align="left"> + Select the dataset. + </td> + </tr> + <tr> + <td align="left"> + Insert Query + </td> + <td align="center"> + ● + </td> + <td align="left"> + The query to be executed. + </td> + </tr> + <tr> + <td align="left"> + Alternative Global Weights + </td> + <td align="center"> + - + </td> + <td align="left"> + Global weights vector used for the construction of the query vector. + </td> + </tr> + <tr> + <td align="left"> + Use Stored Global Weights + </td> + <td align="center"> + ● + </td> + <td align="left"> + Use the global weights vector found on the container directory of the dataset. + </td> + </tr> + <tr> + <td align="left"> + Stoplist + </td> + <td align="center"> + - + </td> + <td align="left"> + Use a stoplist. + </td> + </tr> + <tr> + <td align="left"> + Local Term Weighting + </td> + <td align="center"> + Term Frequency + </td> + <td align="left"> + The local term weighting to be used. + </td> + </tr> + <tr> + <td align="left"> + Vector Space Model + </td> + <td align="center"> + ● + </td> + <td align="left"> + Apply the Vector space Model retrieval method. + </td> + </tr> + <tr> + <td align="left"> + Latent Semantic Analysis + </td> + <td align="center"> + - + </td> + <td align="left"> + The method used in the course of the Latent Semantic Analysis technique. Possible values: 'Singular Value Decomposition', 'Principal Component Analysis', 'Clusteredd Latent Semantic Analysis', 'Centroid Mathod', 'Semidiscrete Decomposition', 'SPQR'. + </td> + </tr> + <tr> + <td align="left"> + Number of Factors + </td> + <td align="center"> + - + </td> + <td align="left"> + Select the number of factors used during the retrieval process. + </td> + </tr> + <tr> + <td align="left"> + Similarity Measure + </td> + <td align="center"> + cosine + </td> + <td align="left"> + Similarity measure used during the retrieval process. + </td> + </tr> + <tr> + <td align="left"> + Number of most revevant + </td> + <td align="center"> + ● + </td> + <td align="left"> + Defines the number of most relevant documents returned for a query. + </td> + </tr> + <tr> + <td align="left"> + Similarity measure exceeds + </td> + <td align="center"> + - + </td> + <td align="left"> + Defines the minimum similarity measure value for which a document is treated as relevant to the query. + </td> + </tr> + <tr> + <td align="left"> + Continue + </td> + <td align="center"> + - + </td> + <td align="left"> + Apply the selected operation. + </td> + </tr> + <tr> + <td align="left"> + Reset + </td> + <td align="center"> + - + </td> + <td align="left"> + Reset window to default values. + </td> + </tr> + <tr> + <td align="left"> + Exit + </td> + <td align="center"> + - + </td> + <td align="left"> + Exit window. + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval1.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval1.html new file mode 100644 index 0000000000000000000000000000000000000000..5a91a41416d247c72ec614f3bac5de0b110d2a85 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval1.html @@ -0,0 +1,74 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Retrieval Module (retrieval_gui)</h2> + </td> + </tr> + <tr> + <td> + <p align="justify"> + Assume we have processed a collection with tmg_gui, construct a TDM + with 1,033 documents and 12,184 terms (corresponding to the well-known + MEDLINE collection) and store the results to "TMG_HOME/data/medline". + Assume then, we want to retrieve the relevant documents to a specific + query for the following input: + </p> + <ul> + <li> + <p>insert query: 'the crystalline lens in vertebrates, including humans' </p> + </li> + <li> + <p>use stored global weights: yes </p> + </li> + <li> + <p>stoplist: common_words </p> + </li> + <li> + <p>local term weighting: Term Frequency </p> + </li> + <li> + <p>latent semantic analysis by: Clustered Latent Semantic Indexing </p> + </li> + <li> + <p>number of factors: 100 </p> + </li> + <li> + <p>similarity measure: Cosine </p> + </li> + <li> + <p>number of most relevant documents: 5 </p> + </li> + </ul> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="retrieval2.html">Step 2</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval2.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval2.html new file mode 100644 index 0000000000000000000000000000000000000000..6bf339584a31a9d40f583e5a68e35cea483e8956 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval2.html @@ -0,0 +1,52 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Retrieval Module (retrieval_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Initially select the retrieval method you want to apply, by pressing the corresponding radio button. </p> + </li> + <li> + <p align="justify">The selection of a radio button activates the required fields in the GUI, while deactivating the rest fields. </p> + </li> + </ul> + <p align="center"> + <img src="images/retrieval_gui1.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="retrieval3.html">Step 3</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval3.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval3.html new file mode 100644 index 0000000000000000000000000000000000000000..8f223d84920d008e9d5566aaf66d726e657bf5a9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval3.html @@ -0,0 +1,49 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Retrieval Module (retrieval_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Fill in the required fields, by pressing the check buttons, editing the edit boxes or selecting the appropriate files/variables by pressing the Browse button. </p> + </li> + </ul> + <p align="center"> + <img src="images/retrieval_gui2.jpg" width="604" height="598" /> + </p> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="retrieval4.html">Step 4</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval4.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval4.html new file mode 100644 index 0000000000000000000000000000000000000000..c28a6486b95d8b02115b7610bf22f5df58aa3a11 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval4.html @@ -0,0 +1,55 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<link rel="stylesheet" href="styles/main.css" media="screen" type="text/css" /> +<title>Text to Matrix Generator - Indexing Module</title> +<style type="text/css"> + body { + background-color: #ffffff; + font-size: 11pt; + line-height: 20px; + overflow: hidden; + } +</style> +</head> +<body> +<table id="content_frame_table" align="left" width="96%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td align="center"> + <h2>Retrieval Module (retrieval_gui)</h2> + </td> + </tr> + <tr> + <td> + <ul> + <li> + <p align="justify">Press the "Continue" button in order to perform selected operation.</p> + </li> + <li> + <p align="justify">Results will be saved to the workspace. </p> + </li> + <li> + <p align="justify">Furthermore, in case data have been stored to MySQL, the user gets an <a href="retrieval_response.html" target="_blank">html response</a>. </p> + </li> + <li> + <p align="justify">Press the Reset button in order to change the input. </p> + </li> + </ul> + </td> + </tr> + <tr> + <td> + <p align="center"> + <a href="intro.html">Return to main page</a> + <a href="retrieval1.html">Start Page</a> + </p> + </td> + </tr> +</table> +<script type="text/javascript"> + var frame_height = document.getElementById("content_frame_table").clientHeight; + parent.document.getElementById("content_frame_id").height = frame_height; +</script> +</body> +</html> \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval_response.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval_response.html new file mode 100644 index 0000000000000000000000000000000000000000..01d4995fa3186ee8dfaa12b2c98b1e508e615bb2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/retrieval_response.html @@ -0,0 +1,45 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" > +<head> +<title>TMG: Retrieval response</title> +<link href="../documentation/tmgstyle.css" rel="stylesheet" type="text/css" /> +</head> +<body> + <center> + <span style="font-size: 24pt"> + <hr />TMG: Retrieval Response<br /> + <hr /> + </span> + </center> + <center><span style="font-weight:bold;font-size:14pt">Query: the crystalline lens in vertebrates, including humans </span></center><br><br> + <div style="background-color:teal;color:white;padding:4px"> + <span style="font-weight:bold;color:white"> + Document 212 - Similarity: 0.39685</div><br> + <div style="margin-left:20px;margin-bottom:1em;font-size:12pt"> + experiments dealing with the role played by the aqueous humor and retina in lens regeneration of adult newts . 1. these three groups of experiments involve approximately 140 eyes of adult newts, triturus v. viridescens . they were devised to examine what, if any, role the aqueous humor plays during lens regeneration from the dorsal iris . 2. many daily injections of aqueous humor from normal eyes were made in lentectomized eyes for as long as 96 days in some cases . as controls some lensless eyes were daily injected with holtfreter's solution . in others aqueous humor was merely withdrawn . 3) procedures for the injection experiments are difficult to control . however, the most successful cases showed varying degrees of inhibition and retardation of lens regeneration . 4. pairs of eyes were united at large adjacent wound openings to provide a common reservoir of aqueous humor bathing both lenses and dorsal irises . in some cases the eyes were placed on the side of the body . in others more successful unions were made by fusing a transplanted eye to the right eye of a host . 5. approximately three months after operation one of two large lens regenerates in a pair of perfectly fused eyes was removed . six weeks later a new large lens regenerate reappeared in most of the lentectomized units in the presence of the intact lens of the other unit 6. there is a strong possibility that the more than normal amount of neural retina present provided a more powerful retinal factor for lens regeneration than the inhibiting influence of the intact lens in the environment . .i 213 <br><br> + </div> + <div style="background-color:teal;color:white;padding:4px"> + <span style="font-weight:bold;color:white"> + Document 184 - Similarity: 0.39233</div><br> + <div style="margin-left:20px;margin-bottom:1em;font-size:12pt"> + an investigation of mitotic control in the rabbit lens epithelium . a water soluble substance which inhibits mitosis in the rabbit lens epithelium has been found to be present in young and old rabbit lenses . it has a high molecular weight and is relatively stable at room tempera- ture . the inhibitory factor is associated with the y-crystallin frac- tion and exists throughout the young lens, although the activity in the nuclear region (on a wet weight basis) is less than half that of the cortex and epithelium . .i 185 <br><br> + </div> + <div style="background-color:teal;color:white;padding:4px"> + <span style="font-weight:bold;color:white"> + Document 169 - Similarity: 0.38649</div><br> + <div style="margin-left:20px;margin-bottom:1em;font-size:12pt"> + carbonic anhydrase distribution in rabbit lens . the distribution of carbonic anhydrase activity in the mature rabbit lens was determined . the activities in nucleus, cortex, epithelium with anterior capsule, anterior capsule, and posterior capsule were, respectively, 2484 ( 256), 1571 ( 87), 545 ( 93), 159 ( 39) and 65 ( 49) moles co /kg wet tissue wt per hr at 0 c . it was concluded, on the basis of the available evidence, that carbonic anhydrase cannot play a primary role in the cation transport system of the lens . .i 170 <br><br> + </div> + <div style="background-color:teal;color:white;padding:4px"> + <span style="font-weight:bold;color:white"> + Document 164 - Similarity: 0.38371</div><br> + <div style="margin-left:20px;margin-bottom:1em;font-size:12pt"> + dual cation activation of bovine lens autolysis . the autolytic activity of bovine lens extracts at 55 c. and ph 7.4 has been shown to be markedly influenced by the simultaneous presence of mono- and divalent cations . of the cations tested, na at 2.5 to 5 mm . and mg at 5 to 10 mm. produce the best activation . the stimulation is synergistic . on the basis of results obtained here and in other laboratories, the suggestion is made that this combination of cations may be required for activation of the neutral proteinase of the lens . in the presence of mg and average physiologic lenticular levels of both na and k , autolysis is suppressed to the basal level obtainable in the presence of mg alone . .i 165 <br><br> + </div> + <div style="background-color:teal;color:white;padding:4px"> + <span style="font-weight:bold;color:white"> + Document 170 - Similarity: 0.3715</div><br> + <div style="margin-left:20px;margin-bottom:1em;font-size:12pt"> + changes in weight and adenosine triphosphate content in the lens of the xylose-fed rat . xylitol and sorbitol accumulated in the lens of the xylose-fed rat two days before loss of adenosine triphosphate, and cataractous changes, were apparent . the maximum degree of cataract occurred when the level of the polyols was at its highest . regression of cataract was accompanied by decrease in polyol concentration and restoration of the level of atp . the lens of the xylose-fed rat did not usually increase in weight . .i 171 <br><br> + </div> +<hr align="center" size="2" width="100%"><span style="color: #552800; font-family:Tahoma; font-size:10pt">Research supported in part by the University of Patras K. Karatheodori B120 and a Bodossaki foundation scholarship.</span><br><br><img height="62" src="images/logo-panepistimiouen.gif" width="154"></img><img height="61" src="images/Caratheodory_2.jpg" width="50"></img><p><span style="font-size: 10pt; color: #552800; font-family: Tahoma">Copyright � 2008 Dimitrios Zeimpekis and Efstratios Gallopoulos<p><span style="font-size: 10pt; color: #552800; font-family: Tahoma">Please send comments to </span><span style="font-size: 10pt; color: #552800; font-family: Tahoma"><a href="mailto:dsz@hpclab.ceid.upatras.gr">dsz@hpclab.ceid.upatras.gr</a></span><span style="font-size: 10pt; color: #552800; font-family: Tahoma"> or stratis@ceid.upatras.gr</span></p></span></BODY></HTML> diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/styles/main.css b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/styles/main.css new file mode 100644 index 0000000000000000000000000000000000000000..61a223954ef2683042b59b276b7b747680717d11 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/styles/main.css @@ -0,0 +1,207 @@ +@charset "windows-1253"; +body { + background-color: #cacbcb; + font-size: 11pt; + color: #552800; + font-family: Tahoma; + line-height: 11px; + margin: 0px 0px 0px 0px; + text-align: left; +} + +.main_table { + font-size: 11pt; + color:#552800; + font-family: Tahoma; + line-height:20px; + text-align:left; +} + +.form_table { + font-size: 11pt; + color:#552800; + font-family: Tahoma; + line-height:30px; + text-align:left; +} + +.files_table { + font-size: 10pt; + color:#552800; + font-family: Tahoma; + border-spacing:1px; +} + +.files_table_header_row { + background-color: #adbce7; + font-size: 11pt; + color:#FFFFFF; + font-weight: bold; + font-family: Tahoma; + padding: 2px 0 2px 6px; +} + +.files_table_row { + font-size: 10pt; + color:#552800; + font-family: Tahoma; + padding: 2px 0 2px 6px; + border-bottom: 1px #acbce7 solid; +} + +.retrieval_results_header_row { + background-color: #adbce7; + font-size: 11pt; + color:#FFFFFF; + font-weight: bold; + font-family: Tahoma; + padding: 0px 0 0px 6px; +} + +.retrieval_results_row { + font-size: 11pt; + font-family: Tahoma; + padding: 2px 0 20px 0; +} + +.service_table { + font-size: 10pt; + color:#552800; + font-family: Tahoma; +} + +.service_table_header_row { + font-size: 14pt; + font-weight: bold; +} + +.service_table_subheader_row { + font-size: 12pt; + font-weight: bold; +} + +.main_table a, .main_table a:visited { + text-decoration: none; + color: blue; +} + +.main_table a:hover { + color: #e87f2a; +} + +.header { + font-size: 32pt; + color:#ffffff; + font-family: Tahoma; + font-weight: bold; +} + +.footer { + font-size: 10pt; + color:#552800; + font-family: Tahoma; + font-weight: normal; + line-height: 20px; +} + +#menu dt, #menu ul { +margin: 0; +padding: 0; +list-style-type: none; +line-height: 32px; +} +#menu { +position: relative; +top: 0em; +left: 1.3em; +width: 203px; +} + +#menu dt { +cursor: pointer; +margin: 2px 0; +text-align: left; +background:url(../images/menu_bg.jpg) no-repeat left center; +width: 203px; +height: 36px; +} + +#menu ul { +padding: 2px; +} +#menu dt a { +color: #FFFFFF; +font-family: Tahoma; +font-size: 13px; +font-weight: bold; +text-decoration: none; +display: block; +margin-left: 10px; +} +#menu dt a:hover { +color: #888888; +} + +.form_field { + border: 1px #acbce7 solid; + background-color: #eeeeee; +} + +.form_button { + color: #fff; + font-weight: bold; + background-color: #acbce7; + border: #fff solid 1px; +} + +.button { + border: #fff solid 1px; + background-color: #acbce7; + font-size: 12px; + font-weight: bold; + color: #fff; + padding: 2px 4px 2px 4px; +} + +.upload_button { + border: #fff solid 1px; + background-color: #acbce7; + font-size: 12px; + font-weight: bold; + color: #fff; + padding: 4px 4px 4px 4px; +} + +.grayed_text { + color: #aaaaaa; + font-size: 10pt; +} + +a, a:visited { + text-decoration: none; + color: blue; +} + +a:hover { + color: #e87f2a; +} + +/* Make the text shrink to fit narrow windows, but not stretch too far in +wide windows. */ +div.content { + max-width: 670px; + /* Hack for IE6 */ + width: auto !important; width: 670px; +} + +pre.codeinput { + background: #ecebeb; + padding: 10px; +} + +@media print { + pre.codeinput {word-wrap:break-word; width:100%;} +} + +span.comment {color: #5e677e} + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/tmg_ver.5.0R6_manual.pdf b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/tmg_ver.5.0R6_manual.pdf new file mode 100644 index 0000000000000000000000000000000000000000..c616e1df7c4478239829d4b472badb27505972cb Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/documentation/tmg_ver.5.0R6_manual.pdf differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/bisecting_nndsvd.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/bisecting_nndsvd.m new file mode 100644 index 0000000000000000000000000000000000000000..823a77c80a8ddf9cffa4d2fad181ea4acd56e58f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/bisecting_nndsvd.m @@ -0,0 +1,30 @@ +function varargout=bisecting_nndsvd(varargin) +% BISECTING_NNDSVD - a bisecting form of the the Non-Negative Double +% Singular Value Decomposition Method [2]. +% BISECTING_NNDSVD applies a bisecting form of the the +% Non-Negative Double Singular Value Decomposition Method [2] +% using a PDDP-like [2] clustering Method. +% [W, H]=BISECTING_NNDSVD(A, k, svd_method) returns a non-negative +% rank-k approximation of the input matrix A using svd_method for +% the SVD (possible values svds, propack). +% +% REFERENCES: +% [1] D.Boley, Principal Direction Divisive Partitioning, Data +% Mining and Knowledge Discovery 2 (1998), no. 4, 325-344. +% [2] C. Boutsidis and E. Gallopoulos. SVD-based initialization: +% A head start on nonnegative matrix factorization. Pattern +% Recognition, Volume 41, Issue 4, Pages 1350-1362, April 2008. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% Check input +error(nargchk(2, 3, nargin)); +if nargin==2, + if nargout==1, varargout{1}=bisecting_nndsvd_p(varargin{1}, varargin{2}); end + if nargout==2, [varargout{1}, varargout{2}]=bisecting_nndsvd_p(varargin{1}, varargin{2}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=bisecting_nndsvd_p(varargin{1}, varargin{2}); end +else, + if nargout==1, varargout{1}=bisecting_nndsvd_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==2, [varargout{1}, varargout{2}]=bisecting_nndsvd_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=bisecting_nndsvd_p(varargin{1}, varargin{2}, varargin{3}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/bisecting_nndsvd_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/bisecting_nndsvd_p.p new file mode 100644 index 0000000000000000000000000000000000000000..4a9cf36ed7b55332b2567c5bb5b7a42f2c2efdce Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/bisecting_nndsvd_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/block_nndsvd.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/block_nndsvd.m new file mode 100644 index 0000000000000000000000000000000000000000..761586015b62f3e38cb995cae01917c8f23a3564 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/block_nndsvd.m @@ -0,0 +1,46 @@ +function varargout=block_nndsvd(A, clusters, l, func, alpha_val, svd_method) +% BLOCK_NNDSVD - computes a non-negative rank-L approximation +% of the input matrix using the Clustered Latent Semantic +% Indexing Method [2] and the Non-Negative Double Singular +% Value Decomposition Method [1]. +% [X, Y]=BLOCK_NNDSVD(A, CLUSTERS, L, FUNC, ALPHA_VAL, +% SVD_METHOD) computes a non-negative rank-L approximation +% X*Y of the input matrix A with the Clustered Latent +% Semantic Indexing Method [2], and the Non-Negative Double +% Singular Value Decomposition Method [1], +% using the cluster structure information from CLUSTERS [3]. +% FUNC denotes the method used for the selection of the +% number of factors from each cluster. Possible values for +% FUNC: +% - 'f': Selection using a heuristic method from [2] +% (see KS_SELECTION). +% - 'f1': Same as 'f' but use at least one factor +% from each cluster. +% - 'equal': Use the same number of factors from +% each cluster. +% ALPHA_VAL is a value in [0, 1] used in the number of +% factors selection heuristic [2]. Finally, SVD_METHOD +% defines the method used for the computation of the SVD +% (svds or propack). +% +% REFERENCES: +% [1] C. Boutsidis and E. Gallopoulos. SVD-based +% initialization: A head start on nonnegative matrix +% factorization. Pattern Recognition, Volume 41, +% Issue 4, Pages 1350-1362, April 2008. +% [2] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible +% Approximation Scheme from Clustered Term-Document +% Matrices. In Proc. 5th SIAM International Conference +% on Data Mining, pages 631�635, Newport Beach, California, +% 2005. +% [3] D. Zeimpekis and E. Gallopoulos. Document Clustering +% using NMF based on Spectral Information. In Proc. Text Mining +% Workshop 2008 held in conjunction with the 8th SIAM +% International Conference on Data Mining, Atlanta, 2008. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(6, 6, nargin)); +if nargout==1, varargout{1}=block_nndsvd_p(A, clusters, l, func, alpha_val, svd_method); end +if nargout==2, [varargout{1}, varargout{2}]=block_nndsvd_p(A, clusters, l, func, alpha_val, svd_method); end +if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=block_nndsvd_p(A, clusters, l, func, alpha_val, svd_method); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/block_nndsvd_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/block_nndsvd_p.p new file mode 100644 index 0000000000000000000000000000000000000000..cad86ad31faade244b381a25b149bdda8c65549a Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/block_nndsvd_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/clsi.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/clsi.m new file mode 100644 index 0000000000000000000000000000000000000000..de56c3081d5122af32ed482babd285f20dd56695 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/clsi.m @@ -0,0 +1,35 @@ +function varargout=clsi(A, clusters, l, func, alpha_val, svd_method) +% CLSI - computes a rank-L approximation of the input matrix +% using the Clustered Latent Semantic Indexing Method [1] +% [X, Y]=CLSI(A, CLUSTERS, L, FUNC, ALPHA_VAL, SVD_METHOD) +% computes the rank-L approximation X*Y of the input matrix +% A with the Clustered Latent Semantic Indexing Method [1], +% using the cluster structure information from CLUSTERS. +% FUNC denotes the method used for the selection of the +% number of factors from each cluster. Possible values for +% FUNC: +% - 'f': Selection using a heuristic method from [1] +% (see KS_SELECTION). +% - 'f1': Same as 'f' but use at least one factor +% from each cluster. +% - 'equal': Use the same number of factors from +% each cluster. +% ALPHA_VAL is a value in [0, 1] used in the number of +% factors selection heuristic [1]. Finally, SVD_METHOD +% defines the method used for the computation of the SVD +% (svds or propack). +% +% REFERENCES: +% [1] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible +% Approximation Scheme from Clustered Term-Document Matrices. +% In Proc. 5th SIAM International Conference on Data Mining, +% pages 631�635, Newport Beach, California, 2005. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(6, 6, nargin)); +if nargout==1, varargout{1}=clsi_p(A, clusters, l, func, alpha_val, svd_method); end +if nargout==2, [varargout{1}, varargout{2}]=clsi_p(A, clusters, l, func, alpha_val, svd_method); end +if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=clsi_p(A, clusters, l, func, alpha_val, svd_method); end +if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=clsi_p(A, clusters, l, func, alpha_val, svd_method); end +if nargout==5, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}]=clsi_p(A, clusters, l, func, alpha_val, svd_method); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/clsi_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/clsi_p.p new file mode 100644 index 0000000000000000000000000000000000000000..effddd31d8349795dd9f366bbabd621593480033 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/clsi_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/cm.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/cm.m new file mode 100644 index 0000000000000000000000000000000000000000..32e4b0f36514acefd90c681f5c50c05263dd8f3e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/cm.m @@ -0,0 +1,16 @@ +function [X, Y]=cm(A, clusters) +% CM - computes a rank-L approximation of the input matrix +% using the Centroids Method [1] +% [X, Y]=CM(A, CLUSTERS) computes the rank-K approximation +% X*Y of the input matrix A with the Centroids Method [1], +% using the cluster structure information from CLUSTERS. +% +% REFERENCES: +% [1] H. Park, M. Jeon, and J. Rosen. Lower Dimensional Representation +% of Text Data Based on Centroids and Least Squares. +% BIT Numerical Mathematics, 43(2):427�448, 2003. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +[X, Y]=cm_p(A, clusters); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/cm_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/cm_p.p new file mode 100644 index 0000000000000000000000000000000000000000..85b9446958391b331bb99885f3f9f118e175619c Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/cm_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/col_rearrange.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/col_rearrange.m new file mode 100644 index 0000000000000000000000000000000000000000..b8ecc6616ace7e6e06f4d501e9251e1031811d07 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/col_rearrange.m @@ -0,0 +1,12 @@ +function [A, n_cols, col_inds]=col_rearrange(A, clusters) +% COL_REARRANGE - reorders a matrix using a clustering result +% [A, N_COLS, COL_INDS]=COL_REARRANGE(A, CLUSTERS) reorders +% the columns of matrix A using the clustering result represented +% by the structure CLUSTERS. N_COLS stores the last column index +% for each column block, while COL_INDS containes the permuted +% column indices. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +[A, n_cols, col_inds]=col_rearrange_p(A, clusters); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/col_rearrange_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/col_rearrange_p.p new file mode 100644 index 0000000000000000000000000000000000000000..c088b70491c3a68af3defb5db623591b15857959 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/col_rearrange_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection.m new file mode 100644 index 0000000000000000000000000000000000000000..168b1b38bec8d6671dd6aa4362f4448b1f3b68a3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection.m @@ -0,0 +1,25 @@ +function n_st=ks_selection(A, n_cols, alpha_val, l) +% KS_SELECTION - implements the heuristic method from [2] for +% the selection of the number of factors from each cluster +% used in the Clustered Latent Semantic Indexing method [1]. +% N_ST=KS_SELECTION(A, N_COLS, ALPHA_VAL, L) returns in N_ST +% a vector of integers denoting the number of factors (sum +% equals L) selected from each cluster of the tdm A. N_COLS +% is a vector containing the last column index for each column +% block, while ALPHA_VAL is a value in [0, 1]. +% +% REFERENCES: +% [1] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible +% Approximation Scheme from Clustered Term-Document Matrices. +% In Proc. 5th SIAM International Conference on Data Mining, +% pages 631�635, Newport Beach, California, 2005. +% [2] D. Zeimpekis and E. Gallopoulos, "Linear and Non-Linear +% Dimensional Reduction via Class Representatives for Text +% Classification", In Proc. of the 2006 IEEE International +% Conference on Data Mining, pp. 1172-1177, December 2006, +% Hong Kong. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +n_st=ks_selection_p(A, n_cols, alpha_val, l); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection1.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection1.m new file mode 100644 index 0000000000000000000000000000000000000000..4853179c4fdd966b42392cd5ac48c8a398676397 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection1.m @@ -0,0 +1,26 @@ +function n_st=ks_selection1(A, n_cols, alpha_val, l) +% KS_SELECTION1 - implements the heuristic method from [2] for +% the selection of the number of factors from each cluster used +% in the Clustered Latent Semantic Indexing method [1]. The +% number of factors from each cluster is at least 1. +% N_ST=KS_SELECTION1(A, N_COLS, ALPHA_VAL, L) returns in N_ST +% a vector of integers denoting the number of factors +% (sum equals L) selected from each cluster of the tdm A. +% N_COLS is a vector containing the last column index for +% each column block, while ALPHA_VAL is a value in [0, 1]. +% +% REFERENCES: +% [1] D. Zeimpekis and E. Gallopoulos. CLSI: A Flexible +% Approximation Scheme from Clustered Term-Document Matrices. +% In Proc. 5th SIAM International Conference on Data Mining, +% pages 631�635, Newport Beach, California, 2005. +% [2] D. Zeimpekis and E. Gallopoulos, "Linear and Non-Linear +% Dimensional Reduction via Class Representatives for Text +% Classification", In Proc. of the 2006 IEEE International +% Conference on Data Mining, pp. 1172-1177, December 2006, +% Hong Kong. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +n_st=ks_selection1_p(A, n_cols, alpha_val, l); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection1_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection1_p.p new file mode 100644 index 0000000000000000000000000000000000000000..02ea692c41eb04299be87829a0b1126dafe4ec03 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection1_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection_p.p new file mode 100644 index 0000000000000000000000000000000000000000..2443a478966e20bcbfeed22371a717bd27c746aa Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/ks_selection_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/nnmf_mul_update.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/nnmf_mul_update.m new file mode 100644 index 0000000000000000000000000000000000000000..c03148e71c5402a582d55f265d3207d3c891bb78 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/nnmf_mul_update.m @@ -0,0 +1,19 @@ +function varargout = nnmf_mul_update(A, W, H, nit, dsp) +% NNMF_MUL_UPDATE - Applies the multiplicative update algorithm +% of Lee and Seung. +% NNMF_MUL_UPDATE applies the multiplicative update algorithm +% of Lee and Seung for non-negative factorizations. [W, H, S] +% = nnmf_mul_update(A, W, H, NIT, DSP) produces a non-negative +% factorization of A, W*H, using as initial factors W and H, +% applying NIT iterations. +% +% REFERENCES: +% [1] D. Lee, S. Seung, Algorithms for Non-negative Matrix +% Factorization, NIPS (2000), 556-562. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(5, 5, nargin)); +if nargout==1, varargout{1}=nnmf_mul_update_p(A, W, H, nit, dsp); end +if nargout==2, [varargout{1}, varargout{2}]=nnmf_mul_update_p(A, W, H, nit, dsp); end +if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=nnmf_mul_update_p(A, W, H, nit, dsp); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/nnmf_mul_update_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/nnmf_mul_update_p.p new file mode 100644 index 0000000000000000000000000000000000000000..72f59ff8af88b25e7d46a47dda14822a96478ab1 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/nnmf_mul_update_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca.m new file mode 100644 index 0000000000000000000000000000000000000000..1d9f95989a2cabce6ba4f4a1297e3c11bf2136f8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca.m @@ -0,0 +1,18 @@ +function [U, S, V]=pca(A, c, k, method) +% PCA - Principal Component Analysis +% [U, S, V]=PCA(A, C, K, METHOD) computes the K-factor +% Principal Component Analysis of A, i.e. SVD of +% A-C*ones(size(A, 2), 1), using either the svds function +% of MATLAB or the PROPACK package [1]. +% +% REFERENCES: +% [1] R.M.Larsen, PROPACK: A Software Package for the +% Symmetric Eigenvalue Problem and Singular Value Problems +% on Lanczos and Lanczos Bidiagonalization +% with Partial Reorthogonalization, Stanford University, +% http://sun.stanford.edu/~rmunk/PROPACK. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +[U, S, V]=pca_p(A, c, k, method); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat.m new file mode 100644 index 0000000000000000000000000000000000000000..2b905351d1067ccd25e7947a22e2b5543716a6c6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat.m @@ -0,0 +1,10 @@ +function [U, S, V]=pca_mat(A, c, k) +% PCA_MAT - Principal Component Analysis with MATLAB (svds) +% [U, S, V]=PCA_MAT(A, C, K) computes the K-factor Principal +% Component Analysis of A, i.e. SVD of A-C*ones(size(A, 2), +% 1), using the svds function of MATLAB. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(3, 3, nargin)); +[U, S, V]=pca_mat_p(A, c, k); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat_afun.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat_afun.m new file mode 100644 index 0000000000000000000000000000000000000000..718d8cbc2a552bdfeb44f82fbbcb21ef65930bb3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat_afun.m @@ -0,0 +1,7 @@ +function y=pca_mat_afun(x, A, h, g) +% PCA_MAT_AFUN - Auxiliary function used in PCA_MAT. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +y=pca_mat_afun_p(x, A, h, g); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat_afun_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat_afun_p.p new file mode 100644 index 0000000000000000000000000000000000000000..751b1db7176a00d7b82d80658d918b1e5dd5c9ca Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat_afun_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat_p.p new file mode 100644 index 0000000000000000000000000000000000000000..952f6c4546981162b11954ae2dd9fdd3067750b8 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_mat_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_p.p new file mode 100644 index 0000000000000000000000000000000000000000..33f2a48da03e6cb7feaaeaf0b6c8c6a2cbabbcb5 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack.m new file mode 100644 index 0000000000000000000000000000000000000000..2d1dab073c7c5de29ea89eb6a3f7afa3ced31fb8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack.m @@ -0,0 +1,17 @@ +function [U, S, V]=pca_propack(A, c, k) +% PCA_PROPACK - Principal Component Analysis with PROPACK +% [U, S, V]=PCA_PROPACK(A, C, K) computes the K-factor +% Principal Component Analysis of A, i.e. SVD of +% A-C*ones(size(A, 2), 1), using the PROPACK package [1]. +% +% REFERENCES: +% [1] R.M.Larsen, PROPACK: A Software Package for the +% Symmetric Eigenvalue Problem and Singular Value Problems +% on Lanczos and Lanczos Bidiagonalization +% with Partial Reorthogonalization, Stanford University, +% http://sun.stanford.edu/~rmunk/PROPACK. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(3, 3, nargin)); +[U, S, V]=pca_propack_p(A, c, k); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_Atransfunc.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_Atransfunc.m new file mode 100644 index 0000000000000000000000000000000000000000..1f3484f893625961f3a459ff04b5dd1119fd414e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_Atransfunc.m @@ -0,0 +1,7 @@ +function y=pca_propack_Atransfunc(x) +% PCA_PROPACK_ATRANSFUNC - Auxiliary function used in PCA_PROPACK. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +y=pca_propack_Atransfunc_p(x); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_Atransfunc_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_Atransfunc_p.p new file mode 100644 index 0000000000000000000000000000000000000000..83c4cc9266eb60c3239cb4c1d58acdb9cb62ffae Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_Atransfunc_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_afun.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_afun.m new file mode 100644 index 0000000000000000000000000000000000000000..aa317f38145fb994582e3fa6804dd1492227c389 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_afun.m @@ -0,0 +1,7 @@ +function y=pca_propack_afun(x) +% PCA_PROPACK_AFUN - Auxiliary function used in TMG_PCA_PROPACK. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +y=pca_propack_afun_p(x); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_afun_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_afun_p.p new file mode 100644 index 0000000000000000000000000000000000000000..17fd3d0607190716772e89771dcd2fb4b20ad589 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_afun_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_p.p new file mode 100644 index 0000000000000000000000000000000000000000..97665d85db2ce6e375fcbe1ca7db50354596bf1f Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_propack_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update.m new file mode 100644 index 0000000000000000000000000000000000000000..7361b55a849a5d9ec86c8ee76567c5f8d2c32499 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update.m @@ -0,0 +1,12 @@ +function [U, S, V]=pca_update(A, W, H, c, k) +% PCA_UPDATE - Principal Component Analysis of a rank-l +% updated matrix with MATLAB (eigs) +% [U, S, V]=PCA_UPDATE(A, W, H, C, K) computes the K-factor +% Principal Component Analysis of A - W * H, i.e. SVD of +% (A - W * H) - C * ones(size(A, 2), 1), using the svds +% function of MATLAB. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(5, 5, nargin)); +[U, S, V]=pca_update_p(A, W, H, c, k); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update_afun.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update_afun.m new file mode 100644 index 0000000000000000000000000000000000000000..0de172091775bac4d6a0dcca6879a0ca64cce5d9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update_afun.m @@ -0,0 +1,7 @@ +function y=pca_update_afun(x, A, W, H, h, g) +% PCA_UPDATE_AFUN - Auxiliary function used in PCA_UPDATE. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(6, 6, nargin)); +y=pca_update_afun_p(x, A, W, H, h, g); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update_afun_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update_afun_p.p new file mode 100644 index 0000000000000000000000000000000000000000..a6cf8650d9197d1b2b62cc6903eb93614a744109 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update_afun_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update_p.p new file mode 100644 index 0000000000000000000000000000000000000000..f958b23db188812256829cf963ae90f129c8bc47 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/pca_update_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/sdd_tmg.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/sdd_tmg.m new file mode 100644 index 0000000000000000000000000000000000000000..9c36556f1624ec66a5d4be1fe1561ff8f27020d1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/sdd_tmg.m @@ -0,0 +1,16 @@ +function [X, D, Y]=sdd_tmg(A, k) +% SDD_TMG - interface for SDDPACK +% [X, D, Y]=SDD_TMG(A, K) computes a rank-K Semidiscrete +% Decomposition of A using the SDDPACK [1]. +% +% REFERENCES: +% Tamara G. Kolda and Dianne P. O'Leary, Computation and +% Uses of the Semidiscrete Matrix Decomposition, Computer +% Science Department Report CS-TR-4012 Institute for Advanced +% Computer Studies Report UMIACS-TR-99-22, University of +% Maryland, April 1999. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +[X, D, Y]=sdd_tmg_p(A, k); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/sdd_tmg_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/sdd_tmg_p.p new file mode 100644 index 0000000000000000000000000000000000000000..fa5aaf2847ddb67da18772735cd04c4a94bab7be Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/sdd_tmg_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_tmg.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_tmg.m new file mode 100644 index 0000000000000000000000000000000000000000..9a7cae7fb7d54ec2f899640090290fb2abb32a08 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_tmg.m @@ -0,0 +1,17 @@ +function [U, S, V]=svd_tmg(A, k, method) +% SVD_TMG - Singular Value Decomposition +% [U, S, V]=SVD_TMG(A, K, METHOD) computes the K-factor +% truncated Singular Value Decomposition of A using either +% the svds function of MATLAB or the PROPACK package [1]. +% +% REFERENCES: +% [1] R.M.Larsen, PROPACK: A Software Package for the +% Symmetric Eigenvalue Problem and Singular Value Problems +% on Lanczos and Lanczos Bidiagonalization +% with Partial Reorthogonalization, Stanford University, +% http://sun.stanford.edu/~rmunk/PROPACK. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(3, 3, nargin)); +[U, S, V]=svd_tmg_p(A, k, method); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_tmg_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_tmg_p.p new file mode 100644 index 0000000000000000000000000000000000000000..353eaceb0f16ccf4de0fb82b01e2db852a532181 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_tmg_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update.m new file mode 100644 index 0000000000000000000000000000000000000000..b58d2cafc555b902263edc42820d918c2756abd7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update.m @@ -0,0 +1,10 @@ +function [U, S, V]=svd_update(A, X, Y, k) +% SVD_UPDATE - Singular Value Decomposition of a +% rank-l update matrix with MATLAB (eigs) +% [U, S, V]=SVD_UPDATE(A, X, Y, K) computes the +% K-factor SVD of A-X*Y, using the eigs function of MATLAB. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +[U, S, V]=svd_update_p(A, X, Y, k); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update_afun.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update_afun.m new file mode 100644 index 0000000000000000000000000000000000000000..9384f4ff3ce6ab28fbff914b100cb882e3d0cffd --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update_afun.m @@ -0,0 +1,7 @@ +function y=svd_update_afun(x, A, X, Y) +% SVD_UPDATE_AFUN - Auxiliary function used in SVD_UPDATE. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +y=svd_update_afun_p(x, A, X, Y); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update_afun_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update_afun_p.p new file mode 100644 index 0000000000000000000000000000000000000000..91b0b75847aa70c1ff6bd20aeb17488526f75af7 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update_afun_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update_p.p new file mode 100644 index 0000000000000000000000000000000000000000..c7c318e448406f80ca8ad961794b7761059b3cdc Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr/svd_update_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr_gui.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr_gui.fig new file mode 100644 index 0000000000000000000000000000000000000000..ef13b7c6359de13ecbceae9d39456c1976aa4f06 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr_gui.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr_gui.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr_gui.m new file mode 100644 index 0000000000000000000000000000000000000000..50cf80f7b188e95b7f49d55bef9cc695026d1dcb --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/dr_gui.m @@ -0,0 +1,961 @@ +function varargout = dr_gui(varargin) +% DR_GUI +% DR_GUI is a graphical user interface for all +% the dimensionality reduction functions of the Text +% to Matrix Generator (TMG) Toolbox. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @dr_gui_OpeningFcn, ... + 'gui_OutputFcn', @dr_gui_OutputFcn, ... + 'gui_LayoutFcn', [], ... + 'gui_Callback', []); +if nargin && ischar(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + +% --- Executes just before dr_gui is made visible. +function dr_gui_OpeningFcn(hObject, eventdata, handles, varargin) +% This function has no output args, see OutputFcn. +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +% varargin unrecognized PropertyName/PropertyValue pairs from the +% command line (see VARARGIN) + +% Choose default command line output for dr_gui +handles.output = hObject; + +handles.light_gray=[0.8824 0.8824 0.8824]; +handles.gray=[0.9255 0.9137 0.8471]; +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=14.5410; +wdth=15.7572; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +handles.objects=[handles.svdsRadio;handles.propackRadio;handles.kmeansRadio;handles.skmeansRadio;... + handles.PDDPRadio;handles.nClusters;handles.CentroidInit;handles.CentroidsVar;handles.CentroidsVarButton;... + handles.Termination;handles.TerminationValue;handles.DispRes;handles.lPDDP;handles.PDDPVariant;... + handles.maxlPDDP;handles.ksSelection;handles.ksSelection1]; + +states=zeros(length(handles.objects), 1); states([1 2])=1; +handles=activate_uicontrol(states, handles); + +% Update handles structure +guidata(hObject, handles); + +% UIWAIT makes dr_gui wait for user response (see UIRESUME) +% uiwait(handles.figure1); + + +% --- Outputs from this function are returned to the command line. +function varargout = dr_gui_OutputFcn(hObject, eventdata, handles) +% varargout cell array for returning output args (see VARARGOUT); +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Get default command line output from handles structure +varargout{1} = handles.output; + + +% --- Executes during object creation, after setting all properties. +function DatasetMenu_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end +datasets=cell(1, 1); datasets{1, 1}=''; +n_datasets=0; +str=fileparts(mfilename('fullpath')); +dirs=dir(strcat(str, filesep, 'data')); +for i=1:size(dirs, 1), + cur=dirs(i); + if isequal(cur.name, '.') | isequal(cur.name, '..') | ~isdir(strcat(str, filesep, 'data', filesep, cur.name)), continue; end + if exist(strcat(str, filesep, 'data', filesep, cur.name, filesep, 'A.mat')), n_datasets=n_datasets+1; datasets{n_datasets+1, 1}=strcat(str, filesep, 'data', filesep, cur.name); end +end +set(hObject, 'String', datasets); +guidata(hObject, handles); + +function DatasetMenu_Callback(hObject, eventdata, handles) + + +% --- Executes on button press in SVDRadio. +function SVDRadio_Callback(hObject, eventdata, handles) +% hObject handle to SVDRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of SVDRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.PCARadio, 'Value', 0); + set(handles.CLSIRadio, 'Value', 0); + set(handles.CMRadio, 'Value', 0); + set(handles.SDDRadio, 'Value', 0); + set(handles.SPQRRadio, 'Value', 0); +end + +states=zeros(length(handles.objects), 1); states([1 2])=1; +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + + + +function nFactorsSVD_Callback(hObject, eventdata, handles) +% hObject handle to nFactorsSVD (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of nFactorsSVD as text +% str2double(get(hObject,'String')) returns contents of nFactorsSVD as a double +if get(handles.CMRadio, 'Value')==1, set(handles.nClusters, 'String', get(hObject, 'String')); end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function nFactorsSVD_CreateFcn(hObject, eventdata, handles) +% hObject handle to nFactorsSVD (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in StoreRes. +function StoreRes_Callback(hObject, eventdata, handles) +% hObject handle to StoreRes (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of StoreRes +guidata(hObject, handles); + +% --- Executes on button press in ContinueButton. +function ContinueButton_Callback(hObject, eventdata, handles) +% hObject handle to ContinueButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +datasets=get(handles.DatasetMenu, 'String'); +id=get(handles.DatasetMenu, 'Value'); +if isequal(datasets{id}, ''), msgbox('You have to provide a dataset...', 'Error', 'modal'); return; end +k=get(handles.nFactorsSVD, 'String'); +if isempty(k), msgbox('You have to provide the number of factors...', 'Error', 'modal'); return; end +k=str2double(k); +if ~isnumeric(k), msgbox('You have to provide the number of factors...', 'Error', 'modal'); return; end +if mod(k, 1)~=0, msgbox('You have to provide an integer number of factors...', 'Error', 'modal'); return; end +load(strcat(datasets{id}, filesep, 'A.mat')); + +if get(handles.CLSIRadio, 'Value')==1 | get(handles.CMRadio, 'Value')==1, + nc=get(handles.nClusters, 'String'); + if isempty(nc), msgbox('You have to provide the number of clusters...', 'Error', 'modal'); return; end + nc=str2double(nc); + if ~isnumeric(nc), msgbox('You have to provide the number of clusters...', 'Error', 'modal'); return; end + if mod(nc, 1)~=0, msgbox('You have to provide an integer number of clusters...', 'Error', 'modal'); return; end + if nc>k, msgbox('Number of clusters must not exceed number of factors...', 'Error', 'modal'); return; end + if nc<k & get(handles.CMRadio, 'Value')==1, msgbox('Number of clusters must be equal to the number of factors for the Centroids Method...', 'Error', 'modal'); return; end + + clust_method=''; + if get(handles.kmeansRadio, 'Value')==1, clust_method='kmeans'; elseif get(handles.skmeansRadio, 'Value')==1, clust_method='skmeans'; else, clust_method='pddp'; end + if ~isequal(clust_method, 'pddp'), + centroids=get(handles.CentroidInit, 'Value'); + if centroids==1, + C=[]; + else, + s=get(handles.CentroidsVar, 'String'); + if isempty(s), msgbox('You have to provide the centroids variable. Use the Browse button...', 'Error', 'modal'); return; end + C=evalin('base', s); + [m, n]=size(C); if m~=size(A, 1) | n~=k, msgbox('The centroid variable you provided has incorrect dimensions...', 'Error', 'modal'); return; end + end + + term_method=get(handles.Termination, 'Value'); + s=get(handles.TerminationValue, 'String'); + if term_method==1, + term_method='epsilon'; + if isempty(s), + r=questdlg('You didn''t provide the epsilon value. Using the default value...', 'Genie Question', 'OK', 'CANCEL', 'OK'); + if ~isequal(r, 'OK'), return; end + else, + s=str2double(s); + if ~isnumeric(s), msgbox('You have to provide the epsilon value...', 'Error', 'modal'); return; end + opts.epsilon=s; + end + else, + term_method='n_iter'; + if isempty(s), + r=questdlg('You didn''t provide the ''number of iterations'' value. Using the default value...', 'Genie Question', 'OK', 'CANCEL', 'OK'); + if ~isequal(r, 'OK'), return; end + else, + s=str2double(s); + if ~isnumeric(s), msgbox('You have to provide the number of iterations...', 'Error', 'modal'); return; end + if mod(s, 1)~=0, msgbox('You have to provide an integer number of iterations...', 'Error', 'modal'); return; end + opts.iter=s; + end + end + if get(handles.DispRes, 'Value')==1, opts.dsp=1; else, opts.dsp=0; end + if isequal(clust_method, 'kmeans'), + clusters=ekmeans(A, C, nc, term_method, opts); + else, + clusters=skmeans(A, C, nc, term_method, opts); + end + else, + if get(handles.svdsRadio, 'Value')==1, svd_method='svds'; else, svd_method='propack'; end + if get(handles.maxlPDDP, 'Value')==1, + v=get(handles.PDDPVariant, 'Value'); + if v==1, + clusters=pddp(A, nc, 'max', svd_method, get(handles.DispRes, 'Value')); + else, + clusters=pddp_optcutpd(A, nc, 'max', svd_method, get(handles.DispRes, 'Value')); + end + else, + l=get(handles.lPDDP, 'String'); + tmp=2^str2num(l); while tmp<k, tmp=tmp+2^str2num(l)-1; end + if tmp>k, + if get(handles.CLSIRadio, 'Value')==1, + err_pddp=new_sprintf('Number of principal components for PDDP you supplied produces more than %d clusters (number of factors for CLSI). Please alter your selection...', k); + else, + err_pddp=new_sprintf('Number of principal components for PDDP you supplied produces more than %d clusters (number of factors for CM). Please alter your selection...', k); + end + msgbox(err_pddp, 'Error', 'modal'); return; + end + if isempty(l), msgbox('You have to provide the number of principal directions for PDDP...', 'Error', 'modal'); return; end + v=get(handles.PDDPVariant, 'Value'); + if str2double(l)>1, + if v==1, + clusters=pddp(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + else, + clusters=pddp_optcutpd(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + end + else, + if v==1, + clusters=pddp(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + elseif v==2, + clusters=pddp_2means(A, nc, svd_method, get(handles.DispRes, 'Value'), 0); + elseif v==3, + clusters=pddp_optcut(A, nc, svd_method, get(handles.DispRes, 'Value')); + elseif v==4, + clusters=pddp_optcut_2means(A, nc, svd_method, get(handles.DispRes, 'Value'), 0); + else, + clusters=pddp_optcutpd(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + end + end + end + end + assignin('base', 'clusters', clusters); +end + + +if get(handles.SVDRadio, 'Value')==1, + if get(handles.svdsRadio, 'Value')==1, svd_method='svds'; else, svd_method='propack'; end + [Usvd, Ssvd, Vsvd]=svd_tmg(A, k, svd_method); + + assignin('base', 'A', A); assignin('base', 'Usvd', Usvd); assignin('base', 'Ssvd', Ssvd); assignin('base', 'Vsvd', Vsvd); assignin('base', 'k', k); +end +if get(handles.PCARadio, 'Value')==1, + if get(handles.svdsRadio, 'Value')==1, svd_method='svds'; else, svd_method='propack'; end + [Upca, Spca, Vpca]=pca(A, sum(A, 2)/size(A, 2), k, svd_method); + + assignin('base', 'A', A); assignin('base', 'Upca', Upca); assignin('base', 'Spca', Spca); assignin('base', 'Vpca', Vpca); assignin('base', 'k', k); +end +if get(handles.CLSIRadio, 'Value')==1, + if get(handles.svdsRadio, 'Value')==1, svd_method='svds'; else, svd_method='propack'; end + if get(handles.ksSelection, 'Value')==0, func='ff'; elseif get(handles.ksSelection1, 'Value')==1, func='f1'; else, func='f'; end + [Xclsi, Yclsi]=clsi(A, clusters, k, func, 0.5, svd_method); + + assignin('base', 'A', A); assignin('base', 'Xclsi', Xclsi); assignin('base', 'Yclsi', Yclsi); assignin('base', 'k', k); +end +if get(handles.CMRadio, 'Value')==1, + [Xcm, Ycm]=cm(A, clusters); + + assignin('base', 'A', A); assignin('base', 'Xcm', Xcm); assignin('base', 'Ycm', Ycm); assignin('base', 'k', k); +end +if get(handles.SDDRadio, 'Value')==1, + if get(handles.svdsRadio, 'Value')==1, svd_method='svds'; else, svd_method='propack'; end + [Xsdd, Dsdd, Ysdd]=sdd_tmg(A, k); + + assignin('base', 'A', A); assignin('base', 'Dsdd', Dsdd); assignin('base', 'Xsdd', Xsdd); assignin('base', 'Ysdd', Ysdd); assignin('base', 'k', k); +end +if get(handles.SPQRRadio, 'Value')==1, + [ncols, Rspqr, colx, norms]=spqr(A, 10^(-8)*norm(A, 'fro'), k); + Qspqr=A(:, colx(1:ncols))*inv(Rspqr(:, 1:ncols)); + Apspqr=A(:, colx); + assignin('base', 'A', A); assignin('base', 'Apspqr', Apspqr); assignin('base', 'Qspqr', Qspqr); assignin('base', 'Rspqr', Rspqr); assignin('base', 'k', k); +end + +if get(handles.StoreRes, 'Value')==1, + datasets=get(handles.DatasetMenu, 'String'); v=get(handles.DatasetMenu, 'Value'); dataset=datasets{v}; + if get(handles.SVDRadio, 'Value')==1, + str=strcat(dataset, filesep, 'svd'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + str1=strcat(str, filesep, 'Usvd.mat'); str2=strcat(str, filesep, 'Ssvd.mat'); str3=strcat(str, filesep, 'Vsvd.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; if exist(str3), delete(str3); end; + end + str1=strcat(str, filesep, 'Usvd'); str2=strcat(str, filesep, 'Ssvd'); str3=strcat(str, filesep, 'Vsvd'); + save(str1, 'Usvd'); save(str2, 'Ssvd'); save(str3, 'Vsvd'); + end + if get(handles.PCARadio, 'Value')==1, + str=strcat(dataset, filesep, 'pca'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + str1=strcat(str, filesep, 'Upca.mat'); str2=strcat(str, filesep, 'Spca.mat'); str3=strcat(str, filesep, 'Vpca.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; if exist(str3), delete(str3); end; + end + str1=strcat(str, filesep, 'Upca'); str2=strcat(str, filesep, 'Spca'); str3=strcat(str, filesep, 'Vpca'); + save(str1, 'Upca'); save(str2, 'Spca'); save(str3, 'Vpca'); + end + if get(handles.CLSIRadio, 'Value')==1, + str=strcat(dataset, filesep, 'clsi'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + str1=strcat(str, filesep, 'Xclsi.mat'); str2=strcat(str, filesep, 'Yclsi.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; + end + str1=strcat(str, filesep, 'Xclsi'); str2=strcat(str, filesep, 'Yclsi'); + save(str1, 'Xclsi'); save(str2, 'Yclsi'); + end + if get(handles.CMRadio, 'Value')==1, + str=strcat(dataset, filesep, 'cm'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + str1=strcat(str, filesep, 'Xcm.mat'); str2=strcat(str, filesep, 'Ycm.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; + end + str1=strcat(str, filesep, 'Xcm'); str2=strcat(str, filesep, 'Ycm'); + save(str1, 'Xcm'); save(str2, 'Ycm'); + end + if get(handles.SDDRadio, 'Value')==1, + str=strcat(dataset, filesep, 'sdd'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + str1=strcat(str, filesep, 'Dsdd.mat'); str2=strcat(str, filesep, 'Xsdd.mat'); str3=strcat(str, filesep, 'Ysdd.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; if exist(str3), delete(str3); end; + end + str1=strcat(str, filesep, 'Dsdd'); str2=strcat(str, filesep, 'Xsdd'); str3=strcat(str, filesep, 'Ysdd'); + save(str1, 'Dsdd'); save(str2, 'Xsdd'); save(str3, 'Ysdd'); + end + if get(handles.SPQRRadio, 'Value')==1, + str=strcat(dataset, filesep, 'spqr'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + str1=strcat(str, filesep, 'Qspqr.mat'); str2=strcat(str, filesep, 'Rspqr.mat'); str3=strcat(str, filesep, 'Apspqr.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; if exist(str3), delete(str3); end; + end + str1=strcat(str, filesep, 'Qspqr'); str2=strcat(str, filesep, 'Rspqr'); str3=strcat(str, filesep, 'Apspqr'); + save(str1, 'Qspqr'); save(str2, 'Rspqr'); save(str3, 'Apspqr'); + end +end +msgbox('Done!', 'modal') + +guidata(hObject, handles); + +% --- Executes on button press in ClearBotton. +function ClearBotton_Callback(hObject, eventdata, handles) +% hObject handle to ClearBotton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +set(handles.DatasetMenu, 'Value', 1); +set(handles.SVDRadio, 'Value', 1); set(handles.PCARadio, 'Value', 0); set(handles.CLSIRadio, 'Value', 0); +set(handles.CMRadio, 'Value', 0); set(handles.SDDRadio, 'Value', 0); set(handles.SPQRRadio, 'Value', 0); +set(handles.svdsRadio, 'Value', 1); set(handles.propackRadio, 'Value', 0); +set(handles.kmeansRadio, 'Value', 1); set(handles.skmeansRadio, 'Value', 0); set(handles.PDDPRadio, 'Value', 0); +set(handles.CentroidInit, 'Value', 1); set(handles.CentroidsVar, 'String', ''); +set(handles.Termination, 'Value', 1); set(handles.TerminationValue, 'String', '1'); +set(handles.lPDDP, 'String', '1'); set(handles.maxlPDDP, 'Value', 0); +set(handles.ksSelection, 'Value', 1); set(handles.ksSelection1, 'Value', 0); set(handles.nClusters, 'String', ''); +set(handles.DispRes, 'Value', 1); set(handles.nFactorsSVD, 'String', ''); +set(handles.StoreRes, 'Value', 1); +s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; +set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); + +states=zeros(length(handles.objects), 1); states([1 2])=1; +handles=activate_uicontrol(states, handles); +guidata(hObject, handles); + +% --- Executes on button press in ExitButton. +function ExitButton_Callback(hObject, eventdata, handles) +% hObject handle to ExitButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +delete(handles.figure1); + + +% --- Executes on button press in PCARadio. +function PCARadio_Callback(hObject, eventdata, handles) +% hObject handle to PCARadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of PCARadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.SVDRadio, 'Value', 0); + set(handles.CLSIRadio, 'Value', 0); + set(handles.CMRadio, 'Value', 0); + set(handles.SDDRadio, 'Value', 0); + set(handles.SPQRRadio, 'Value', 0); +end + +states=zeros(length(handles.objects), 1); states([1 2])=1; +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in CLSIRadio. +function CLSIRadio_Callback(hObject, eventdata, handles) +% hObject handle to CLSIRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of CLSIRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.SVDRadio, 'Value', 0); + set(handles.PCARadio, 'Value', 0); + set(handles.CMRadio, 'Value', 0); + set(handles.SDDRadio, 'Value', 0); + set(handles.SPQRRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); states(8)=-1; +handles=activate_uicontrol(states, handles); + +state_kmeans=get(handles.kmeansRadio, 'Value'); +state_skmeans=get(handles.skmeansRadio, 'Value'); +state_pddp=get(handles.PDDPRadio, 'Value'); +if state_kmeans==1, + states=ones(length(handles.objects), 1); states([13 14 15])=0; states(8)=-1; + state=get(handles.CentroidInit, 'Value'); + if state==1, states([8 9])=0; end +end +if state_skmeans==1, + states=ones(length(handles.objects), 1); states([13 14 15])=0; states(8)=-1; + state=get(handles.CentroidInit, 'Value'); + if state==1, states([8 9])=0; end +end +if state_pddp==1, + states=zeros(length(handles.objects), 1); states([1 2 3 4 5 6 12 13 14 15 16])=1; + state=get(handles.maxlPDDP, 'Value'); + if state==1, + set(handles.lPDDP, 'String', ''); + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); + else, + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); + end +end +if get(handles.ksSelection, 'Value')==1, states(17)=1; else, states(17)=0; end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in CMRadio. +function CMRadio_Callback(hObject, eventdata, handles) +% hObject handle to CMRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of CMRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.SVDRadio, 'Value', 0); + set(handles.PCARadio, 'Value', 0); + set(handles.CLSIRadio, 'Value', 0); + set(handles.SDDRadio, 'Value', 0); + set(handles.SPQRRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); states([1 2])=0; states(8)=-1; states(6)=-1; +handles=activate_uicontrol(states, handles); + +state_kmeans=get(handles.kmeansRadio, 'Value'); +state_skmeans=get(handles.skmeansRadio, 'Value'); +state_pddp=get(handles.PDDPRadio, 'Value'); +if state_kmeans==1, + states=ones(length(handles.objects), 1); states([1 2 13 14 15 16 17])=0; states(8)=-1; states(6)=-1; + state=get(handles.CentroidInit, 'Value'); + if state==1, states([8 9])=0; end +end +if state_skmeans==1, + states=ones(length(handles.objects), 1); states([1 2 13 14 15 16 17])=0; states(8)=-1; states(6)=-1; + state=get(handles.CentroidInit, 'Value'); + if state==1, states([8 9])=0; end +end +if state_pddp==1, + states=zeros(length(handles.objects), 1); states([1 2 3 4 5 6 12 13 14 15])=1; states(6)=-1; + state=get(handles.maxlPDDP, 'Value'); + if state==1, + set(handles.lPDDP, 'String', ''); + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); + else, + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); + end +end +set(handles.nClusters, 'String', get(handles.nFactorsSVD, 'String')); +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in SDDRadio. +function SDDRadio_Callback(hObject, eventdata, handles) +% hObject handle to SDDRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of SDDRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.SVDRadio, 'Value', 0); + set(handles.PCARadio, 'Value', 0); + set(handles.CLSIRadio, 'Value', 0); + set(handles.CMRadio, 'Value', 0); + set(handles.SPQRRadio, 'Value', 0); +end + +states=zeros(length(handles.objects), 1); +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in SPQRRadio. +function SPQRRadio_Callback(hObject, eventdata, handles) +% hObject handle to SPQRRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of SPQRRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.SVDRadio, 'Value', 0); + set(handles.PCARadio, 'Value', 0); + set(handles.CLSIRadio, 'Value', 0); + set(handles.CMRadio, 'Value', 0); + set(handles.SDDRadio, 'Value', 0); +end + +states=zeros(length(handles.objects), 1); +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in svdsRadio. +function svdsRadio_Callback(hObject, eventdata, handles) +% hObject handle to svdsRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of svdsRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.propackRadio, 'Value', 0); +end +guidata(hObject, handles); + +% --- Executes on button press in propackRadio. +function propackRadio_Callback(hObject, eventdata, handles) +% hObject handle to propackRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of propackRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.svdsRadio, 'Value', 0); +end +guidata(hObject, handles); + +% --- Executes on button press in kmeansRadio. +function kmeansRadio_Callback(hObject, eventdata, handles) +% hObject handle to kmeansRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of kmeansRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.skmeansRadio, 'Value', 0); + set(handles.PDDPRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); states([13 14 15])=0; states(8)=-1; +if ~get(handles.CLSIRadio, 'Value')==1, states([1 2])=0; end +state=get(handles.CentroidInit, 'Value'); +if state==1, states([8 9])=0; end +if get(handles.ksSelection, 'Value')==0, states(17)=0; else, states(17)=1; end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in skmeansRadio. +function skmeansRadio_Callback(hObject, eventdata, handles) +% hObject handle to skmeansRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of skmeansRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.kmeansRadio, 'Value', 0); + set(handles.PDDPRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); states([13 14 15])=0; states(8)=-1; +if ~get(handles.CLSIRadio, 'Value')==1, states([1 2])=0; end +state=get(handles.CentroidInit, 'Value'); +if state==1, states([8 9])=0; end +if get(handles.ksSelection, 'Value')==0, states(17)=0; else, states(17)=1; end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in PDDPRadio. +function PDDPRadio_Callback(hObject, eventdata, handles) +% hObject handle to PDDPRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of PDDPRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.kmeansRadio, 'Value', 0); + set(handles.skmeansRadio, 'Value', 0); +end + +states=zeros(length(handles.objects), 1); states([1 2 3 4 5 6 12 13 14 15 16])=1; +state=get(handles.maxlPDDP, 'Value'); +if state==1, + set(handles.lPDDP, 'String', ''); + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +else, + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +end +if get(handles.ksSelection, 'Value')==0, states(17)=0; else, states(17)=1; end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + + +function nClusters_Callback(hObject, eventdata, handles) +% hObject handle to nClusters (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of nClusters as text +% str2double(get(hObject,'String')) returns contents of nClusters as a double +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function nClusters_CreateFcn(hObject, eventdata, handles) +% hObject handle to nClusters (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on selection change in CentroidInit. +function CentroidInit_Callback(hObject, eventdata, handles) +% hObject handle to CentroidInit (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns CentroidInit contents as cell array +% contents{get(hObject,'Value')} returns selected item from CentroidInit +state=get(hObject, 'Value'); +if state==1, + set(handles.CentroidsVarButton, 'Enable', 'off'); +else, + set(handles.CentroidsVarButton, 'Enable', 'on'); +end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function CentroidInit_CreateFcn(hObject, eventdata, handles) +% hObject handle to CentroidInit (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function CentroidsVar_Callback(hObject, eventdata, handles) +% hObject handle to CentroidsVar (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of CentroidsVar as text +% str2double(get(hObject,'String')) returns contents of CentroidsVar +% as a double +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function CentroidsVar_CreateFcn(hObject, eventdata, handles) +% hObject handle to CentroidsVar (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in CentroidsVarButton. +function CentroidsVarButton_Callback(hObject, eventdata, handles) +% hObject handle to CentroidsVarButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s=open_file(3); +set(handles.CentroidsVar, 'String', s); +guidata(hObject, handles); + +% --- Executes on selection change in Termination. +function Termination_Callback(hObject, eventdata, handles) +% hObject handle to Termination (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns Termination contents as cell array +% contents{get(hObject,'Value')} returns selected item from Termination + +state=get(hObject, 'Value'); s=get(handles.TerminationValue, 'String'); +if state==1 & isempty(s), set(handles.TerminationValue, 'String', 1); end +if state==2 & isempty(s), set(handles.TerminationValue, 'String', 10); end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Termination_CreateFcn(hObject, eventdata, handles) +% hObject handle to Termination (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function TerminationValue_Callback(hObject, eventdata, handles) +% hObject handle to TerminationValue (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of TerminationValue as text +% str2double(get(hObject,'String')) returns contents of TerminationValue as a double +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function TerminationValue_CreateFcn(hObject, eventdata, handles) +% hObject handle to TerminationValue (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in DispRes. +function DispRes_Callback(hObject, eventdata, handles) +% hObject handle to DispRes (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of DispRes +guidata(hObject, handles); + + +function lPDDP_Callback(hObject, eventdata, handles) +% hObject handle to lPDDP (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of lPDDP as text +% str2double(get(hObject,'String')) returns contents of lPDDP as a double +l=get(hObject, 'String'); +if isempty(l), return; end +l=str2double(l); +if ~isnumeric(l), msgbox('You have to provide the number of principal directions...', 'Error', 'modal'); return; end +if mod(l, 1)~=0, msgbox('You have to provide an integer number of principal directions...', 'Error', 'modal'); return; end +state=get(handles.maxlPDDP, 'Value'); +if state==1, + set(handles.maxlPDDP, 'Value', 0); + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; + set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +end +if l>1, + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +else, + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function lPDDP_CreateFcn(hObject, eventdata, handles) +% hObject handle to lPDDP (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on selection change in PDDPVariant. +function PDDPVariant_Callback(hObject, eventdata, handles) +% hObject handle to PDDPVariant (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns PDDPVariant contents as cell array +% contents{get(hObject,'Value')} returns selected item from PDDPVariant +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function PDDPVariant_CreateFcn(hObject, eventdata, handles) +% hObject handle to PDDPVariant (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in maxlPDDP. +function maxlPDDP_Callback(hObject, eventdata, handles) +% hObject handle to maxlPDDP (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of maxlPDDP +state=get(hObject, 'Value'); +if state==1, + set(handles.lPDDP, 'String', ''); + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +else, + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPVariant, 'String', s); set(handles.PDDPVariant, 'Value', 1); +end +guidata(hObject, handles); + + +% --- Executes on button press in ksSelection. +function ksSelection_Callback(hObject, eventdata, handles) +% hObject handle to ksSelection (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of ksSelection +state=get(hObject, 'Value'); +if state==0, set(handles.ksSelection1, 'Enable', 'off'); else, set(handles.ksSelection1, 'Enable', 'on'); end + +%-------------------------------------------------------------------------- +%set Active and BackgroundColor field of each uicontrol item depending on +%the Radio Button that is pressed (called by the corresponding callback) +function handles=activate_uicontrol(states, handles) +sz=size(handles.objects, 1); +for i=1:sz, + if states(i)==1, tmp='on'; elseif states(i)==0, tmp='off'; else, tmp='inactive'; end + set(handles.objects(i), 'Enable', tmp); + if states(i)~=1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', handles.light_gray);continue; + end + if states(i)==1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', 'white'); + end +end + + +% --- Executes on button press in ksSelection1. +function ksSelection1_Callback(hObject, eventdata, handles) +% hObject handle to ksSelection1 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of ksSelection1 + + +% -------------------------------------------------------------------- +function NNMFMenu_Callback(hObject, eventdata, handles) +% hObject handle to NNMFMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/filters/tika-app-0.9.jar b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/filters/tika-app-0.9.jar new file mode 100644 index 0000000000000000000000000000000000000000..31edb727e3a946f266d4eb6579c2af473df76ec3 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/filters/tika-app-0.9.jar differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/filters/untex.exe b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/filters/untex.exe new file mode 100644 index 0000000000000000000000000000000000000000..524faebdf8521ad82e6575a1beb5965637f589c6 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/filters/untex.exe differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/gui.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/gui.fig new file mode 100644 index 0000000000000000000000000000000000000000..4e884aece350e707df68c87c8ad12b5794a9e331 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/gui.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/gui.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/gui.m new file mode 100644 index 0000000000000000000000000000000000000000..537628db8407d98373c28bf1b13643b7aad27124 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/gui.m @@ -0,0 +1,186 @@ +function varargout = gui(varargin) +% GUI +% GUI is a simple, top graphical user interface of the Text to +% Matrix Generator (TMG) Toolbox. Using GUI, the user can +% select any of the four GUI modules (indexing, dimensionality +% reduction, clustering, classification) of TMG. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @gui_OpeningFcn, ... + 'gui_OutputFcn', @gui_OutputFcn, ... + 'gui_LayoutFcn', [], ... + 'gui_Callback', []); +if nargin && ischar(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + +% --- Executes just before gui is made visible. +function gui_OpeningFcn(hObject, eventdata, handles, varargin) +% This function has no output args, see OutputFcn. +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +% varargin unrecognized PropertyName/PropertyValue pairs from the +% command line (see VARARGIN) + +% Choose default command line output for gui +handles.output = hObject; + +handles.light_gray=[0.8824 0.8824 0.8824]; +handles.gray=[0.9255 0.9137 0.8471]; +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=14.5410; +wdth=15.7572; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +% Update handles structure +guidata(hObject, handles); + +% UIWAIT makes gui wait for user response (see UIRESUME) +% uiwait(handles.figure1); + + +% --- Outputs from this function are returned to the command line. +function varargout = gui_OutputFcn(hObject, eventdata, handles) +% varargout cell array for returning output args (see VARARGOUT); +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Get default command line output from handles structure +varargout{1} = handles.output; + + +% --- Executes on button press in IndexingButton. +function IndexingButton_Callback(hObject, eventdata, handles) +% hObject handle to IndexingButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +tmg_gui; + +% --- Executes on button press in DRButton. +function DRButton_Callback(hObject, eventdata, handles) +% hObject handle to DRButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +dr_gui; + +% --- Executes on button press in RetrievalButton. +function RetrievalButton_Callback(hObject, eventdata, handles) +% hObject handle to RetrievalButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +retrieval_gui; + +% --- Executes on button press in ClusteringButton. +function ClusteringButton_Callback(hObject, eventdata, handles) +% hObject handle to ClusteringButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +clustering_gui; + +% --- Executes on button press in ClassificationButton. +function ClassificationButton_Callback(hObject, eventdata, handles) +% hObject handle to ClassificationButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +classification_gui; + +% --- Executes on button press in ExitButton. +function ExitButton_Callback(hObject, eventdata, handles) +% hObject handle to ExitButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +delete(handles.figure1); + +% -------------------------------------------------------------------- +function WindowMenu_Callback(hObject, eventdata, handles) +% hObject handle to WindowMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + + +% -------------------------------------------------------------------- +function IndexingMenu_Callback(hObject, eventdata, handles) +% hObject handle to IndexingMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +tmg_gui; + +% -------------------------------------------------------------------- +function DRMenu_Callback(hObject, eventdata, handles) +% hObject handle to DRMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +dr_gui; + +% -------------------------------------------------------------------- +function NNMFMenu_Callback(hObject, eventdata, handles) +% hObject handle to NNMFMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +nnmf_gui; + +% -------------------------------------------------------------------- +function RetrievalMenu_Callback(hObject, eventdata, handles) +% hObject handle to RetrievalMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +retrieval_gui; + +% -------------------------------------------------------------------- +function ClusteringMenu_Callback(hObject, eventdata, handles) +% hObject handle to ClusteringMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +clustering_gui; + +% -------------------------------------------------------------------- +function ClassificationMenu_Callback(hObject, eventdata, handles) +% hObject handle to ClassificationMenu (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +classification_gui; + +% -------------------------------------------------------------------- +function HelpMenu_Callback(hObject, eventdata, handles) + +% -------------------------------------------------------------------- +function DocMenu_Callback(hObject, eventdata, handles) +current_path=strcat(fileparts(mfilename('fullpath'))); +if exist(strcat(current_path, '/documentation/index.html')), + open(strcat(current_path, '/documentation/index.html')); +else, + msgbox('Documentation is not available...', 'Error', 'modal'); + return; +end + +% -------------------------------------------------------------------- +function OnlineHelp_Callback(hObject, eventdata, handles) +web('http://scgroup6.ceid.upatras.gr:8000/wiki/index.php/Main_Page'); + +% -------------------------------------------------------------------- +function About_Callback(hObject, eventdata, handles) +about_tmg_gui; + +% --- Executes on button press in NNMFButton. +function NNMFButton_Callback(hObject, eventdata, handles) +% hObject handle to NNMFButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +nnmf_gui; diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/init_tmg.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/init_tmg.m new file mode 100644 index 0000000000000000000000000000000000000000..b0df6355b97374ef54cce54c6d4cd6e0e1c3ea5c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/init_tmg.m @@ -0,0 +1,98 @@ +function init_tmg +% INIT_TMG - Installation script of TMG +% INIT_TMG is the installation script of the Text to Matrix +% Generator (TMG) Toolbox. INIT_TMG creates the MySQL +% database and adds all TMG directories to the path. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + + +an1=new_sprintf('=================================================================================================='); +% create database after a MATLAB restart +if exist('mysql_info.mat'), + load mysql_info.mat; + if isfield(mysql, 'run'), + res=create_database(mysql); + if res~=1, + if mysql.is_set==1, an=new_sprintf('WARNING: Unable to create MySQL database! '); disp(an); end + mysql.is_set=0; + else, + an=new_sprintf('Database created successfully!'); disp(an); + end + mysql=rmfield(mysql, 'run'); + save mysql_info mysql; + return; + end +end +% check for MySQL avalaibility and store +% corresponding information to mysql_info.mat +disp(an1); disp(an1); an=new_sprintf('You are about to installed the TMG Toolbox to you system. Press any key to continue!'); disp(an);disp(an1); disp(an1); pause; +tmp=isequal(strtrim(lower(input('Is MATLAB Database Toolbox installed (yes/no)?: ', 's'))), 'yes'); +quit_matlab=0; +if tmp==1, + mysql.is_set=isequal(strtrim(lower(input('Is MySQL installed (yes/no)?: ', 's'))), 'yes'); + if mysql.is_set==1, + str=input('Please give the full path to the MySQL Java Connector (jar file): ', 's'); + fid=fopen(strcat(matlabroot, filesep, 'toolbox', filesep, 'local', filesep, 'classpath.txt'), 'a'); fprintf(fid, '\n%s', str); fclose(fid); + mysql.user=input('Please give the login for MySQL: ', 's'); mysql.pass=input('Please give the password for MySQL: ', 's'); + quit_matlab=isequal(strtrim(lower(input('In order to complete the installation you have to exit MATLAB and run init_tmg again! Quitting MATLAB (yes/no)? ', 's'))), 'yes'); + if quit_matlab~=1, an=new_sprintf('Installation has not been completed! Please run init_tmg again! '); disp(an); return; end + mysql.run=1; + end +else, + mysql.is_set=0; +end +save mysql_info mysql; + +% add directories to path + +disp(an1); an=new_sprintf('Adding directories to MATLAB path...'); disp(an);disp(an1); +str=strcat(fileparts(mfilename('fullpath'))); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'classification'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'clustering'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'data'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'documentation'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'dr'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'results'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'retrieval'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'sample_documents'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'filters'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'log_files'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'var'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'var', filesep, 'ANLS'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'var', filesep, 'NNDSVD'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'var', filesep, 'PROPACK'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'var', filesep, 'SPQR'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +str=strcat(fileparts(mfilename('fullpath')), filesep, 'var', filesep, 'SDDPACK', filesep, 'matlab'); addpath(str); +an=new_sprintf('Adding directory %s...', str); disp(an); +savepath; +if quit_matlab==1, quit; end + +% create database for TMG +function res=create_database(mysql) +if mysql.is_set==0, + res=-1; return; +end +conn=database('mysql', mysql.user, mysql.pass, 'com.mysql.jdbc.Driver', 'jdbc:mysql://127.0.0.1:3306/mysql'); +if ~isempty(conn.Message), an=new_sprintf('MySQL: Unknown user or wrong password... Skipping...'); disp(an);res=-1; return; end +str1='create database TMG;'; +str2='use TMG;'; +str3='create table COLLECTION (id INT PRIMARY KEY AUTO_INCREMENT, name TEXT, location TEXT, ndocs_tot INT, ndocs_act INT, nterms INT, terms_per_doc DOUBLE, ind_terms_per_doc DOUBLE, sparsity DOUBLE, rem_tl INT, rem_g INT, rem_l INT, rem_stop INT, rem_stem INT);'; +str4='create table DOCUMENT (id BIGINT PRIMARY KEY AUTO_INCREMENT, body LONGTEXT, collection_id INT, doc_id BIGINT, FOREIGN KEY (collection_id) REFERENCES COLLECTION(id) ON DELETE CASCADE);'; +res=exec(conn, str1); res=exec(conn, str2); res=exec(conn, str3); res=exec(conn, str4); res=1; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/log_files/filters_results.log b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/log_files/filters_results.log new file mode 100644 index 0000000000000000000000000000000000000000..824dfdf3bf0714bd0e5b541ec68a9e93e0b65d56 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/log_files/filters_results.log @@ -0,0 +1,2404 @@ +================================================================================================================================================================== +Running TMG... +Converting Results on ../Data/textDocs.txt file in 08-Jul-2014 11:26:11... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 11:26:11... + +Estimated time of parsing documents: 0.018707 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on ../Data/textDocs.txt file in 08-Jul-2014 11:28:42... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 11:28:42... + +Estimated time of parsing documents: 0.032785 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450MNS&MM\CourseMaterialFinal\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 11:57:52... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 11:57:52... + +Estimated time of parsing documents: 0.143939 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 14:54:05... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 14:54:05... + +Estimated time of parsing documents: 0.057501 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 14:54:21... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 14:54:21... + +Estimated time of parsing documents: 0.021207 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 14:54:33... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 14:54:33... + +Estimated time of parsing documents: 0.032240 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 14:54:59... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 14:54:59... + +Estimated time of parsing documents: 0.038092 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 14:55:15... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 14:55:15... + +Estimated time of parsing documents: 0.022815 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:02:45... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:02:45... + +Estimated time of parsing documents: 0.139884 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:03:11... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:03:11... + +Estimated time of parsing documents: 0.030563 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:04:54... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:04:54... + +Estimated time of parsing documents: 0.244278 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:08:42... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:08:42... + +Estimated time of parsing documents: 0.032402 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:09:15... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:09:15... + +Estimated time of parsing documents: 0.139142 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:10:39... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:10:39... + +Estimated time of parsing documents: 0.172797 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:12:09... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:12:09... + +Estimated time of parsing documents: 0.212321 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:34:45... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:34:47... + +Estimated time of parsing documents: 1.819764 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:38:37... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:38:38... + +Estimated time of parsing documents: 0.156025 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 15:40:59... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:40:59... + +Estimated time of parsing documents: 0.144967 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on ../Data/textDocs.txt file in 08-Jul-2014 15:43:43... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 15:43:43... + +Estimated time of parsing documents: 0.031968 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:14:04... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:14:04... + +Estimated time of parsing documents: 0.039073 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on ../Data/textDocs.txt file in 08-Jul-2014 16:14:07... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:14:07... + +Estimated time of parsing documents: 0.022025 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:16:50... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:16:50... + +Estimated time of parsing documents: 0.023819 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:17:55... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:17:55... + +Estimated time of parsing documents: 0.032296 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:17:56... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:17:56... + +Estimated time of parsing documents: 0.018687 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:17:56... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:17:56... + +Estimated time of parsing documents: 0.016600 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:21:48... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:21:48... + +Estimated time of parsing documents: 0.042520 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:21:49... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:21:49... + +Estimated time of parsing documents: 0.018114 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:21:49... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:21:49... + +Estimated time of parsing documents: 0.016763 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:24:48... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:24:48... + +Estimated time of parsing documents: 0.087827 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:24:48... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:24:48... + +Estimated time of parsing documents: 0.038207 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 08-Jul-2014 16:24:48... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 08-Jul-2014 16:24:48... + +Estimated time of parsing documents: 0.016217 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 09-Jul-2014 15:22:57... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 09-Jul-2014 15:22:57... + +Estimated time of parsing documents: 0.046270 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 09-Jul-2014 15:22:58... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 09-Jul-2014 15:22:58... + +Estimated time of parsing documents: 0.021281 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 09-Jul-2014 15:22:59... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 09-Jul-2014 15:22:59... + +Estimated time of parsing documents: 0.017959 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 13:46:20... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 13:46:20... + +Estimated time of parsing documents: 0.040584 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 13:46:21... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 13:46:21... + +Estimated time of parsing documents: 0.017881 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 13:46:21... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 13:46:21... + +Estimated time of parsing documents: 0.016718 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 13:51:34... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 13:51:34... + +Estimated time of parsing documents: 0.062735 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 13:51:34... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 13:51:34... + +Estimated time of parsing documents: 0.020757 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 13:51:35... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 13:51:35... + +Estimated time of parsing documents: 0.076451 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 14:28:48... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 14:28:48... + +Estimated time of parsing documents: 0.074439 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 14:28:49... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 14:28:49... + +Estimated time of parsing documents: 0.035035 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 14:28:50... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 14:28:50... + +Estimated time of parsing documents: 0.036302 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 14:31:29... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 14:31:29... + +Estimated time of parsing documents: 0.071513 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 14:31:30... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 14:31:30... + +Estimated time of parsing documents: 0.050343 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 14:31:31... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 14:31:31... + +Estimated time of parsing documents: 0.031765 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 14:50:19... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 14:50:19... + +Estimated time of parsing documents: 0.028983 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 14:50:19... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 14:50:19... + +Estimated time of parsing documents: 0.015132 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 14:50:20... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 14:50:20... + +Estimated time of parsing documents: 0.014854 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 15:54:10... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 15:54:10... + +Estimated time of parsing documents: 0.094097 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 15:54:14... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 15:54:14... + +Estimated time of parsing documents: 0.462504 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 10-Jul-2014 15:54:14... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 10-Jul-2014 15:54:14... + +Estimated time of parsing documents: 0.045554 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 10:06:18... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 10:06:18... + +Estimated time of parsing documents: 0.047971 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 10:06:23... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 10:06:23... + +Estimated time of parsing documents: 0.078123 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 10:06:24... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 10:06:24... + +Estimated time of parsing documents: 0.020263 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 11:36:46... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 11:36:46... + +Estimated time of parsing documents: 0.046170 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 11:36:46... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 11:36:46... + +Estimated time of parsing documents: 0.020913 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 11:36:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 11:36:47... + +Estimated time of parsing documents: 0.021539 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 12:59:26... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 12:59:26... + +Estimated time of parsing documents: 0.054741 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 12:59:28... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 12:59:28... + +Estimated time of parsing documents: 0.027630 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 12:59:28... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 12:59:28... + +Estimated time of parsing documents: 0.023916 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 13:03:27... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 13:03:27... + +Estimated time of parsing documents: 0.033822 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 13:03:28... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 13:03:28... + +Estimated time of parsing documents: 0.023792 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 20-Jul-2014 13:03:28... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 20-Jul-2014 13:03:28... + +Estimated time of parsing documents: 0.017336 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 12:06:18... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 12:06:18... + +Estimated time of parsing documents: 0.123437 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 12:06:20... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 12:06:20... + +Estimated time of parsing documents: 0.041372 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 12:06:21... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 12:06:21... + +Estimated time of parsing documents: 0.127175 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 12:51:50... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 12:51:50... + +Estimated time of parsing documents: 0.365642 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 12:51:52... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 12:51:52... + +Estimated time of parsing documents: 0.084949 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 12:51:52... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 12:51:52... + +Estimated time of parsing documents: 0.026637 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 13:26:16... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 13:26:16... + +Estimated time of parsing documents: 0.075052 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 13:26:17... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 13:26:17... + +Estimated time of parsing documents: 0.026991 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 13:26:17... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 13:26:17... + +Estimated time of parsing documents: 0.016120 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 14:09:46... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 14:09:46... + +Estimated time of parsing documents: 0.137061 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 14:09:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 14:09:47... + +Estimated time of parsing documents: 0.025804 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 21-Jul-2014 14:09:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 21-Jul-2014 14:09:47... + +Estimated time of parsing documents: 0.022398 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 28-Jan-2015 13:13:46... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 28-Jan-2015 13:13:47... + +Estimated time of parsing documents: 0.017221 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 28-Jan-2015 13:13:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 28-Jan-2015 13:13:47... + +Estimated time of parsing documents: 0.003171 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 28-Jan-2015 13:13:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 28-Jan-2015 13:13:47... + +Estimated time of parsing documents: 0.003148 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 28-Jan-2015 13:40:36... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 28-Jan-2015 13:40:36... + +Estimated time of parsing documents: 0.013216 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 28-Jan-2015 13:40:36... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 28-Jan-2015 13:40:36... + +Estimated time of parsing documents: 0.012390 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 28-Jan-2015 13:40:36... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 28-Jan-2015 13:40:36... + +Estimated time of parsing documents: 0.003142 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 29-Jan-2015 11:21:08... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 29-Jan-2015 11:21:08... + +Estimated time of parsing documents: 0.012147 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 29-Jan-2015 11:21:08... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 29-Jan-2015 11:21:08... + +Estimated time of parsing documents: 0.008931 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 29-Jan-2015 11:21:09... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 29-Jan-2015 11:21:09... + +Estimated time of parsing documents: 0.003600 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on /home/sfvn/Dropbox/02450_public (1)/Exercises/02450Toolbox_Matlab/Data/textDocs.txt file in 06-Sep-2015 19:09:36... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 06-Sep-2015 19:09:37... + +Estimated time of parsing documents: 0.118478 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on /home/sfvn/Dropbox/02450_public (1)/Exercises/02450Toolbox_Matlab/Data/textDocs.txt file in 06-Sep-2015 19:09:51... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 06-Sep-2015 19:09:51... + +Estimated time of parsing documents: 0.004685 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on /home/sfvn/Dropbox/02450_public (1)/Exercises/02450Toolbox_Matlab/Data/textDocs.txt file in 06-Sep-2015 19:10:06... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 06-Sep-2015 19:10:06... + +Estimated time of parsing documents: 0.003407 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on /home/sfvn/Dropbox/02450_public (1)/Exercises/02450Toolbox_Matlab/Scripts/../Data/textDocs.txt file in 07-Sep-2015 12:29:11... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 07-Sep-2015 12:29:11... + +Estimated time of parsing documents: 0.006182 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 01-Feb-2016 11:45:49... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 01-Feb-2016 11:45:49... + +Estimated time of parsing documents: 0.005022 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 01-Feb-2016 11:45:50... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 01-Feb-2016 11:45:50... + +Estimated time of parsing documents: 0.007090 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 01-Feb-2016 11:45:50... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 01-Feb-2016 11:45:50... + +Estimated time of parsing documents: 0.006439 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 01-Feb-2016 11:48:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 01-Feb-2016 11:48:47... + +Estimated time of parsing documents: 0.009121 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 01-Feb-2016 11:48:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 01-Feb-2016 11:48:47... + +Estimated time of parsing documents: 0.009135 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 01-Feb-2016 11:48:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 01-Feb-2016 11:48:47... + +Estimated time of parsing documents: 0.008199 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 01-Feb-2016 16:15:45... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 01-Feb-2016 16:15:45... + +Estimated time of parsing documents: 0.009412 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 01-Feb-2016 16:15:46... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 01-Feb-2016 16:15:46... + +Estimated time of parsing documents: 0.007184 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 01-Feb-2016 16:15:46... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 01-Feb-2016 16:15:46... + +Estimated time of parsing documents: 0.006442 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 02-Mar-2016 18:57:45... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 18:57:45... + +Estimated time of parsing documents: 0.233916 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt file in 02-Mar-2016 18:57:50... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 18:57:51... + +Estimated time of parsing documents: 0.027083 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on papers.txt file in 02-Mar-2016 19:02:25... +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\papers.txt file in 02-Mar-2016 19:49:49... +================================================================================================================================================================== + +-File papers.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:49:49... + +Estimated time of parsing documents: 0.042316 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\papers.txt file in 02-Mar-2016 19:51:39... +================================================================================================================================================================== + +-File papers.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:51:39... + +Estimated time of parsing documents: 0.026236 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\papers.txt file in 02-Mar-2016 19:51:52... +================================================================================================================================================================== + +-File papers.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:51:52... + +Estimated time of parsing documents: 0.029256 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\papers.txt file in 02-Mar-2016 19:53:22... +================================================================================================================================================================== + +-File papers.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:53:22... + +Estimated time of parsing documents: 0.030196 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\papers.txt file in 02-Mar-2016 19:53:34... +================================================================================================================================================================== + +-File papers.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:53:34... + +Estimated time of parsing documents: 0.041114 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 19:55:37... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:55:38... + +Estimated time of parsing documents: 0.521062 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 19:58:18... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:58:18... + +Estimated time of parsing documents: 0.457267 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 19:58:24... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:58:24... + +Estimated time of parsing documents: 0.370302 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 19:58:38... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:58:38... + +Estimated time of parsing documents: 0.374152 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 19:58:45... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 19:58:45... + +Estimated time of parsing documents: 0.358193 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:02:42... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:02:43... + +Estimated time of parsing documents: 0.361018 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:02:55... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:02:55... + +Estimated time of parsing documents: 0.369506 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:02:59... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:02:59... + +Estimated time of parsing documents: 0.391033 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:03:05... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:03:05... + +Estimated time of parsing documents: 0.376483 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:03:10... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:03:11... + +Estimated time of parsing documents: 0.389452 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:03:21... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:03:22... + +Estimated time of parsing documents: 0.368977 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:03:31... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:03:31... + +Estimated time of parsing documents: 0.367876 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:25:28... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:25:28... + +Estimated time of parsing documents: 0.414415 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:26:55... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:26:56... + +Estimated time of parsing documents: 0.364518 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:27:02... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:27:02... + +Estimated time of parsing documents: 0.358386 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:27:43... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:27:43... + +Estimated time of parsing documents: 0.362107 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:33:36... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:33:36... + +Estimated time of parsing documents: 0.385000 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:33:50... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:33:51... + +Estimated time of parsing documents: 0.370750 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:33:51... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:33:51... + +Estimated time of parsing documents: 0.415766 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:34:02... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:34:02... + +Estimated time of parsing documents: 0.368090 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:34:03... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:34:03... + +Estimated time of parsing documents: 0.370119 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:34:43... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:34:44... + +Estimated time of parsing documents: 0.375329 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:34:44... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:34:45... + +Estimated time of parsing documents: 0.375065 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:35:14... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:35:14... + +Estimated time of parsing documents: 0.361255 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:35:19... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:35:19... + +Estimated time of parsing documents: 0.382421 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:35:28... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:35:28... + +Estimated time of parsing documents: 0.365241 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:35:29... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:35:29... + +Estimated time of parsing documents: 0.368696 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:36:09... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:36:09... + +Estimated time of parsing documents: 0.385581 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:36:10... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:36:10... + +Estimated time of parsing documents: 0.379977 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:47:56... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:47:56... + +Estimated time of parsing documents: 0.391579 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:47:57... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:47:57... + +Estimated time of parsing documents: 0.369705 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:48:24... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:48:24... + +Estimated time of parsing documents: 0.362476 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:48:25... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:48:25... + +Estimated time of parsing documents: 0.379106 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:49:33... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:49:33... + +Estimated time of parsing documents: 0.355808 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:49:34... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:49:34... + +Estimated time of parsing documents: 0.412756 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:49:59... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:50:00... + +Estimated time of parsing documents: 0.368544 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:50:00... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:50:01... + +Estimated time of parsing documents: 0.418452 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:50:28... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:50:28... + +Estimated time of parsing documents: 0.375312 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:50:29... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:50:29... + +Estimated time of parsing documents: 0.365812 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:55:11... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:55:11... + +Estimated time of parsing documents: 0.395120 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:55:12... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:55:12... + +Estimated time of parsing documents: 0.408971 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:55:45... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:55:45... + +Estimated time of parsing documents: 0.397955 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:55:46... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:55:46... + +Estimated time of parsing documents: 0.390293 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:56:00... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:56:00... + +Estimated time of parsing documents: 0.369707 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:56:01... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:56:01... + +Estimated time of parsing documents: 0.366050 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:56:38... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:56:38... + +Estimated time of parsing documents: 0.382589 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:56:38... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:56:39... + +Estimated time of parsing documents: 0.365715 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:56:48... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:56:48... + +Estimated time of parsing documents: 0.399223 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:56:49... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:56:49... + +Estimated time of parsing documents: 0.430404 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:57:15... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:57:16... + +Estimated time of parsing documents: 0.358247 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 20:57:16... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 20:57:16... + +Estimated time of parsing documents: 0.366291 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 21:03:58... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 21:03:58... + +Estimated time of parsing documents: 0.378328 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 21:03:59... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 21:03:59... + +Estimated time of parsing documents: 0.388473 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 21:05:19... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 21:05:20... + +Estimated time of parsing documents: 0.381298 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 21:05:20... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 21:05:21... + +Estimated time of parsing documents: 0.380852 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 21:09:07... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 21:09:07... + +Estimated time of parsing documents: 0.391629 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 21:09:08... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 21:09:08... + +Estimated time of parsing documents: 0.419384 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 21:09:46... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 21:09:46... + +Estimated time of parsing documents: 0.370370 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 21:09:47... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 21:09:47... + +Estimated time of parsing documents: 0.383414 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 22:44:26... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 22:44:27... + +Estimated time of parsing documents: 0.392237 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 22:44:27... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 22:44:28... + +Estimated time of parsing documents: 0.393928 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 22:44:36... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 22:44:36... + +Estimated time of parsing documents: 0.370465 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex file in 02-Mar-2016 22:44:37... +================================================================================================================================================================== + +-File newpapers.tex converted successfully... + +================================================================================================================================================================== +Filtering of input files ended at 02-Mar-2016 22:44:37... + +Estimated time of parsing documents: 0.364572 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\Morten\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 14-Feb-2017 09:32:53... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 14-Feb-2017 09:32:53... + +Estimated time of parsing documents: 0.111086 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\Morten\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 14-Feb-2017 09:33:02... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 14-Feb-2017 09:33:02... + +Estimated time of parsing documents: 0.008002 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\Morten\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 14-Feb-2017 09:33:04... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 14-Feb-2017 09:33:04... + +Estimated time of parsing documents: 0.005075 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on ../Data/textDocs.txt file in 13-Feb-2018 09:55:45... +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on /home/jehi/Dropbox/02450_public/Exercises/02450Toolbox_Matlab/Scripts/../Data/textDocs.txt file in 13-Feb-2018 09:56:04... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 13-Feb-2018 09:56:04... + +Estimated time of parsing documents: 0.005038 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on /home/jehi/Dropbox/02450_public/Exercises/02450Toolbox_Matlab/Scripts/../Data/textDocs.txt file in 13-Feb-2018 09:56:50... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 13-Feb-2018 09:56:50... + +Estimated time of parsing documents: 0.042582 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on /home/jehi/Dropbox/02450_public/Exercises/02450Toolbox_Matlab/Scripts/../Data/textDocs.txt file in 13-Feb-2018 09:57:09... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 13-Feb-2018 09:57:09... + +Estimated time of parsing documents: 0.005275 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on ../Data/textDocs.txt file in 13-Feb-2018 09:58:47... +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on ../Data/textDocs.txt file in 13-Feb-2018 09:59:03... +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 18-Feb-2020 09:38:03... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 18-Feb-2020 09:38:03... + +Estimated time of parsing documents: 0.032910 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 18-Feb-2020 09:38:06... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 18-Feb-2020 09:38:06... + +Estimated time of parsing documents: 0.023449 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 07-Feb-2021 12:19:10... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 07-Feb-2021 12:19:10... + +Estimated time of parsing documents: 0.024226 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 07-Feb-2021 12:19:11... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 07-Feb-2021 12:19:11... + +Estimated time of parsing documents: 0.017525 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 07-Feb-2021 12:19:12... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 07-Feb-2021 12:19:12... + +Estimated time of parsing documents: 0.020879 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 07-Feb-2021 12:19:16... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 07-Feb-2021 12:19:16... + +Estimated time of parsing documents: 0.016389 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 07-Feb-2021 12:19:19... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 07-Feb-2021 12:19:19... + +Estimated time of parsing documents: 0.019866 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 16-Feb-2021 16:42:31... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 16-Feb-2021 16:42:31... + +Estimated time of parsing documents: 0.018738 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 16-Feb-2021 16:42:38... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 16-Feb-2021 16:42:38... + +Estimated time of parsing documents: 0.018177 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 16-Feb-2021 16:42:41... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 16-Feb-2021 16:42:41... + +Estimated time of parsing documents: 0.016513 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 11:24:01... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 11:24:01... + +Estimated time of parsing documents: 0.073234 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 11:24:02... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 11:24:03... + +Estimated time of parsing documents: 0.063688 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 11:29:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 11:29:47... + +Estimated time of parsing documents: 0.119877 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 11:29:47... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 11:29:48... + +Estimated time of parsing documents: 0.050712 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 11:30:54... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 11:30:54... + +Estimated time of parsing documents: 0.037566 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 12:06:45... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 12:06:45... + +Estimated time of parsing documents: 0.039435 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 12:08:32... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 12:08:32... + +Estimated time of parsing documents: 0.034205 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 12:09:10... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 12:09:10... + +Estimated time of parsing documents: 0.019534 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 14:04:26... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 14:04:26... + +Estimated time of parsing documents: 0.022289 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 14:05:36... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 14:05:36... + +Estimated time of parsing documents: 0.015720 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 14:05:48... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 14:05:48... + +Estimated time of parsing documents: 0.014094 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 14:05:57... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 14:05:57... + +Estimated time of parsing documents: 0.014016 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 14:07:37... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 14:07:37... + +Estimated time of parsing documents: 0.075002 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 14:26:08... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 14:26:08... + +Estimated time of parsing documents: 0.100070 seconds +================================================================================================================================================================== +================================================================================================================================================================== +Running TMG... +Converting Results on C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt file in 03-May-2023 14:31:17... +================================================================================================================================================================== + +-File textDocs.txt did not need conversion... + +================================================================================================================================================================== +Filtering of input files ended at 03-May-2023 14:31:17... + +Estimated time of parsing documents: 0.039420 seconds +================================================================================================================================================================== diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/log_files/tmg.log b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/log_files/tmg.log new file mode 100644 index 0000000000000000000000000000000000000000..4b54367cd46456e21f7e50f188dfe2dbbea4d48a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/log_files/tmg.log @@ -0,0 +1,5698 @@ +================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 14:54:06... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.057501 seconds +Estimated time for constructing tdm and the other workspace parts: 0.498256 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 08-Jul-2014 14:54:22... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.021207 seconds +Estimated time for constructing tdm and the other workspace parts: 0.199263 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 08-Jul-2014 14:54:33... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.032240 seconds +Estimated time for constructing tdm and the other workspace parts: 0.289087 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 08-Jul-2014 14:54:59... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.038092 seconds +Estimated time for constructing tdm and the other workspace parts: 0.347639 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 08-Jul-2014 14:55:15... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.022815 seconds +Estimated time for constructing tdm and the other workspace parts: 0.178046 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 08-Jul-2014 15:02:45... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.139884 seconds +Estimated time for constructing tdm and the other workspace parts: 0.496178 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 08-Jul-2014 15:03:11... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.030563 seconds +Estimated time for constructing tdm and the other workspace parts: 0.306238 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 08-Jul-2014 15:04:55... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.244278 seconds +Estimated time for constructing tdm and the other workspace parts: 0.841877 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 08-Jul-2014 15:08:42... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.032402 seconds +Estimated time for constructing tdm and the other workspace parts: 0.292072 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 08-Jul-2014 15:09:15... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.139142 seconds +Estimated time for constructing tdm and the other workspace parts: 0.406273 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 08-Jul-2014 15:10:40... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.172797 seconds +Estimated time for constructing tdm and the other workspace parts: 0.418930 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 08-Jul-2014 15:12:10... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.212321 seconds +Estimated time for constructing tdm and the other workspace parts: 0.544839 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 08-Jul-2014 15:34:49... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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: 1.819764 seconds +Estimated time for constructing tdm and the other workspace parts: 2.377028 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 08-Jul-2014 15:38:38... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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.156025 seconds +Estimated time for constructing tdm and the other workspace parts: 0.467905 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 08-Jul-2014 15:41:00... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:14:05... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:16:51... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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 = 18 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 24.4444% + +Estimated time for parsing and converting the files: 0.023819 seconds +Estimated time for constructing tdm and the other workspace parts: 0.201301 seconds + +Removed 17 stopwords... +Removed 2 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 08-Jul-2014 16:17:56... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:17:56... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:17:56... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:21:49... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:21:49... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:21:49... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:24:48... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:24:48... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 08-Jul-2014 16:24:49... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 09-Jul-2014 15:22:58... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 09-Jul-2014 15:22:59... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 09-Jul-2014 15:22:59... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 13:46:21... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 13:46:21... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 13:46:21... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 13:51:34... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 13:51:35... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 13:51:35... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 14:28:49... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 14:28:50... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 14:28:51... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 14:31:30... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 14:31:30... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 14:31:31... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 14:50:19... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 14:50:19... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 14:50:20... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 15:54:13... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 15:54:14... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 10-Jul-2014 15:54:15... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 10:06:23... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 10:06:24... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 10:06:24... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 11:36:46... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 11:36:47... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 11:36:47... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 12:59:27... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 12:59:28... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 12:59:28... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 13:03:28... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 13:03:28... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 20-Jul-2014 13:03:28... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 12:06:20... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 12:06:21... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 12:06:22... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 12:51:52... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 12:51:52... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 12:51:53... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 13:26:17... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 13:26:17... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 13:26:17... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 14:09:47... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 14:09:47... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 21-Jul-2014 14:09:48... +Using the Perl implementation... +Input File/Directory: C:\Users\hh.lpf\Dropbox\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 28-Jan-2015 13:13:47... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 28-Jan-2015 13:13:47... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 28-Jan-2015 13:13:47... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 28-Jan-2015 13:40:36... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 28-Jan-2015 13:40:36... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 28-Jan-2015 13:40:37... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 29-Jan-2015 11:21:08... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 29-Jan-2015 11:21:08... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 29-Jan-2015 11:21:09... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 06-Sep-2015 19:09:37... +Using the Perl implementation... +Input File/Directory: \home\sfvn\Dropbox\02450_public (1)\Exercises\02450Toolbox_Matlab\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.118478 seconds +Estimated time for constructing tdm and the other workspace parts: 0.342049 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 06-Sep-2015 19:09:51... +Using the Perl implementation... +Input File/Directory: \home\sfvn\Dropbox\02450_public (1)\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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 = 18 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 24.4444% + +Estimated time for parsing and converting the files: 0.004685 seconds +Estimated time for constructing tdm and the other workspace parts: 0.077547 seconds + +Removed 17 stopwords... +Removed 2 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 06-Sep-2015 19:10:07... +Using the Perl implementation... +Input File/Directory: \home\sfvn\Dropbox\02450_public (1)\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 17 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 25.8824% + +Estimated time for parsing and converting the files: 0.003407 seconds +Estimated time for constructing tdm and the other workspace parts: 0.054810 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 2 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 07-Sep-2015 12:29:11... +Using the Perl implementation... +Input File/Directory: \home\sfvn\Dropbox\02450_public (1)\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 17 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 25.8824% + +Estimated time for parsing and converting the files: 0.006182 seconds +Estimated time for constructing tdm and the other workspace parts: 0.071444 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 2 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-2016 11:45:50... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 01-Feb-2016 11:45:50... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 01-Feb-2016 11:45:50... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 01-Feb-2016 11:48:47... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 01-Feb-2016 11:48:47... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 01-Feb-2016 11:48:47... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 01-Feb-2016 16:15:46... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\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================================================================================================================================================================== +Running tmg (tmg_p.m) on 01-Feb-2016 16:15:46... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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================================================================================================================================================================== +Running tmg (tmg_p.m) on 01-Feb-2016 16:15:46... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no================================================================================================================================================================== +Running tmg (tmg_p.m) on 02-Mar-2016 18:57:46... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\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.233916 seconds +Estimated time for constructing tdm and the other workspace parts: 0.735221 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 02-Mar-2016 18:57:51... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 17 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 25.8824% + +Estimated time for parsing and converting the files: 0.027083 seconds +Estimated time for constructing tdm and the other workspace parts: 0.423077 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 2 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 02-Mar-2016 19:51:52... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\papers.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 1 +Number of terms = 25 +Average number of terms per document (before the normalization) = 45 +Average number of indexing terms per document = 25 +Sparsity = 100% + +Estimated time for parsing and converting the files: 0.029256 seconds +Estimated time for constructing tdm and the other workspace parts: 0.544892 seconds + +Removed 17 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 19:53:22... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\papers.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 1 +Number of terms = 25 +Average number of terms per document (before the normalization) = 45 +Average number of indexing terms per document = 25 +Sparsity = 100% + +Estimated time for parsing and converting the files: 0.030196 seconds +Estimated time for constructing tdm and the other workspace parts: 0.396876 seconds + +Removed 17 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 19:53:34... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\papers.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 1 +Number of terms = 25 +Average number of terms per document (before the normalization) = 45 +Average number of indexing terms per document = 25 +Sparsity = 100% + +Estimated time for parsing and converting the files: 0.041114 seconds +Estimated time for constructing tdm and the other workspace parts: 0.397971 seconds + +Removed 17 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 19:55:38... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 25 +Average number of terms per document (before the normalization) = 15 +Average number of indexing terms per document = 8.33333 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.521062 seconds +Estimated time for constructing tdm and the other workspace parts: 0.410468 seconds + +Removed 17 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 19:58:19... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 25 +Average number of terms per document (before the normalization) = 15 +Average number of indexing terms per document = 8.33333 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.457267 seconds +Estimated time for constructing tdm and the other workspace parts: 0.428654 seconds + +Removed 17 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 19:58:24... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 25 +Average number of terms per document (before the normalization) = 15 +Average number of indexing terms per document = 8.33333 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.370302 seconds +Estimated time for constructing tdm and the other workspace parts: 0.398482 seconds + +Removed 17 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 19:58:38... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 25 +Average number of terms per document (before the normalization) = 15 +Average number of indexing terms per document = 8.33333 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.374152 seconds +Estimated time for constructing tdm and the other workspace parts: 0.418813 seconds + +Removed 17 stopwords... +Removed 0 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 02-Mar-2016 19:58:45... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 25 +Average number of terms per document (before the normalization) = 15 +Average number of indexing terms per document = 8.33333 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.358193 seconds +Estimated time for constructing tdm and the other workspace parts: 0.400675 seconds + +Removed 17 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:02:43... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 37 +Average number of terms per document (before the normalization) = 21.3333 +Average number of indexing terms per document = 15.6667 +Sparsity = 39.6396% + +Estimated time for parsing and converting the files: 0.361018 seconds +Estimated time for constructing tdm and the other workspace parts: 0.395342 seconds + +Removed 0 terms using the stemming algorithm... +Removed 13 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 02-Mar-2016 20:02:55... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +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 = 3 +Number of terms = 37 +Average number of terms per document (before the normalization) = 21.3333 +Average number of indexing terms per document = 15.6667 +Sparsity = 39.6396% + +Estimated time for parsing and converting the files: 0.369506 seconds +Estimated time for constructing tdm and the other workspace parts: 0.381706 seconds + +Removed 13 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 02-Mar-2016 20:03:00... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 37 +Average number of terms per document (before the normalization) = 21.3333 +Average number of indexing terms per document = 15.6667 +Sparsity = 39.6396% + +Estimated time for parsing and converting the files: 0.391033 seconds +Estimated time for constructing tdm and the other workspace parts: 0.397037 seconds + +Removed 0 terms using the stemming algorithm... +Removed 13 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 02-Mar-2016 20:03:11... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 20 +Average number of terms per document (before the normalization) = 21.3333 +Average number of indexing terms per document = 7 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.389452 seconds +Estimated time for constructing tdm and the other workspace parts: 0.407880 seconds + +Removed 30 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:03:22... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 20 +Average number of terms per document (before the normalization) = 21.3333 +Average number of indexing terms per document = 7 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.368977 seconds +Estimated time for constructing tdm and the other workspace parts: 0.400836 seconds + +Removed 30 stopwords... +Removed 0 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 02-Mar-2016 20:03:32... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 20 +Average number of terms per document (before the normalization) = 21.3333 +Average number of indexing terms per document = 7 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.367876 seconds +Estimated time for constructing tdm and the other workspace parts: 0.412739 seconds + +Removed 30 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:25:29... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 4 +Number of terms = 20 +Average number of terms per document (before the normalization) = 16 +Average number of indexing terms per document = 5.25 +Sparsity = 25% + +Estimated time for parsing and converting the files: 0.414415 seconds +Estimated time for constructing tdm and the other workspace parts: 0.388908 seconds + +Removed 30 stopwords... +Removed 0 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 02-Mar-2016 20:26:56... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 6 +Number of terms = 26 +Average number of terms per document (before the normalization) = 15.3333 +Average number of indexing terms per document = 4.83333 +Sparsity = 17.9487% + +Estimated time for parsing and converting the files: 0.364518 seconds +Estimated time for constructing tdm and the other workspace parts: 0.392068 seconds + +Removed 36 stopwords... +Removed 0 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 02-Mar-2016 20:27:03... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 6 +Number of terms = 26 +Average number of terms per document (before the normalization) = 15.3333 +Average number of indexing terms per document = 4.83333 +Sparsity = 17.9487% + +Estimated time for parsing and converting the files: 0.358386 seconds +Estimated time for constructing tdm and the other workspace parts: 0.401292 seconds + +Removed 36 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:27:44... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 6 +Number of terms = 26 +Average number of terms per document (before the normalization) = 15.3333 +Average number of indexing terms per document = 4.83333 +Sparsity = 17.9487% + +Estimated time for parsing and converting the files: 0.362107 seconds +Estimated time for constructing tdm and the other workspace parts: 0.406533 seconds + +Removed 36 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:33:37... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 17 +Average number of terms per document (before the normalization) = 19.3333 +Average number of indexing terms per document = 5.66667 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.385000 seconds +Estimated time for constructing tdm and the other workspace parts: 0.413232 seconds + +Removed 30 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:33:51... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 17 +Average number of terms per document (before the normalization) = 19.3333 +Average number of indexing terms per document = 5.66667 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.370750 seconds +Estimated time for constructing tdm and the other workspace parts: 0.389428 seconds + +Removed 30 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:33:52... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 17 +Average number of terms per document (before the normalization) = 19.3333 +Average number of indexing terms per document = 5.66667 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.415766 seconds +Estimated time for constructing tdm and the other workspace parts: 0.396987 seconds + +Removed 30 stopwords... +Removed 0 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 02-Mar-2016 20:34:03... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 17 +Average number of terms per document (before the normalization) = 19.3333 +Average number of indexing terms per document = 5.66667 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.368090 seconds +Estimated time for constructing tdm and the other workspace parts: 0.390270 seconds + +Removed 30 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:34:04... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 17 +Average number of terms per document (before the normalization) = 19.3333 +Average number of indexing terms per document = 5.66667 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.370119 seconds +Estimated time for constructing tdm and the other workspace parts: 0.402214 seconds + +Removed 30 stopwords... +Removed 0 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 02-Mar-2016 20:34:44... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 17 +Average number of terms per document (before the normalization) = 19.3333 +Average number of indexing terms per document = 5.66667 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.375329 seconds +Estimated time for constructing tdm and the other workspace parts: 0.393947 seconds + +Removed 30 stopwords... +Removed 0 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 02-Mar-2016 20:34:45... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 17 +Average number of terms per document (before the normalization) = 19.3333 +Average number of indexing terms per document = 5.66667 +Sparsity = 33.3333% + +Estimated time for parsing and converting the files: 0.375065 seconds +Estimated time for constructing tdm and the other workspace parts: 0.391279 seconds + +Removed 30 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:35:15... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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) = 15.4 +Average number of indexing terms per document = 5 +Sparsity = 20% + +Estimated time for parsing and converting the files: 0.361255 seconds +Estimated time for constructing tdm and the other workspace parts: 0.391491 seconds + +Removed 32 stopwords... +Removed 0 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 02-Mar-2016 20:35:20... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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) = 15.4 +Average number of indexing terms per document = 5 +Sparsity = 20% + +Estimated time for parsing and converting the files: 0.382421 seconds +Estimated time for constructing tdm and the other workspace parts: 0.409959 seconds + +Removed 32 stopwords... +Removed 0 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 02-Mar-2016 20:35:29... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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) = 15.4 +Average number of indexing terms per document = 5 +Sparsity = 20% + +Estimated time for parsing and converting the files: 0.365241 seconds +Estimated time for constructing tdm and the other workspace parts: 0.398710 seconds + +Removed 32 stopwords... +Removed 0 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 02-Mar-2016 20:35:30... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 25 +Average number of terms per document (before the normalization) = 15.4 +Average number of indexing terms per document = 5 +Sparsity = 20% + +Estimated time for parsing and converting the files: 0.368696 seconds +Estimated time for constructing tdm and the other workspace parts: 0.405160 seconds + +Removed 32 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:36:10... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 6 +Number of terms = 29 +Average number of terms per document (before the normalization) = 14.3333 +Average number of indexing terms per document = 5 +Sparsity = 17.2414% + +Estimated time for parsing and converting the files: 0.385581 seconds +Estimated time for constructing tdm and the other workspace parts: 0.435438 seconds + +Removed 33 stopwords... +Removed 0 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 02-Mar-2016 20:36:11... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 6 +Number of terms = 29 +Average number of terms per document (before the normalization) = 14.3333 +Average number of indexing terms per document = 5 +Sparsity = 17.2414% + +Estimated time for parsing and converting the files: 0.379977 seconds +Estimated time for constructing tdm and the other workspace parts: 0.411090 seconds + +Removed 33 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:47:57... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 25 +Average number of terms per document (before the normalization) = 19 +Average number of indexing terms per document = 10.6667 +Sparsity = 40% + +Estimated time for parsing and converting the files: 0.391579 seconds +Estimated time for constructing tdm and the other workspace parts: 0.430246 seconds + +Removed 13 stopwords... +Removed 0 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 02-Mar-2016 20:47:58... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 25 +Average number of terms per document (before the normalization) = 19 +Average number of indexing terms per document = 10.6667 +Sparsity = 40% + +Estimated time for parsing and converting the files: 0.369705 seconds +Estimated time for constructing tdm and the other workspace parts: 0.411255 seconds + +Removed 13 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:48:24... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 4 +Number of terms = 33 +Average number of terms per document (before the normalization) = 19.5 +Average number of indexing terms per document = 10.5 +Sparsity = 30.303% + +Estimated time for parsing and converting the files: 0.362476 seconds +Estimated time for constructing tdm and the other workspace parts: 0.444954 seconds + +Removed 20 stopwords... +Removed 0 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 02-Mar-2016 20:48:25... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 4 +Number of terms = 32 +Average number of terms per document (before the normalization) = 19.5 +Average number of indexing terms per document = 10.5 +Sparsity = 31.25% + +Estimated time for parsing and converting the files: 0.379106 seconds +Estimated time for constructing tdm and the other workspace parts: 0.403236 seconds + +Removed 20 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:49:34... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 4 +Number of terms = 17 +Average number of terms per document (before the normalization) = 13.75 +Average number of indexing terms per document = 4.25 +Sparsity = 25% + +Estimated time for parsing and converting the files: 0.355808 seconds +Estimated time for constructing tdm and the other workspace parts: 0.418288 seconds + +Removed 24 stopwords... +Removed 0 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 02-Mar-2016 20:49:35... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 4 +Number of terms = 17 +Average number of terms per document (before the normalization) = 13.75 +Average number of indexing terms per document = 4.25 +Sparsity = 25% + +Estimated time for parsing and converting the files: 0.412756 seconds +Estimated time for constructing tdm and the other workspace parts: 0.454366 seconds + +Removed 24 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:50:00... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 22 +Average number of terms per document (before the normalization) = 13.4 +Average number of indexing terms per document = 4.4 +Sparsity = 20% + +Estimated time for parsing and converting the files: 0.368544 seconds +Estimated time for constructing tdm and the other workspace parts: 0.403232 seconds + +Removed 28 stopwords... +Removed 0 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 02-Mar-2016 20:50:01... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 22 +Average number of terms per document (before the normalization) = 13.4 +Average number of indexing terms per document = 4.4 +Sparsity = 20% + +Estimated time for parsing and converting the files: 0.418452 seconds +Estimated time for constructing tdm and the other workspace parts: 0.427890 seconds + +Removed 28 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:50:28... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 6 +Number of terms = 24 +Average number of terms per document (before the normalization) = 15.3333 +Average number of indexing terms per document = 4.33333 +Sparsity = 18.0556% + +Estimated time for parsing and converting the files: 0.375312 seconds +Estimated time for constructing tdm and the other workspace parts: 0.413767 seconds + +Removed 42 stopwords... +Removed 0 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 02-Mar-2016 20:50:29... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 6 +Number of terms = 24 +Average number of terms per document (before the normalization) = 15.3333 +Average number of indexing terms per document = 4.33333 +Sparsity = 18.0556% + +Estimated time for parsing and converting the files: 0.365812 seconds +Estimated time for constructing tdm and the other workspace parts: 0.413230 seconds + +Removed 42 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:55:12... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 4 +Number of terms = 18 +Average number of terms per document (before the normalization) = 17.75 +Average number of indexing terms per document = 4.5 +Sparsity = 25% + +Estimated time for parsing and converting the files: 0.395120 seconds +Estimated time for constructing tdm and the other workspace parts: 0.410088 seconds + +Removed 34 stopwords... +Removed 0 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 02-Mar-2016 20:55:13... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 4 +Number of terms = 18 +Average number of terms per document (before the normalization) = 17.75 +Average number of indexing terms per document = 4.5 +Sparsity = 25% + +Estimated time for parsing and converting the files: 0.408971 seconds +Estimated time for constructing tdm and the other workspace parts: 0.440352 seconds + +Removed 34 stopwords... +Removed 0 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:55:45... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 7 +Number of terms = 33 +Average number of terms per document (before the normalization) = 16.1429 +Average number of indexing terms per document = 4.71429 +Sparsity = 14.2857% + +Estimated time for parsing and converting the files: 0.397955 seconds +Estimated time for constructing tdm and the other workspace parts: 0.447782 seconds + +Removed 48 stopwords... +Removed 0 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 02-Mar-2016 20:55:46... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 7 +Number of terms = 32 +Average number of terms per document (before the normalization) = 16.1429 +Average number of indexing terms per document = 4.71429 +Sparsity = 14.7321% + +Estimated time for parsing and converting the files: 0.390293 seconds +Estimated time for constructing tdm and the other workspace parts: 0.472209 seconds + +Removed 48 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:56:01... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 4 +Number of terms = 20 +Average number of terms per document (before the normalization) = 15 +Average number of indexing terms per document = 5 +Sparsity = 25% + +Estimated time for parsing and converting the files: 0.369707 seconds +Estimated time for constructing tdm and the other workspace parts: 0.422692 seconds + +Removed 29 stopwords... +Removed 0 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 02-Mar-2016 20:56:02... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 4 +Number of terms = 19 +Average number of terms per document (before the normalization) = 15 +Average number of indexing terms per document = 5 +Sparsity = 26.3158% + +Estimated time for parsing and converting the files: 0.366050 seconds +Estimated time for constructing tdm and the other workspace parts: 0.429542 seconds + +Removed 29 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:56:38... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 23 +Average number of terms per document (before the normalization) = 13.8 +Average number of indexing terms per document = 4.8 +Sparsity = 20.8696% + +Estimated time for parsing and converting the files: 0.382589 seconds +Estimated time for constructing tdm and the other workspace parts: 0.401924 seconds + +Removed 30 stopwords... +Removed 0 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 02-Mar-2016 20:56:39... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 22 +Average number of terms per document (before the normalization) = 13.8 +Average number of indexing terms per document = 4.8 +Sparsity = 21.8182% + +Estimated time for parsing and converting the files: 0.365715 seconds +Estimated time for constructing tdm and the other workspace parts: 0.397958 seconds + +Removed 30 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:56:49... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 15 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 35.5556% + +Estimated time for parsing and converting the files: 0.399223 seconds +Estimated time for constructing tdm and the other workspace parts: 0.408217 seconds + +Removed 17 stopwords... +Removed 0 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 02-Mar-2016 20:56:50... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 14 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 38.0952% + +Estimated time for parsing and converting the files: 0.430404 seconds +Estimated time for constructing tdm and the other workspace parts: 0.422477 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 20:57:16... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 15 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 35.5556% + +Estimated time for parsing and converting the files: 0.358247 seconds +Estimated time for constructing tdm and the other workspace parts: 0.378253 seconds + +Removed 17 stopwords... +Removed 0 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 02-Mar-2016 20:57:17... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 14 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 38.0952% + +Estimated time for parsing and converting the files: 0.366291 seconds +Estimated time for constructing tdm and the other workspace parts: 0.383167 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 21:03:59... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 7 +Number of terms = 46 +Average number of terms per document (before the normalization) = 17.5714 +Average number of indexing terms per document = 7.14286 +Sparsity = 14.9068% + +Estimated time for parsing and converting the files: 0.378328 seconds +Estimated time for constructing tdm and the other workspace parts: 0.436576 seconds + +Removed 36 stopwords... +Removed 0 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 02-Mar-2016 21:04:00... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 7 +Number of terms = 45 +Average number of terms per document (before the normalization) = 17.5714 +Average number of indexing terms per document = 7.14286 +Sparsity = 15.2381% + +Estimated time for parsing and converting the files: 0.388473 seconds +Estimated time for constructing tdm and the other workspace parts: 0.474018 seconds + +Removed 36 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 21:05:20... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 8 +Number of terms = 49 +Average number of terms per document (before the normalization) = 16.5 +Average number of indexing terms per document = 6.75 +Sparsity = 13.2653% + +Estimated time for parsing and converting the files: 0.381298 seconds +Estimated time for constructing tdm and the other workspace parts: 0.428086 seconds + +Removed 39 stopwords... +Removed 0 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 02-Mar-2016 21:05:21... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 8 +Number of terms = 48 +Average number of terms per document (before the normalization) = 16.5 +Average number of indexing terms per document = 6.75 +Sparsity = 13.5417% + +Estimated time for parsing and converting the files: 0.380852 seconds +Estimated time for constructing tdm and the other workspace parts: 0.428472 seconds + +Removed 39 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 21:09:08... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 15 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 35.5556% + +Estimated time for parsing and converting the files: 0.391629 seconds +Estimated time for constructing tdm and the other workspace parts: 0.401219 seconds + +Removed 17 stopwords... +Removed 0 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 02-Mar-2016 21:09:09... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 14 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 38.0952% + +Estimated time for parsing and converting the files: 0.419384 seconds +Estimated time for constructing tdm and the other workspace parts: 0.412325 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 21:09:47... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 15 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 35.5556% + +Estimated time for parsing and converting the files: 0.370370 seconds +Estimated time for constructing tdm and the other workspace parts: 0.401801 seconds + +Removed 17 stopwords... +Removed 0 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 02-Mar-2016 21:09:48... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 14 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 38.0952% + +Estimated time for parsing and converting the files: 0.383414 seconds +Estimated time for constructing tdm and the other workspace parts: 0.395074 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 22:44:27... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 15 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 35.5556% + +Estimated time for parsing and converting the files: 0.392237 seconds +Estimated time for constructing tdm and the other workspace parts: 0.420358 seconds + +Removed 17 stopwords... +Removed 0 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 02-Mar-2016 22:44:28... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 14 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 38.0952% + +Estimated time for parsing and converting the files: 0.393928 seconds +Estimated time for constructing tdm and the other workspace parts: 0.414575 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 02-Mar-2016 22:44:37... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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 = 3 +Number of terms = 15 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 35.5556% + +Estimated time for parsing and converting the files: 0.370465 seconds +Estimated time for constructing tdm and the other workspace parts: 0.388033 seconds + +Removed 17 stopwords... +Removed 0 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 02-Mar-2016 22:44:38... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Dropbox\02450_private\MLBOOK\Matlab\newpapers.tex +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\..\..\02450_public\Exercises\02450Toolbox_Matlab\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 3 +Number of terms = 14 +Average number of terms per document (before the normalization) = 13.6667 +Average number of indexing terms per document = 5.33333 +Sparsity = 38.0952% + +Estimated time for parsing and converting the files: 0.364572 seconds +Estimated time for constructing tdm and the other workspace parts: 0.413194 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 0 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 14-Feb-2017 09:32:54... +Using the Perl implementation... +Input File/Directory: C:\Users\Morten\Dropbox\02450_public\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.111086 seconds +Estimated time for constructing tdm and the other workspace parts: 0.479446 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 14-Feb-2017 09:33:02... +Using the Perl implementation... +Input File/Directory: C:\Users\Morten\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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 = 18 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 24.4444% + +Estimated time for parsing and converting the files: 0.008002 seconds +Estimated time for constructing tdm and the other workspace parts: 0.134538 seconds + +Removed 17 stopwords... +Removed 2 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 14-Feb-2017 09:33:04... +Using the Perl implementation... +Input File/Directory: C:\Users\Morten\Dropbox\02450_public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 17 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 25.8824% + +Estimated time for parsing and converting the files: 0.005075 seconds +Estimated time for constructing tdm and the other workspace parts: 0.144655 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 2 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 13-Feb-2018 09:56:04... +Using the Perl implementation... +Input File/Directory: \home\jehi\Dropbox\02450_public\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.005038 seconds +Estimated time for constructing tdm and the other workspace parts: 0.138077 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 13-Feb-2018 09:56:50... +Using the Perl implementation... +Input File/Directory: \home\jehi\Dropbox\02450_public\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.042582 seconds +Estimated time for constructing tdm and the other workspace parts: 0.040823 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 13-Feb-2018 09:57:09... +Using the Perl implementation... +Input File/Directory: \home\jehi\Dropbox\02450_public\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.005275 seconds +Estimated time for constructing tdm and the other workspace parts: 0.029356 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 18-Feb-2020 09:38:04... +Using the Perl implementation... +Input File/Directory: C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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 = 18 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 24.4444% + +Estimated time for parsing and converting the files: 0.032910 seconds +Estimated time for constructing tdm and the other workspace parts: 0.396597 seconds + +Removed 17 stopwords... +Removed 2 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 18-Feb-2020 09:38:06... +Using the Perl implementation... +Input File/Directory: C:\mm\02450MaterialGit\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 17 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 25.8824% + +Estimated time for parsing and converting the files: 0.023449 seconds +Estimated time for constructing tdm and the other workspace parts: 0.292734 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 2 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 07-Feb-2021 12:19:11... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Documents\02450public\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.024226 seconds +Estimated time for constructing tdm and the other workspace parts: 0.528857 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 07-Feb-2021 12:19:11... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Documents\02450public\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.017525 seconds +Estimated time for constructing tdm and the other workspace parts: 0.293589 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 07-Feb-2021 12:19:12... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Documents\02450public\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.020879 seconds +Estimated time for constructing tdm and the other workspace parts: 0.307712 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 07-Feb-2021 12:19:16... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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 = 18 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 24.4444% + +Estimated time for parsing and converting the files: 0.016389 seconds +Estimated time for constructing tdm and the other workspace parts: 0.239975 seconds + +Removed 17 stopwords... +Removed 2 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 07-Feb-2021 12:19:19... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 17 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 25.8824% + +Estimated time for parsing and converting the files: 0.019866 seconds +Estimated time for constructing tdm and the other workspace parts: 0.276505 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 2 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 16-Feb-2021 16:42:32... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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 = 18 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 24.4444% + +Estimated time for parsing and converting the files: 0.018738 seconds +Estimated time for constructing tdm and the other workspace parts: 0.378412 seconds + +Removed 17 stopwords... +Removed 2 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 16-Feb-2021 16:42:38... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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 = 18 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 24.4444% + +Estimated time for parsing and converting the files: 0.018177 seconds +Estimated time for constructing tdm and the other workspace parts: 0.211209 seconds + +Removed 17 stopwords... +Removed 2 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 16-Feb-2021 16:42:41... +Using the Perl implementation... +Input File/Directory: C:\Users\tuhe\Documents\02450public\Exercises\02450Toolbox_Matlab\Scripts\..\Data\textDocs.txt +Delimiter: emptyline +Line Delimiter: Yes +Stoplist Filename: ..\Data\stopWords.txt +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: yes +Removing Numbers: no +Removing Alphanumerics: no + +================================================================================= +Results: +================================================================================= +Number of documents = 5 +Number of terms = 17 +Average number of terms per document (before the normalization) = 11 +Average number of indexing terms per document = 4.4 +Sparsity = 25.8824% + +Estimated time for parsing and converting the files: 0.016513 seconds +Estimated time for constructing tdm and the other workspace parts: 0.277798 seconds + +Removed 17 stopwords... +Removed 1 terms using the stemming algorithm... +Removed 2 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 03-May-2023 11:24:02... +Using the Perl implementation... +Input File/Directory: C:\mm\02450MaterialGit\02450public\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.073234 seconds +Estimated time for constructing tdm and the other workspace parts: 0.831803 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 03-May-2023 11:29:47... +Using the Perl implementation... +Input File/Directory: C:\mm\02450MaterialGit\02450public\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.119877 seconds +Estimated time for constructing tdm and the other workspace parts: 0.612717 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 03-May-2023 14:07:37... +Using the Perl implementation... +Input File/Directory: C:\mm\02450MaterialGit\02450public\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.075002 seconds +Estimated time for constructing tdm and the other workspace parts: 0.424223 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 03-May-2023 14:26:08... +Using the Perl implementation... +Input File/Directory: C:\mm\02450MaterialGit\02450public\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.100070 seconds +Estimated time for constructing tdm and the other workspace parts: 0.644671 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 03-May-2023 14:31:17... +Using the Perl implementation... +Input File/Directory: C:\mm\02450MaterialGit\02450public\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.039420 seconds +Estimated time for constructing tdm and the other workspace parts: 0.320591 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... +================================================================================= diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_dictionary.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_dictionary.m new file mode 100644 index 0000000000000000000000000000000000000000..6e712d0f90f3b7fb8e51e3a3700846b25e60616f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_dictionary.m @@ -0,0 +1,16 @@ +function [all_words, all_doc_ids]=merge_dictionary(all_words, new_words, all_doc_ids, new_doc_ids) +% MERGE_DICTIONARY - merges two cell arrays of chars and returns +% only the distinct elements of their union (used by tmg.m, +% tmg_query.m, tdm_update.m) +% [ALL_WORDS, ALL_DOC_IDS]=MERGE_DICTIONARY(ALL_WORDS, NEW_WORDS, +% ALL_DOC_IDS, NEW_DOC_IDS) returns in ALL_WORDS all distinct +% elements of the union of the cell arrays of chars ALL_WORDS, +% NEW_WORDS corresponding to two document collections. ALL_DOC_IDS +% and NEW_DOC_IDS contain the inverted indices of the two +% collections. Output argument ALL_DOC_IDS contains the inverted +% index of the whole collection. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +[all_words, all_doc_ids]=merge_dictionary_p(all_words, new_words, all_doc_ids, new_doc_ids); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_dictionary_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_dictionary_p.p new file mode 100644 index 0000000000000000000000000000000000000000..002ffe9a864fc1c4513e6d3540c63149b591b574 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_dictionary_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_tdms.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_tdms.m new file mode 100644 index 0000000000000000000000000000000000000000..5e9edac3aa382717ba115053d6bbe63a502d8585 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_tdms.m @@ -0,0 +1,43 @@ +function [A, dictionary]=merge_tdms(varargin) +% MERGE_TDMS - Merges two document collections +% [A, DICTIONARY]=MERGE_TDMS(A1, DICTIONARY1, A2, DICTIONARY2] +% merges the tdms A1 and A2 with corresponding dictionaries +% DICTIONARY1 and DICTIONARY2. +% MERGE_TDS(A1, DICTIONARY1, A2, DICTIONARY2, OPTIONS) defines +% optional parameters: +% - OPTIONS.min_local_freq: The minimum local frequency for +% a term (default 1) +% - OPTIONS.max_local_freq: The maximum local frequency for +% a term (default inf) +% - OPTIONS.min_global_freq: The minimum global frequency +% for a term (default 1) +% - OPTIONS.max_global_freq: The maximum global frequency +% for a term (default inf) +% - OPTIONS.local_weight: The local term weighting function +% (default 't'). Possible values (see [1, 2]): +% 't': Term Frequency +% 'b': Binary +% 'l': Logarithmic +% 'a': Alternate Log +% 'n': Augmented Normalized Term Frequency +% - OPTIONS.global_weight: The global term weighting function +% (default 'x'). Possible values (see [1, 2]): +% 'x': None +% 'e': Entropy +% 'f': Inverse Document Frequency (IDF) +% 'g': GfIdf +% 'n': Normal +% 'p': Probabilistic Inverse +% - OPTIONS.normalization: Indicates if we normalize the +% document vectors (default 'x'). Possible values: +% 'x': None +% 'c': Cosine +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 5, nargin)); +if naragin==4, + [A, dictionary]=merge_tdms(varargin{1}, varargin{2}, varargin{3}, varargin{4}); +else, + [A, dictionary]=merge_tdms(varargin{1}, varargin{2}, varargin{3}, varargin{4}, varargin{5}); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_tdms_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_tdms_p.p new file mode 100644 index 0000000000000000000000000000000000000000..4f00f245766bbbfb421d4d63f4199450ec36de5c Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/merge_tdms_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/new_sprintf.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/new_sprintf.m new file mode 100644 index 0000000000000000000000000000000000000000..43a00b55691895d154686aeaab4dab86034e85e0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/new_sprintf.m @@ -0,0 +1,11 @@ + +function varargout = new_sprintf(varargin) +% adjust input arguments here +for k=1:nargin + if (issparse(varargin{k})) + varargin{k} = full(varargin{k}); + end +end +% call the built-in function +[varargout{1:nargout}] = builtin('sprintf',varargin{:}); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/nnmf_gui.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/nnmf_gui.fig new file mode 100644 index 0000000000000000000000000000000000000000..1d2fa1dce74a3aa604183a30128cd8da8e235708 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/nnmf_gui.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/nnmf_gui.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/nnmf_gui.m new file mode 100644 index 0000000000000000000000000000000000000000..033920e32cb3d989d894aed2a97e1c7eb5f34139 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/nnmf_gui.m @@ -0,0 +1,1315 @@ +function varargout = nnmf_gui(varargin) +% nnmf_gui +% nnmf_gui is a graphical user interface for all +% non-negative dimensionality reduction techniques implemented +% in the Text to Matrix Generator (TMG) Toolbox. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @nnmf_gui_OpeningFcn, ... + 'gui_OutputFcn', @nnmf_gui_OutputFcn, ... + 'gui_LayoutFcn', [], ... + 'gui_Callback', []); +if nargin && ischar(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + +% --- Executes just before nnmf_gui is made visible. +function nnmf_gui_OpeningFcn(hObject, eventdata, handles, varargin) +% This function has no output args, see OutputFcn. +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +% varargin unrecognized PropertyName/PropertyValue pairs from the +% command line (see VARARGIN) + +% Choose default command line output for nnmf_gui +handles.output = hObject; + +handles.light_gray=[0.8824 0.8824 0.8824]; +handles.gray=[0.9255 0.9137 0.8471]; +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=14.5410; +wdth=15.7572; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +handles.objects=[handles.kmeansRadio; + handles.skmeansRadio; + handles.PDDPRadio; + handles.nClusters; + handles.CentroidInit; + handles.CentroidsVar; + handles.CentroidsVarButton; + handles.Termination; + handles.TerminationValue; + handles.DispRes; + handles.lPDDP; + handles.PDDPvariant; + handles.maxlPDDP; + handles.svds; + handles.propack; + handles.refinementMethod; + handles.RefineNIter; + handles.refineResultsDisplay]; + +states=zeros(length(handles.objects), 1); +handles=activate_uicontrol(states, handles); + +% Update handles structure +guidata(hObject, handles); + +% UIWAIT makes nnmf_gui wait for user response (see UIRESUME) +% uiwait(handles.figure1); + + +% --- Outputs from this function are returned to the command line. +function varargout = nnmf_gui_OutputFcn(hObject, eventdata, handles) +% varargout cell array for returning output args (see VARARGOUT); +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Get default command line output from handles structure +varargout{1} = handles.output; + + +% --- Executes during object creation, after setting all properties. +function DatasetMenu_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end +datasets=cell(1, 1); datasets{1, 1}=''; +n_datasets=0; +str=fileparts(mfilename('fullpath')); +dirs=dir(strcat(str, filesep, 'data')); +for i=1:size(dirs, 1), + cur=dirs(i); + if isequal(cur.name, '.') | isequal(cur.name, '..') | ~isdir(strcat(str, filesep, 'data', filesep, cur.name)), continue; end + if exist(strcat(str, filesep, 'data', filesep, cur.name, filesep, 'A.mat')), n_datasets=n_datasets+1; datasets{n_datasets+1, 1}=strcat(str, filesep, 'data', filesep, cur.name); end +end +set(hObject, 'String', datasets); +guidata(hObject, handles); + +function DatasetMenu_Callback(hObject, eventdata, handles) + +function nFactorsSVD_Callback(hObject, eventdata, handles) +% hObject handle to nFactorsSVD (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of nFactorsSVD as text +% str2double(get(hObject,'String')) returns contents of nFactorsSVD as a double +if get(handles.CLRadio, 'Value')==1, set(handles.nClusters, 'String', get(hObject, 'String')); end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function nFactorsSVD_CreateFcn(hObject, eventdata, handles) +% hObject handle to nFactorsSVD (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in StoreRes. +function StoreRes_Callback(hObject, eventdata, handles) +% hObject handle to StoreRes (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of StoreRes +guidata(hObject, handles); + +% --- Executes on button press in ContinueButton. +function ContinueButton_Callback(hObject, eventdata, handles) +% hObject handle to ContinueButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +datasets=get(handles.DatasetMenu, 'String'); +id=get(handles.DatasetMenu, 'Value'); +if isequal(datasets{id}, ''), msgbox('You have to provide a dataset...', 'Error', 'modal'); return; end +k=get(handles.nFactorsSVD, 'String'); +if isempty(k), msgbox('You have to provide the number of factors...', 'Error', 'modal'); return; end +k=str2double(k); +if ~isnumeric(k), msgbox('You have to provide the number of factors...', 'Error', 'modal'); return; end +if mod(k, 1)~=0 | k<=0, msgbox('You have to provide a positive integer number of factors...', 'Error', 'modal'); return; end +load(strcat(datasets{id}, filesep, 'A.mat')); +load(strcat(datasets{id}, filesep, 'titles.mat')); + +if get(handles.RefineFactorsCheckbox, 'Value') == 1, + refine_dsp = get(handles.refineResultsDisplay, 'Value'); + if get(handles.refinementMethod, 'Value') == 1, + nit = get(handles.RefineNIter, 'String'); + if isempty(nit), msgbox('You have to provide the number of iterations...', 'Error', 'modal'); return; end + nit=str2double(nit); + if ~isnumeric(nit), msgbox('You have to provide the number of iterations...', 'Error', 'modal'); return; end + if mod(nit, 1)~=0, msgbox('You have to provide an integer number of iterations...', 'Error', 'modal'); return; end + end +end + +if get(handles.BLOCKNNDSVDRadio, 'Value')==1 | get(handles.CLRadio, 'Value')==1, + nc=get(handles.nClusters, 'String'); + if isempty(nc), msgbox('You have to provide the number of clusters...', 'Error', 'modal'); return; end + nc=str2double(nc); + if ~isnumeric(nc), msgbox('You have to provide the number of clusters...', 'Error', 'modal'); return; end + if mod(nc, 1)~=0, msgbox('You have to provide an integer number of clusters...', 'Error', 'modal'); return; end + if get(handles.CLRadio, 'Value')==1 & nc~=k, msgbox('Number of clusters must be equal to the number of factors...', 'Error', 'modal'); return; end + if nc>k, msgbox('Number of clusters must not exceed number of factors...', 'Error', 'modal'); return; end + + clust_method=''; + if get(handles.kmeansRadio, 'Value')==1, clust_method='kmeans'; elseif get(handles.skmeansRadio, 'Value')==1, clust_method='skmeans'; else, clust_method='pddp'; end + if ~isequal(clust_method, 'pddp'), + centroids=get(handles.CentroidInit, 'Value'); + if centroids==1, + C=[]; + else, + s=get(handles.CentroidsVar, 'String'); + if isempty(s), msgbox('You have to provide the centroids variable. Use the Browse button...', 'Error', 'modal'); return; end + C=evalin('base', s); + [m, n]=size(C); if m~=size(A, 1) | n~=k, msgbox('The centroid variable you provided has incorrect dimensions...', 'Error', 'modal'); return; end + end + + term_method=get(handles.Termination, 'Value'); + s=get(handles.TerminationValue, 'String'); + if term_method==1, + term_method='epsilon'; + if isempty(s), + r=questdlg('You didn''t provide the epsilon value. Using the default value...', 'Genie Question', 'OK', 'CANCEL', 'OK'); + if ~isequal(r, 'OK'), return; end + else, + s=str2double(s); + if ~isnumeric(s), msgbox('You have to provide the epsilon value...', 'Error', 'modal'); return; end + opts.epsilon=s; + end + else, + term_method='n_iter'; + if isempty(s), + r=questdlg('You didn''t provide the ''number of iterations'' value. Using the default value...', 'Genie Question', 'OK', 'CANCEL', 'OK'); + if ~isequal(r, 'OK'), return; end + else, + s=str2double(s); + if ~isnumeric(s), msgbox('You have to provide the number of iterations...', 'Error', 'modal'); return; end + if mod(s, 1)~=0, msgbox('You have to provide an integer number of iterations...', 'Error', 'modal'); return; end + opts.iter=s; + end + end + if get(handles.DispRes, 'Value')==1, opts.dsp=1; else, opts.dsp=0; end + if isequal(clust_method, 'kmeans'), + [clusters, QQ, Wkmeans]=ekmeans(A, C, nc, term_method, opts); + Wkmeans = col_normalization(Wkmeans); + else, + [clusters, QQ, Wskmeans]=skmeans(A, C, nc, term_method, opts); + Wskmeans = col_normalization(Wskmeans); + end + else, + state=get(handles.propack, 'Value'); if state==0, svd_method = 'svds'; else, svd_method = 'propack'; end + v=get(handles.PDDPvariant, 'Value'); + state=get(handles.maxlPDDP, 'Value'); + if state == 1, + if v==1, + [clusters, tree_struct]=pddp(A, nc, 'max', svd_method, get(handles.DispRes, 'Value')); + else, + [clusters, tree_struct]=pddp_optcutpd(A, nc, 'max', svd_method, get(handles.DispRes, 'Value')); + end + else, + l=get(handles.lPDDP, 'String'); + tmp=2^str2num(l); while tmp<k, tmp=tmp+2^str2num(l)-1; end + if tmp>k, + err_pddp=new_sprintf('Number of principal components for PDDP you supplied produces more than %d clusters (number of NNMF factors). Please alter your selection...', k); + msgbox(err_pddp, 'Error', 'modal'); return; + end + if isempty(l), msgbox('You have to provide the number of principal directions for PDDP...', 'Error', 'modal'); return; end + if str2double(l)>1, + if v==1, + [clusters, tree_struct]=pddp(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + else, + [clusters, tree_struct]=pddp_optcutpd(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + end + else, + if v==1, + [clusters, tree_struct]=pddp(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + elseif v==2, + [clusters, tree_struct]=pddp_2means(A, nc, svd_method, get(handles.DispRes, 'Value'), 0); + elseif v==3, + [clusters, tree_struct]=pddp_optcut(A, nc, svd_method, get(handles.DispRes, 'Value')); + elseif v==4, + [clusters, tree_struct]=pddp_optcut_2means(A, nc, svd_method, get(handles.DispRes, 'Value'), 0); + else, + [clusters, tree_struct]=pddp_optcutpd(A, nc, l, svd_method, get(handles.DispRes, 'Value')); + end + end + end + Wpddp = col_normalization(pddp_extract_centroids(tree_struct, size(A, 1), nc)); + end + assignin('base', 'clusters', clusters); +end + + +if get(handles.RandomRadio, 'Value')==1, + Wrandom = rand(size(A, 1), k); Hrandom = rand(k, size(A, 2)); + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + [Wrandom, Hrandom, ss]=nnmf_mul_update(A, Wrandom, Hrandom, nit, refine_dsp); + else, + [Wrandom, Hrandom]=nmfanls_comb(A, size(Hrandom, 1), Hrandom, refine_dsp); + end + end + + assignin('base', 'A', A); assignin('base', 'Wrandom', Wrandom); assignin('base', 'Hrandom', Hrandom); assignin('base', 'k', k); +end +if get(handles.NNDSVDRadio, 'Value')==1, + state=get(handles.propack, 'Value'); if state==0, svd_method = 'svds'; else, svd_method = 'propack'; end + [Wnndsvd, Hnndsvd] = nndsvd(A, k, svd_method, 0); + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + [Wnndsvd, Hnndsvd, ss]=nnmf_mul_update(A, Wnndsvd, Hnndsvd, nit, refine_dsp); + else, + [Wnndsvd, Hnndsvd] = nmfanls_comb(A, size(Hnndsvd, 1), Hnndsvd, refine_dsp); + end + end + + assignin('base', 'A', A); assignin('base', 'Wnndsvd', Wnndsvd); assignin('base', 'Hnndsvd', Hnndsvd); assignin('base', 'k', k); +end +if get(handles.BLOCKNNDSVDRadio, 'Value')==1, + state=get(handles.propack, 'Value'); if state==0, svd_method = 'svds'; else, svd_method = 'propack'; end + [Wblocknndsvd, Hblocknndsvd]=block_nndsvd(A, clusters, k, 'f', 0.5, svd_method); + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + [Wblocknndsvd, Hblocknndsvd, ss]=nnmf_mul_update(A, Wblocknndsvd, Hblocknndsvd, nit, refine_dsp); + else, + [Wblocknndsvd, Hblocknndsvd] = nmfanls_comb(A, size(Hblocknndsvd, 1), Hblocknndsvd, refine_dsp); + end + end + + assignin('base', 'A', A); assignin('base', 'Wblocknndsvd', Wblocknndsvd); assignin('base', 'Hblocknndsvd', Hblocknndsvd); assignin('base', 'k', k); +end +if get(handles.BISECTINGNNDSVDRadio, 'Value')==1, + state=get(handles.propack, 'Value'); if state==0, svd_method = 'svds'; else, svd_method = 'propack'; end + [Wbisnndsvd, Hbisnndsvd] = bisecting_nndsvd(A, k, svd_method); + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + [Wbisnndsvd, Hbisnndsvd, ss]=nnmf_mul_update(A, Wbisnndsvd, Hbisnndsvd, nit, refine_dsp); + else, + [Wbisnndsvd, Hbisnndsvd] = nmfanls_comb(A, size(Hbisnndsvd, 1), Hbisnndsvd, refine_dsp); + end + end + + assignin('base', 'A', A); assignin('base', 'Wbisnndsvd', Wbisnndsvd); assignin('base', 'Hbisnndsvd', Hbisnndsvd); assignin('base', 'k', k); +end +if get(handles.CLRadio, 'Value')==1, + if isequal(clust_method, 'kmeans'), + Hkmeans = rand(k, size(A, 2)); + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + [Wkmeans, Hkmeans, ss]=nnmf_mul_update(A, Wkmeans, Hkmeans, nit, refine_dsp); + else, + [Wtmp, Htmp] = nmfanls_comb(A', size(Wkmeans, 2), Wkmeans', refine_dsp); + Wkmeans = Htmp'; + Hkmeans = Wtmp'; + end + end + assignin('base', 'A', A); assignin('base', 'Wkmeans', Wkmeans); assignin('base', 'Hkmeans', Hkmeans); assignin('base', 'k', k); + end + if isequal(clust_method, 'skmeans'), + Hskmeans = rand(k, size(A, 2)); + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + [Wskmeans, Hskmeans, ss]=nnmf_mul_update(A, Wskmeans, Hskmeans, nit, refine_dsp); + else, + [Wtmp, Htmp] = nmfanls_comb(A', size(Wskmeans, 2), Wskmeans', refine_dsp); + Wskmeans = Htmp'; + Hskmeans = Wtmp'; + end + end + assignin('base', 'A', A); assignin('base', 'Wskmeans', Wskmeans); assignin('base', 'Hskmeans', Hskmeans); assignin('base', 'k', k); + end + if isequal(clust_method, 'pddp'), + Hpddp = rand(k, size(A, 2)); + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + [Wpddp, Hpddp, ss]=nnmf_mul_update(A, Wpddp, Hpddp, nit, refine_dsp); + else, + [Wtmp, Htmp] = nmfanls_comb(A', size(Wpddp, 2), Wpddp', refine_dsp); + Wpddp = Htmp'; + Hpddp = Wtmp'; + end + end + assignin('base', 'A', A); assignin('base', 'Wpddp', Wpddp); assignin('base', 'Hpddp', Hpddp); assignin('base', 'k', k); + end +end + +if get(handles.RandomRadio, 'Value')==1, + [s, ind]=max(Hrandom, [], 1); + clusters_random={'ind'}; for j=1:k, clusters_random{j+1, 1}=find(ind==j); end + title = 'NNMF Clustering with random initialization'; + assignin('base', 'clusters_random', clusters_random); +end +if get(handles.NNDSVDRadio, 'Value')==1, + [s, ind]=max(Hnndsvd, [], 1); + clusters_nndsvd={'ind'}; for j=1:k, clusters_nndsvd{j+1, 1}=find(ind==j); end + title = 'NNMF Clustering with NNDSVD Initialization'; + assignin('base', 'clusters_nndsvd', clusters_nndsvd); +end +if get(handles.BLOCKNNDSVDRadio, 'Value')==1, + [s, ind]=max(Hblocknndsvd, [], 1); + clusters_blocknndsvd={'ind'}; for j=1:k, clusters_blocknndsvd{j+1, 1}=find(ind==j); end + if isequal(clust_method, 'kmeans'), + title = 'NNMF Clustering with Block NNDSVD (k-means) Initialization'; + elseif isequal(clust_method, 'skmeans'), + title = 'NNMF Clustering with Block NNDSVD (Spherical k-means) Initialization'; + else, + title = 'NNMF Clustering with Block NNDSVD (PDDP) Initialization'; + end + assignin('base', 'clusters_blocknndsvd', clusters_blocknndsvd); +end +if get(handles.BISECTINGNNDSVDRadio, 'Value')==1, + [s, ind]=max(Hbisnndsvd, [], 1); + clusters_bisnndsvd={'ind'}; for j=1:k, clusters_bisnndsvd{j+1, 1}=find(ind==j); end + title = 'NNMF Clustering with Bisecting NNDSVD Initialization'; + assignin('base', 'clusters_bisnndsvd', clusters_bisnndsvd); +end +if get(handles.CLRadio, 'Value')==1, + if isequal(clust_method, 'kmeans'), + [s, ind]=max(Hkmeans, [], 1); + clusters_kmeans={'ind'}; for j=1:k, clusters_kmeans{j+1, 1}=find(ind==j); end + title = 'NNMF Clustering with k-means Preconditioning'; + assignin('base', 'clusters_kmeans', clusters_kmeans); + end + if isequal(clust_method, 'skmeans'), + [s, ind]=max(Hskmeans, [], 1); + clusters_skmeans={'ind'}; for j=1:k, clusters_skmeans{j+1, 1}=find(ind==j); end + title = 'NNMF Clustering with Spherical k-means Preconditioning'; + assignin('base', 'clusters_skmeans', clusters_skmeans); + end + if isequal(clust_method, 'pddp'), + [s, ind]=max(Hpddp, [], 1); + clusters_pddp={'ind'}; for j=1:k, clusters_pddp{j+1, 1}=find(ind==j); end + title = 'NNMF Clustering with PDDP Preconditioning'; + assignin('base', 'clusters_pddp', clusters_pddp); + end +end + +if get(handles.StoreRes, 'Value')==1, + datasets=get(handles.DatasetMenu, 'String'); v=get(handles.DatasetMenu, 'Value'); dataset=datasets{v}; + if get(handles.RandomRadio, 'Value')==1, + str=strcat(dataset, filesep, 'nnmf'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + str=strcat(str, filesep, 'mlup'); + else, + str=strcat(str, filesep, 'anls'); + end + if ~exist(str), mkdir(str); end + end + str1=strcat(str, filesep, 'Wrandom.mat'); str2=strcat(str, filesep, 'Hrandom.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; + end + str1=strcat(str, filesep, 'Wrandom'); str2=strcat(str, filesep, 'Hrandom'); + save(str1, 'Wrandom'); save(str2, 'Hrandom'); + end + if get(handles.NNDSVDRadio, 'Value')==1, + str=strcat(dataset, filesep, 'nnmf'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + str=strcat(str, filesep, 'mlup'); + else, + str=strcat(str, filesep, 'anls'); + end + if ~exist(str), mkdir(str); end + end + str1=strcat(str, filesep, 'Wnndsvd.mat'); str2=strcat(str, filesep, 'Hnndsvd.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; + end + str1=strcat(str, filesep, 'Wnndsvd'); str2=strcat(str, filesep, 'Hnndsvd'); + save(str1, 'Wnndsvd'); save(str2, 'Hnndsvd'); + end + if get(handles.BLOCKNNDSVDRadio, 'Value')==1, + str=strcat(dataset, filesep, 'nnmf'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + str=strcat(str, filesep, 'mlup'); + else, + str=strcat(str, filesep, 'anls'); + end + if ~exist(str), mkdir(str); end + end + str1=strcat(str, filesep, 'Wblocknndsvd.mat'); str2=strcat(str, filesep, 'Hblocknndsvd.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; + end + str1=strcat(str, filesep, 'Wblocknndsvd'); str2=strcat(str, filesep, 'Hblocknndsvd'); + save(str1, 'Wblocknndsvd'); save(str2, 'Hblocknndsvd'); + end + if get(handles.BISECTINGNNDSVDRadio, 'Value')==1, + str=strcat(dataset, filesep, 'nnmf'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + str=strcat(str, filesep, 'mlup'); + else, + str=strcat(str, filesep, 'anls'); + end + if ~exist(str), mkdir(str); end + end + str1=strcat(str, filesep, 'Wbisnndsvd.mat'); str2=strcat(str, filesep, 'Hbisnndsvd.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; + end + str1=strcat(str, filesep, 'Wbisnndsvd'); str2=strcat(str, filesep, 'Hbisnndsvd'); + save(str1, 'Wbisnndsvd'); save(str2, 'Hbisnndsvd'); + end + if get(handles.CLRadio, 'Value')==1, + str=strcat(dataset, filesep, 'nnmf'); + if ~exist(str), mkdir(str); end + str=strcat(str, filesep, 'k_', num2str(k)); + if ~exist(str), + mkdir(str); + else, + if isequal(clust_method, 'kmeans'), + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + str=strcat(str, filesep, 'mlup'); + else, + str=strcat(str, filesep, 'anls'); + end + if ~exist(str), mkdir(str); end + end + str1=strcat(str, filesep, 'Wkmeans.mat'); str2=strcat(str, filesep, 'Hkmeans.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; + end + if isequal(clust_method, 'skmeans'), + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + str=strcat(str, filesep, 'mlup'); + else, + str=strcat(str, filesep, 'anls'); + end + if ~exist(str), mkdir(str); end + end + str1=strcat(str, filesep, 'Wskmeans.mat'); str2=strcat(str, filesep, 'Hskmeans.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; + end + if isequal(clust_method, 'pddp'), + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + str=strcat(str, filesep, 'mlup'); + else, + str=strcat(str, filesep, 'anls'); + end + if ~exist(str), mkdir(str); end + end + str1=strcat(str, filesep, 'Wpddp.mat'); str2=strcat(str, filesep, 'Hpddp.mat'); + if exist(str1), delete(str1); end; if exist(str2), delete(str2); end; + end + end + if isequal(clust_method, 'kmeans'), + str1=strcat(str, filesep, 'Wkmeans'); str2=strcat(str, filesep, 'Hkmeans'); + save(str1, 'Wkmeans'); save(str2, 'Hkmeans'); + end + if isequal(clust_method, 'skmeans'), + str1=strcat(str, filesep, 'Wskmeans'); str2=strcat(str, filesep, 'Hskmeans'); + save(str1, 'Wskmeans'); save(str2, 'Hskmeans'); + end + if isequal(clust_method, 'pddp'), + str1=strcat(str, filesep, 'Wpddp'); str2=strcat(str, filesep, 'Hpddp'); + save(str1, 'Wpddp'); save(str2, 'Hpddp'); + end + end +end + +view_res = questdlg('View NNMF clustering result?', ... + 'clustering Result', ... + 'Yes', 'No', 'Yes'); +if isequal(view_res, 'Yes'), + if get(handles.RefineFactorsCheckbox, 'Value') == 1, + if get(handles.refinementMethod, 'Value') == 1, + title = new_sprintf('Multiplicative update %s', title); + else, + title = new_sprintf('ANLS %s', title); + end + end + if get(handles.RandomRadio, 'Value')==1, + create_kmeans_response(clusters_random, titles, title); + end + if get(handles.NNDSVDRadio, 'Value')==1, + create_kmeans_response(clusters_nndsvd, titles, title); + end + if get(handles.BLOCKNNDSVDRadio, 'Value')==1, + create_kmeans_response(clusters_blocknndsvd, titles, title); + end + if get(handles.BISECTINGNNDSVDRadio, 'Value')==1, + create_kmeans_response(clusters_bisnndsvd, titles, title); + end + if get(handles.CLRadio, 'Value')==1, + if isequal(clust_method, 'kmeans'), + create_kmeans_response(clusters_kmeans, titles, title); + end + if isequal(clust_method, 'skmeans'), + create_kmeans_response(clusters_skmeans, titles, title); + end + if isequal(clust_method, 'pddp'), + create_kmeans_response(clusters_pddp, titles, title); + end + end +else + msgbox('Done!', 'modal'); +end + +guidata(hObject, handles); + +% --- Executes on button press in ClearBotton. +function ClearBotton_Callback(hObject, eventdata, handles) +% hObject handle to ClearBotton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +set(handles.DatasetMenu, 'Value', 1); + +set(handles.RandomRadio, 'Value', 1); +set(handles.NNDSVDRadio, 'Value', 0); +set(handles.BLOCKNNDSVDRadio, 'Value', 0); +set(handles.BISECTINGNNDSVDRadio, 'Value', 0); +set(handles.CLRadio, 'Value', 0); + +set(handles.kmeansRadio, 'Value', 1); +set(handles.skmeansRadio, 'Value', 0); +set(handles.PDDPRadio, 'Value', 0); + +set(handles.CentroidInit, 'Value', 1); +set(handles.CentroidsVar, 'String', ''); +set(handles.Termination, 'Value', 1); +set(handles.TerminationValue, 'String', '1'); +set(handles.lPDDP, 'String', '1'); +set(handles.nClusters, 'String', ''); +set(handles.DispRes, 'Value', 1); + +set(handles.nFactorsSVD, 'String', ''); +set(handles.StoreRes, 'Value', 1); + +set(handles.RefineFactorsCheckbox, 'Value', 0); +set(handles.RefineNIter, 'String', ''); + +states=zeros(length(handles.objects), 1); +handles=activate_uicontrol(states, handles); +guidata(hObject, handles); + +% --- Executes on button press in ExitButton. +function ExitButton_Callback(hObject, eventdata, handles) +% hObject handle to ExitButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +delete(handles.figure1); + +% --- Executes on button press in RandomRadio. +function RandomRadio_Callback(hObject, eventdata, handles) +% hObject handle to RandomRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of RandomRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.NNDSVDRadio, 'Value', 0); + set(handles.BLOCKNNDSVDRadio, 'Value', 0); + set(handles.BISECTINGNNDSVDRadio, 'Value', 0); + set(handles.CLRadio, 'Value', 0); +end + +states=zeros(length(handles.objects), 1); +refine_status = get(handles.RefineFactorsCheckbox, 'Value'); +if refine_status == 1, + states(end - 2) = 1; + states(end) = 1; + if get(handles.refinementMethod, 'Value') == 1, + states(end - 1) = 1; + end +end + +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + + +% --- Executes on button press in NNDSVDRadio. +function NNDSVDRadio_Callback(hObject, eventdata, handles) +% hObject handle to NNDSVDRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of NNDSVDRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.RandomRadio, 'Value', 0); + set(handles.BLOCKNNDSVDRadio, 'Value', 0); + set(handles.BISECTINGNNDSVDRadio, 'Value', 0); + set(handles.CLRadio, 'Value', 0); +end + +states=zeros(length(handles.objects), 1); +states([14 15]) = 1; +handles=activate_uicontrol(states, handles); +refine_status = get(handles.RefineFactorsCheckbox, 'Value'); +if refine_status == 1, + states(end - 2) = 1; + states(end) = 1; + if get(handles.refinementMethod, 'Value') == 1, + states(end - 1) = 1; + end +end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in BLOCKNNDSVDRadio. +function BLOCKNNDSVDRadio_Callback(hObject, eventdata, handles) +% hObject handle to BLOCKNNDSVDRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of BLOCKNNDSVDRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.RandomRadio, 'Value', 0); + set(handles.NNDSVDRadio, 'Value', 0); + set(handles.BISECTINGNNDSVDRadio, 'Value', 0); + set(handles.CLRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); +handles=activate_uicontrol(states, handles); + +state_kmeans=get(handles.kmeansRadio, 'Value'); +state_skmeans=get(handles.skmeansRadio, 'Value'); +state_pddp=get(handles.PDDPRadio, 'Value'); + +if state_kmeans==1, + states=ones(length(handles.objects), 1); states([11:13])=0; states(7)=-1; + state=get(handles.CentroidInit, 'Value'); + if state==1, states([6 7])=0; end +end +if state_skmeans==1, + states=ones(length(handles.objects), 1); states([11:13])=0; states(7)=-1; + state=get(handles.CentroidInit, 'Value'); + if state==1, states([6 7])=0; end +end +if state_pddp==1, + states=ones(length(handles.objects), 1); states(5:9)=0; + state=get(handles.maxlPDDP, 'Value'); + if state==1, + states(11) = 0; + end +end +refine_status = get(handles.RefineFactorsCheckbox, 'Value'); +if refine_status == 1, + states(end - 2) = 1; + states(end) = 1; + if get(handles.refinementMethod, 'Value') == 2, + states(end - 1) = 0; + end +else, + states(end - 2: end) = 0; +end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in BISECTINGNNDSVDRadio. +function BISECTINGNNDSVDRadio_Callback(hObject, eventdata, handles) +% hObject handle to BISECTINGNNDSVDRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of BISECTINGNNDSVDRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.RandomRadio, 'Value', 0); + set(handles.NNDSVDRadio, 'Value', 0); + set(handles.BLOCKNNDSVDRadio, 'Value', 0); + set(handles.CLRadio, 'Value', 0); +end + +states=zeros(length(handles.objects), 1); states(10) = 1; +states([14 15]) = 1; +handles=activate_uicontrol(states, handles); +refine_status = get(handles.RefineFactorsCheckbox, 'Value'); +if refine_status == 1, + states(end - 2) = 1; + states(end) = 1; + if get(handles.refinementMethod, 'Value') == 1, + states(end - 1) = 1; + end +end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in CLRadio. +function CLRadio_Callback(hObject, eventdata, handles) +% hObject handle to CLRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of CLRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.RandomRadio, 'Value', 0); + set(handles.NNDSVDRadio, 'Value', 0); + set(handles.BLOCKNNDSVDRadio, 'Value', 0); + set(handles.BISECTINGNNDSVDRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); +handles=activate_uicontrol(states, handles); + +state_kmeans=get(handles.kmeansRadio, 'Value'); +state_skmeans=get(handles.skmeansRadio, 'Value'); +state_pddp=get(handles.PDDPRadio, 'Value'); + +if state_kmeans==1, + states=ones(length(handles.objects), 1); states([11:13])=0; states(7)=-1; + state=get(handles.CentroidInit, 'Value'); + if state==1, states([6 7])=0; end +end +if state_skmeans==1, + states=ones(length(handles.objects), 1); states([11:13])=0; states(7)=-1; + state=get(handles.CentroidInit, 'Value'); + if state==1, states([6 7])=0; end +end +if state_pddp==1, + states=ones(length(handles.objects), 1); states(5:9)=0; + state=get(handles.maxlPDDP, 'Value'); + if state==1, + states(11) = 0; + end +end +refine_status = get(handles.RefineFactorsCheckbox, 'Value'); +if refine_status == 1, + states(end - 2) = 1; + states(end) = 1; + if get(handles.refinementMethod, 'Value') == 2, + states(end - 1) = 0; + end +else, + states(end - 2: end) = 0; +end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in kmeansRadio. +function kmeansRadio_Callback(hObject, eventdata, handles) +% hObject handle to kmeansRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of kmeansRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.skmeansRadio, 'Value', 0); + set(handles.PDDPRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); states([11:13])=0; +state=get(handles.CentroidInit, 'Value'); +if state==1, states([6 7])=0; end +refine_status = get(handles.RefineFactorsCheckbox, 'Value'); +if refine_status == 1, + states(end - 2) = 1; + states(end) = 1; + if get(handles.refinementMethod, 'Value') == 2, + states(end - 1) = 0; + end +else, + states(end - 2: end) = 0; +end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in skmeansRadio. +function skmeansRadio_Callback(hObject, eventdata, handles) +% hObject handle to skmeansRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of skmeansRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.kmeansRadio, 'Value', 0); + set(handles.PDDPRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); states([11:13])=0; +state=get(handles.CentroidInit, 'Value'); +if state==1, states([6 7])=0; end +refine_status = get(handles.RefineFactorsCheckbox, 'Value'); +if refine_status == 1, + states(end - 2) = 1; + states(end) = 1; + if get(handles.refinementMethod, 'Value') == 2, + states(end - 1) = 0; + end +else, + states(end - 2: end) = 0; +end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + +% --- Executes on button press in PDDPRadio. +function PDDPRadio_Callback(hObject, eventdata, handles) +% hObject handle to PDDPRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of PDDPRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.kmeansRadio, 'Value', 0); + set(handles.skmeansRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); states([5:9])=0; states(7) = -1; +state=get(handles.maxlPDDP, 'Value'); +if state==1, + states(11)=0; +end +refine_status = get(handles.RefineFactorsCheckbox, 'Value'); +if refine_status == 1, + states(end - 2) = 1; + states(end) = 1; + if get(handles.refinementMethod, 'Value') == 2, + states(end - 1) = 0; + end +else, + states(end - 2: end) = 0; +end +handles=activate_uicontrol(states, handles); + +guidata(hObject, handles); + + +function nClusters_Callback(hObject, eventdata, handles) +% hObject handle to nClusters (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of nClusters as text +% str2double(get(hObject,'String')) returns contents of nClusters as a double +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function nClusters_CreateFcn(hObject, eventdata, handles) +% hObject handle to nClusters (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on selection change in CentroidInit. +function CentroidInit_Callback(hObject, eventdata, handles) +% hObject handle to CentroidInit (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns CentroidInit contents as cell array +% contents{get(hObject,'Value')} returns selected item from CentroidInit +state=get(hObject, 'Value'); +if state==1, + set(handles.CentroidsVarButton, 'Enable', 'off'); +else, + set(handles.CentroidsVarButton, 'Enable', 'on'); +end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function CentroidInit_CreateFcn(hObject, eventdata, handles) +% hObject handle to CentroidInit (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function CentroidsVar_Callback(hObject, eventdata, handles) +% hObject handle to CentroidsVar (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of CentroidsVar as text +% str2double(get(hObject,'String')) returns contents of CentroidsVar +% as a double +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function CentroidsVar_CreateFcn(hObject, eventdata, handles) +% hObject handle to CentroidsVar (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in CentroidsVarButton. +function CentroidsVarButton_Callback(hObject, eventdata, handles) +% hObject handle to CentroidsVarButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s=open_file(3); +set(handles.CentroidsVar, 'String', s); +guidata(hObject, handles); + +% --- Executes on selection change in Termination. +function Termination_Callback(hObject, eventdata, handles) +% hObject handle to Termination (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns Termination contents as cell array +% contents{get(hObject,'Value')} returns selected item from Termination + +state=get(hObject, 'Value'); s=get(handles.TerminationValue, 'String'); +if state==1 & isempty(s), set(handles.TerminationValue, 'String', 1); end +if state==2 & isempty(s), set(handles.TerminationValue, 'String', 10); end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Termination_CreateFcn(hObject, eventdata, handles) +% hObject handle to Termination (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function TerminationValue_Callback(hObject, eventdata, handles) +% hObject handle to TerminationValue (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of TerminationValue as text +% str2double(get(hObject,'String')) returns contents of TerminationValue as a double +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function TerminationValue_CreateFcn(hObject, eventdata, handles) +% hObject handle to TerminationValue (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in DispRes. +function DispRes_Callback(hObject, eventdata, handles) +% hObject handle to DispRes (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of DispRes +guidata(hObject, handles); + + +function lPDDP_Callback(hObject, eventdata, handles) +% hObject handle to lPDDP (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of lPDDP as text +% str2double(get(hObject,'String')) returns contents of lPDDP as a double +l=get(hObject, 'String'); +if isempty(l), return; end +l=str2double(l); +if ~isnumeric(l), msgbox('You have to provide the number of principal directions...', 'Error', 'modal'); return; end +if mod(l, 1)~=0, msgbox('You have to provide an integer number of principal directions...', 'Error', 'modal'); return; end +state=get(handles.maxlPDDP, 'Value'); +if state==1, + set(handles.maxlPDDP, 'Value', 0); + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; + set(handles.PDDPvariant, 'String', s); set(handles.PDDPvariant, 'Value', 1); +end +if l>1, + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPvariant, 'String', s); set(handles.PDDPvariant, 'Value', 1); +else, + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPvariant, 'String', s); set(handles.PDDPvariant, 'Value', 1); +end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function lPDDP_CreateFcn(hObject, eventdata, handles) +% hObject handle to lPDDP (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in ksSelection1. +function ksSelection1_Callback(hObject, eventdata, handles) +% hObject handle to ksSelection1 (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of ksSelection1 + + +% --- Executes on button press in RefineFactorsCheckbox. +function RefineFactorsCheckbox_Callback(hObject, eventdata, handles) +% hObject handle to RefineFactorsCheckbox (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of RefineFactorsCheckbox + +state = get(hObject, 'Value'); +if state == 1, tmp = 'on'; elseif state == 0, tmp = 'off'; else, tmp = 'inactive'; end +set(handles.refinementMethod, 'Enable', tmp); +set(handles.refineResultsDisplay, 'Enable', tmp); + +set(handles.RefineNIter, 'Enable', tmp); +if state ~= 1, + set(handles.RefineNIter, 'BackgroundColor', handles.light_gray); +else, + if get(handles.refinementMethod, 'Value') == 2, + set(handles.RefineNIter, 'Enable', 'off'); + set(handles.RefineNIter, 'BackgroundColor', handles.light_gray); + else, + set(handles.RefineNIter, 'BackgroundColor', 'white'); + end +end + + +function RefineNIter_Callback(hObject, eventdata, handles) +% hObject handle to RefineNIter (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of RefineNIter as text +% str2double(get(hObject,'String')) returns contents of RefineNIter as a double +l=get(hObject, 'String'); +if isempty(l), return; end +l=str2double(l); +if ~isnumeric(l), msgbox('You have to provide the number of iterations...', 'Error', 'modal'); return; end +if mod(l, 1)~=0 | l<=0, msgbox('You have to provide a positive integer number of iterations...', 'Error', 'modal'); return; end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function RefineNIter_CreateFcn(hObject, eventdata, handles) +% hObject handle to RefineNIter (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor',handles.light_gray); +end + + +% --- Executes on selection change in refinementMethod. +function refinementMethod_Callback(hObject, eventdata, handles) +% hObject handle to refinementMethod (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns refinementMethod contents as cell array +% contents{get(hObject,'Value')} returns selected item from refinementMethod +if get(handles.refinementMethod, 'Value') == 2, + set(handles.RefineNIter, 'Enable', 'off'); + set(handles.RefineNIter, 'BackgroundColor', handles.light_gray); +else, + set(handles.RefineNIter, 'Enable', 'on'); + set(handles.RefineNIter, 'BackgroundColor', 'white'); +end + + +% --- Executes during object creation, after setting all properties. +function refinementMethod_CreateFcn(hObject, eventdata, handles) +% hObject handle to refinementMethod (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in refineResultsDisplay. +function refineResultsDisplay_Callback(hObject, eventdata, handles) +% hObject handle to refineResultsDisplay (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of refineResultsDisplay + + +% --- Executes on button press in svds. +function svds_Callback(hObject, eventdata, handles) +% hObject handle to svds (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of svds +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.propack, 'Value', 0); +end +guidata(hObject, handles); + + +% --- Executes on button press in propack. +function propack_Callback(hObject, eventdata, handles) +% hObject handle to propack (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of propack +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.svds, 'Value', 0); +end +guidata(hObject, handles); + + +% --- Executes on selection change in PDDPvariant. +function PDDPvariant_Callback(hObject, eventdata, handles) +% hObject handle to PDDPvariant (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns PDDPvariant contents as cell array +% contents{get(hObject,'Value')} returns selected item from PDDPvariant + + +% --- Executes during object creation, after setting all properties. +function PDDPvariant_CreateFcn(hObject, eventdata, handles) +% hObject handle to PDDPvariant (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in maxlPDDP. +function maxlPDDP_Callback(hObject, eventdata, handles) +% hObject handle to maxlPDDP (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of maxlPDDP +state=get(hObject, 'Value'); +if state==1, + set(handles.lPDDP, 'Enable', 'off'); + set(handles.lPDDP, 'BackgroundColor', handles.light_gray); + s={'Basic';'Optimal Split on Projection'}; v=1; set(handles.PDDPvariant, 'String', s); set(handles.PDDPvariant, 'Value', 1); +else, + set(handles.lPDDP, 'Enable', 'on'); + set(handles.lPDDP, 'BackgroundColor', 'white'); + s={'Basic';'Split with k-means';'Optimal Split';'Optimal Split with k-means';'Optimal Split on Projection'}; v=1; set(handles.PDDPvariant, 'String', s); set(handles.PDDPvariant, 'Value', 1); +end + +%-------------------------------------------------------------------------- +%set Active and BackgroundColor field of each uicontrol item depending on +%the Radio Button that is pressed (called by the corresponding callback) +function handles=activate_uicontrol(states, handles) +sz=size(handles.objects, 1); +for i=1:sz, + if states(i)==1, tmp='on'; elseif states(i)==0, tmp='off'; else, tmp='inactive'; end + set(handles.objects(i), 'Enable', tmp); + if states(i)~=1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', handles.light_gray);continue; + end + if states(i)==1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', 'white'); + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/open_file.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/open_file.fig new file mode 100644 index 0000000000000000000000000000000000000000..503b3323668b4e732857c35d4dbed4287d0ce02b Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/open_file.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/open_file.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/open_file.m new file mode 100644 index 0000000000000000000000000000000000000000..dab2f1b838da6fc02154b7504b714bbf880c5293 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/open_file.m @@ -0,0 +1,352 @@ +function varargout = open_file(varargin) +% OPEN_FILE +% OPEN_FILE is a graphical user interface for selecting a file, +% directory or variable from the workspace. The function returns +% the name of the selected file, directory or variable. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +%Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @open_file_OpeningFcn, ... + 'gui_OutputFcn', @open_file_OutputFcn, ... + 'gui_LayoutFcn', [] , ... + 'gui_Callback', []); +if nargin & isstr(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + +% --- Executes just before open_file is made visible. +function open_file_OpeningFcn(hObject, eventdata, handles, varargin) + +handles.output = hObject; + +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=6.741748437499999; +wdth=14.778970104166666; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +%----- +root=pwd; +tmp={pwd}; +str=strcat(fileparts(mfilename('fullpath')), filesep, 'log_files'); +cd(str); +% if exist('./history.log')~=2, +if exist('history.log')~=2, + fid=fopen('history.log', 'at'); + if fid==-1, error('Unable to open file history.log...'); end + fprintf(fid, '%s\n', root);fclose(fid); +else, + tmp=textread('history.log', '%s', -1, 'delimiter', '\n'); +end + +cd(root);% change dir to the previous current path + +pwd_ind=find(ismember(tmp, pwd)); + +if isempty(pwd_ind), + cd(str); + fid=fopen('history.log', 'at'); + if fid==-1, error('Unable to open file history.log...'); end + fprintf(fid, '%s\n', root);fclose(fid); + cd(root); + tmp{end+1}=pwd;pwd_ind=size(tmp, 1); +end + +set(handles.WorkingDir, 'String', tmp); +set(handles.WorkingDir, 'Value', pwd_ind); +handles.work_dirs=tmp; +handles.work_dir_ind=pwd_ind; +%----- +handles.c_dir=pwd; +handles.open_type='Files'; +guidata(hObject, handles); + +%check input +if nargin~=4 | varargin{1}>3, + errordlg('Type load_list(i)...', 'Input Argument Error!'); + return; +end +handles.open_files=varargin{1}; +guidata(hObject, handles); + +tmp={'Files'}; +ind=1; +if handles.open_files==2, + tmp{2}='Variables'; +end +if handles.open_files==3, + tmp={'Variables'}; + handles.open_type='Variables'; +end +set(handles.Popup1, 'String', tmp); +set(handles.Popup1, 'Value', ind); +if handles.open_files<3, set(handles.listbox1, 'String', GetList(pwd)); else, set(handles.listbox1, 'String', GetList1); end +guidata(hObject, handles); + +% UIWAIT makes open_file wait for user response (see UIRESUME) +uiwait(handles.figure1); + + +% --- Outputs from this function are returned to the command line. +function varargout = open_file_OutputFcn(hObject, eventdata, handles) + +varargout{1} = handles.c_dir; +varargout{2} = handles.open_type; +delete(handles.figure1); + +% --- Executes during object creation, after setting all properties. +function listbox1_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end +files=GetList(pwd); +set(hObject, 'String', files); +set(hObject, 'Value', 1); + +% --- Executes on selection change in listbox1. +function listbox1_Callback(hObject, eventdata, handles) + +str=strcat(fileparts(mfilename('fullpath')), filesep, 'log_files'); + +if isequal(get(handles.figure1,'SelectionType'), 'open'), + if isequal(handles.open_type, 'Variables'), + vars=get(hObject, 'String'); + vars_ind=get(hObject, 'Value'); + handles.c_dir=vars{vars_ind}; + guidata(hObject, handles); + uiresume(handles.figure1); + return; + end + dirs=get(hObject, 'String'); + dirs_ind=get(hObject, 'Value'); + cur_dir=dirs{dirs_ind}; + if isequal(cur_dir, '.'), + return; + end + if isequal(cur_dir, '..'), + [pathstr, name] = fileparts(handles.c_dir); + handles.c_dir=pathstr; + guidata(hObject, handles); + else, + if ~isequal(handles.c_dir(end), filesep), + handles.c_dir=strcat(handles.c_dir, filesep, cur_dir); + else, + handles.c_dir=strcat(handles.c_dir, cur_dir); + end + guidata(hObject, handles); + end + cur_dir=handles.c_dir; + if isdir(cur_dir), + files=GetList(cur_dir); + set(hObject, 'String', files); + set(hObject, 'Value', 1); + cur_ind=find(ismember(handles.work_dirs, cur_dir)); + if isempty(cur_ind), + handles.work_dirs{end+1, 1}=cur_dir; + guidata(hObject, handles); + handles.work_dir_ind=size(handles.work_dirs, 1); + root=pwd; + cd(str); + fid=fopen('history.log', 'at'); + if fid==-1, error('Unable to open file history.log...'); end + fprintf(fid, '%s\n', cur_dir);fclose(fid); + cd(root); + else, + handles.work_dir_ind=cur_ind; + end + guidata(hObject, handles); + set(handles.WorkingDir, 'String', handles.work_dirs); + set(handles.WorkingDir, 'Value', handles.work_dir_ind); + guidata(hObject, handles); + else, + uiresume(handles.figure1); + end +end + +% --- Executes on button press in OpenButton. +function OpenButton_Callback(hObject, eventdata, handles) + +str=strcat(fileparts(mfilename('fullpath')), filesep, 'log_files'); + +dirs=get(handles.listbox1, 'String'); +dirs_ind=get(handles.listbox1, 'Value'); +cur_dir=dirs{dirs_ind}; +if isequal(handles.open_type, 'Variables'), + handles.c_dir=cur_dir; + guidata(hObject, handles); + uiresume(handles.figure1); + return; +end +if isequal(cur_dir, '.'), + if handles.open_files==0, uiresume(handles.figure1); end + return; +end +if isequal(cur_dir, '..'), + [pathstr, name] = fileparts(handles.c_dir); + handles.c_dir=pathstr; + guidata(hObject, handles); + if handles.open_files==0, uiresume(handles.figure1); return; end +else, + if ~isequal(handles.c_dir(end), filesep), + handles.c_dir=strcat(handles.c_dir, filesep, cur_dir); + else, + handles.c_dir=strcat(handles.c_dir, cur_dir); + end + guidata(hObject, handles); +end +cur_dir=handles.c_dir; +if isdir(cur_dir), + if handles.open_files==0, uiresume(handles.figure1); return; end + files=GetList(cur_dir); + set(handles.listbox1, 'String', files); + set(handles.listbox1, 'Value', 1); + cur_ind=find(ismember(handles.work_dirs, cur_dir)); + if isempty(cur_ind), + handles.work_dirs{end+1, 1}=cur_dir; + guidata(hObject, handles); + handles.work_dir_ind=size(handles.work_dirs, 1); + root=pwd; + cd(str); + fid=fopen('history.log', 'at'); + if fid==-1, error('Unable to open file history.log...'); end + fprintf(fid, '%s\n', cur_dir);fclose(fid); + cd(root); + else, + handles.work_dir_ind=cur_ind; + end + guidata(hObject, handles); + set(handles.WorkingDir, 'String', handles.work_dirs); + set(handles.WorkingDir, 'Value', handles.work_dir_ind); + guidata(hObject, handles); +else, + uiresume(handles.figure1); +end + + +% --- Executes on button press in CancelButton. +function CancelButton_Callback(hObject, eventdata, handles) + +handles.c_dir=[]; +guidata(hObject, handles); +uiresume(handles.figure1); + +function figure1_CloseRequestFcn(hObject, eventdata, handles) + +if isequal(get(handles.figure1, 'waitstatus'), 'waiting') + uiresume(handles.figure1); +else + delete(handles.figure1); +end + + +% --- Executes during object creation, after setting all properties. +function Popup1_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + +% --- Executes on selection change in Popup1. +function Popup1_Callback(hObject, eventdata, handles) + +open_type=get(hObject, 'String'); +open_type_ind=get(hObject, 'Value'); +handles.open_type=open_type{open_type_ind}; + +if open_type_ind==1, + handles.c_dir=pwd;guidata(hObject, handles); + files=GetList(handles.c_dir); + set(handles.listbox1, 'String', files); + set(handles.listbox1, 'Value', 1); + pwd_ind=find(ismember(handles.work_dirs, pwd)); + set(handles.WorkingDir, 'String', handles.work_dirs); + set(handles.WorkingDir, 'Value', pwd_ind); + handles.work_dir_ind=pwd_ind; +else, + variables=GetList1; + set(handles.listbox1, 'String', variables); + set(handles.listbox1, 'Value', 1); + set(handles.WorkingDir, 'String', 'Workspace'); + set(handles.WorkingDir, 'Value', 1); +end +guidata(hObject, handles); + +%------------------------------------------------------------------------- +%get list of files of the input directory +function files=GetList(dir_name) + +file_struct=dir(dir_name); +files={}; +n_files=0; +for i=1:size(file_struct, 1), + n_files=n_files+1; + files{n_files, 1}=file_struct(i).name; +end + +%get list of variables of the workspace +function variables=GetList1 + +vars=evalin('base', 'whos'); +variables={}; +n_variables=0; +for i=1:size(vars, 1), + n_variables=n_variables+1; + variables{n_variables, 1}=vars(i).name; +end + + +% --- Executes during object creation, after setting all properties. +function WorkingDir_CreateFcn(hObject, eventdata, handles) +% hObject handle to WorkingDir (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + +% --- Executes on selection change in WorkingDir. +function WorkingDir_Callback(hObject, eventdata, handles) +% hObject handle to WorkingDir (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns WorkingDir contents as cell array +% contents{get(hObject,'Value')} returns selected item from WorkingDir + +if isequal(handles.open_type, 'Variables'), return; end +s=get(hObject, 'String'); +ind=get(hObject, 'Value'); +if ~isdir(s{ind}), + an=new_sprintf('Error opening directory ''%s''. Directory does not exist...', s{ind}); + msgbox(an, 'modal'); + set(hObject, 'Value', handles.work_dir_ind); + return; +end +handles.c_dir=s{ind}; +set(handles.listbox1, 'String', GetList(s{ind})); +set(handles.listbox1, 'Value', 1); +guidata(hObject, handles); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/Stemmer.pm b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/Stemmer.pm new file mode 100644 index 0000000000000000000000000000000000000000..fac116dceb94a923ddd4a5b920ff7495d7af4f54 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/Stemmer.pm @@ -0,0 +1,322 @@ +#!/usr/bin/perl -w +# Stemmer.pm is a perl module implementing the Porter stemming algorithm [1]. +# +# REFERENCES: +# [1] M.F.Porter, An algorithm for suffix stripping, Program, 14(3): 130-137, +# 1980. +# +# Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +use strict; + +package Stemmer; + +sub get_signature($) +{ + my $token=$_[0]; + my $n=length($token); + my $signature=''; + my $i=0; + my $c; + my $c1; + + for ($i=0;$i<$n;$i++) { + if ($i==0) { $c=substr($token, 0, -length($token)+1); } else { $c=substr($token, $i, -length($token)+$i+1); } + if ($c eq 'a' or $c eq 'e' or $c eq 'i' or $c eq 'o' or $c eq 'u') { + $signature=$signature.'v'; + } else { + if ($c eq 'y' and $i==0) { $signature=$signature.'c'; next; } + $c1=''; + if ($i==1) { $c1=$signature; } elsif ($i>1) {$c1=substr($signature, $i-1); } + if ($c eq 'y' and $c1 eq 'c') { $signature=$signature.'v'; } else { $signature=$signature.'c'; } + } + } + return $signature; +} + +sub get_m(@) +{ + my ($signature, $n)=@_; + if ($n<length($signature)) { $signature=substr($signature, 0, -length($signature)+$n); } + my $sign=substr($signature, 0, -length($signature)+1); + my $i; + my $cur=1; + my $c; + my $c1; + + for ($i=1;$i<length($signature);$i++) { + if ($i==length($signature)-1) { $c=substr($signature, $i); } else { $c=substr($signature, $i, -length($signature)+$i+1); } + $c1=substr($sign, length($sign)-1); + if ($c1 ne $c) { + $sign=$sign.$c; $cur++; + } + } + my $res=($sign=~s/vc/vc/g); if ($res eq '') { $res=0; } + return $res; +} + +sub stemmer_fun(@) { + my ($token, $dsp)=@_; + my ($m1, $m2, $m3, $m4, $m5, $m6, $m7); + $token=lc($token); + if ($dsp!=0) { $dsp=1; } + + my $n=length($token); + + if ($token=~ m/\d/ or $n<3) { return $token; } + + my $signature=get_signature($token); + if ($dsp==1) { print "signature = $signature\n"; } + + # step 1a + my $flag=0; + if ($n>=4) { + if ($token=~ m/sses$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>=3 and $flag==0) { + if ($token=~ m/ies$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>=2 and $flag==0) { + if ($token=~ m/ss$/) { $flag=1; } + } + if ($flag==0) { + if ($token=~ m/s$/) { $token=substr($token, 0, -1); $signature=substr($signature, 0, -1); } + } + if ($dsp==1) { print "After step 1a: $token\n"; } + + #Step 1b + my $m; + my $c; + my $c1; + my $c2; + $n=length($token); + $flag=0; + my $flag1=0; + if ($n>3) { + $m=get_m($signature, $n-3); + if ($m>0 and $token=~m/eed$/) { $token=substr($token, 0, -1); $signature=substr($signature, 0, -1); $flag=1; } + } + if ($n>2 and $flag==0) { + $c=substr($signature, 0, -2); + $c1=substr($token, length($token)-3, -2); + if ($c=~m/v/ and $token=~m/ed$/ and $c1 ne 'e') { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; $flag1=1; } + } + if ($n>3 and $flag==0) { + $c=substr($signature, 0, -3); + if ($c=~m/v/ and $token=~m/ing$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag1=1; } + } + $n=length($token); + if ($flag1==1) { + $flag=0; + if ($n>1) { + if ($token=~m/at$/ or $token=~m/bl$/ or $token=~m/iz$/) { $token=$token.'e'; $signature=$signature.'v'; $flag=1; } + $c=substr($signature, length($signature)-1); + $c1=substr($token, length($token)-2, -1); + $c2=substr($token, length($token)-1); + if ($flag==0 and $c eq 'c' and $c1 eq $c2 and $c2 ne 'l' and $c2 ne 's' and $c2 ne 'z') { $token=substr($token, 0, -1); $signature=substr($signature, 0, -1); $flag=1; } + } + $n=length($token); + if ($n>2 and $flag==0) { + $m=get_m($signature, $n); + $c=substr($signature, length($signature)-3); + $c2=substr($token, length($token)-1); + if ($m==1 and ($c eq 'cvc' and $c2 ne 'w' and $c2 ne 'x' and $c2 ne 'y')) { $token=$token.'e'; $signature=$signature.'v'; } + } + } + if ($dsp==1) { print "After step 1b: $token\n"; } + + #Step 1c + $n=length($token); + if ($n>1) { + $c=substr($signature, 0, -1); + $c2=substr($token, length($token)-1); + if ($c=~m/v/ and $c2 eq 'y') { $token=substr($token, 0, -1); $signature=substr($signature, 0, -1); $token=$token.'i'; $signature=$signature.'v'; } + } + if ($dsp==1) { print "After step 1c: $token\n"; } + + #Step 2 + $n=length($token); + $flag=0; + if ($n>7) { + $m7=get_m($signature, $n-7); if ($m7>0 and $token=~m/ational$/) { $token=substr($token, 0, -5); $signature=substr($signature, 0, -4); $token=$token.'e'; $flag=1; } + } + if ($n>6 and $flag==0) { + $m6=get_m($signature, $n-6); if ($m6>0 and $token=~m/tional$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>4 and $flag==0) { + $m4=get_m($signature, $n-4); if ($m4>0 and $token=~m/enci$/) { $token=substr($token, 0, -1); $token=$token.'e'; $flag=1; } + } + if ($n>4 and $flag==0) { + if ($m4>0 and $token=~m/anci$/) { $token=substr($token, 0, -1); $token=$token.'e'; $flag=1; } + } + if ($n>4 and $flag==0) { + if ($m4>0 and $token=~m/izer$/) { $token=substr($token, 0, -1); $signature=substr($signature, 0, -1); $flag=1; } + } + #New rule + if ($n>3 and $flag==0) { + $m3=get_m($signature, $n-3); if ($m3>0 and $token=~m/bli$/) { $token=substr($token, 0, -1); $token=$token.'e'; $flag=1; } + } + if ($n>4 and $flag==0) { + if ($m4>0 and $token=~m/alli$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>5 and $flag==0) { + $m5=get_m($signature, $n-5); if ($m5>0 and $token=~m/entli$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>3 and $flag==0) { + if ($m3>0 and $token=~m/eli$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>5 and $flag==0) { + if ($m5>0 and $token=~m/ousli$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>7 and $flag==0) { + if ($m7>0 and $token=~m/ization$/) { $token=substr($token, 0, -5); $signature=substr($signature, 0, -4); $token=$token.'e'; $flag=1; } + } + if ($n>5 and $flag==0) { + if ($m5>0 and $token=~m/ation$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -2); $token=$token.'e'; $flag=1; } + } + if ($n>4 and $flag==0) { + if ($m4>0 and $token=~m/ator$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -1); $token=$token.'e'; $flag=1; } + } + if ($n>5 and $flag==0) { + if ($m5>0 and $token=~m/alism$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>7 and $flag==0) { + if ($m7>0 and $token=~m/iveness$/) { $token=substr($token, 0, -4); $signature=substr($signature, 0, -4); $flag=1; } + } + if ($n>7 and $flag==0) { + if ($m7>0 and $token=~m/fulness$/) { $token=substr($token, 0, -4); $signature=substr($signature, 0, -4); $flag=1; } + } + if ($n>7 and $flag==0) { + if ($m7>0 and $token=~m/ousness$/) { $token=substr($token, 0, -4); $signature=substr($signature, 0, -4); $flag=1; } + } + if ($n>5 and $flag==0) { + if ($m5>0 and $token=~m/aliti$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>5 and $flag==0) { + if ($m5>0 and $token=~m/iviti$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -2); $token=$token.'e'; $flag=1; } + } + if ($n>6 and $flag==0) { + if ($m6>0 and $token=~m/biliti$/) { $token=substr($token, 0, -5); $signature=substr($signature, 0, -5); $token=$token.'le'; $signature=$signature.'cv'; $flag=1; } + } + #New rule + if ($n>4 and $flag==0) { + if ($m4>0 and $token=~m/logi$/) { $token=substr($token, 0, -1); $signature=substr($signature, 0, -1); $flag=1; } + } + if ($dsp==1) { print "After step 2: $token\n"; } + + #Step 3 + $n=length($token); + $flag=0; + if ($n>5) { + $m5=get_m($signature, $n-5); if ($m5>0 and $token=~m/icate$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>5 and $flag==0) { + if ($m5>0 and $token=~m/ative$/) { $token=substr($token, 0, -5); $signature=substr($signature, 0, -5); $flag=1; } + } + if ($n>5 and $flag==0) { + if ($m5>0 and $token=~m/alize$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>5 and $flag==0) { + if ($m5>0 and $token=~m/iciti$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>4 and $flag==0) { + $m4=get_m($signature, $n-4); if ($m4>0 and $token=~m/ical$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>3 and $flag==0) { + $m3=get_m($signature, $n-3); if ($m3>0 and $token=~m/ful$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>4 and $flag==0) { + if ($m4>0 and $token=~m/ness$/) { $token=substr($token, 0, -4); $signature=substr($signature, 0, -4); $flag=1; } + } + if ($dsp==1) { print "After step 3: $token\n"; } + + #Step 4 + $n=length($token); + $flag=0; + if ($n>2) { + $m2=get_m($signature, $n-2); if ($m2>1 and $token=~m/al$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>4 and $flag==0) { + $m4=get_m($signature, $n-4); if ($m4>1 and $token=~m/ance$/) { $token=substr($token, 0, -4); $signature=substr($signature, 0, -4); $flag=1; } + } + if ($n>4 and $flag==0) { + if ($m4>1 and $token=~m/ence$/) { $token=substr($token, 0, -4); $signature=substr($signature, 0, -4); $flag=1; } + } + if ($n>2 and $flag==0) { + if ($m2>1 and $token=~m/er$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>2 and $flag==0) { + if ($m2>1 and $token=~m/ic$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>4 and $flag==0) { + if ($m4>1 and $token=~m/able$/) { $token=substr($token, 0, -4); $signature=substr($signature, 0, -4); $flag=1; } + } + if ($n>4 and $flag==0) { + if ($m4>1 and $token=~m/ible$/) { $token=substr($token, 0, -4); $signature=substr($signature, 0, -4); $flag=1; } + } + if ($n>3 and $flag==0) { + $m3=get_m($signature, $n-3); if ($m3>1 and $token=~m/ant$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>5 and $flag==0) { + $m5=get_m($signature, $n-5); if ($m5>1 and $token=~m/ement$/) { $token=substr($token, 0, -5); $signature=substr($signature, 0, -5); $flag=1; } + } + if ($n>4 and $flag==0) { + if ($m4>1) { $c2=substr($token, length($token)-4, -3); } + if ($m4>1 and $token=~m/ment$/ and $c2 ne 'e') { $token=substr($token, 0, -4); $signature=substr($signature, 0, -4); $flag=1; } + } + if ($n>3 and $flag==0) { + if ($m3>1) { $c1=substr($token, length($token)-4, -3); $c2=substr($token, length($token)-5, -4); } + if ($m3>1 and $token=~m/ent$/ and $c1 ne 'm' and !($c2 eq 'e' and $c1 eq 'm')) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>3 and $flag==0) { + if ($m3>1) { $c1=substr($token, length($token)-4, -3); } + if ($m3>1 and ($c1 eq 's' or $c1 eq 't') and $token=~m/ion$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>2 and $flag==0) { + if ($m2>1 and $token=~m/ou$/) { $token=substr($token, 0, -2); $signature=substr($signature, 0, -2); $flag=1; } + } + if ($n>3 and $flag==0) { + if ($m3>1 and $token=~m/ism$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>3 and $flag==0) { + if ($m3>1 and $token=~m/ate$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>3 and $flag==0) { + if ($m3>1 and $token=~m/iti$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>3 and $flag==0) { + if ($m3>1 and $token=~m/ous$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>3 and $flag==0) { + if ($m3>1 and $token=~m/ive$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($n>3 and $flag==0) { + if ($m3>1 and $token=~m/ize$/) { $token=substr($token, 0, -3); $signature=substr($signature, 0, -3); $flag=1; } + } + if ($dsp==1) { print "After step 4: $token\n"; } + + #Step 5a + $n=length($token); + $flag=0; + if ($n>1) { + $m1=get_m($signature, $n-1); if ($m1>1 and $token=~m/e$/) { $token=substr($token, 0, -1); $signature=substr($signature, 0, -1); $flag=1; } + } + if ($n>1 and $flag==0) { + if ($m1==1) { $c=substr($signature, length($signature)-4, -1); $c1=substr($token, length($token)-2, -1); $c2=substr($token, length($token)-1); } + if ($m1==1 and ($n<=3 or !(($c eq 'cvc' and $c1 ne 'w' and $c1 ne 'x' and $c1 ne 'y'))) and $c2 eq 'e') { $token=substr($token, 0, -1); $signature=substr($signature, 0, -1); $flag=1; } + } + if ($dsp==1) { print "After step 5a: $token\n"; } + + #Step 5b + $n=length($token); + $flag=0; + if ($n>1) { + if ($m1>1) { $c1=substr($token, length($token)-2, -1); $c2=substr($token, length($token)-1); } + $m1=get_m($signature, $n); if ($m1>1 and $c1 eq 'l' and $c2 eq 'l') { $token=substr($token, 0, -1); $signature=substr($signature, 0, -1); $flag=1; } + } + if ($dsp==1) { print "After step 5b: $token\n"; } + + return $token; +} +1; + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/stemmer.pl b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/stemmer.pl new file mode 100644 index 0000000000000000000000000000000000000000..8c5718329fc76e867bd651c651bfba853fe335ab --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/stemmer.pl @@ -0,0 +1,25 @@ +#!/usr/bin/perl -w +# stemmer.pl is an interface to the Stemmer module. +# +# Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +use lib $ARGV[0]; +use Stemmer; + +$filename=$ARGV[1]; +open FD, '<'.$filename; + +#$tokens=<FD>; +#@tokens=split(/\s+/, $tokens); +#print $#tokens+1, "\n"; +@tokens=<FD>; + +for ($i=0;$i<$#tokens+1;$i++) { + chomp $tokens[$i]; + $tokens[$i]=Stemmer::stemmer_fun($tokens[$i], 0); +} + +$,="\n"; +close FD; open FD, '>'.$filename; +print FD @tokens; +close FD; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/strip_html.pl b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/strip_html.pl new file mode 100644 index 0000000000000000000000000000000000000000..9d2e14e23d207d6dfc8ee67caa0959df89650211 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/strip_html.pl @@ -0,0 +1,32 @@ +#/usr/bin/perl -w +#!/usr/bin/perl -w +# strip_html.pl is a perl implementation of the MATLAB strip_html function. +# +# Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +use strict; + +my $filename=$ARGV[0]; +my $ext=0; +my ($contents, $line, $i); +my (@con, @con1); +local $/=''; + +# input file must have an '.html' or '.htm' suffix +if ($filename=~m/\.htm$/ or $filename=~m/\.html$/) { $ext=1; } +if ($ext==0) { print "Give an html file...\n"; exit; } +open FD, '<'.$filename or die "No such file...\n"; + +# applying conversion +print "Converting file $filename...\n"; +$contents=<FD>; close FD; +$contents=~s/<\s*(script)(.*?)<\s*\/script\s*>//gs; +$contents=~s/<[^>|^<]*>//gs; +$contents=~s/</</gs; $contents=~s/>/>/gs; $contents=~s/ / /gs; $contents=~s/&/&/gs; $contents=~s/"/ /gs; + +# saving result +@con=split(/\n/, $contents); +for $line (@con) { chomp $line; $line=~s/[^\040-\176]//g; $line=~s/\s+$//; if ($line ne '') { push @con1, $line; } } +open FD, '>'.$filename.'.txt'; +#for ($i=0;$i<$#con1;$i++) { if ($con1[$i] ne '') { print FD $con1[$i], "\n"; } } close FD; +$,="\n"; print FD @con1; close FD; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/tmg_perl.pl b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/tmg_perl.pl new file mode 100644 index 0000000000000000000000000000000000000000..6855598a6192e13d8331b922c8d87d25fb09cfd3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/tmg_perl.pl @@ -0,0 +1,278 @@ +#!/usr/bin/perl -w +# tmg_perl.pl is a perl implementation of the MATLAB tmg function. +# +# Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +use lib $ARGV[0]; +use strict; +use Stemmer; + +my $sp1; +my $sp2; +my $delimiter; +my $line_delimiter; +my $stoplist; +my $use_stoplist; +my $remove_num; +my $remove_al; +my @tmp_stopwords; +my %stopwords; +my $word; +my $stemming; +my $min_length; +my $max_length; +my $filename; +my @files; +my %inv_index; +my $doc_id; +my @words_per_doc; +my $file; +my @ar; +my @new_doc; +my $i; +my $cnt; +my $chunk; +my $j; +my $jj; +my @words; +my $rem_stoplist; +my $rem_terms_length; +my $rem_stemming; +my $rem_numbers; +my $rem_alphanumerics; +#my %tmp; +#my $token; +#my $stemmed_token; +#my @docs; +my $doc; +#my @keys; +my @values; +my $display_filename; +my $dsp; +my %removed_words_length; +my %removed_words_numbers; +my %removed_words_stopwords; +my %removed_words_alphanumerics; + + +open FILE_DICT, ">dict.tmp"; +open FILE_TITLES, ">titles.tmp"; + +$delimiter=$ARGV[1]; +$line_delimiter=$ARGV[2]; +$stoplist=$ARGV[3]; +$stemming=$ARGV[4]+0; +$min_length=$ARGV[5]+0; +$max_length=$ARGV[6]+0; +$filename=$ARGV[7]; +$dsp=$ARGV[8]+0; +$remove_num=$ARGV[9]+0; +$remove_al=$ARGV[10]+0; + +$sp1='ltspcl'; $sp2='gtspcl'; $delimiter=~s/$sp1/</g; $delimiter=~s/$sp2/>/g; +$use_stoplist=1; if ($stoplist eq '-nostoplist') { $use_stoplist=0; } +open FILE_STOPLIST, '<'.$stoplist or $use_stoplist=0; +if ($use_stoplist!=0) { + @tmp_stopwords=map {lc($_);} <FILE_STOPLIST>; close FILE_STOPLIST; + for $word (@tmp_stopwords) { + chomp $word; if ($word=~ /\r$/) { chop($word); } + $stopwords{$word}++; + } + undef @tmp_stopwords; +} +open FF, '<'.$filename; @files=<FF>; close FF; $cnt=0; for $file (@files) { chomp $file; $files[$cnt++]=$file; } +if ($delimiter eq 'none_delimiter' or $delimiter eq 'emptyline') { + $line_delimiter='1'; +} +$line_delimiter=$line_delimiter+0; +if ($delimiter eq 'emptyline') { + $delimiter=''; +} + +%inv_index=(); +$doc_id=0; +@words_per_doc=(); +open FD1, '>d1.tmp'; open FD2, '>d2.tmp'; +for $file (@files) { + $display_filename=$file; $display_filename=~s/\\/\//; + print "=================================================================================\nParsing file $display_filename...\n=================================================================================\n"; + open FILE, '<'.$file; + if ($line_delimiter==1) { + $delimiter=lc($delimiter); + @ar=map {lc($_);} <FILE>; + unshift @ar, ''; + + @new_doc=(1); + if ($delimiter eq 'none_delimiter') { + for ($i=1;$i<$#ar+1;$i++) { $new_doc[$i]=0; } + $cnt=1; + for $chunk (@ar[1..$#ar]) { + chomp $chunk; + if ($chunk =~ /\r$/) { + chop($chunk); + } + while ($chunk=~m/\s$/) { chop $chunk; } + $chunk =~ s/~|`|!|@|#|\$|%|\^|&|\*|\(|\)|-|_|=|\+|\[|\]|{|}|\\|\||:|;|'|"|<|>|\?|\/|,|\.|�|�|�|�/ /g; + $chunk =~ s/^\s+//; + $ar[$cnt++]=$chunk; + } + } else { + $cnt=1; + for $chunk (@ar[1..$#ar]) { + chomp $chunk; + if ($chunk =~ /\r$/) { + chop($chunk); + } + while ($chunk=~m/\s$/) { chop $chunk; } + if ($chunk eq $delimiter) { + $new_doc[$cnt]=1; + if ($new_doc[$cnt-1]==1 or $new_doc[$cnt-1]==-1) { + $new_doc[$cnt]=-1; + } + } else { + $new_doc[$cnt]=0; + } + $chunk =~ s/~|`|!|@|#|\$|%|\^|&|\*|\(|\)|-|_|=|\+|\[|\]|{|}|\\|\||:|;|'|"|<|>|\?|\/|,|\.|�|�|�|�/ /g; + $chunk =~ s/^\s+//; + $ar[$cnt++]=$chunk; + } + } + + for ($i=0;$i<$#new_doc;$i++) { + if ($new_doc[$i]==1) { + $doc_id++; $words_per_doc[$doc_id-1]=0; + if ($dsp==1) { print "Parsing document $doc_id...\n"; } + if ($i==0 and $new_doc[1]==-1) { for ($jj=2;$jj<$#new_doc+1;$jj++) { if ($new_doc[$jj]==0) { last; } } } else { $jj=$i+1; } + if (length($ar[$jj])>50) { print FILE_TITLES $file, '.', $doc_id, "\n\t", substr($ar[$jj], 0, -length($ar[$jj])+50), "\n"; } else { print FILE_TITLES $file, '.', $doc_id, "\n\t", $ar[$jj], "\n"; } + #print FILE_TITLES $file, '.', $doc_id, "\n\t", $ar[$jj], "\n"; + for ($j=$i+1;$j<$#new_doc+1;$j++) { + if ($j==$i+1 and $new_doc[$j]==1) { + $doc_id--; + last; + } + if ($new_doc[$j]==-1){ + next; + } + if ($new_doc[$j]==1) { + if ($dsp==1) { print "\tNumber of terms: $words_per_doc[$doc_id-1]...\n"; } + last; + } + @words=split(/\s+/, $ar[$j]); $words_per_doc[$doc_id-1]+=$#words+1; + for $word (@words) { + $inv_index{$word}{$doc_id}+=1; + } + } + } + } + if ($new_doc[$#new_doc]==0) { if ($dsp==1) { print "\tNumber of terms: $words_per_doc[$doc_id-1]...\n"; } } + } + else { + $/=$delimiter; + @ar=map {lc($_);} <FILE>; + for ($i=0;$i<$#ar+1;$i++) { + if (length($ar[$i])>50) { print FILE_TITLES $file, '.', $doc_id, "\n\t", substr($ar[$i], 0, -length($ar[$i])+50), "\n"; } else { print FILE_TITLES $file, '.', $doc_id, "\n\t", $ar[$i], "\n"; } + $chunk=$ar[$i]; + $chunk =~ s/~|`|!|@|#|\$|%|\^|&|\*|\(|\)|-|_|=|\+|\[|\]|{|}|\\|\||:|;|'|"|<|>|\?|\/|,|\.|�|�|�|�/ /g; + $chunk =~ s/^\s+//; + $ar[$i]=$chunk; + $doc_id++; $words_per_doc[$doc_id-1]=0; + @words=split(/\s+/, $ar[$i]); $words_per_doc[$doc_id-1]+=$#words+1; + if ($#words==-1) { + $doc_id--; + next; + } else { + if ($dsp==1) { print "Parsing document $doc_id...\n"; } + } + for $word (@words) { + $inv_index{$word}{$doc_id}+=1; + } + if ($dsp==1) { print "\tNumber of terms: $words_per_doc[$doc_id-1]...\n"; } + } + } + close FILE; @ar=(); undef @ar; + for $word (keys %inv_index) { + if (exists($stopwords{$word})) { $removed_words_stopwords{$word}++; next; } + if ($remove_num==1){if ($word =~ m/^\d+$/ ) { $removed_words_numbers{$word}++; next; }} + if (length($word)<$min_length or length($word)>$max_length) { $removed_words_length{$word}++; next; } + if ($remove_al==1){if ($word =~ m/\d+/){if ($remove_num==1){$removed_words_alphanumerics{$word}++;next;}else{if($word !~ m/^\d+$/ ){$removed_words_alphanumerics{$word}++;next;}}}} + print FD1 "$word\n"; + for $doc (keys %{$inv_index{$word}}) { + print FD2 "$doc $inv_index{$word}{$doc} "; + } + print FD2 "\n"; + } + undef %inv_index; +} +close FD1; close FD2; +my @tmp_array1=keys %removed_words_stopwords; $rem_stoplist=@tmp_array1; +my @tmp_array2=keys %removed_words_numbers; $rem_numbers=@tmp_array2; +my @tmp_array3=keys %removed_words_length; $rem_terms_length=@tmp_array3; +my @tmp_array4=keys %removed_words_alphanumerics; $rem_alphanumerics=@tmp_array4; + + +my %tmp_index1; +if ($stemming==1) { + open FD3, '<d1.tmp'; + while (<FD3>) { + $word=$_; chomp $word; + if ($word =~ /\r$/) { + chop($word); + } + $tmp_index1{$word}=0; + } + close FD3; +} +open FD1, '<d1.tmp'; open FD2, '<d2.tmp'; open FD3, '>d3.tmp'; +my $word1; +$cnt=0; $rem_stemming=0; +while (<FD1>) { + $word=$_; chomp $word; + if ($word =~ /\r$/) { + chop($word); + } + if ($stemming==1) { + $word1=Stemmer::stemmer_fun($word, 0); + if (exists($inv_index{$word1}) and $tmp_index1{$word}==0) { + $rem_stemming++; + } + $tmp_index1{$word}=1; $word=$word1; + } + $word1=<FD2>; chomp $word1; + if ($word1 =~ /\r$/) { + chop($word1); + } + + if (exists($inv_index{$word})) { print FD3 $word1.$inv_index{$word}, "\n"; } else { $cnt++; $inv_index{$word}=$cnt; print FD3 $word1.$cnt, "\n"; } +} +close FD1; close FD2; close FD3; +unlink("d1.tmp"); unlink("d2.tmp"); + + +$,="\n"; +print FILE_DICT sort keys %inv_index; +open FILE_WORD_IDS, '>word_ids.tmp'; +for $word (sort keys %inv_index) { + print FILE_WORD_IDS $inv_index{$word}, "\n"; +} + +open FILE_MATRIX, '>matrix.tmp'; +open FD3, '<d3.tmp'; +while (<FD3>) { + $word=$_; chomp $word; + if ($word =~ /\r$/) { + chop($word); + } + @values=split(/\s+/, $word); $cnt=$values[$#values]; + for ($i=0;$i<$#values;$i+=2) { + print FILE_MATRIX "$cnt $values[$i] $values[$i+1]\n"; + } +} +close FD3; close FILE_WORD_IDS; +unlink("d3.tmp"); + +open FILE_WPD, '>wpd.tmp'; +print FILE_WPD "$rem_stoplist\n$rem_stemming\n$rem_terms_length\n"; +$,="\n"; print FILE_WPD @words_per_doc; close FILE_WPD; +close FILE_DICT; +close FILE_TITLES; +close FILE_MATRIX; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/tmg_query_perl.pl b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/tmg_query_perl.pl new file mode 100644 index 0000000000000000000000000000000000000000..3b781fe460e468e6a5087840a701e6e2cc813532 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/perl/tmg_query_perl.pl @@ -0,0 +1,265 @@ +#!/usr/bin/perl -w +# tmg_query_perl.pl is a perl implementation of the MATLAB tmg_query function. +# +# Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +use lib $ARGV[0]; +use strict; +use Stemmer; + +my $sp1; +my $sp2; +my $delimiter; +my $line_delimiter; +my $stoplist; +my $use_stoplist; +my @stopwords; +my $word; +my $stemming; +my $remove_num; +my $remove_al; +#my $min_length; +#my $max_length; +my $filename; +my @files; +my %inv_index; +my $doc_id; +my @words_per_doc; +my $file; +my @ar; +my @new_doc; +my $i; +my $cnt; +my $chunk; +my $j; +my $jj; +my @words; +#my $rem_stoplist; +#my $rem_terms_length; +#my $rem_stemming; +my %tmp; +my $token; +my $stemmed_token; +my @docs; +my $doc; +my @keys; +my @values; +my $display_filename; +my $dsp; + +open FILE_DICT, ">dict.tmp"; +open FILE_TITLES, ">titles.tmp"; + +$delimiter=$ARGV[1]; +$line_delimiter=$ARGV[2]; +$stoplist=$ARGV[3]; +$stemming=$ARGV[4]+0; +#$min_length=$ARGV[5]+0; +#$max_length=$ARGV[6]+0; +$filename=$ARGV[5]; +$dsp=$ARGV[6]+0; +$remove_num=$ARGV[7]+0; +$remove_al=$ARGV[8]+0; + +$sp1='ltspcl'; $sp2='gtspcl'; $delimiter=~s/$sp1/</g; $delimiter=~s/$sp2/>/g; +$use_stoplist=1; if ($stoplist eq '-nostoplist') { $use_stoplist=0; } +open FILE_STOPLIST, '<'.$stoplist or $use_stoplist=0; +if ($use_stoplist!=0) { + @stopwords=map {lc($_);} <FILE_STOPLIST>; close FILE_STOPLIST; + for $word (@stopwords) { + chomp $word; if ($word=~ /\r$/) { chop($word); } + } +} +open FF, '<'.$filename; @files=<FF>; close FF; $cnt=0; for $file (@files) { chomp $file; $files[$cnt++]=$file; } +if ($delimiter eq 'none_delimiter' or $delimiter eq 'emptyline') { + $line_delimiter='1'; +} +$line_delimiter=$line_delimiter+0; +if ($delimiter eq 'emptyline') { + $delimiter=''; +} + +%inv_index=(); +$doc_id=0; +@words_per_doc=(); +for $file (@files) { + $display_filename=$file; $display_filename=~s/\\/\//; + if ($dsp==1) { print "=================================================================================\nParsing file $display_filename...\n=================================================================================\n"; } + open FILE, '<'.$file; + if ($line_delimiter==1) { + $delimiter=lc($delimiter); + @ar=map {lc($_);} <FILE>; + unshift @ar, ''; + + @new_doc=(1); + if ($delimiter eq 'none_delimiter') { + for ($i=1;$i<$#ar+1;$i++) { $new_doc[$i]=0; } + $cnt=1; + for $chunk (@ar[1..$#ar]) { + chomp $chunk; + if ($chunk =~ /\r$/) { + chop($chunk); + } + while ($chunk=~m/\s$/) { chop $chunk; } + $chunk =~ s/~|`|!|@|#|\$|%|\^|&|\*|\(|\)|-|_|=|\+|\[|\]|{|}|\\|\||:|;|'|"|<|>|\?|\/|,|\.�|�|�|�/ /g; + $chunk =~ s/^\s+//; + $ar[$cnt++]=$chunk; + } + } else { + $cnt=1; + for $chunk (@ar[1..$#ar]) { + chomp $chunk; + if ($chunk =~ /\r$/) { + chop($chunk); + } + while ($chunk=~m/\s$/) { chop $chunk; } + if ($chunk eq $delimiter) { + $new_doc[$cnt]=1; + if ($new_doc[$cnt-1]==1 or $new_doc[$cnt-1]==-1) { + $new_doc[$cnt]=-1; + } + } else { + $new_doc[$cnt]=0; + } + $chunk =~ s/~|`|!|@|#|\$|%|\^|&|\*|\(|\)|-|_|=|\+|\[|\]|{|}|\\|\||:|;|'|"|<|>|\?|\/|,|\.�|�|�|�/ /g; + $chunk =~ s/^\s+//; + $ar[$cnt++]=$chunk; + } + } + + for ($i=0;$i<$#new_doc;$i++) { + if ($new_doc[$i]==1) { + $doc_id++; $words_per_doc[$doc_id-1]=0; + if ($dsp==1) { print "Parsing query $doc_id...\n"; } + if ($i==0 and $new_doc[1]==-1) { for ($jj=2;$jj<$#new_doc+1;$jj++) { if ($new_doc[$jj]==0) { last; } } } else { $jj=$i+1; } + if (length($ar[$jj])>50) { print FILE_TITLES $file, '.', $doc_id, "\n\t", substr($ar[$jj], 0, -length($ar[$jj])+50), "\n"; } else { print FILE_TITLES $file, '.', $doc_id, "\n\t", $ar[$jj], "\n"; } + #print FILE_TITLES $file, '.', $doc_id, "\n\t", $ar[$jj], "\n"; + for ($j=$i+1;$j<$#new_doc+1;$j++) { + if ($j==$i+1 and $new_doc[$j]==1) { + $doc_id--; + last; + } + if ($new_doc[$j]==-1){ + next; + } + if ($new_doc[$j]==1) { + if ($dsp==1) { print "\tNumber of terms: $words_per_doc[$doc_id-1]...\n"; } + last; + } + @words=split(/\s+/, $ar[$j]); $words_per_doc[$doc_id-1]+=$#words+1; + for $word (@words) { + $inv_index{$word}{$doc_id}+=1; + } + } + } + } + if ($new_doc[$#new_doc]==0) { if ($dsp==1) { print "\tNumber of terms: $words_per_doc[$doc_id-1]...\n"; } } + } + else { + $/=$delimiter; + @ar=map {lc($_);} <FILE>; + for ($i=0;$i<$#ar+1;$i++) { + if (length($ar[$i])>50) { print FILE_TITLES $file, '.', $doc_id, "\n\t", substr($ar[$i], 0, -length($ar[$i])+50), "\n"; } else { print FILE_TITLES $file, '.', $doc_id, "\n\t", $ar[$i], "\n"; } + $chunk=$ar[$i]; + $chunk =~ s/~|`|!|@|#|\$|%|\^|&|\*|\(|\)|-|_|=|\+|\[|\]|{|}|\\|\||:|;|'|"|<|>|\?|\/|,|\.�|�|�|�/ /g; + $chunk =~ s/^\s+//; + $ar[$i]=$chunk; + $doc_id++; $words_per_doc[$doc_id-1]=0; + if ($dsp==1) { print "Parsing query $doc_id...\n"; } + @words=split(/\s+/, $ar[$i]); $words_per_doc[$doc_id-1]+=$#words+1; + if ($#words==0) { + $doc_id--; + next; + } + for $word (@words) { + $inv_index{$word}{$doc_id}+=1; + } + if ($dsp==1) { print "\tNumber of terms: $words_per_doc[$doc_id-1]...\n"; } + } + } + close FILE; +} + +#$rem_stoplist=0; +if ($use_stoplist==1) { + if ($dsp==1) { print "Removing stopwords...\n"; } + for $word (@stopwords) { + if (exists($inv_index{$word})) { delete $inv_index{$word}; } + } +} + +#$rem_terms_length=0; +if ($remove_num==1){if ($dsp==1) { print "=================================================================================\nRemoving numbers...\n"; } } +if ($remove_al==1){if ($dsp==1) { print "=================================================================================\nRemoving alphanumerics...\n"; } } +if ($dsp==1) { print "Normalizing the dictionary...\n=================================================================================\n"; } +for $word (keys %inv_index) { + if ($remove_num==1){ + if ($word =~ m/^\d+$/ ) { + delete $inv_index{$word}; + next; + } + } + if ($remove_al==1){ + if ($word =~ m/\d+/){ + if ($remove_num==1){ + delete $inv_index{$word}; + next; + } + else{ + if($word !~ m/^\d+$/ ){ + delete $inv_index{$word}; + next; + } + } + } + } +# if (length($word)<$min_length or length($word)>$max_length) { +# delete $inv_index{$word}; +# $rem_terms_length++; +# } +} + + +#$rem_stemming=0; +if ($stemming==1) { + if ($dsp==1) { print "Applying stemming...\n=================================================================================\n"; } + %tmp=%inv_index; + %inv_index=(); + for $token (keys %tmp) { + $stemmed_token=Stemmer::stemmer_fun($token, 0); + if (!exists($inv_index{$stemmed_token})) { + $inv_index{$stemmed_token}=$tmp{$token}; + } else { +# $rem_stemming++; + @docs=keys %{$tmp{$token}}; + for $doc (@docs) { + $inv_index{$stemmed_token}{$doc}+=$tmp{$token}{$doc}; + } + } + } +} + +#print "Number of terms = ", scalar keys(%inv_index), "\n"; +#print "Number of documents = ", $doc_id, "\n"; + + + +$,="\n"; +print FILE_DICT sort keys %inv_index; + +open FILE_DICT1, '>dict1.tmp'; +$cnt=0; +for $word (sort keys %inv_index) { + $cnt++; + @keys=keys %{$inv_index{$word}}; + @values=values %{$inv_index{$word}}; + for ($i=0;$i<$#keys+1;$i++) { + print FILE_DICT1 "$cnt $keys[$i] $values[$i]\n"; + } +} +open FILE_WPD, '>wpd.tmp'; +#print FILE_WPD "$rem_stoplist\n$rem_stemming\n$rem_terms_length\n"; +$,="\n"; print FILE_WPD @words_per_doc; close FILE_WPD; +close FILE_DICT; +close FILE_TITLES; +close FILE_DICT1; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/ps_pdf2ascii.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/ps_pdf2ascii.m new file mode 100644 index 0000000000000000000000000000000000000000..8ba11556673dabccb298c20f7e5f8991e175a98a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/ps_pdf2ascii.m @@ -0,0 +1,15 @@ +function result=ps_pdf2ascii(filename,directory) +% PS_PDF2ASCII - converts the input ps or pdf file to ASCII +% RESULT = PS_PDF2ASCII(FILENAME,DIRECTORY) converts the input ps or +% pdf files to ASCII, using ghostscript's utility 'ps2ascii' and moves +% the converted file into directory. +% RESULT returns a success indicator, e.g. -2 if the input +% file does not exist or has a wrong format, -1 if gs is not +% installed or the path isn't set, 0 if 'ps2ascii' didn't +% work properly, and 1 if the conversion was successful. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); + +result=ps_pdf2ascii_p(filename,directory); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/ps_pdf2ascii_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/ps_pdf2ascii_p.p new file mode 100644 index 0000000000000000000000000000000000000000..9fda4be7d7c58fd63a04ecc3596651e0495c3636 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/ps_pdf2ascii_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/lsa.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/lsa.m new file mode 100644 index 0000000000000000000000000000000000000000..610574944251596ccdb3067a33f585c1327166ae --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/lsa.m @@ -0,0 +1,21 @@ +function [sc, doc_inds]=lsa(D, P, q, normalize_docs) +% LSA - Applies the Latent Semantic Analysis Model to a +% document collection +% [SC, DOCS_INDS] = LSA(D, P, Q, NORMALIZE_DOCS) applies +% LSA to the text collection represented by the latent +% semantic factors D, P of the collection's term - document +% matrix, for the query defined by the vector Q [1]. +% NORMALIZE_DOCS defines if the document vectors are to be +% normalized (1) or not (0). SC contains the sorted +% similarity coefficients, while DOC_INDS contains the +% corresponding document indices. +% +% REFERENCES: +% [1] M.Berry and M.Browne, Understanding Search Engines, +% Mathematical Modeling and Text Retrieval, Philadelphia, +% PA: Society for Industrial and Applied Mathematics, 1999. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(4, 4, nargin)); +[sc, doc_inds]=lsa_p(D, P, q, normalize_docs); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/lsa_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/lsa_p.p new file mode 100644 index 0000000000000000000000000000000000000000..23397ab1182e6cdbff879109872882d24b713d28 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/lsa_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/vsm.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/vsm.m new file mode 100644 index 0000000000000000000000000000000000000000..7c4b28cc90ca26d58d8396867252dc4660e16bad --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/vsm.m @@ -0,0 +1,19 @@ +function [sc, doc_inds]=vsm(D, q, normalize_docs) +% VSM - Applies the Vector Space Model to a document collection +% [SC, DOCS_INDS] = VSM(D, Q, NORMALIZE_DOCS) applies the +% Vector Space Model to the text collection represented by +% the term - document matrix D for the query defined by the +% vector Q [1]. NORMALIZE_DOCS defines if the document +% vectors are to be normalized (1) or not (0). SC contains +% the sorted similarity coefficients, while DOC_INDS contains +% the corresponding document indices. +% +% REFERENCES: +% [1] M.Berry and M.Browne, Understanding Search Engines, +% Mathematical Modeling and Text Retrieval, Philadelphia, +% PA: Society for Industrial and Applied Mathematics, 1999. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(3, 3, nargin)); +[sc, doc_inds]=vsm_p(D, q, normalize_docs); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/vsm_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/vsm_p.p new file mode 100644 index 0000000000000000000000000000000000000000..d7d4503b303a0fe168c4a4416b9520f8c3de1234 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval/vsm_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval_gui.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval_gui.fig new file mode 100644 index 0000000000000000000000000000000000000000..38389ef4dd375e0a4a91e8f0c72e1c36cc8cdd3e Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval_gui.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval_gui.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval_gui.m new file mode 100644 index 0000000000000000000000000000000000000000..a5b75876a5f9cda5ae2e5018200fc96b37c7320e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/retrieval_gui.m @@ -0,0 +1,792 @@ +function varargout = retrieval_gui(varargin) +% RETRIEVAL_GUI +% RETRIEVAL_GUI is a graphical user interface for all the retrieval +% functions of the Text to Matrix Generator (TMG) Toolbox. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @retrieval_gui_OpeningFcn, ... + 'gui_OutputFcn', @retrieval_gui_OutputFcn, ... + 'gui_LayoutFcn', [], ... + 'gui_Callback', []); +if nargin && ischar(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + +% --- Executes just before retrieval_gui is made visible. +function retrieval_gui_OpeningFcn(hObject, eventdata, handles, varargin) +% This function has no output args, see OutputFcn. +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +% varargin unrecognized PropertyName/PropertyValue pairs from the +% command line (see VARARGIN) + +% Choose default command line output for retrieval_gui +handles.output = hObject; + +handles.light_gray=[0.8824 0.8824 0.8824]; +handles.gray=[0.9255 0.9137 0.8471]; +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=14.5410; +wdth=15.7572; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +OPTIONS=struct('delimiter', 'none_delimiter', 'line_delimiter', 1, 'stemming', 0, ... + 'local_weight', 't', 'dsp', 0); +handles.OPTIONS=OPTIONS; +handles.gwquery_type='Files'; + +handles.objects=[handles.Query;handles.GW;handles.GWButton;handles.StoredGW;handles.Stoplist;handles.StoplistButton;... + handles.TW;handles.VSMRadio;handles.LSARadio;handles.LSAMethod;handles.nFactors;handles.Similarity;... + handles.NTopRadio;handles.NTop;handles.MostRelRadio;handles.SimCoef]; + +states=zeros(length(handles.objects), 1); +handles=activate_uicontrol(states, handles); +handles.methods={'Singular Value Decomposition';'Principal Component Analysis';'Clustered Latent Semantic Indexing';'Centroid Method';'Semidiscrete Decomposition';'SPQR'}; +handles.k=cell(6, 1); +set(handles.sp_text1, 'Visible', 'off'); set(handles.sp_text2, 'Visible', 'off'); + +handles.ntop_def=20; +handles.thres_def=20; + +% Update handles structure +guidata(hObject, handles); + +% UIWAIT makes retrieval_gui wait for user response (see UIRESUME) +% uiwait(handles.figure1); + + +% --- Outputs from this function are returned to the command line. +function varargout = retrieval_gui_OutputFcn(hObject, eventdata, handles) +% varargout cell array for returning output args (see VARARGOUT); +% hObject handle to figure +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Get default command line output from handles structure +varargout{1} = handles.output; + +% --- Executes during object creation, after setting all properties. +function DatasetMenu_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end +datasets=cell(1, 1); datasets{1, 1}=''; +n_datasets=0; +str=fileparts(mfilename('fullpath')); +dirs=dir(strcat(str, filesep, 'data')); +for i=1:size(dirs, 1), + cur=dirs(i); + if isequal(cur.name, '.') | isequal(cur.name, '..') | ~isdir(strcat(str, filesep, 'data', filesep, cur.name)), continue; end + if exist(strcat(str, filesep, 'data', filesep, cur.name, filesep, 'A.mat')) & exist(strcat(str, filesep, 'data', filesep, cur.name, filesep, 'dictionary.mat')), + n_datasets=n_datasets+1; datasets{n_datasets+1, 1}=strcat(str, filesep, 'data', filesep, cur.name); + end +end +set(hObject, 'String', datasets); +guidata(hObject, handles); + +function DatasetMenu_Callback(hObject, eventdata, handles) +s=get(hObject, 'String'); v=get(hObject, 'Value'); +states=zeros(length(handles.objects), 1); +if ~isempty(s{v}), + states(1)=1; + if get(handles.StoredGW, 'Value')==0, states([2 3])=1; end + states((4:8))=1; + k=cell(6, 1); + act=zeros(6, 1); + ss={'svd';'pca';'clsi';'cm';'sdd';'spqr'}; + str=s{v}; + for i=1:length(ss), + str1=strcat(str, filesep, ss{i}); + if exist(str1), + sss=dir(str1); + for j=1:size(sss, 1), + cur=sss(j); + if isequal(cur, '.') | isequal(cur, '..') | ~isdir(strcat(str1, filesep, cur.name)), continue; end + if i==1, + if exist(strcat(str1, filesep, cur.name, filesep, 'Usvd.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Ssvd.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Vsvd.mat')), + act(1)=1; + kk=str2double(cur.name(3:end)); if isempty(k{1}), k{1}=kk; else, k{1}(end+1, 1)=kk; end + end + end + if i==2, + if exist(strcat(str1, filesep, cur.name, filesep, 'Upca.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Spca.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Vpca.mat')), + act(2)=1; + kk=str2double(cur.name(3:end)); if isempty(k{2}), k{2}=kk; else, k{2}(end+1, 1)=kk; end + end + end + if i==3, + if exist(strcat(str1, filesep, cur.name, filesep, 'Xclsi.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Yclsi.mat')), + act(3)=1; + kk=str2double(cur.name(3:end)); if isempty(k{3}), k{3}=kk; else, k{3}(end+1, 1)=kk; end + end + end + if i==4, + if exist(strcat(str1, filesep, cur.name, filesep, 'Xcm.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Ycm.mat')), + act(4)=1; + kk=str2double(cur.name(3:end)); if isempty(k{4}), k{4}=kk; else, k{4}(end+1, 4)=kk; end + end + end + if i==5, + if exist(strcat(str1, filesep, cur.name, filesep, 'Xsdd.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Dsdd.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Ysdd.mat')), + act(5)=1; + kk=str2double(cur.name(3:end)); if isempty(k{5}), k{5}=kk; else, k{5}(end+1, 1)=kk; end + end + end + if i==6, + if exist(strcat(str1, filesep, cur.name, filesep, 'Qspqr.mat')) & exist(strcat(str1, filesep, cur.name, filesep, 'Rspqr.mat')), + act(6)=1; + kk=str2double(cur.name(3:end)); if isempty(k{6}), k{6}=kk; else, k{6}(end+1, 1)=kk; end + end + end + end + end + end + if ~isempty(find(act)), + set(handles.sp_text1, 'Visible', 'off'); set(handles.sp_text2, 'Visible', 'off'); + states(9)=1; + if get(handles.LSARadio, 'Value')==1, states([10 11])=1; end + set(handles.LSAMethod, 'String', {handles.methods{find(act)}}'); set(handles.LSAMethod, 'Value', 1); + frs=find(act); set(handles.nFactors, 'String', k{frs(1)}); + handles.k=k; + else, + set(handles.VSMRadio, 'Value', 1); set(handles.LSARadio, 'Value', 0); + set(handles.sp_text1, 'Visible', 'on'); set(handles.sp_text2, 'Visible', 'on'); + handles.k=cell(6, 1); + end + states(12)=1; + states([13 15])=1; + if get(handles.NTopRadio, 'Value')==1, states(14)=1; states(16)=0; else, states(14)=0; states(16)=1; end +end +handles=activate_uicontrol(states, handles); +% Update handles structure +guidata(hObject, handles); + +% --- Executes on button press in ContinueButton. +function ContinueButton_Callback(hObject, eventdata, handles) +% hObject handle to ContinueButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +if isempty(get(handles.Query, 'String')), + an=new_sprintf('You didin''t supply a query...'); + msgbox(an, 'Error', 'modal'); + return; +end +str=get(handles.DatasetMenu, 'String'); str=str{get(handles.DatasetMenu, 'Value')}; +load(strcat(str, filesep, 'A.mat')); load(strcat(str, filesep, 'dictionary.mat')); +if get(handles.StoredGW, 'Value'), + if exist(strcat(str, filesep, 'global_weights.mat')), load(strcat(str, filesep, 'global_weights.mat')); end +else, + if isempty(get(handles.GW, 'String')), + global_weights=ones(size(dictionary, 1), 1); + else, + if isequal(handles.gwquery_type, 'Files'), + if ~exist(get(handles.GW, 'String')), + an=new_sprintf('File %s not found...', get(handles.GW, 'String')); + msgbox(an, 'Error', 'modal'); + return; + else, + load(get(handles.GW, 'String')); + global_weights=eval(char(fieldnames(load(get(handles.GW, 'String'))))); + if size(global_weights, 1)~=size(A, 1), + an=new_sprintf('Dictionary size does not match...'); + msgbox(an, 'Error', 'modal'); + return; + end + opts.global_weights=global_weights; + end + else, + global_weights=evalin('base', get(handles.GW, 'String')); + if size(global_weights, 1)~=size(A, 1), + an=new_sprintf('Dictionary size does not match...'); + msgbox(an, 'Error', 'modal'); + return; + end + opts.global_weights=global_weights; + end + end +end +opts.dsp=0; +opts.delimiter='none_delimiter'; opts.line_delimiter=1; +opts.remove_num=0; opts.remove_al=0; opts.parse_subd=0; +opts.local_weight=handles.OPTIONS.local_weight; +if ~isempty(get(handles.Stoplist, 'String')), + if ~exist(get(handles.Stoplist, 'String')), + an=new_sprintf('File %s not found...', get(handles.Stoplist, 'String')); + msgbox(an, 'Error', 'modal'); + return; + else, + opts.stoplist=get(handles.Stoplist, 'String'); + end +end +if exist(strcat(str, filesep, 'update_struct.mat')), + load(strcat(str, filesep, 'update_struct.mat')); + opts.stemming=update_struct.stemming; +end +fname=datestr(now); fname=strrep(fname, ' ', '_'); fname=strrep(fname, ':', '-'); +qry=get(handles.Query, 'String'); +fid=fopen(fname, 'wt'); qry(:, end+1)=' '; for ij=1:size(qry, 1), fprintf(fid, '%s', qry(ij, :)); end; fclose(fid); +filename=strcat(pwd,filesep,fname); +q=tmg_query(filename, dictionary, opts); +if nnz(q)==0, an=new_sprintf('The query is empty...'); msgbox(an, 'Error', 'modal'); return; end +load(strcat(str, filesep, 'A.mat')); +normalize_docs=(get(handles.Similarity, 'Value')==1); +if get(handles.VSMRadio, 'Value'), + [sc, doc_inds]=vsm(A, q, normalize_docs); +else, + s=get(handles.LSAMethod, 'String'); v=get(handles.LSAMethod, 'Value'); k=get(handles.nFactors, 'String'); k=strtrim(k(get(handles.nFactors, 'Value'), :)); + if isequal(s{v}, handles.methods{1}), + str=strcat(str, filesep, 'svd', filesep, 'k_', k); + load(strcat(str, filesep, 'Usvd.mat')); load(strcat(str, filesep, 'Ssvd.mat')); load(strcat(str, filesep, 'Vsvd.mat')); + D=Ssvd*Vsvd'; P=Usvd; + assignin('base', 'Usvd', Usvd); assignin('base', 'Ssvd', Ssvd); assignin('base', 'Vsvd', Vsvd); + end + if isequal(s{v}, handles.methods{2}), + str=strcat(str, filesep, 'pca', filesep, 'k_', k); + load(strcat(str, filesep, 'Upca.mat')); load(strcat(str, filesep, 'Spca.mat')); load(strcat(str, filesep, 'Vpca.mat')); + D=Spca*Vpca'; P=Upca; + assignin('base', 'Upca', Upca); assignin('base', 'Spca', Spca); assignin('base', 'Vpca', Vpca); + end + if isequal(s{v}, handles.methods{3}), + str=strcat(str, filesep, 'clsi', filesep, 'k_', k); + load(strcat(str, filesep, 'Xclsi.mat')); load(strcat(str, filesep, 'Yclsi.mat')); + D=Yclsi; P=Xclsi; + assignin('base', 'Xclsi', Xclsi); assignin('base', 'Yclsi', Yclsi); + end + if isequal(s{v}, handles.methods{4}), + str=strcat(str, filesep, 'cm', filesep, 'k_', k); + load(strcat(str, filesep, 'Xcm.mat')); load(strcat(str, filesep, 'Ycm.mat')); + D=Ycm; P=Xcm; + assignin('base', 'Xcm', Xcm); assignin('base', 'Ycm', Ycm); + end + if isequal(s{v}, handles.methods{5}), + str + str=strcat(str, filesep, 'sdd', filesep, 'k_', k) + load(strcat(str, filesep, 'Xsdd.mat')); load(strcat(str, filesep, 'Dsdd.mat')); load(strcat(str, filesep, 'Ysdd.mat')); + D=Xsdd*diag(Dsdd)*Ysdd'; P=[]; + assignin('base', 'Xsdd', Xsdd); assignin('base', 'Dsdd', Dsdd); assignin('base', 'Ysdd', Ysdd); + end + if isequal(s{v}, handles.methods{6}), + str=strcat(str, filesep, 'spqr', filesep, 'k_', k); + load(strcat(str, filesep, 'Qspqr.mat')); load(strcat(str, filesep, 'Rspqr.mat')); + D=Rspqr; P=Qspqr; + assignin('base', 'Qspqr', Qspqr); assignin('base', 'Rspqr', Rspqr); + end + assignin('base', 'D', D); assignin('base', 'P', P); + [sc, doc_inds]=lsa(D, P, q, normalize_docs); +end +assignin('base', 'A', A); assignin('base', 'q', q); assignin('base', 'sc', sc); assignin('base', 'doc_inds', doc_inds); +str=get(handles.DatasetMenu, 'String'); dataset=str{get(handles.DatasetMenu, 'Value')}; +sc=sc(find(sc>0)); if ~isempty(sc), doc_inds=doc_inds(1:length(sc)); else, doc_inds=[]; end +fid=fopen(fname, 'r'); qry=fgetl(fid); fclose(fid); +delete(fname); +if get(handles.NTopRadio, 'Value') == 1, + ntop=get(handles.NTop, 'String'); + if ~isempty(ntop), + ntop=str2double(ntop); if ceil(ntop)~=ntop || ntop<=0, ntop=handles.ntop_def; end + else, + ntop=handles.ntop_def; + end +else, + thres=get(handles.SimCoef, 'String'); + if ~isempty(thres), + thres=str2double(thres); if thres<0, thres=handles.thres_def; end + else, + thres=handles.thres_def; + end +end +if get(handles.NTopRadio, 'Value') == 1, + if length(doc_inds)>ntop, create_retrieval_response(dataset, doc_inds(1:ntop), sc(1:ntop), qry); + else, create_retrieval_response(dataset, doc_inds, sc, qry); + end +else, + create_retrieval_response(dataset, doc_inds(find(sc>=thres)), sc(find(sc>=thres)), qry); +end + +guidata(hObject, handles); + +% --- Executes on button press in ClearBotton. +function ClearBotton_Callback(hObject, eventdata, handles) +% hObject handle to ClearBotton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +set(handles.DatasetMenu, 'Value', 1); set(handles.Query, 'String', ''); +set(handles.GW, 'String', ''); set(handles.Stoplist, 'String', ''); +set(handles.TW, 'Value', 1); set(handles.LSAMethod, 'String', cell(1, 1)); +set(handles.nFactors, 'String', cell(1, 1)); set(handles.Similarity, 'Value', 1); +set(handles.VSMRadio, 'Value', 1); set(handles.LSARadio, 'Value', 0); +set(handles.StoredGW, 'Value', 1); +states=zeros(size(handles.objects, 1), 1); +handles=activate_uicontrol(states, handles); + +% --- Executes on button press in ExitButton. +function ExitButton_Callback(hObject, eventdata, handles) +% hObject handle to ExitButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +delete(handles.figure1); + + +function Query_Callback(hObject, eventdata, handles) +% hObject handle to Query (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of Query as text +% str2double(get(hObject,'String')) returns contents of Query as a double + + +% --- Executes during object creation, after setting all properties. +function Query_CreateFcn(hObject, eventdata, handles) +% hObject handle to Query (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in VSMRadio. +function VSMRadio_Callback(hObject, eventdata, handles) +% hObject handle to VSMRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of VSMRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.LSARadio, 'Value', 0); +end +set(handles.LSAMethod, 'Enable', 'off'); set(handles.nFactors, 'Enable', 'off'); + +% --- Executes on button press in LSARadio. +function LSARadio_Callback(hObject, eventdata, handles) +% hObject handle to LSARadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of LSARadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.VSMRadio, 'Value', 0); +end + +states=ones(length(handles.objects), 1); +if get(handles.NTopRadio, 'Value') == 1, + states(16) = 0; +else, + states(14) = 0; +end +handles=activate_uicontrol(states, handles); +if get(handles.StoredGW, 'Value') == 1, + set(handles.GW, 'Enable', 'off'); + set(handles.GWButton, 'Enable', 'off'); + set(handles.GW, 'BackgroundColor', handles.light_gray); +else, + set(handles.GW, 'Enable', 'on'); + set(handles.GWButton, 'Enable', 'on'); + set(handles.GW, 'BackgroundColor', 'white'); +end + +% --- Executes on selection change in LSAMethod. +function LSAMethod_Callback(hObject, eventdata, handles) +% hObject handle to LSAMethod (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns LSAMethod contents as cell array +% contents{get(hObject,'Value')} returns selected item from LSAMethod +s=get(hObject, 'String'); s=s{get(hObject, 'Value')}; +switch s, + case 'Singular Value Decomposition', + set(handles.nFactors, 'String', num2str(handles.k{1})); + case 'Principal Component Analysis', + set(handles.nFactors, 'String', num2str(handles.k{2})); + case 'Clustered Latent Semantic Indexing', + set(handles.nFactors, 'String', num2str(handles.k{3})); + case 'Centroid Method', + set(handles.nFactors, 'String', num2str(handles.k{4})); + case 'Semidiscrete Decomposition', + set(handles.nFactors, 'String', num2str(handles.k{5})); + case 'SPQR', + set(handles.nFactors, 'String', num2str(handles.k{6})); +end +% Update handles structure +guidata(hObject, handles); + + +% --- Executes during object creation, after setting all properties. +function LSAMethod_CreateFcn(hObject, eventdata, handles) +% hObject handle to LSAMethod (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on selection change in nFactors. +function nFactors_Callback(hObject, eventdata, handles) +% hObject handle to nFactors (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns nFactors contents as cell array +% contents{get(hObject,'Value')} returns selected item from nFactors + + +% --- Executes during object creation, after setting all properties. +function nFactors_CreateFcn(hObject, eventdata, handles) +% hObject handle to nFactors (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function GW_Callback(hObject, eventdata, handles) +% hObject handle to GW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of GW as text +% str2double(get(hObject,'String')) returns contents of GW as a double +s=get(hObject, 'String'); +handles.gwquery_type='Files'; +guidata(hObject, handles); +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'global_weights'), + OPT=rmfield(OPT, 'global_weights'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.gwquery_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + OPT=handles.OPTIONS;if isfield(OPT, 'global_weights'), OPT=rmfield(OPT, 'global_weights'); end + handles.OPTIONS=OPT; + set(hObject, 'String', '');guidata(hObject, handles); + return; + end +end + +OPT.global_weights=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function GW_CreateFcn(hObject, eventdata, handles) +% hObject handle to GW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in GWButton. +function GWButton_Callback(hObject, eventdata, handles) +% hObject handle to GWButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +[s, handles.gwquery_type]=open_file(2); +guidata(hObject, handles); +set(handles.GW, 'String', s); + +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'global_weights'), + OPT=rmfield(OPT, 'global_weights'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.gwquery_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + OPT=handles.OPTIONS;if isfield(OPT, 'global_weights'), OPT=rmfield(OPT, 'global_weights'); end + handles.OPTIONS=OPT; + set(handles.GW, 'String', '');guidata(hObject, handles); + return; + end +end + +OPT.global_weights=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes on selection change in TW. +function TW_Callback(hObject, eventdata, handles) +% hObject handle to TW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns TW contents as cell array +% contents{get(hObject,'Value')} returns selected item from TW +OPT=handles.OPTIONS; +ind=get(hObject, 'Value'); +switch ind, + case 1, + OPT.local_weight='t'; + case 2, + OPT.local_weight='b'; + case 3, + OPT.local_weight='l'; + case 4, + OPT.local_weight='a'; + case 5, + OPT.local_weight='n'; +end +handles.OPTIONS=OPT; +handles.gwquery_type='Files'; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function TW_CreateFcn(hObject, eventdata, handles) +% hObject handle to TW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function Stoplist_Callback(hObject, eventdata, handles) +% hObject handle to Stoplist (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of Stoplist as text +% str2double(get(hObject,'String')) returns contents of Stoplist as a double +s=get(hObject,'String'); +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'stoplist'), + OPT=rmfield(OPT, 'stoplist'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end + +OPT.stoplist=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Stoplist_CreateFcn(hObject, eventdata, handles) +% hObject handle to Stoplist (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in StoplistButton. +function StoplistButton_Callback(hObject, eventdata, handles) +% hObject handle to StoplistButton (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +s=open_file(1); +set(handles.Stoplist, 'String', s); + +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'stoplist'), + OPT=rmfield(OPT, 'stoplist'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end + +OPT.stoplist=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + + +% --- Executes on selection change in Similarity. +function Similarity_Callback(hObject, eventdata, handles) +% hObject handle to Similarity (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: contents = get(hObject,'String') returns Similarity contents as cell array +% contents{get(hObject,'Value')} returns selected item from Similarity + + +% --- Executes during object creation, after setting all properties. +function Similarity_CreateFcn(hObject, eventdata, handles) +% hObject handle to Similarity (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: popupmenu controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + +% --- Executes on button press in StoredGW. +function StoredGW_Callback(hObject, eventdata, handles) +% hObject handle to StoredGW (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of StoredGW +s=get(hObject, 'Value'); +if s==1, + set(handles.GW, 'BackgroundColor', handles.light_gray); + set(handles.GW, 'Enable', 'off'); set(handles.GWButton, 'Enable', 'off'); +else, + set(handles.GW, 'BackgroundColor', 'white'); + set(handles.GW, 'Enable', 'on'); set(handles.GWButton, 'Enable', 'on'); +end +guidata(hObject, handles); + +%-------------------------------------------------------------------------- +%set Active and BackgroundColor field of each uicontrol item depending on +%the Radio Button that is pressed (called by the corresponding callback) +function handles=activate_uicontrol(states, handles) +sz=size(handles.objects, 1); +for i=1:sz, + if states(i)==1, tmp='on'; elseif states(i)==0, tmp='off'; else, tmp='inactive'; end + set(handles.objects(i), 'Enable', tmp); + if states(i)~=1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', handles.light_gray);continue; + end + if states(i)==1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', 'white'); + end +end + + +% --- Executes on button press in NTopRadio. +function NTopRadio_Callback(hObject, eventdata, handles) +% hObject handle to NTopRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of NTopRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.MostRelRadio, 'Value', 0); +end +set(handles.NTop, 'Enable', 'on'); +set(handles.SimCoef, 'Enable', 'off'); +set(handles.NTop, 'BackgroundColor', 'white'); +set(handles.SimCoef, 'BackgroundColor', handles.light_gray); + +% --- Executes on button press in MostRelRadio. +function MostRelRadio_Callback(hObject, eventdata, handles) +% hObject handle to MostRelRadio (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hint: get(hObject,'Value') returns toggle state of MostRelRadio +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.NTopRadio, 'Value', 0); +end +set(handles.NTop, 'Enable', 'off'); +set(handles.SimCoef, 'Enable', 'on'); +set(handles.SimCoef, 'BackgroundColor', 'white'); +set(handles.NTop, 'BackgroundColor', handles.light_gray); + + +function NTop_Callback(hObject, eventdata, handles) +% hObject handle to NTop (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of NTop as text +% str2double(get(hObject,'String')) returns contents of NTop as a double + + +% --- Executes during object creation, after setting all properties. +function NTop_CreateFcn(hObject, eventdata, handles) +% hObject handle to NTop (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + + +function SimCoef_Callback(hObject, eventdata, handles) +% hObject handle to SimCoef (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) + +% Hints: get(hObject,'String') returns contents of SimCoef as text +% str2double(get(hObject,'String')) returns contents of SimCoef as a double + + +% --- Executes during object creation, after setting all properties. +function SimCoef_CreateFcn(hObject, eventdata, handles) +% hObject handle to SimCoef (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles empty - handles not created until after all CreateFcns called + +% Hint: edit controls usually have a white background on Windows. +% See ISPC and COMPUTER. +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) + set(hObject,'BackgroundColor','white'); +end + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/sample_documents/sample1 b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/sample_documents/sample1 new file mode 100644 index 0000000000000000000000000000000000000000..75389589c112ccb29a49800d77c3967921b8d1d7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/sample_documents/sample1 @@ -0,0 +1,145 @@ +Matrices, Vector Spaces, and Information Retrieval - Michael W. Berry, Zlatko Drmac, Elizabeth R. Jessup +The evolution of digital libraries and the Internet has dramatically transformed the pro-cessing, storage, +and retrieval of information. Efforts to digitize text, images, video, and audio now consume a substantial +portion of both academic and industrial activity. Evenwhen there is no shortage of textual materials on a +particular topic, procedures for indexing or extracting the knowledge or conceptual information contained in +them can belacking. Recently developed information retrieval technologies are based on the concept of a vector +space. Data are modeled as a matrix, and a user's query of the database isrepresented as a vector. Relevant +documents in the database are then identified via simple vector operations. Orthogonal factorizations of the +matrix provide mechanisms for han-dling uncertainty in the database itself. The purpose of this paper is to +show how such fundamental mathematical concepts from linear algebra can be used to manage and indexlarge text +collections. + +Principal Direction Divisive Partitioning - Daniel Boley +We propose a new algorithm capable of partitioning a set of documents or other samples based on an embedding in a +high dimensional Euclidean space (i.e. in which every document is a vector of real numbers). The method is unusual +in that it is divisive, as opposed to agglomerative, and operates by repeatedly splitting clusters into smaller +clusters. The splits are not based on any distance or similarity measure. The documents are assembled in to a matrix +which is very sparse. It is this sparsity that permits the algorithm to be very efficient. The performance of the +method is illustrated with a set of text documents obtained from the World Wide Web. Some possible extensions are +proposed for further investigation. + +Numerical Progress in Eigenvalue Computation in the 20th - Gene H. Golub and Henk A. van der Vorst +This paper sketches the main research developments in the area of computational methods +for eigenvalue problems during the 20th century. The earliest of such methods dates back +to work of Jacobi in the middle of the nineteenth century. Since computing eigenvalues +and vectors is essentially more complicated than solving linear systems, it is not +surprising that highly significant developments in this area started with the introduction +of electronic computers around 1950. In the early decades of this century, however, +important theoretical developments had been made from which computational techniques could +grow. Research in this area of numerical linear algebra is very active, since there is a +heavy demand for solving complicated problems associated with stability and perturbation +analysis for practical applications. For standard problems, powerful tools are available, +but there still remain many open problems. It is the intention of this contribution to +sketch the main developments of this century, especially as they relate to one another, +and to give an impression of the state of the art at the turn of our century. + +Dimension reduction based on centroids and least squares for efficient processing of text data - M. Jeon, H. Park, and J.B. Rosen +Dimension reduction in today's vector space based information retrieval system is essentialfor improving computational +efficiency in handling massive data. In our previous work we proposed a mathematical framework for lower dimensional +representations of text datain vector space based information retrieval, and a couple of dimension reduction method +using minimization and matrix rank reduction formula. One of our proposed methods isCentroidQR method which utilizes +orthogonal transformation on centroids, and the test results showed that its classification results were exactly +the same as those of classificationwith full dimension when a certain classification algorithm is applied. In this +paper we discuss in detail the CentroidQR, and prove mathematically its classification propertieswith two different +similarity measures of L2 and cosine. + +Limited-Memory Matrix Methods with Applications - Tamara Gibson Kolda +The focus of this dissertation is on matrix decompositions that use a limited amount of computer memory, +thereby allowing problems with a very large number of variables to be solved. Specifically, we will focus +on two applications areas: optimization and information retrieval. We introduce a general algebraic form for +the matrix update in limited-memory quasiNewton methods. Many well-known methods such as limited-memory Broyden +Family methods satisfy the general form. We are able to prove several results about methods which satisfy the +general form. In particular, we show that the only limited-memory Broyden Family method (using exact line searches) +that is guaranteed to terminate within n iterations on an n-dimensional strictly convex quadratic is the +limited-memory BFGS method. Furthermore, we are able to introduce several new variations on the limited-memory +BFGS method that retain the quadratic termination property. We also have a new result that shows that full-memory +Broyden Family methods (using exact line searches) that skip p updates to the quasi-Newton matrix will terminate +in no more than n + p steps on an n-dimensional strictly convex quadratic. We propose several new variations on the +limited-memory BFGS method and test these on standard test problems. We also introduce and test a new method for a +process known as Latent Semantic Indexing (LSI) for information retrieval. The new method replaces the singular +value matrix decomposition (SVD) at the heart of LSI with a semi-discrete matrix decomposition (SDD). We show +several convergence results for the SDD and compare some strategies for computing it on general matrices. We also +compare the SVD-based LSI to the SDD-based LSI and show that the SDD-based method has a faster query computation +time and requires significantly less storage. We also propose and test several SDD-updating strategies for adding +new documents to the collection. + +Lanczos bidiagonalization with partial reorthogonalization - Rasmus Munk Larsen +A partial reorthogonalization procedure (BPRO) for maintaining semi-orthogonality among the left and right Lanczos +vectors in the Lanczos bidiagonalization (LBD) is presented. The resulting algorithm is mathematically equivalent +to the symmetric Lanczos algorithm with partial reorthogonalization (PRO) developed by Simon, but works directly +on the Lanczos bidiagonalization of A. For computing the singular values and vectors of a large sparse matrix with +high accuracy, the BPRO algorithm uses only half the amount of storage and a factor of 3-4 less work compared to +methods based on PRO applied to an equivalent symmetric system. Like PRO, the algorithm presented here is based on +simple recurrences, which enable it to monitor the loss of orthogonality among the Lanczos vectors directly without +forming inner products. These recurrences are used to develop a Lanczos bidiagonalization algorithm with partial +reorthogonalization, which has been implemented in a MATLAB package for sparse SVD and eigenvalue problems called +PROPACK. Numerical experiments with the routines from PROPACK are conducted using a test problem from inverse +helioseismology to illustrate the properties of the method. In addition, a number of test matrices from the +Harwell-Boeing collection are used to compare the accuracy and efficiency of the MATLAB implementations of BPRO +and PRO with the svds routine in MATLAB 5.1, which uses an implicitly restarted Lanczos algorithm. + +k-Plane Clustering - P.S. BRADLEY and O.L. MANGASARIAN +A finite new algorithm is proposed for clustering m given points in n-dimensional real space into +k clusters by generating k planes that constitute a local solution to the nonconvex problem of +minimizing the sum of squares of the 2-norm distances between each point and a nearest plane. The +key to the algorithm lies in a formulation that generates a plane in n-dimensional space that +minimizes the sum of the squares of the 2-norm distances to each of m1 given points in the space.The +plane is generated by an eigenvector corresponding to a smallest eigenvalue of an n * n simple matrix +derived from the m1 points. The algorithm was tested on the publicly available Wisconsin Breast +Prognosis Cancer database to generate well separated patient survival curves. In contrast, the k-mean +algorithm did not generate such well-separated survival curves. + +Approximate Solutions and Eigenvalue Bounds from Krylov Subspaces - Chris C. Paige and Beresford N. Parlett and Henk A. Van der Vorst +Approximations to the solution of a large sparse symmetric system of equations are +considered.The conjugate gradient and minimum residual approximations are studied without +reference to their computation. Several different bases for the associated Krylov subspace +are used, including the usual Lanczos basis. The zeros of the iteration polynomial for the +minimum residual approximation (harmonic Ritz values) are characterized in several ways and, +in addition, attractive convergence properties are established. The connection of these +harmonic Ritz values to Lehmann's optimal intervals for eigenvalues of the original matrix +appears to be new. + +An Iterative Method for Nonsymmetric Systems with Multiple Right-Hand Sides - V. Simonciniy and E. Gallopoulos +We propose a method for the solution of linear systems AX = B where A is a large, possibly +sparse, nonsymmetric matrix of order n, and B is an arbitrary rectangular matrix of order n +s with s of moderate size. The method uses a single Krylov subspace per step as a generator +of approximations, a projection process, and a Richardson acceleration technique. It thus +combines the advantages of recent hybrid methods with those for solving symmetric systems with +multiple right-hand sides. Numerical experiments indicate that in several cases the method has +better practical performance and significantly lower memory requirements than block versions +of nonsymmetric solvers and other proposed methods for the solution of systems with multiple +righthand sides. + +IMPLICITLY RESTARTED ARNOLDI/LANCZOS METHODS FOR LARGE SCALE EIGENVALUE CALCULATIONS - D. C. Sorensen +This report provides an introductory overview of the numerical solution of large scale algebraic +eigenvalue problems. The main focus is on a class of methods called Krylov subspace projection +methods. The Lanczos method is the premier member of this class and the Arnoldi method is a +generalization to the nonsymmetric case. A recently developed and very promising variant of the +Arnoldi/Lanczos scheme called the Implicitly Restarted Arnoldi Method is presented here in detail. +This method is highlighted because of its suitability as a basis for software development. It may +be viewed as a truncated form of the implicitly shifted QR-algorithm that is appropriate for very +large problems. Based on this technique, a public domain software package called ARPACK has been +developed in Fortran 77 for finding a few eigenvalues and eigenvectors of large scale symmetric, +nonsymmetric, standard or generalized problems. This package has performed well on workstations, +parallel-vector supercomputers, distributed memory parallel systems and clusters of workstations. +The important features of this package are presented along with a discussion some applications +and performance indicators. + +PDDP(l): Towards a Flexible Principal Direction Divisive Partitioning Clustering Algorithm - D. Zeimpekis and E. Gallopoulos +In this "work-in-progress" we consider the problem ofclustering large document collections into clusters +in the context of the vector space model. We consider the Principal Direction Divisive Partitioning (PDDP) +algorithm andevaluate its performance relative to k-means type algorithms. We introduce and outline +PDDP(l), a generalizationof PDDP and explore its effectiveness showing by means of numerical experiments +on standard datasets that it frequently improves the overall performance of PDDP andthat it could provide +an interesting alternative to LSI. + +STRUCTURE AND PERTURBATION ANALYSIS OF TRUNCATED SVD FOR COLUMN-PARTITIONED MATRICES - ZHENYUE ZHANG AND HONGYUAN ZHA +In this paper we study truncated SVD for column-partitioned matrices. In particular, +we analyze the relation between the truncated SVD of a matrix and the truncated SVDs +of its submatrices. We give necessary and sufficient conditions under which truncated +SVD of a matrix can be constructed from those of its submatrices. We then present +perturbation analysis to show that an approximate truncated SVD can still be computed +even if the given necessary and sufficient conditions are only approximately satisfied. +We also apply our general results to a class of matrices with the so-called +low-rank-plus-shift structure. \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/sample_documents/sample_query1 b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/sample_documents/sample_query1 new file mode 100644 index 0000000000000000000000000000000000000000..ff3898ad618ca317f9abc90a8a0539000ebf0f08 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/sample_documents/sample_query1 @@ -0,0 +1,3 @@ +linear algebra;decomposition;parallel algorithm + +information retrieval;clustering;term-document matrix \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/stemmer.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/stemmer.m new file mode 100644 index 0000000000000000000000000000000000000000..a9bd72665b8b3d9a31b348ab8c5a7c88e4eeded4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/stemmer.m @@ -0,0 +1,14 @@ +function s=stemmer(token, dsp) +% STEMMER - applies the Porter's Stemming algorithm [1] +% S = STEMMER(TOKEN, DSP) returns in S the stemmed word of +% TOKEN. DSP indicates if the function displays the result +% of each stem (1). +% +% REFERENCES: +% [1] M.F.Porter, An algorithm for suffix stripping, Program, +% 14(3): 130-137, 1980. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +s=stemmer_p(token, dsp); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/stemmer_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/stemmer_p.p new file mode 100644 index 0000000000000000000000000000000000000000..405b200cbd875a73dc9763b848e44c1957229fb6 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/stemmer_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/strip_html.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/strip_html.m new file mode 100644 index 0000000000000000000000000000000000000000..841de00f05d0f6a85a828ff08d1632a4ec9af77f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/strip_html.m @@ -0,0 +1,10 @@ +function varargout=strip_html(filename) +% STRIP_HTML - removes html entities from an html file +% S = STRIP_HTML(FILENAME) parses the file FILENAME and removes +% the html entities, while the result is stored in S as a +% cell array and written in file "FILENAME.TXT". +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +if nargout==0, strip_html_p(filename); else, s=strip_html_p(filename); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/strip_html_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/strip_html_p.p new file mode 100644 index 0000000000000000000000000000000000000000..0336a62d7c1a50621f9944212adfe02e8acbd28e Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/strip_html_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_downdate.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_downdate.m new file mode 100644 index 0000000000000000000000000000000000000000..df63172ff2476d6712e5a00e198d77d61d6cf1f9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_downdate.m @@ -0,0 +1,60 @@ +function varargout=tdm_downdate(varargin) +% TDM_DOWNDATE - renews a text collection by downdating the +% correspoding term-document matrix +% A = TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns the new +% term - document matrix of the downdated collection. +% UPDATE_STRUCT defines the update structure returned by TMG, +% while REMOVED_DOCS defines the indices of the documents that +% is to be be removed. +% [A, DICTIONARY] = TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) +% returns also the dictionary for the updated collection, while +% [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZED_FACTORS] +% = TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns the +% vectors of global weights for the dictionary and the +% normalization factor for each document in case such a factor +% is used. If normalization is not used TDM_DOWNDATE returns a +% vector of all ones. [A, DICTIONARY, GLOBAL_WEIGHTS, +% NORMALIZATION_FACTORS, WORDS_PER_DOC] = +% TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns statistics +% for each document, i.e. the number of terms for each document. +% [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, +% WORDS_PER_DOC, TITLES, FILES] = TDM_DOWNDATE(UPDATE_STRUCT, +% REMOVED_DOCS) returns in FILES the filenames containing the +% collection's documents and a cell array (TITLES) that contains +% a declaratory title for each document, as well as the document's +% first line. +% Finally [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, +% WORDS_PER_DOC, TITLES, FILES, UPDATE_STRUCT] = +% TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS) returns the update +% structure that keeps the essential information for the +% collection' s update (or downdate). +% TDM_DOWNDATE(UPDATE_STRUCT, REMOVED_DOCS, OPTIONS) defines +% optional parameters: +% - OPTIONS.dsp: Displays results (default 1) or not (0) +% to the command window. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +%================================================================== +%check input and set parameters +%================================================================== +error(nargchk(2, 3, nargin)); +if nargin==2, + if nargout==1, varargout{1}=tdm_downdate_p(varargin{1}, varargin{2}); end + if nargout==2, [varargout{1}, varargout{2}]=tdm_downdate_p(varargin{1}, varargin{2}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=tdm_downdate_p(varargin{1}, varargin{2}); end + if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=tdm_downdate_p(varargin{1}, varargin{2}); end + if nargout==5, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}]=tdm_downdate_p(varargin{1}, varargin{2}); end + if nargout==6, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}]=tdm_downdate_p(varargin{1}, varargin{2}); end + if nargout==7, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}]=tdm_downdate_p(varargin{1}, varargin{2}); end + if nargout==8, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}, varargout{8}]=tdm_downdate_p(varargin{1}, varargin{2}); end +else, + if nargout==1, varargout{1}=tdm_downdate_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==2, [varargout{1}, varargout{2}]=tdm_downdate_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=tdm_downdate_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=tdm_downdate_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==5, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}]=tdm_downdate_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==6, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}]=tdm_downdate_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==7, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}]=tdm_downdate_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==8, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}, varargout{8}]=tdm_downdate_p(varargin{1}, varargin{2}, varargin{3}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_downdate_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_downdate_p.p new file mode 100644 index 0000000000000000000000000000000000000000..bb1dc1b2a32e15b0917438391d7543d61381af40 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_downdate_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_update.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_update.m new file mode 100644 index 0000000000000000000000000000000000000000..6e405ea90246c4303015ca586f3bffc1f52d0d2a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_update.m @@ -0,0 +1,82 @@ +function varargout=tdm_update(varargin) +% TDM_UPDATE renews a text collection by updating the +% correspoding term-document matrix. +% A = TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns the new +% term - document matrix of the updated collection. FILENAME +% defines the file (or files in case a directory is supplied) +% containing the new documents, while UPDATE_STRUCT defines +% the update structure returned by TMG. In case FILENAME +% variable is empty, the collection is simply updated using +% the options defined by UPDATE_STRUCT (for example, use +% another term-weighting scheme). +% [A, DICTIONARY] = TDM_UPDATE(FILENAME, UPDATE_STRUCT) +% returns also the dictionary for the updated collection, +% while [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZED_FACTORS] +% = TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns the vectors +% of global weights for the dictionary and the normalization +% factor for each document in case such a factor is used. +% If normalization is not used TDM_UPDATE returns a vector +% of all ones. +% [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, +% WORDS_PER_DOC] = TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns +% statistics for each document, i.e. the number of terms for +% each document. +% [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, +% WORDS_PER_DOC, TITLES, FILES] = TDM_UPDATE(FILENAME, +% UPDATE_STRUCT) returns in FILES the filenames contained in +% directory (or file) FILENAME and a cell array (TITLES) that +% containes a declaratory title for each document, as well as +% the document's first line. +% Finally [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, +% WORDS_PER_DOC, TITLES, FILES, UPDATE_STRUCT] = +% TDM_UPDATE(FILENAME, UPDATE_STRUCT) returns the update +% structure that keeps the essential information for the +% collection' s update (or downdate). +% TDM_UPDATE(FILENAME, UPDATE_STRUCT, OPTIONS) defines optional +% parameters: +% - OPTIONS.delimiter: The delimiter between documents within +% the same file. Possible values are 'emptyline' (default), +% 'none_delimiter' (treats each file as a single document) +% or any other string. +% - OPTIONS.line_delimiter: Defines if the delimiter takes a +% whole line of text (default, 1) or not. +% - OPTIONS.update_step: The step used for the incremental +% built of the inverted index (default 10,000). +% - OPTIONS.dsp: Displays results (default 1) or not (0) to +% the command window. +% - OPTIONS.remove_num: Indicates if we remove the numbers from the +% dictionary (value 1) or not (value 0- default). +% - OPTIONS.remove_al: Indicates if we remove the alphanumerics from +% the dictionary (value 1) or not (value 0- default). +% - OPTIONS.parse_subd: Indicates if we parse all the subdirectories +% without be questioned (value 1), or we are asked which +% subdirectories to parse (value 0-default). This option is +% recommended for large collections with many subdirectories +% so that they can be run in batch mode. Setting this options we +% are avoiding questions during the parsing. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +%================================================================== +%check input and set parameters +%================================================================== +error(nargchk(2, 3, nargin)); +if nargin==2, + if nargout==1, varargout{1}=tdm_update_p(varargin{1}, varargin{2}); end + if nargout==2, [varargout{1}, varargout{2}]=tdm_update_p(varargin{1}, varargin{2}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=tdm_update_p(varargin{1}, varargin{2}); end + if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=tdm_update_p(varargin{1}, varargin{2}); end + if nargout==5, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}]=tdm_update_p(varargin{1}, varargin{2}); end + if nargout==6, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}]=tdm_update_p(varargin{1}, varargin{2}); end + if nargout==7, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}]=tdm_update_p(varargin{1}, varargin{2}); end + if nargout==8, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}, varargout{8}]=tdm_update_p(varargin{1}, varargin{2}); end +else, + if nargout==1, varargout{1}=tdm_update_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==2, [varargout{1}, varargout{2}]=tdm_update_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=tdm_update_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=tdm_update_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==5, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}]=tdm_update_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==6, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}]=tdm_update_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==7, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}]=tdm_update_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==8, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}, varargout{8}]=tdm_update_p(varargin{1}, varargin{2}, varargin{3}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_update_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_update_p.p new file mode 100644 index 0000000000000000000000000000000000000000..73d78fceef9a919f3d5004d885cd461c672a9b56 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tdm_update_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg.m new file mode 100644 index 0000000000000000000000000000000000000000..2e9381547e403000ec64316b6c9d7f8d8f1af2c9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg.m @@ -0,0 +1,127 @@ +function varargout=tmg(varargin) +% TMG - Text to Matrix Generator + % TMG parses a text collection and generates the term - + % document matrix. + % A = TMG(FILENAME) returns the term - document matrix, + % that corresponds to the text collection contained in + % files of directory (or file) FILENAME. + % Each document must be separeted by a blank line (or + % another delimiter that is defined by OPTIONS argument) + % in each file. + % [A, DICTIONARY] = TMG(FILENAME) returns also the + % dictionary for the collection, while [A, DICTIONARY, + % GLOBAL_WEIGHTS, NORMALIZED_FACTORS] = TMG(FILENAME) + % returns the vectors of global weights for the dictionary + % and the normalization factor for each document in case + % such a factor is used. If normalization is not used TMG + % returns a vector of all ones. + % [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + % WORDS_PER_DOC] = TMG(FILENAME) returns statistics for + % each document, i.e. the number of terms for each document. + % [A, DICTIONARY, GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, + % WORDS_PER_DOC, TITLES, FILES] = TMG(FILENAME) returns in + % FILES the filenames contained in directory (or file) + % FILENAME and a cell array (TITLES) that containes a + % declaratory title for each document, as well as the + % document's first line. Finally [A, DICTIONARY, + % GLOBAL_WEIGHTS, NORMALIZATION_FACTORS, WORDS_PER_DOC, + % TITLES, FILES, UPDATE_STRUCT] = TMG(FILENAME) returns a + % structure that keeps the essential information for the + % collection' s update (or downdate). + % + % TMG(FILENAME, OPTIONS) defines optional parameters: + % - OPTIONS.use_mysql: Indicates if results are to be + % stored in MySQL. + % - OPTIONS.db_name: The name of the directory where + % the results are to be saved. + % - OPTIONS.delimiter: The delimiter between documents + % within the same file. Possible values are 'emptyline' + % (default), 'none_delimiter' (treats each file as a + % single document) or any other string. + % - OPTIONS.line_delimiter: Defines if the delimiter + % takes a whole line of text (default, 1) or not. + % - OPTIONS.stoplist: The filename for the stoplist, + % i.e. a list of common words that we don't use for + % the indexing (default no stoplist used). + % - OPTIONS.stemming: Indicates if the stemming algorithm + % is used (1) or not (0 - default). + % - OPTIONS.update_step: The step used for the incremental + % built of the inverted index (default 10,000). + % - OPTIONS.min_length: The minimum length for a term + % (default 3). + % - OPTIONS.max_length: The maximum length for a term + % (default 30). + % - OPTIONS.min_local_freq: The minimum local frequency for + % a term (default 1). + % - OPTIONS.max_local_freq: The maximum local frequency for + % a term (default inf). + % - OPTIONS.min_global_freq: The minimum global frequency + % for a term (default 1). + % - OPTIONS.max_global_freq: The maximum global frequency + % for a term (default inf). + % - OPTIONS.local_weight: The local term weighting function + % (default 't'). Possible values (see [1, 2]): + % 't': Term Frequency + % 'b': Binary + % 'l': Logarithmic + % 'a': Alternate Log + % 'n': Augmented Normalized Term Frequency + % - OPTIONS.global_weight: The global term weighting function + % (default 'x'). Possible values (see [1, 2]): + % 'x': None + % 'e': Entropy + % 'f': Inverse Document Frequency (IDF) + % 'g': GfIdf + % 'n': Normal + % 'p': Probabilistic Inverse + % - OPTIONS.normalization: Indicates if we normalize the + % document vectors (default 'x'). Possible values: + % 'x': None + % 'c': Cosine + % - OPTIONS.dsp: Displays results (default 1) or not (0) to + % the command window. + % - OPTIONS.remove_num: Indicates if we remove the numbers from the + % dictionary (value 1) or not (value 0- default). + % - OPTIONS.remove_al: Indicates if we remove the alphanumerics from + % the dictionary (value 1) or not (value 0-default). + % - OPTIONS.parse_subd: Indicates if we parse all the subdirectories + % without be questioned (value 1), or we are asked which + % subdirectories to parse (value 0-default). This option is + % recommended for large collections with many subdirectories + % so that they can be run in batch mode. Setting this options we + % are avoiding questions during the parsing. + % + % REFERENCES: + % [1] M.Berry and M.Browne, Understanding Search Engines, Mathematical + % Modeling and Text Retrieval, Philadelphia, PA: Society for Industrial + % and Applied Mathematics, 1999. + % [2] T.Kolda, Limited-Memory Matrix Methods with Applications, + % Tech.Report CS-TR-3806, 1997. + % + % Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +%================================================================== +%check input and set parameters +%================================================================== +TMG_current_directory = pwd(); +error(nargchk(1, 2, nargin)); +if nargin==1, + if nargout==1, varargout{1}=tmg_p(varargin{1}); end + if nargout==2, [varargout{1}, varargout{2}]=tmg_p(varargin{1}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=tmg_p(varargin{1}); end + if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=tmg_p(varargin{1}); end + if nargout==5, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}]=tmg_p(varargin{1}); end + if nargout==6, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}]=tmg_p(varargin{1}); end + if nargout==7, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}]=tmg_p(varargin{1}); end + if nargout==8, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}, varargout{8}]=tmg_p(varargin{1}); end +else, + if nargout==1, varargout{1}=tmg_p(varargin{1}, varargin{2}); end + if nargout==2, [varargout{1}, varargout{2}]=tmg_p(varargin{1}, varargin{2}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=tmg_p(varargin{1}, varargin{2}); end + if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=tmg_p(varargin{1}, varargin{2}); end + if nargout==5, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}]=tmg_p(varargin{1}, varargin{2}); end + if nargout==6, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}]=tmg_p(varargin{1}, varargin{2}); end + if nargout==7, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}]=tmg_p(varargin{1}, varargin{2}); end + if nargout==8, [varargout{1}, varargout{2}, varargout{3}, varargout{4}, varargout{5}, varargout{6}, varargout{7}, varargout{8}]=tmg_p(varargin{1}, varargin{2}); end +end +cd(TMG_current_directory); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_gui.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_gui.fig new file mode 100644 index 0000000000000000000000000000000000000000..01e133375255b06f9e06cccbfe96d65f29c55342 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_gui.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_gui.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_gui.m new file mode 100644 index 0000000000000000000000000000000000000000..d92b87417d670c3a3344ee49529892e3832fe7a5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_gui.m @@ -0,0 +1,1032 @@ +function varargout = tmg_gui(varargin) +% TMG_GUI +% TMG_GUI is a graphical user interface for all the indexing +% routines of the Text to Matrix Generator (TMG) Toolbox. +% For a full documentation type 'help tmg', 'help tmg_query', +% 'help tdm_update' or 'help tdm_downdate'. +% For a full documentation of the GUI's usage, select the +% help tab to the GUI. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @tmg_gui_OpeningFcn, ... + 'gui_OutputFcn', @tmg_gui_OutputFcn, ... + 'gui_LayoutFcn', [] , ... + 'gui_Callback', []); +if nargin & isstr(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + +% --- Executes just before tmg_gui is made visible. +function tmg_gui_OpeningFcn(hObject, eventdata, handles, varargin) + +handles.output = hObject; + +handles.light_gray=[0.8824 0.8824 0.8824]; +handles.gray=[0.9255 0.9137 0.8471]; +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=14.5410; +wdth=15.7572; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +OPTIONS=struct('use_mysql', 0, 'delimiter', 'emptyline', 'line_delimiter', 1, 'stemming', 0, 'min_length', 3, 'max_length', 30, ... + 'min_local_freq', 1, 'min_global_freq', 1, 'max_local_freq', inf, 'max_global_freq', inf, ... + 'local_weight', 't', 'global_weight', 'x', 'normalization', 'x', 'dsp', 1, 'remove_num', 0, 'remove_al', 0,'parse_subd',0); +handles.OPTIONS=OPTIONS; +handles.update_struct_type='Files'; +handles.removed_docs_type='Files'; +handles.dictionary_type='Files'; +handles.gwquery_type='Files'; +handles.objects=[handles.Filename;handles.FilenameButton;handles.Dictionary;handles.DictionaryButton;handles.GWQuery;... + handles.GWQueryButton;handles.UpdateStruct;handles.UpdateStructButton;handles.RemovedDocs;handles.RemovedDocsButton;... + handles.Delimiter;handles.Stoplist;handles.StoplistButton;handles.MinLength;handles.MaxLength;handles.MinLocal;handles.MaxLocal;... + handles.MinGlobal;handles.MaxGlobal;handles.LocalWeight;handles.GlobalWeight;handles.Normalization;handles.Stemming;handles.UseMySQL;... + handles.StoreIn;handles.RemoveNum;handles.RemoveAl;handles.ParseSubd;]; + +guidata(hObject, handles); +%set(handles.StoreIn, 'Enable', 'off'); +%set(handles.StoreIn, 'BackgroundColor', handles.light_gray); +guidata(hObject, handles); + +% --- Outputs from this function are returned to the command line. +function varargout = tmg_gui_OutputFcn(hObject, eventdata, handles) + +varargout{1} = handles.output; + + +% --- Executes during object creation, after setting all properties. +function StoreIn_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + +function StoreIn_Callback(hObject, eventdata, handles) + +s=get(hObject,'String'); +if ~isempty(s), + handles.OPTIONS.db_name=s; + guidata(hObject, handles); +else, + OPT=handles.OPTIONS; + if isfield(OPT, 'db_name'), handles.OPTIONS=rmfield(OPT, 'db_name'); end + guidata(hObject, handles); +end + +% --- Executes on button press in Disp. +function UseMySQL_Callback(hObject, eventdata, handles) + +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, +% set(handles.StoreIn, 'Enable', 'on'); +% set(handles.StoreIn, 'BackgroundColor', 'white'); + OPT.use_mysql=1; +else, +% set(handles.StoreIn, 'Enable', 'off'); +% set(handles.StoreIn, 'BackgroundColor', handles.light_gray); + OPT.use_mysql=0; +end +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Filename_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + +function Filename_Callback(hObject, eventdata, handles) + +s=get(hObject,'String'); +if isempty(s) & isfield(handles, 'filename'), + handles=rmfield(handles, 'filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end + +handles.filename=s; +guidata(hObject, handles); + +% --- Executes on button press in FilenameButton. +function FilenameButton_Callback(hObject, eventdata, handles) + +flname=open_file(0); +set(handles.Filename, 'String', flname); +if isempty(flname) & isfield(handles, 'filename'), + handles=rmfield(handles, 'filename'); + guidata(hObject, handles); + return; +end +if isempty(flname), return; end + +handles.filename=flname; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Delimiter_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function Delimiter_Callback(hObject, eventdata, handles) + +s=get(hObject,'String'); +if ~isempty(s), + handles.OPTIONS.delimiter=s; + guidata(hObject, handles); +else, + handles.OPTIONS.delimiter='emptyline'; + guidata(hObject, handles); +end + +% --- Executes during object creation, after setting all properties. +function Stoplist_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function Stoplist_Callback(hObject, eventdata, handles) + +s=get(hObject,'String'); +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'stoplist'), + OPT=rmfield(OPT, 'stoplist'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end + +OPT.stoplist=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes on button press in StoplistButton. +function StoplistButton_Callback(hObject, eventdata, handles) + +s=open_file(1); +set(handles.Stoplist, 'String', s); + +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'stoplist'), + OPT=rmfield(OPT, 'stoplist'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end + +OPT.stoplist=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function MinLength_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function MinLength_Callback(hObject, eventdata, handles) + +n=str2double(get(hObject,'String')); +if ~isempty(n), + handles.OPTIONS.min_length=n; + guidata(hObject, handles); +else, + handles.OPTIONS.min_length=3; +end + +% --- Executes during object creation, after setting all properties. +function MaxLength_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function MaxLength_Callback(hObject, eventdata, handles) + +n=str2double(get(hObject,'String')); +if ~isempty(n), + handles.OPTIONS.max_length=n; + guidata(hObject, handles); +else, + handles.OPTIONS.max_length=30; +end + +% --- Executes during object creation, after setting all properties. +function MinLocal_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function MinLocal_Callback(hObject, eventdata, handles) + +n=str2double(get(hObject,'String')); +if ~isempty(n), + handles.OPTIONS.min_local_freq=n; + guidata(hObject, handles); +else, + handles.OPTIONS.min_local_freq=1; +end + +% --- Executes during object creation, after setting all properties. +function MaxLocal_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function MaxLocal_Callback(hObject, eventdata, handles) + +n=str2double(get(hObject,'String')); +if ~isempty(n), + handles.OPTIONS.max_local_freq=n; + guidata(hObject, handles); +else, + handles.OPTIONS.max_local_freq=inf; +end + +% --- Executes during object creation, after setting all properties. +function MinGlobal_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function MinGlobal_Callback(hObject, eventdata, handles) + +n=str2double(get(hObject,'String')); +if ~isempty(n), + handles.OPTIONS.min_global_freq=n; + guidata(hObject, handles); +else, + handles.OPTIONS.min_global_freq=1; +end + +% --- Executes during object creation, after setting all properties. +function MaxGlobal_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function MaxGlobal_Callback(hObject, eventdata, handles) + +n=str2double(get(hObject,'String')); +if ~isempty(n), + handles.OPTIONS.max_global_freq=n; + guidata(hObject, handles); +else, + handles.OPTIONS.max_global_freq=inf; +end + +% --- Executes during object creation, after setting all properties. +function LocalWeight_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + +% --- Executes on selection change in LocalWeight. +function LocalWeight_Callback(hObject, eventdata, handles) + +OPT=handles.OPTIONS; +ind=get(hObject, 'Value'); +switch ind, + case 1, + OPT.local_weight='t'; + case 2, + OPT.local_weight='b'; + case 3, + OPT.local_weight='l'; + case 4, + OPT.local_weight='a'; + case 5, + OPT.local_weight='n'; +end +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function GlobalWeight_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + +% --- Executes on selection change in GlobalWeight. +function GlobalWeight_Callback(hObject, eventdata, handles) + +OPT=handles.OPTIONS; +ind=get(hObject, 'Value'); +switch ind, + case 1, + OPT.global_weight='x'; + case 2, + OPT.global_weight='e'; + case 3, + OPT.global_weight='f'; + case 4, + OPT.global_weight='g'; + case 5, + OPT.global_weight='n'; + case 6, + OPT.global_weight='p'; +end +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes on button press in Normalization. +function Normalization_Callback(hObject, eventdata, handles) + +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, OPT.normalization='c'; else, OPT.normalization='x'; end +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes on button press in Stemming. +function Stemming_Callback(hObject, eventdata, handles) + +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, OPT.stemming=1; else, OPT.stemming=0; end +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes on button press in ExitButton. +function ExitButton_Callback(hObject, eventdata, handles) + +delete(handles.figure1); + + +% --- Executes on button press in Disp. +function Disp_Callback(hObject, eventdata, handles) + +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, OPT.dsp=1; else, OPT.dsp=0; end +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes on button press in ContinueButton. +function ContinueButton_Callback(hObject, eventdata, handles) + +create_flag=get(handles.CreateRadio, 'Value'); +create_query_flag=get(handles.RadioQuery, 'Value'); +update_flag=get(handles.RadioUpdate, 'Value'); +downdate_flag=get(handles.RadioDowndate, 'Value'); + +if create_flag, + if ~isfield(handles, 'filename') | isempty(handles.filename), + msgbox('You have to specify the directory...', 'Error', 'modal'); + return; + end + OPT=handles.OPTIONS; + filename=handles.filename; + if isfield(OPT, 'db_name'), + if exist(strcat(fileparts(mfilename('fullpath')), filesep, 'data', filesep, OPT.db_name)), + an=new_sprintf('%s collection already exists. Please give another name...', OPT.db_name);msgbox(an, 'Error', 'modal'); return; + end + end + [A, dictionary, global_weights, normalization_factors, words_per_doc, titles, files, update_struct]=tmg(filename, OPT); +end + +if create_query_flag, + if ~isfield(handles, 'filename') | isempty(handles.filename), + msgbox('You have to specify the directory...', 'Error', 'modal'); + return; + end + if ~isfield(handles, 'dictionary') | isempty(handles.dictionary), + msgbox('You have to specify the dictionary...', 'Error', 'modal'); + return; + end + filename=handles.filename; + if isequal(handles.dictionary_type, 'Files'), + if exist(handles.dictionary)==0, + an=new_sprintf('File %s not found...', handles.dictionary); + msgbox(an, 'Error', 'modal'); + return; + else, + load(handles.dictionary); + dictionary=eval(char(fieldnames(load(handles.dictionary)))); + end + else, + dictionary=evalin('base', handles.dictionary); + end + + OPT=handles.OPTIONS; + OPTS1.delimiter=OPT.delimiter; + OPTS1.line_delimiter=OPT.line_delimiter; + if isfield(OPT, 'stoplist'), OPTS1.stoplist=OPT.stoplist; end + OPTS1.local_weight=OPT.local_weight;OPTS1.stemming=OPT.stemming;OPTS1.dsp=OPT.dsp;OPTS1.remove_num=OPT.remove_num;OPTS1.remove_al=OPT.remove_al;OPTS1.parse_subd=OPT.parse_subd; + + if isfield(OPT, 'global_weights'), + s=OPT.global_weights; + if isequal(handles.gwquery_type, 'Files'), + if ~isempty(s) & exist(s)==0, + an=new_sprintf('File %s not found...', s); + msgbox(an, 'Error', 'modal'); + return; + else, + load(s); + OPTS1.global_weights=eval(char(fieldnames(load(s)))); + end + else, + OPTS1.global_weights=evalin('base', s); + end + end + + [Q, words_per_query, titles, files]=tmg_query(filename, dictionary, OPTS1); +end + +if update_flag, + if ~isfield(handles, 'filename'), + handles.filename=''; + guidata(hObject, handles); + end + if ~isfield(handles, 'update_struct') | isempty(handles.update_struct), + msgbox('You have to specify the update struct...', 'Error', 'modal'); + return; + end + filename=handles.filename; + if isequal(handles.update_struct_type, 'Files'), + if exist(handles.update_struct)==0, + an=new_sprintf('File %s not found...', handles.update_struct); + msgbox(an, 'Error', 'modal'); + return; + else, + load(handles.update_struct); + update_struct=eval(char(fieldnames(load(handles.update_struct)))); + end + else, + update_struct=evalin('base', handles.update_struct); + end + + OPT=handles.OPTIONS; + OPTS1.delimiter=OPT.delimiter;OPTS1.dsp=OPT.dsp; + OPTS1.line_delimiter=OPT.line_delimiter; + OPTS1.remove_num=OPT.remove_num; + OPTS1.remove_al=OPT.remove_al; + OPTS1.parse_subd=OPT.parse_subd; + + [A, dictionary, global_weights, normalization_factors, words_per_doc, titles, files, update_struct]=tdm_update(filename, update_struct, OPTS1); +end +if downdate_flag, + if ~isfield(handles, 'update_struct') | isempty(handles.update_struct), + msgbox('You have to specify the update struct...', 'Error', 'modal'); + return; + end + if ~isfield(handles, 'removed_docs') | isempty(handles.removed_docs), + msgbox('You have to specify the document indices...', 'Error', 'modal'); + return; + end + + if isequal(handles.update_struct_type, 'Files'), + if exist(handles.update_struct)==0, + an=new_sprintf('File %s not found...', handles.update_struct); + msgbox(an, 'Error', 'modal'); + return; + else, + load(handles.update_struct); + update_struct=eval(char(fieldnames(load(handles.update_struct)))); + end + else, + update_struct=evalin('base', handles.update_struct); + end + if isequal(handles.removed_docs_type, 'Files'), + if exist(handles.removed_docs)==0, + an=new_sprintf('File %s not found...', handles.removed_docs); + msgbox(an, 'Error', 'modal'); + return; + else, + load(handles.removed_docs); + removed_docs=eval(char(fieldnames(load(handles.removed_docs)))); + end + else, + removed_docs=evalin('base', handles.removed_docs); + end + + OPT=handles.OPTIONS; + OPTS1.dsp=OPT.dsp; + + [A, dictionary, global_weights, normalization_factors, words_per_doc, titles, files, update_struct]=tdm_downdate(update_struct, removed_docs, OPTS1); +end + +if create_query_flag==0, + assignin('base', 'A', A);assignin('base', 'dictionary', dictionary); + assignin('base', 'global_weights', global_weights);assignin('base', 'normalization_factors', normalization_factors); + assignin('base', 'words_per_doc', words_per_doc);assignin('base', 'titles', titles); + assignin('base', 'files', files);assignin('base', 'update_struct', update_struct); + if create_flag==0, + an=new_sprintf('Do you want to save the results?'); + an=questdlg(an, 'Results', 'YES', 'NO', 'YES'); + if isequal(an, 'YES'), + tmg_save_results(1); + end + end +else, + if isempty(Q), return; end + assignin('base', 'Q', Q);assignin('base', 'words_per_query', words_per_query); + assignin('base', 'titles', titles);assignin('base', 'files', files); + an=new_sprintf('Do you want to save the results?'); + an=questdlg(an, 'Results', 'YES', 'NO', 'YES'); + if isequal(an, 'YES'), + tmg_save_results(2); + end +end +msgbox('Done!', 'modal'); + +% --- Executes on button press in ClearButton. +function ClearButton_Callback(hObject, eventdata, handles) + +OPTIONS=struct('delimiter', 'emptyline','line_delimiter', 1, 'stemming', 0, 'min_length', 3, 'max_length', 30, ... + 'min_local_freq', 1, 'min_global_freq', 1, 'max_local_freq', inf, 'max_global_freq', inf, ... + 'local_weight', 't', 'global_weight', 'x', 'normalization', 'x', 'dsp', 1, 'remove_num', 0, 'remove_al', 0, 'parse_subd',0); +handles.OPTIONS=OPTIONS; + +if isfield(handles, 'filename'), handles.filename=''; end + +set(handles.Filename, 'String', ''); +set(handles.Dictionary, 'String', ''); +set(handles.GWQuery, 'String', ''); +set(handles.UpdateStruct, 'String', ''); +set(handles.RemovedDocs, 'String', ''); +set(handles.Delimiter, 'String', 'emptyline'); +set(handles.Stoplist, 'String', ''); +set(handles.MinLength, 'String', '3'); +set(handles.MaxLength, 'String', '30'); +set(handles.MinLocal, 'String', '1'); +set(handles.MaxLocal, 'String', 'inf'); +set(handles.MinGlobal, 'String', '1'); +set(handles.MaxGlobal, 'String', 'inf'); +set(handles.LocalWeight, 'Value', 1); +set(handles.GlobalWeight, 'Value', 1); +set(handles.Normalization, 'Value', 0); +set(handles.Disp, 'Value', 1); +set(handles.Stemming, 'Value', 0); +set(handles.RemoveAl, 'Value', 0); +set(handles.RemoveNum, 'Value', 0); +set(handles.ParseSubd, 'Value', 0); +handles.update_struct_type='Files'; +handles.removed_docs_type='Files'; +handles.dictionary_type='Files'; +handles.gwquery_type='Files'; +guidata(hObject, handles); + +% --- Executes on button press in CreateRadio. +function CreateRadio_Callback(hObject, eventdata, handles) + +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.RadioQuery, 'Value', 0); + set(handles.RadioUpdate, 'Value', 0); + set(handles.RadioDowndate, 'Value', 0); + states=ones(28, 1);states([(3:10)])=0; + handles=activate_uicontrol(states, handles); +end +guidata(hObject, handles); + + +% --- Executes on button press in RadioUpdate. +function RadioUpdate_Callback(hObject, eventdata, handles) + +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.CreateRadio, 'Value', 0); + set(handles.RadioQuery, 'Value', 0); + set(handles.RadioDowndate, 'Value', 0); + states=zeros(28, 1);states([(1:2) (7:8) 11 (26:28)])=1; + handles=activate_uicontrol(states, handles); +end +guidata(hObject, handles); + + +% --- Executes on button press in RadioDowndate. +function RadioDowndate_Callback(hObject, eventdata, handles) + +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.CreateRadio, 'Value', 0); + set(handles.RadioQuery, 'Value', 0); + set(handles.RadioUpdate, 'Value', 0); + states=zeros(28, 1);states([(7:10)])=1; + handles=activate_uicontrol(states, handles); +end +guidata(hObject, handles); + + +% --- Executes during object creation, after setting all properties. +function UpdateStruct_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function UpdateStruct_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +handles.update_struct_type='Files'; +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'update_struct'), + handles=rmfield(handles, 'update_struct'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.update_struct_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + if isfield(handles, 'update_struct'), handles=rmfield(handles, 'update_struct'); end + set(handles.UpdateStruct, 'String', '');guidata(hObject, handles); + return; + end +end + +handles.update_struct=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function RemovedDocs_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function RemovedDocs_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +handles.removed_docs_type='Files'; +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'removed_docs'), + handles=rmfield(handles, 'removed_docs'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.removed_docs_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + if isfield(handles, 'removed_docs'), handles=rmfield(handles, 'removed_docs'); end + set(handles.RemovedDocs, 'String', '');guidata(hObject, handles); + return; + end +end + +handles.removed_docs=s; +guidata(hObject, handles); + +% --- Executes on button press in UpdateStructButton. +function UpdateStructButton_Callback(hObject, eventdata, handles) + +[s, handles.update_struct_type]=open_file(2); +guidata(hObject, handles); +set(handles.UpdateStruct, 'String', s); + +if isempty(s) & isfield(handles, 'update_struct'), + handles=rmfield(handles, 'update_struct'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.update_struct_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + if isfield(handles, 'update_struct'), handles=rmfield(handles, 'update_struct'); end + set(handles.UpdateStruct, 'String', '');guidata(hObject, handles); + return; + end +end + +handles.update_struct=s; +guidata(hObject, handles); + +% --- Executes on button press in RemovedDocsButton. +function RemovedDocsButton_Callback(hObject, eventdata, handles) + +[s, handles.removed_docs_type]=open_file(2); +guidata(hObject, handles); +set(handles.RemovedDocs, 'String', s); + +if isempty(s) & isfield(handles, 'removed_docs'), + handles=rmfield(handles, 'removed_docs'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.removed_docs_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + if isfield(handles, 'removed_docs'), handles=rmfield(handles, 'removed_docs'); end + set(handles.RemovedDocs, 'String', '');guidata(hObject, handles); + return; + end +end + +handles.removed_docs=s; +guidata(hObject, handles); + + +% --- Executes during object creation, after setting all properties. +function Dictionary_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function Dictionary_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +handles.dictionary_type='Files'; +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'dictionary'), + handles=rmfield(handles, 'dictionary'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.dictionary_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + if isfield(handles, 'dictionary'), handles=rmfield(handles, 'dictionary'); end + set(handles.Dictionary, 'String', '');guidata(hObject, handles); + return; + end +end + +handles.dictionary=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function GWQuery_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function GWQuery_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +handles.gwquery_type='Files'; +guidata(hObject, handles); +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'global_weights'), + OPT=rmfield(OPT, 'global_weights'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.gwquery_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + OPT=handles.OPTIONS;if isfield(OPT, 'global_weights'), OPT=rmfield(OPT, 'global_weights'); end + handles.OPTIONS=OPT; + set(handles.GWQuery, 'String', '');guidata(hObject, handles); + return; + end +end + +OPT.global_weights=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + +% --- Executes on button press in DictionaryButton. +function DictionaryButton_Callback(hObject, eventdata, handles) + +[s, handles.dictionary_type]=open_file(2); +guidata(hObject, handles); +set(handles.Dictionary, 'String', s); + +if isempty(s) & isfield(handles, 'dictionary'), + handles=rmfield(handles, 'dictionary'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.dictionary_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + if isfield(handles, 'dictionary'), handles=rmfield(handles, 'dictionary'); end + set(handles.Dictionary, 'String', '');guidata(hObject, handles); + return; + end +end + +handles.dictionary=s; +guidata(hObject, handles); + +% --- Executes on button press in GWQueryButton. +function GWQueryButton_Callback(hObject, eventdata, handles) + +[s, handles.gwquery_type]=open_file(2); +guidata(hObject, handles); +set(handles.GWQuery, 'String', s); + +OPT=handles.OPTIONS; +if isempty(s) & isfield(OPT, 'global_weights'), + OPT=rmfield(OPT, 'global_weights'); + handles.OPTIONS=OPT; + guidata(hObject, handles); + return; +end +if isempty(s), return; end +if isequal(handles.gwquery_type, 'Files'), + [pathstr, name, ext] = fileparts(s); + if ~isequal(ext, '.mat'), + msgbox('You have to provide a mat file...', 'Error', 'modal'); + OPT=handles.OPTIONS;if isfield(OPT, 'global_weights'), OPT=rmfield(OPT, 'global_weights'); end + handles.OPTIONS=OPT; + set(handles.GWQuery, 'String', '');guidata(hObject, handles); + return; + end +end + +OPT.global_weights=s; +handles.OPTIONS=OPT; +guidata(hObject, handles); + + +% --- Executes on button press in RadioQuery. +function RadioQuery_Callback(hObject, eventdata, handles) + +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.CreateRadio, 'Value', 0); + set(handles.RadioUpdate, 'Value', 0); + set(handles.RadioDowndate, 'Value', 0); + states=zeros(28, 1);states([(1:6) (11:13) 20 23 (26:28)])=1; + handles=activate_uicontrol(states, handles); +end +guidata(hObject, handles); + + +%-------------------------------------------------------------------------- +% --- Executes on button press in LineDelimiter. +function LineDelimiter_Callback(hObject, eventdata, handles) + +state=get(hObject, 'Value'); +if state==0, + OPT=handles.OPTIONS; + OPT.line_delimiter=0; + handles.OPTIONS=OPT; +else, + OPT=handles.OPTIONS; + OPT.line_delimiter=1; + handles.OPTIONS=OPT; +end +guidata(hObject, handles); +%-------------------------------------------------------------------------- + + +%set Active and BackgroundColor field of each uicontrol item depending on +%the Radio Button that is pressed (called by the corresponding callback) +function handles=activate_uicontrol(states, handles) +sz=size(handles.objects, 1); +for i=1:sz, + if states(i), tmp='on'; else, tmp='off'; end + set(handles.objects(i), 'Enable', tmp); + if states(i)==0 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', handles.light_gray);continue; + end + if states(i)==1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', 'white'); + end +end + + +% --- Executes on button press in RemoveAl. +function RemoveAl_Callback(hObject, eventdata, handles) +% hObject handle to RemoveAl (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, OPT.remove_al=1; else, OPT.remove_al=0; end +handles.OPTIONS=OPT; +guidata(hObject, handles); +% Hint: get(hObject,'Value') returns toggle state of RemoveAl + + +% --- Executes on button press in RemoveNum. +function RemoveNum_Callback(hObject, eventdata, handles) +% hObject handle to RemoveNum (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, OPT.remove_num=1; else, OPT.remove_num=0; end +handles.OPTIONS=OPT; +guidata(hObject, handles); +% Hint: get(hObject,'Value') returns toggle state of RemoveNum + + +% --- Executes on button press in ParseSubd. +function ParseSubd_Callback(hObject, eventdata, handles) +% hObject handle to ParseSubd (see GCBO) +% eventdata reserved - to be defined in a future version of MATLAB +% handles structure with handles and user data (see GUIDATA) +OPT=handles.OPTIONS; +s=get(hObject, 'Value'); +if s==1, OPT.parse_subd=1; else, OPT.parse_subd=0; end +handles.OPTIONS=OPT; +guidata(hObject, handles); +% Hint: get(hObject,'Value') returns toggle state of ParseSubd + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_p.p new file mode 100644 index 0000000000000000000000000000000000000000..0485aef5007443aa237ecd6196df893ea870e79f Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_query.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_query.m new file mode 100644 index 0000000000000000000000000000000000000000..960fd96e38b5764e55cf594d1bd53292eec2396f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_query.m @@ -0,0 +1,78 @@ +function varargout=tmg_query(varargin) +% TMG_QUERY - Text to Matrix Generator, query vector constructor +% TMG_QUERY parses a query text collection and generates the +% query vectors corresponding to the supplied dictionary. +% Q = TMG_QUERY(FILENAME, DICTIONARY) returns the query +% vectors, that corresponds to the text collection contained +% in files of directory FILENAME. DICTIONARY is the array of +% terms corresponding to a text collection. +% Each query must be separeted by a blank line (or another +% delimiter that is defined by OPTIONS argument) in each file. +% [Q, WORDS_PER_QUERY] = TMG_QUERY(FILENAME, DICTIONARY) +% returns statistics for each query, i.e. the number of terms +% for each query. +% Finally, [Q, WORDS_PER_QUERY, TITLES, FILES] = +% TMG_QUERY(FILENAME) returns in FILES the filenames contained +% in directory (or file) FILENAME and a cell array (TITLES) +% that containes a declaratory title for each query, as well +% as the query's first line. +% +% TMG_QUERY(FILENAME, DICTIONARY, OPTIONS) defines optional +% parameters: +% - OPTIONS.delimiter: The delimiter between queries within +% the same file. Possible values are 'emptyline' (default), +% 'none_delimiter' (treats each file as a single query) +% or any other string. +% - OPTIONS.line_delimiter: Defines if the delimiter takes a +% whole line of text (default, 1) or not. +% - OPTIONS.stoplist: The filename for the stoplist, i.e. a +% list of common words that we don't use for the indexing +% (default no stoplist used). +% - OPTIONS.stemming: Indicates if the stemming algorithm is +% used (1) or not (0 - default). +% - OPTIONS.update_step: The step used for the incremental +% built of the inverted index (default 10,000). +% - OPTIONS.local_weight: The local term weighting function +% (default 't'). Possible values (see [1, 2]): +% 't': Term Frequency +% 'b': Binary +% 'l': Logarithmic +% 'a': Alternate Log +% 'n': Augmented Normalized Term Frequenct +% - OPTIONS.global_weights: The vector of term global +% weights (returned by tmg). +% - OPTIONS.dsp: Displays results (default 1) or not (0). +% - OPTIONS.remove_num: Indicates if we remove the numbers from the +% dictionary (value 1) or not (value 0- default). +% - OPTIONS.remove_al: Indicates if we remove the alphanumerics from +% the dictionary (value 1) or not (value 0- default). +% - OPTIONS.parse_subd: Indicates if we parse all the subdirectories +% without be questioned (value 1), or we are asked which +% subdirectories to parse (value 0-default). This option is +% recommended for large collections with many subdirectories +% so that they can be run in batch mode. Setting this options we +% are avoiding questions during the parsing. +% REFERENCES: +% [1] M.Berry and M.Browne, Understanding Search Engines, +% Mathematical Modeling and Text Retrieval, Philadelphia, +% PA: Society for Industrial and Applied Mathematics, 1999. +% [2] T.Kolda, Limited-Memory Matrix Methods with Applications, +% Tech.Report CS-TR-3806, 1997. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +%================================================================== +%check input and set parameters +%================================================================== +error(nargchk(2, 3, nargin)); +if nargin==2, + if nargout==1, varargout{1}=tmg_query_p(varargin{1}, varargin{2}); end + if nargout==2, [varargout{1}, varargout{2}]=tmg_query_p(varargin{1}, varargin{2}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=tmg_query_p(varargin{1}, varargin{2}); end + if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=tmg_query_p(varargin{1}, varargin{2}); end +else, + if nargout==1, varargout{1}=tmg_query_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==2, [varargout{1}, varargout{2}]=tmg_query_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==3, [varargout{1}, varargout{2}, varargout{3}]=tmg_query_p(varargin{1}, varargin{2}, varargin{3}); end + if nargout==4, [varargout{1}, varargout{2}, varargout{3}, varargout{4}]=tmg_query_p(varargin{1}, varargin{2}, varargin{3}); end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_query_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_query_p.p new file mode 100644 index 0000000000000000000000000000000000000000..8ba5eda10f1505186d56ba22344091658d856765 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_query_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_save_results.fig b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_save_results.fig new file mode 100644 index 0000000000000000000000000000000000000000..acf9e19300b83a314bc4ba96f2811802050d987c Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_save_results.fig differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_save_results.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_save_results.m new file mode 100644 index 0000000000000000000000000000000000000000..8e1d390e99488a1d712d3e0c8539908b61ff8919 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_save_results.m @@ -0,0 +1,685 @@ +function varargout = tmg_save_results(varargin) +% TMG_SAVE_RESULTS +% TMG_SAVE_RESULTS is a graphical user interface used from +% TMG_GUI, for saving the results to a (or multiple) .mat +% file(s). +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% Initialization code +gui_Singleton = 1; +gui_State = struct('gui_Name', mfilename, ... + 'gui_Singleton', gui_Singleton, ... + 'gui_OpeningFcn', @tmg_save_results_OpeningFcn, ... + 'gui_OutputFcn', @tmg_save_results_OutputFcn, ... + 'gui_LayoutFcn', [] , ... + 'gui_Callback', []); +if nargin & isstr(varargin{1}) + gui_State.gui_Callback = str2func(varargin{1}); +end + +if nargout + [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); +else + gui_mainfcn(gui_State, varargin{:}); +end + + +% --- Executes just before tmg_save_results is made visible. +function tmg_save_results_OpeningFcn(hObject, eventdata, handles, varargin) + +handles.output = hObject; + +handles.light_gray=[0.8824 0.8824 0.8824]; +handles.gray=[0.9255 0.9137 0.8471]; +handles.calling_function='tmg'; +%centre the gui +set(0, 'Units', 'centimeters'); +scr_position=get(0, 'ScreenSize'); +hght=12.4260; +wdth=11.5271; +pos=[(scr_position(3)-wdth)/2 (scr_position(4)-hght)/2 wdth hght]; +set(hObject, 'Units', 'centimeters'); +set(hObject, 'Position', pos); + +handles.objects=[handles.SingleFilename;handles.TdmMatrix;handles.QueryMatrix;handles.Dictionary;... + handles.UpdateStruct;handles.GlobalWeights;handles.NormalizationFactors;handles.WordsPerDoc;... + handles.WordsPerQuery;handles.Titles;handles.Files]; + +if nargin==4 & varargin{1}~=1, + handles.calling_function='tmg_query'; +end +% Update handles structure +guidata(hObject, handles); +set(handles.figure1, 'Resize', 'off'); + +% UIWAIT makes tmg_save_results wait for user response (see UIRESUME) +uiwait(handles.figure1); + + +% --- Outputs from this function are returned to the command line. +function varargout = tmg_save_results_OutputFcn(hObject, eventdata, handles) + +varargout{1} = handles.output; +delete(handles.figure1); + + +% --- Executes on button press in SingleFiles. +function SingleFiles_Callback(hObject, eventdata, handles) + +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.MultipleFiles, 'Value', 0); + states=zeros(11, 1);states(1)=1; + handles=activate_uicontrol(states, handles); +end +guidata(hObject, handles); + + +% --- Executes on button press in MultipleFiles. +function MultipleFiles_Callback(hObject, eventdata, handles) + +state=get(hObject, 'Value'); +if state==0, + set(hObject, 'Value', 1); +else, + set(handles.SingleFiles, 'Value', 0); + states=ones(11, 1);states(1)=0; + if isequal(handles.calling_function, 'tmg'), states([3 9])=0; else, states([2 4:8])=0; end + handles=activate_uicontrol(states, handles); +end +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function SingleFilename_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor','white'); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function SingleFilename_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'single_filename'), + handles=rmfield(handles, 'single_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.single_filename=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function TdmMatrix_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function TdmMatrix_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'tdm_matrix_filename'), + handles=rmfield(handles, 'tdm_matrix_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.tdm_matrix_filename=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function QueryMatrix_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function QueryMatrix_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'query_matrix_filename'), + handles=rmfield(handles, 'query_matrix_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.query_matrix_filename=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Dictionary_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function Dictionary_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'dictionary_filename'), + handles=rmfield(handles, 'dictionary_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.dictionary_filename=s; +guidata(hObject, handles); + +% --- Executes on button press in OkButton. +function OkButton_Callback(hObject, eventdata, handles) + +state=get(handles.SingleFiles, 'Value'); +if state, + A_flag=1;dictionary_flag=1;global_weights_flag=1;normalization_factors_flag=1; + words_per_doc_flag=1;titles_flag=1;files_flag=1;update_struct_flag=1; + words_per_query_flag=1;Q_flag=1; + an=''; + if isequal(handles.calling_function, 'tmg'), + try, A=evalin('base', 'A'); catch, A_flag=0; an='A';end + try, + dictionary=evalin('base', 'dictionary'); + catch, + dictionary_flag=0; if isempty(an), an='dictionary'; else, an=strcat(an, ', dictionary'); end + end + try, + words_per_doc=evalin('base', 'words_per_doc'); + catch, + words_per_doc_flag=0; if isempty(an), an='words_per_doc'; else, an=strcat(an, ', words_per_doc'); end + end + try, + normalization_factors=evalin('base', 'normalization_factors'); + catch, + normalization_factors_flag=0; if isempty(an), an='normalization_factors'; else, an=strcat(an, ', normalization_factors'); end + end + try, + global_weights=evalin('base', 'global_weights'); + catch, + global_weights_flag=0; if isempty(an), an='global_weights'; else, an=strcat(an, ', global_weights'); end + end + try, + update_struct=evalin('base', 'update_struct'); + catch, + update_struct_flag=0; if isempty(an), an='update_struct'; else, an=strcat(an, ', update_struct'); end + end + else, + try, Q=evalin('base', 'Q'); catch, Q_flag=0; an='Q';end + try, + words_per_query=evalin('base', 'words_per_query'); + catch, + words_per_query_flag=0; if isempty(an), an='words_per_query'; else, an=strcat(an, ', words_per_query'); end + end + end + try, + titles=evalin('base', 'titles'); + catch, + titles_flag=0; if isempty(an), an='titles'; else, an=strcat(an, ', titles'); end + end + try, + files=evalin('base', 'files'); + catch, + files_flag=0; if isempty(an), an='files'; else, an=strcat(an, ', files'); end + end + + if ~isempty(an), + an=new_sprintf('Variable(s) %s is(are) empty. Do you want to proceed?', an); + an=questdlg(an, 'Warning', 'YES', 'NO', 'NO'); + if isequal(an, 'NO'), + uiresume(handles.figure1); + end + end + + if isequal(handles.calling_function, 'tmg'), + exist_flag=0; + if A_flag, exist_flag=1; save(handles.single_filename, 'A'); end + if dictionary_flag, + if exist_flag==1, + save(handles.single_filename, 'dictionary', '-append'); + else, + save(handles.single_filename, 'dictionary'); + exist_flag=1; + end + end + if words_per_doc_flag, + if exist_flag==1, + save(handles.single_filename, 'words_per_doc', '-append'); + else, + save(handles.single_filename, 'words_per_doc'); + exist_flag=1; + end + end + if global_weights_flag, + if exist_flag==1, + save(handles.single_filename, 'global_weights', '-append'); + else, + save(handles.single_filename, 'global_weights'); + exist_flag=1; + end + end + if normalization_factors_flag, + if exist_flag==1, + save(handles.single_filename, 'normalization_factors', '-append'); + else, + save(handles.single_filename, 'normalization_factors'); + exist_flag=1; + end + end + if titles_flag, + if exist_flag==1, + save(handles.single_filename, 'titles', '-append'); + else, + save(handles.single_filename, 'titles'); + exist_flag=1; + end + end + if files_flag, + if exist_flag==1, + save(handles.single_filename, 'files', '-append'); + else, + save(handles.single_filename, 'files'); + exist_flag=1; + end + end + if update_struct_flag, + if exist_flag==1, + save(handles.single_filename, 'update_struct', '-append'); + else, + save(handles.single_filename, 'update_struct'); + end + end + else, + exist_flag=0; + if Q_flag, exist_flag=1; save(handles.single_filename, 'Q'); end + if words_per_query_flag, + if exist_flag==1, + save(handles.single_filename, 'words_per_query', '-append'); + else, + save(handles.single_filename, 'words_per_query'); + exist_flag=1; + end + end + if titles_flag, + if exist_flag==1, + save(handles.single_filename, 'titles', '-append'); + else, + save(handles.single_filename, 'titles'); + exist_flag=1; + end + end + if files_flag, + if exist_flag==1, + save(handles.single_filename, 'files', '-append'); + else, + save(handles.single_filename, 'files'); + end + end + end +else, + A_flag=0;dictionary_flag=0;global_weights_flag=0;normalization_factors_flag=0; + words_per_doc_flag=0;titles_flag=0;files_flag=0;update_struct_flag=0; + words_per_query_flag=0;Q_flag=0; + an=''; + if isequal(handles.calling_function, 'tmg'), + if isfield(handles, 'tdm_matrix_filename'), + try, A=evalin('base', 'A'); A_flag=1; catch, A_flag=0; an='A';end + end + if isfield(handles, 'dictionary_filename'), + try, + dictionary=evalin('base', 'dictionary'); dictionary_flag=1; + catch, + dictionary_flag=0; if isempty(an), an='dictionary'; else, an=strcat(an, ', dictionary'); end + end + end + if isfield(handles, 'update_struct_filename'), + try, + update_struct=evalin('base', 'update_struct'); update_struct_flag=1; + catch, + update_struct_flag=0; if isempty(an), an='update_struct'; else, an=strcat(an, ', update_struct'); end + end + end + if isfield(handles, 'global_weights_filename'), + try, + global_weights=evalin('base', 'global_weights'); global_weights_flag=1; + catch, + global_weights_flag=0; if isempty(an), an='global_weights'; else, an=strcat(an, ', global_weights'); end + end + end + if isfield(handles, 'normalization_factors_filename'), + try, + normalization_factors=evalin('base', 'normalization_factors'); normalization_factors_flag=1; + catch, + normalization_factors_flag=0; if isempty(an), an='normalization_factors'; else, an=strcat(an, ', normalization_factors'); end + end + end + if isfield(handles, 'words_per_doc_filename'), + try, + words_per_doc=evalin('base', 'words_per_doc'); words_per_doc_flag=1; + catch, + words_per_doc_flag=0; if isempty(an), an='words_per_doc'; else, an=strcat(an, ', words_per_doc'); end + end + end + else, + if isfield(handles, 'query_matrix_filename'), + try, Q=evalin('base', 'Q'); Q_flag=1; catch, Q_flag=0; an='Q';end + end + if isfield(handles, 'words_per_query_filename'), + try, + words_per_query=evalin('base', 'words_per_query'); words_per_query_flag=1; + catch, + words_per_query_flag=0; if isempty(an), an='words_per_query'; else, an=strcat(an, ', words_per_query'); end + end + end + end + if isfield(handles, 'titles_filename'), + try, + titles=evalin('base', 'titles'); titles_flag=1; + catch, + titles_flag=0; if isempty(an), an='titles'; else, an=strcat(an, ', titles'); end + end + end + if isfield(handles, 'files_filename'), + try, + files=evalin('base', 'files'); files_flag=1; + catch, + files_flag=0; if isempty(an), an='files'; else, an=strcat(an, ', files'); end + end + end + + if ~isempty(an), + an=new_sprintf('Variable(s) %s is(are) empty. Do you want to proceed?', an); + an=questdlg(an, 'Warning', 'YES', 'NO', 'NO'); + if isequal(an, 'NO'), + uiresume(handles.figure1); + end + end + if isequal(handles.calling_function, 'tmg'), + if A_flag, save(handles.tdm_matrix_filename, 'A'); end + if dictionary_flag, save(handles.dictionary_filename, 'dictionary'); end + if global_weights_flag, save(handles.global_weights_filename, 'global_weights'); end + if normalization_factors_flag, save(handles.normalization_factors_filename, 'normalization_factors'); end + if words_per_doc_flag, save(handles.words_per_doc_filename, 'words_per_doc'); end + if update_struct_flag, save(handles.update_struct_filename, 'update_struct'); end + else, + if Q_flag, save(handles.query_matrix_filename, 'Q'); end + if words_per_query_flag, save(handles.words_per_query_filename, 'words_per_query'); end + end + if titles_flag, save(handles.titles_filename, 'titles'); end + if files_flag, save(handles.files_filename, 'files'); end +end +uiresume(handles.figure1); + +% --- Executes on button press in CancelButton. +function CancelButton_Callback(hObject, eventdata, handles) + +uiresume(handles.figure1); + + +% --- Executes during object creation, after setting all properties. +function UpdateStruct_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function UpdateStruct_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'update_struct_filename'), + handles=rmfield(handles, 'update_struct_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.update_struct_filename=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function GlobalWeights_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function GlobalWeights_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'global_weights_filename'), + handles=rmfield(handles, 'global_weights_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.global_weights_filename=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function NormalizationFactors_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function NormalizationFactors_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'normalization_factors_filename'), + handles=rmfield(handles, 'normalization_factors_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.normalization_factors_filename=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function WordsPerDoc_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function WordsPerDoc_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'words_per_doc_filename'), + handles=rmfield(handles, 'words_per_doc_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.words_per_doc_filename=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Titles_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function Titles_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'titles_filename'), + handles=rmfield(handles, 'titles_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.titles_filename=s; +guidata(hObject, handles); + +% --- Executes during object creation, after setting all properties. +function Files_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function Files_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'files_filename'), + handles=rmfield(handles, 'files_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.files_filename=s; +guidata(hObject, handles); + + +% --- Executes during object creation, after setting all properties. +function WordsPerQuery_CreateFcn(hObject, eventdata, handles) + +if ispc + set(hObject,'BackgroundColor', [0.8824 0.8824 0.8824]); +else + set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); +end + + + +function WordsPerQuery_Callback(hObject, eventdata, handles) + +s=get(hObject, 'String'); +guidata(hObject, handles); +if isempty(s) & isfield(handles, 'words_per_query_filename'), + handles=rmfield(handles, 'words_per_query_filename'); + guidata(hObject, handles); + return; +end +if isempty(s), return; end +[pathstr, name, ext] = fileparts(s); +if ~isequal(ext, '.mat'), + s=strcat(s, '.mat'); +end + +handles.words_per_query_filename=s; +guidata(hObject, handles); + +% --- Executes when user attempts to close figure1. +function figure1_CloseRequestFcn(hObject, eventdata, handles) + +if isequal(get(handles.figure1, 'waitstatus'), 'waiting') + uiresume(handles.figure1); +else + delete(handles.figure1); +end + +%set Active and BackgroundColor field of each uicontrol item depending on +%the Radio Button that is pressed (called by the corresponding callback) +function handles=activate_uicontrol(states, handles) +sz=size(handles.objects, 1); +for i=1:sz, + if states(i), tmp='on'; else, tmp='off'; end + set(handles.objects(i), 'Enable', tmp); + if states(i)==0 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', handles.light_gray);continue; + end + if states(i)==1 & isequal(get(handles.objects(i), 'Style'), 'edit'), + set(handles.objects(i), 'BackgroundColor', 'white'); + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_template.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_template.m new file mode 100644 index 0000000000000000000000000000000000000000..14e110a2d1b14603e2ec92e4e9033ea30a66e73d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/tmg_template.m @@ -0,0 +1,105 @@ +% TDM_TEMPLATE - demo script +% This is a template script demonstrating the use of TMG, +% as well as the application of the resulting TDM'S in +% two IR tasks, quering and clustering. The quering models +% used is the Vector Space Model (see vsm.m) and LSI +% (see lsi.m), while two versions of the k-means algorithm +% (euclidean and spherical, see ekmeans.m and skmeans.m) +% cluster the resulting matrix (see also pddp.m). The user can +% edit this code in order to change the default OPTIONS of +% TMG, as well as to apply other IR tasks or use his own +% implementations regarding these tasks. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +% ---Edit these lines in order to set the desired OPTIONS for tmg----- +% OPTIONS.use_mysql=1; % uncomment this line is MySQL is installed in order to store results +% OPTIONS.db_name=''; % uncomment and edit this line in order to store resulting mat files to the data directory +OPTIONS.delimiter='emptyline'; +OPTIONS.line_delimiter=1; +% OPTIONS.stoplist='common_words'; +OPTIONS.stemming=0; +OPTIONS.update_step=10000; +OPTIONS.min_length=3; +OPTIONS.max_length=30; +OPTIONS.min_local_freq=1; +OPTIONS.min_global_freq=1; +OPTIONS.max_local_freq=inf; +OPTIONS.max_global_freq=inf; +OPTIONS.local_weight='t'; +OPTIONS.global_weight='x'; +OPTIONS.normalization='x'; +OPTIONS.dsp=1; +OPTIONS.remove_al=0; +OPTIONS.remove_num=0; +OPTIONS.parse_subd=0; +% -------------------------------------------------------------------- + +% ---Run tmg---------------------------------------------------------- +filename=strcat(fileparts(mfilename('fullpath')),filesep,'sample_documents/sample1'); +[A, dictionary, global_weights, normalization_factors, words_per_doc, titles, files, update_struct]=... + tmg(filename, OPTIONS); +% -------------------------------------------------------------------- + +% ---Edit these lines in order to set the desired OPTIONS for tmg_query----- +OPTIONS.delimiter='emptyline'; +OPTIONS.line_delimiter=1; +% OPTIONS.stoplist=common_words; +OPTIONS.stemming=0; +OPTIONS.local_weight='t'; +OPTIONS.global_weights=global_weights; +OPTIONS.dsp=1; +OPTIONS.remove_al=0; +OPTIONS.remove_num=0; +OPTIONS.parse_subd=0; +% -------------------------------------------------------------------------- + +% ---Run tmg_query---------------------------------------------------------- +query=strcat(fileparts(mfilename('fullpath')),filesep,'sample_documents/sample_query1'); +[Q, words_per_query, titles_query, files_query] = ... + tmg_query(query, dictionary, OPTIONS); +% -------------------------------------------------------------------------- + +% ---Edit these lines in order to set the desired OPTIONS for clustering functions----- +OPTIONSc.iter=10; +% OPTIONSc.epsilon=1; +OPTIONSc.dsp=1; +%OPTIONS.remove_al=0; +%OPTIONS.remove_num=0; +% -------------------------------------------------------------------------- + +% ---Apply VSM, LSI or k-means (euclidean or spherical) clustering algorithm to the resulting tdm's------- +an=new_sprintf('1. Run Vector Space Model.\n2. Run LSI.\n3. Run ekmeans algorithm.\n4. Run skmeans algorithm.\n5. Exit.');disp(an); +an=input('Give your choice: '); +while an<1 | an>5, + an=input('Give your choice (1-5): '); +end +switch an, + case 1, + % ---Edit this line in order to use another implementation of VSM---- + sc=zeros(size(Q, 2), size(A, 2)); doc_inds=sc; + for i=1:size(Q, 2), [sc(i, :), doc_inds(i, :)]=vsm(A, Q(:, i), 1); end + % ------------------------------------------------------------------ + case 2, + % ---Edit this line in order to use another function for the computation of the SVD + k=min(size(A));[U, S, V]=svds(A, min(k, 20)); + % ---------------------------------------------------------- + docs=S*V'; + sc=zeros(size(Q, 2), size(A, 2)); doc_inds=sc; + for i=1:size(Q, 2), [sc(i, :), doc_inds(i, :)]=lsa(docs, U, Q(:, i), 1); end + case 3, + % ---Edit this line in order to use another clustering algorithm---- + C=[]; + k=2; + % epsilon=1; + [cluster_struct, centroids, Q]=ekmeans(A, C, min(size(A, 2), k), 'n_iter', OPTIONSc); + % ------------------------------------------------------------------ + case 4, + % ---Edit this line in order to use another clustering algorithm---- + C=[]; + k=2; + % epsilon=1; + [cluster_struct, centroids, Q]=skmeans(A, C, min(size(A, 2), k), 'n_iter', OPTIONSc); + % ------------------------------------------------------------------ +end +% -------------------------------------------------------------------------- diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_elements.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_elements.m new file mode 100644 index 0000000000000000000000000000000000000000..775a482a6f8fe22e8874b8ceeb2955fef90191f9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_elements.m @@ -0,0 +1,12 @@ +function [elements, n]=unique_elements(x) +% UNIQUE_ELEMENTS - detects all distinct elements of a vector +% [ELEMENTS, N] = UNIQUE_ELEMENTS(X) returns in ELEMENTS all +% distinct elements of vector X, and in N the number of times +% each element appears in X. A value is repeated if it appears +% in non-consecutive elements. For no repetitive elements sort +% the input vector. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +[elements, n]=unique_elements_p(x); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_elements_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_elements_p.p new file mode 100644 index 0000000000000000000000000000000000000000..8b8175e6d67e818f208ed7043ce409a043fafbfd Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_elements_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_words.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_words.m new file mode 100644 index 0000000000000000000000000000000000000000..21efa2bcfcd2fd84d8c862df29d23f66c9c3e048 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_words.m @@ -0,0 +1,15 @@ +function [new_words, new_doc_ids]=unique_words(words, doc_ids, n_docs) +% UNIQUE_WORDS - detects all distinct elements of a cell array of +% chars (used by tmg.m, tmg_query.m, tdm_update.m) +% [NEW_WORDS, NEW_DOC_IDS]=UNIQUE_WORDS(WORDS, DOC_IDS, N_DOCS) +% returns in NEW_WORDS all distinct elements of the cell array +% of chars WORDS. DOC_IDS is the vector of the document identifiers +% containing the corresponding words, while N_DOCS is the total +% number of documents contained to the collection. NEW_DOC_IDS +% contains the inverted index of the collection as a cell array +% of 2 x N_DOCS arrays. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(3, 3, nargin)); +[new_words, new_doc_ids]=unique_words_p(words, doc_ids, n_docs); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_words_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_words_p.p new file mode 100644 index 0000000000000000000000000000000000000000..02fc82abe41f43524bd9b8df7e6a9e7b16895993 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/unique_words_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/untex.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/untex.m new file mode 100644 index 0000000000000000000000000000000000000000..c8e2f7948ec77cf40e95dfe3ecc923f337b0980a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/untex.m @@ -0,0 +1,16 @@ +function result=untex(filename,directory) +% UNTEX - converts the input tex file to ASCII +% RESULT = UNTEX(FILENAME,DIRECTORY) converts the input tex +% files to ASCII, using untex filters suitable for unix systems +% or microsoft windows systems and moves the converted file into +% directory. +% RESULT returns a success indicator, e.g. -2 if the input +% file does not exist or has a wrong format, -1 if untex is +% not installed for unix users or the untex.exe is missing for windows +% users, 0 if untexing didn't work properly, and 1 if the conversion +% was successful. +% Copyright 2011 Eugenia Maria Kontopoulou, Dimitrios Zeimpekis, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); + +result=untex_p(filename,directory); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/untex_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/untex_p.p new file mode 100644 index 0000000000000000000000000000000000000000..0c5d4b77a35c5bc19a44824a929dd6eee1d7f7d3 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/untex_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/ANLS/fcnnls.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/ANLS/fcnnls.m new file mode 100644 index 0000000000000000000000000000000000000000..b5cc6cf04b518014b8fa5f410390b67d159d7d46 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/ANLS/fcnnls.m @@ -0,0 +1,111 @@ +% M. H. Van Benthem and M. R. Keenan, J. Chemometrics 2004; 18: 441-450 +% +% Given A and C this algorithm solves for the optimal +% K in a least squares sense, using that +% A = C*K +% in the problem +% min ||A-C*K||, s.t. K>=0, for given A and C. +% +function [K, Pset] = fcnnls(C, A) +% NNLS using normal equations and the fast combinatorial strategy +% +% I/O: [K, Pset] = fcnnls(C, A); +% K = fcnnls(C, A); +% +% C is the nObs x lVar coefficient matrix +% A is the nObs x pRHS matrix of observations +% K is the lVar x pRHS solution matrix +% Pset is the lVar x pRHS passive set logical array +% +% M. H. Van Benthem and M. R. Keenan +% Sandia National Laboratories +% +% Pset: set of passive sets, one for each column +% Fset: set of column indices for solutions that have not yet converged +% Hset: set of column indices for currently infeasible solutions +% Jset: working set of column indices for currently optimal solutions +% +% Check the input arguments for consistency and initialize +error(nargchk(2,2,nargin)) +[nObs, lVar] = size(C); +if size(A,1)~= nObs, error('C and A have imcompatible sizes'), end +pRHS = size(A,2); +W = zeros(lVar, pRHS); +iter=0; maxiter=3*lVar; +% Precompute parts of pseudoinverse +CtC = C'*C; CtA = C'*A; +% Obtain the initial feasible solution and corresponding passive set +K = cssls(CtC, CtA); +Pset = K > 0; +K(~Pset) = 0; +D = K; +Fset = find(~all(Pset)); +% Active set algorithm for NNLS main loop +oitr=0; % HKim +while ~isempty(Fset) + + oitr=oitr+1; if oitr > 5, fprintf('%d ',oitr);, end % HKim + + % Solve for the passive variables (uses subroutine below) + K(:,Fset) = cssls(CtC, CtA(:,Fset), Pset(:,Fset)); + % Find any infeasible solutions + Hset = Fset(find(any(K(:,Fset) < 0))); + % Make infeasible solutions feasible (standard NNLS inner loop) + if ~isempty(Hset) + nHset = length(Hset); + alpha = zeros(lVar, nHset); + while ~isempty(Hset) & (iter < maxiter) + iter = iter + 1; + alpha(:,1:nHset) = Inf; + % Find indices of negative variables in passive set + [i, j] = find(Pset(:,Hset) & (K(:,Hset) < 0)); + if isempty(i), break, end + hIdx = sub2ind([lVar nHset], i, j); + if nHset==1, % HKim + negIdx = sub2ind(size(K), i, Hset*ones(length(j),1)); %HKim + else % HKim + negIdx = sub2ind(size(K), i, Hset(j)'); + end % HKim + alpha(hIdx) = D(negIdx)./(D(negIdx) - K(negIdx)); + [alphaMin,minIdx] = min(alpha(:,1:nHset)); + alpha(:,1:nHset) = repmat(alphaMin, lVar, 1); + D(:,Hset) = D(:,Hset)-alpha(:,1:nHset).*(D(:,Hset)-K(:,Hset)); + idx2zero = sub2ind(size(D), minIdx, Hset); + D(idx2zero) = 0; + Pset(idx2zero) = 0; + K(:, Hset) = cssls(CtC, CtA(:,Hset), Pset(:,Hset)); + Hset = find(any(K < 0)); nHset = length(Hset); + end + end%if + % Make sure the solution has converged + %if iter == maxiter, error('Maximum number iterations exceeded'), end + % Check solutions for optimality + W(:,Fset) = CtA(:,Fset)-CtC*K(:,Fset); + Jset = find(all(~Pset(:,Fset).*W(:,Fset) <= 0)); + Fset = setdiff(Fset, Fset(Jset)); + % For non-optimal solutions, add the appropriate variable to Pset + if ~isempty(Fset) + [mx, mxidx] = max(~Pset(:,Fset).*W(:,Fset)); + Pset(sub2ind([lVar pRHS], mxidx, Fset)) = 1; + D(:,Fset) = K(:,Fset); + end +end +% ****************************** Subroutine**************************** +function [K] = cssls(CtC, CtA, Pset) +% Solve the set of equations CtA = CtC*K for the variables in set Pset +% using the fast combinatorial approach +K = zeros(size(CtA)); +if (nargin == 2) || isempty(Pset) || all(Pset(:)) + K = CtC\CtA; +else + [lVar pRHS] = size(Pset); + codedPset = 2.^(lVar-1:-1:0)*Pset; + [sortedPset, sortedEset] = sort(codedPset); + breaks = diff(sortedPset); + breakIdx = [0 find(breaks) pRHS]; + for k = 1:length(breakIdx)-1 + cols2solve = sortedEset(breakIdx(k)+1:breakIdx(k+1)); + vars = Pset(:,sortedEset(breakIdx(k)+1)); + K(vars,cols2solve) = CtC(vars,vars)\CtA(vars,cols2solve); + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/ANLS/nmfanls_comb.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/ANLS/nmfanls_comb.m new file mode 100644 index 0000000000000000000000000000000000000000..2a27c5bba30bf52d0270d7998c20a8d36736fe3f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/ANLS/nmfanls_comb.m @@ -0,0 +1,111 @@ +% +% NMF/ANLS +% +% Author: Hyunsoo Kim and Haesun Park, Georgia Insitute of Technology +% Modified by: Dimitris Zeimpekis (zeimpekis@gmail.com) +% +% Reference: +% +% Non-negative Matrix Factorization Based on Alternating Non-negativity +% Constrained Least Squares and Active Set Method, +% Hyunsoo Kim and Haesun Park, SIAM J. Matrix Anal. Appl., to appear, 2008. +% +% URL for updating codes: +% http://compbio.med.harvard.edu/hkim/nmf/index.html +% +% This software requires fcnnls.m that can be obtained from +% M. H. Van Benthem and M. R. Keenan, J. Chemometrics, 2004; 18: 441-450 +% +% NMF: min_{W,H} (1/2) || A - WH ||_F^2 s.t. W>=0, H>=0 +% +% A: m x n data matrix (m: features, n: data points) +% W: m x k basis matrix +% H: k x n coefficient matrix +% +% function +% [W,H,i]=nmfanls_comb(A,k,H,verbose,bi_conv,eps_conv) +% +% input parameters: +% A: m x n data matrix (m: features, n: data points) +% k: desired positive integer k +% H: initial k x n coefficient matrix (is empty initialized to a random +% matrix) +% verbose: verbose = 0 for silence mode, otherwise print log +% bi_conv=[wminchange iconv] biclustering convergence test +% wminchange: the minimal allowance of the change of +% row-clusters (default wminchange=0) +% iconv: decide convergence if row-clusters (within wminchange) +% and column-clusters have not changed for iconv +% convergence checks. (default iconv=10) +% eps_conv: epsilon (to check KKT convergence) +% The smaller epsilon, the more rigorous KKT convergence +% check is. (default eps_conv = 1e-4) +% +% output: +% W: m x k basis matrix +% H: k x n coefficient matrix +% i: the number of iterations +% +% sample usage: +% [W,H]=nmfanls_comb(amlall,3,[],1); +% [W,H]=nmfanls_comb(amlall,3,[],1,[3 10]); +% -- in the convergence check, the row-cluster change +% of at most three rows is allowed. +% +% +function [W,H,i]=nmfanls_comb(A,k,H,verbose,bi_conv,eps_conv) + +if nargin<2, error('too small number of input arguments.'); end +if nargin<6, eps_conv=1e-4; end +if nargin<5, bi_conv=[0 10]; end +if nargin<4, verbose=1; end +if nargin<3, H=rand(k,size(A,2)); end +if isempty(H), H=rand(k,size(A,2)); end + +[m,n]=size(A); maxiter=20000; +wminchange=bi_conv(1); iconv=bi_conv(2); + +if verbose, + fprintf('NMF/ANLS k=%d iconv=%d eps_conv=%e\n',k,iconv,eps_conv); +end + +idxWold=zeros(m,1); idxHold=zeros(1,n); inc=0; + +% initialize random H +%%H=rand(k,n); + +for i=1:maxiter + + % min_w ||H'*W' - A'||, s.t. W>=0, for given A and H. + Wt=fcnnls(H',A'); W=Wt'; + + % min_h ||W*H - A||, s.t. H>=0, for given A and W. + H = fcnnls(W,A); + + % test convergence every 5 iterations + if(mod(i,5)==0) || (i==1) + [y,idxW]=max(W,[],2); [y,idxH]=max(H,[],1); + changedW=length(find(idxW ~= idxWold)); changedH=length(find(idxH ~= idxHold)); + if (changedW<=wminchange) && (changedH==0), inc=inc+1; else inc=0; end + + resmat=min(H,(W'*W)*H-W'*A); resvec=resmat(:); + resmat=min(W,W*(H*H')-A*H'); resvec=[resvec; resmat(:)]; + deltao=norm(resvec,1); %L1-norm + num_notconv=length(find(abs(resvec)>0)); + delta=deltao/num_notconv; + if i==1, delta1=delta; end + + if verbose || (mod(i,1000)==0) % prints number of changing elements + fprintf('\t%d\t%d\t%d %d --- delta: %.4e\n',... + i,inc,changedW,changedH,delta); + end + if (inc>=iconv) && (delta<=eps_conv*delta1), break, end + idxWold=idxW; idxHold=idxH; + end + +end + +% normalization +norm2=sqrt(sum(W.^2,1)); W=W./repmat(norm2,m,1); H=H.*repmat(norm2',1,n); + +return; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/NNDSVD/neg.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/NNDSVD/neg.m new file mode 100644 index 0000000000000000000000000000000000000000..82391812b29892f149cea9df3f19d6811c953551 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/NNDSVD/neg.m @@ -0,0 +1,2 @@ +function [Am] = neg(A); +Am = (A<0).*(-A); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/NNDSVD/nndsvd.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/NNDSVD/nndsvd.m new file mode 100644 index 0000000000000000000000000000000000000000..597cb9096d93f2299523420c14576ceb29748e98 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/NNDSVD/nndsvd.m @@ -0,0 +1,110 @@ +function [W,H] = nndsvd(A,k,svd_method,flag); +% +% This function implements the NNDSVD algorithm described in [1] for +% initializattion of Nonnegative Matrix Factorization Algorithms. +% +% [W,H] = nndsvd(A,k,svd_method,flag); +% +% INPUT +% ------------ +% +% A : the input nonnegative m x n matrix A +% k : the rank of the computed factors W,H +% svd_method: SVD method, possible values, svds, propack +% flag : indicates the variant of the NNDSVD Algorithm +% flag=0 --> NNDSVD +% flag=1 --> NNDSVDa +% flag=2 --> NNDSVDar +% +% OUTPUT +% ------------- +% +% W : nonnegative m x k matrix +% H : nonnegative k x n matrix +% +% +% References: +% +% [1] C. Boutsidis and E. Gallopoulos, SVD-based initialization: A head +% start for nonnegative matrix factorization, Pattern Recognition, 2007 +% doi:10.1016/j.patcog.2007.09.010 +% +% This code is kindly provided by the authors for research purposes. +% - Efstratios Gallopoulos (stratis@ceid.upatras.gr) +% - Christos Boutsidis (boutsc@cs.rpi.edu) +% +% Modified by Dimitris Zeimpekis (zeimpekis@gmail.com) +% +% +% For questions or comments please send an e-mail to +% boutsc@cs.rpi.edu (Christos Boutsidis) + +%check the input matrix +if numel(find(A<0)) > 0 + error('The input matrix contains negative elements !') +end + +if ~isequal(svd_method,'svds') & ~isequal(svd_method,'propack'), svd_method='svds'; end + +%size of input matrix +[m,n] = size(A); + +%the matrices of the factorization +W = zeros(m,k); +H = zeros(k,n); + +%1st SVD --> partial SVD rank-k to the input matrix A. +if isequal(svd_method,'svds'), + [U,S,V] = svds(A,k); +else, + warning off; [U,S,V]=lansvd(A,k,'L'); warning on; +end + +%choose the first singular triplet to be nonnegative +W(:,1) = sqrt(S(1,1)) * abs(U(:,1) ); +H(1,:) = sqrt(S(1,1)) * abs(V(:,1)'); + +% second SVD for the other factors (see table 1 in our paper) +for i=2:k + uu = U(:,i); vv = V(:,i); + uup = pos(uu); uun = neg(uu) ; + vvp = pos(vv); vvn = neg(vv); + n_uup = norm(uup); + n_vvp = norm(vvp) ; + n_uun = norm(uun) ; + n_vvn = norm(vvn) ; + termp = n_uup*n_vvp; termn = n_uun*n_vvn; + if (termp >= termn) + W(:,i) = sqrt(S(i,i)*termp)*uup/n_uup; + H(i,:) = sqrt(S(i,i)*termp)*vvp'/n_vvp; + else + W(:,i) = sqrt(S(i,i)*termn)*uun/n_uun; + H(i,:) = sqrt(S(i,i)*termn)*vvn'/n_vvn; + end +end +%------------------------------------------------------------ + +%actually these numbers are zeros +W(find(W<0.0000000001))=0; +H(find(H<0.0000000001))=0; + +%fill in the zero elements with the average : NNDSVDa +if flag==1 + ind1 = find(W==0) ; + ind2 = find(H==0) ; + average = mean(A(:)) ; + W( ind1 ) = average ; + H( ind2 ) = average ; + +% fill in the zero elements with random values in the space :[0:average/100] +% NNDSVDar +elseif flag==2 + ind1 = find(W==0) ; + ind2 = find(H==0) ; + n1 = numel(ind1); + n2 = numel(ind2); + + average = mean(A(:)) ; + W( ind1 ) = (average*rand(n1,1)./100) ; + H( ind2 ) = (average*rand(n2,1)./100) ; +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/NNDSVD/pos.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/NNDSVD/pos.m new file mode 100644 index 0000000000000000000000000000000000000000..20b901d7914f6902bca37c20217d84ad737e764c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/NNDSVD/pos.m @@ -0,0 +1,2 @@ +function [Ap] = pos(A) +Ap = (A>=0).*A; diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/Afunc.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/Afunc.m new file mode 100644 index 0000000000000000000000000000000000000000..92073c79a0067dfc39c8fced7115395dbeb09f58 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/Afunc.m @@ -0,0 +1,12 @@ +function y=Afunc(x) +% y=Afunc(x) +% Testfunction returning a linear operator applied to x. +% Used for testing lansvd. +% +% y = A'*x + +% Rasmus Munk Larsen, DAIMI, 1998 + +global A MxV +y = A*x; +MxV = MxV + 1; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/AtAfunc.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/AtAfunc.m new file mode 100644 index 0000000000000000000000000000000000000000..ba823033035ddbec6dcccabda24b022bb931d77a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/AtAfunc.m @@ -0,0 +1,13 @@ +function y=AtAfunc(x) +% y=AtAfunc(x) +% Testfunction defining a linear operator applied to x. +% Used for testing laneig. +% +% y = A'*(A*x) + +% Rasmus Munk Larsen, DAIMI, 1998 + + +global A MxV +y = A'*(A*x); +MxV = MxV + 2; diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/Atransfunc.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/Atransfunc.m new file mode 100644 index 0000000000000000000000000000000000000000..d1f35d18e35fdc699adfa16abcd064a5d3c91f19 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/Atransfunc.m @@ -0,0 +1,12 @@ +function y=Atransfunc(x) +% y=Atransfunc(x) +% Testfunction returning the transpose of a linear operator applied to x. +% Used for testing lansvd. +% +% y = A'*x + +% Rasmus Munk Larsen, DAIMI, 1998 + +global A MxV +y = A'*x; +MxV = MxV + 1; diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/Cfunc.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/Cfunc.m new file mode 100644 index 0000000000000000000000000000000000000000..013b84dc446d2d6b13f77696a5c9ebc4f0f1a8f0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/Cfunc.m @@ -0,0 +1,15 @@ +function y = Cfunc(x) +% y=Cfunc(x) +% Testfunction defining a linear operator applied to x. +% Used for testing laneig. +% +% y = [ 0 A ] * x +% [ A' 0 ] + +% Rasmus Munk Larsen, DAIMI, 1998 + + +global A MxV +[m n] = size(A); +y = [A*x(m+1:end,:); A'*x(1:m,:)]; +MxV = MxV + 2; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.m new file mode 100644 index 0000000000000000000000000000000000000000..35bdab8f49591e996379c56ce660aec846dcf14a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.m @@ -0,0 +1,31 @@ +function [sigma,bnd] = bdsqr(alpha,beta) + +% BDSQR: Compute the singular values and bottom element of +% the left singular vectors of a (k+1) x k lower bidiagonal +% matrix with diagonal alpha(1:k) and lower bidiagonal beta(1:k), +% where length(alpha) = length(beta) = k. +% +% [sigma,bnd] = bdsqr(alpha,beta) +% +% Input parameters: +% alpha(1:k) : Diagonal elements. +% beta(1:k) : Sub-diagonal elements. +% Output parameters: +% sigma(1:k) : Computed eigenvalues. +% bnd(1:k) : Bottom elements in left singular vectors. + +% Below is a very slow replacement for the BDSQR MEX-file. + +warning('PROPACK:NotUsingMex','Using slow matlab code for bdsqr.') +k = length(alpha); +if min(size(alpha)') ~= 1 | min(size(beta)') ~= 1 + error('alpha and beta must be vectors') +elseif length(beta) ~= k + error('alpha and beta must have the same lenght') +end +B = spdiags([alpha(:),beta(:)],[0,-1],k+1,k); +[U,S,V] = svd(full(B),0); +sigma = diag(S); +bnd = U(end,1:k)'; + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexglx b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexglx new file mode 100644 index 0000000000000000000000000000000000000000..3972ea975dd84a082051240b4770032935e8405c Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexglx differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexsg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexsg new file mode 100644 index 0000000000000000000000000000000000000000..3a0c1a2acda4ca359f48b55ada25b9b57c86c636 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexsg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexsg64 b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexsg64 new file mode 100644 index 0000000000000000000000000000000000000000..56d48bfa79c236e65c327a49a368991966476d23 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexsg64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexsol b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexsol new file mode 100644 index 0000000000000000000000000000000000000000..345566abba98106a927710ee68ece7037644d043 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr.mexsol differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr_mex.c b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr_mex.c new file mode 100644 index 0000000000000000000000000000000000000000..004c000d2401c06cc4d9771f9139aa54abddd139 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/bdsqr_mex.c @@ -0,0 +1,71 @@ +/* +MEX interface for LAPACK routine bdsqr. +Matlab calling sequence: + [sigma,bnd] = bdsqr(alpha,beta) +*/ + +#include <stdio.h> +#include <string.h> +#include "mex.h" + +/* Templates for FORTRAN routines: */ +void dbdqr_(int *n, double *d, double *e, double *c1, double *c2); +void dbdsqr_(char *uplo, int *n, int *ncvt, int *nru, int *ncc, + double *d, double *e, double *vt, int *ldt, double *u, + int *ldu, double *c, int *ldc, double *work, int *info); + +/* Here comes the gateway function to be called by Matlab: */ +void mexFunction(int nlhs, mxArray *plhs[], + int nrhs, const mxArray *prhs[]) +{ + int m, n, i, info, zero=0, one=1; + double *d,*e,dummy, *wrk, *bnd; + + if (nrhs != 2) + mexErrMsgTxt("bdsqr requires two input arguments"); + else if (nlhs != 2) + mexErrMsgTxt("bdsqr requires two output arguments"); + + m = mxGetM(prhs[0]); /* get the dimensions of the input */ + n = mxGetN(prhs[0]); + /* make sure input input vectors are same length */ + if (m != mxGetM(prhs[1]) ) + mexErrMsgTxt("alpha and beta must have the same size"); + /* make sure input is m x 1 */ + if ( n != 1 || mxGetN(prhs[1]) != 1 || n != mxGetN(prhs[1])) + mexErrMsgTxt("alpha and beta must be a m x 1 vectors"); + + /* Create/allocate return arguments */ + for (i=0; i<2; i++) { + plhs[i]=mxCreateDoubleMatrix(m,1,mxREAL); + } + + e = mxCalloc(m,sizeof(double)); + wrk = mxCalloc(4*m-4,sizeof(double)); + d = mxGetPr(plhs[0]); + memcpy(d,mxGetPr(prhs[0]), m*sizeof(double)); + memcpy(e,mxGetPr(prhs[1]), m*sizeof(double)); + bnd = mxGetPr(plhs[1]); + for (i=0; i<m; i++) + bnd[i] = 0; + + /* Reduce to upper m-by-m upper bidiagonal */ + dbdqr_(&m, d, e, &bnd[m-1],&dummy); + + /* Compute singular values and last row of U */ + dbdsqr_("u", &m, &zero, &one, &zero, d, e, &dummy, &one, + bnd, &one, &dummy, &one, wrk, &info); + + /* Check exit status of dbdsqr */ + if ( info < 0 ) + mexErrMsgTxt("DBDSQR was called with illegal arguments"); + else if ( info > 0) + mexWarnMsgTxt("DBDSQR: singular values did not converge"); + + /* Free work arrays */ + mxFree(e); + mxFree(wrk); +} + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/compute_int.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/compute_int.m new file mode 100644 index 0000000000000000000000000000000000000000..e3aa06ea7450c22b8861f1726bd4ce10b3e499a8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/compute_int.m @@ -0,0 +1,56 @@ +function int = compute_int(mu,j,delta,eta,LL,strategy,extra) +%COMPUTE_INT: Determine which Lanczos vectors to reorthogonalize against. +% +% int = compute_int(mu,eta,LL,strategy,extra)) +% +% Strategy 0: Orthogonalize vectors v_{i-r-extra},...,v_{i},...v_{i+s+extra} +% with nu>eta, where v_{i} are the vectors with mu>delta. +% Strategy 1: Orthogonalize all vectors v_{r-extra},...,v_{s+extra} where +% v_{r} is the first and v_{s} the last Lanczos vector with +% mu > eta. +% Strategy 2: Orthogonalize all vectors with mu > eta. +% +% Notice: The first LL vectors are excluded since the new Lanczos +% vector is already orthogonalized against them in the main iteration. + +% Rasmus Munk Larsen, DAIMI, 1998. + +if (delta<eta) + error('DELTA should satisfy DELTA >= ETA.') +end +switch strategy + case 0 + I0 = find(abs(mu(1:j))>=delta); + if length(I0)==0 + [mm,I0] = max(abs(mu(1:j))); + end + int = zeros(j,1); + for i = 1:length(I0) + for r=I0(i):-1:1 + if abs(mu(r))<eta | int(r)==1 + break; + else + int(r) = 1; + end + end + int(max(1,r-extra+1):r) = 1; + for s=I0(i)+1:j + if abs(mu(s))<eta | int(s)==1 + break; + else + int(s) = 1; + end + end + int(s:min(j,s+extra-1)) = 1; + end + if LL>0 + int(1:LL) = 0; + end + int = find(int); + case 1 + int=find(abs(mu(1:j))>eta); + int = max(LL+1,min(int)-extra):min(max(int)+extra,j); + case 2 + int=find(abs(mu(1:j))>=eta); +end +int = int(:); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/dbdqr.f b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/dbdqr.f new file mode 100644 index 0000000000000000000000000000000000000000..755a9f8c7210c1450317a1d74bb9bb956455bef5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/dbdqr.f @@ -0,0 +1,23 @@ + + subroutine dbdqr(n, D, E, c1, c2) + implicit none + integer n + double precision D(*),E(*),c1,c2 + + integer i + double precision cs,sn,r + + if (n.lt.2) return + do i=1,n-1 + call dlartg(d(i),e(i),cs,sn,r) + d(i) = r + e(i) = sn*d(i+1) + d(i+1) = cs*d(i+1) + enddo + call dlartg(d(n),e(n),cs,sn,r) + d(n) = r + e(n) = 0.0 + c1 = sn + c2 = cs + end + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/helio.mat b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/helio.mat new file mode 100644 index 0000000000000000000000000000000000000000..b43fb5d5e3b29815341d2b072c1ace5f2d1ca5b9 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/helio.mat differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanbpro.doc b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanbpro.doc new file mode 100644 index 0000000000000000000000000000000000000000..381410b65c5b3ab25abad7765f46dd240c5bdab6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanbpro.doc @@ -0,0 +1,85 @@ +LANBPRO Lanczos bidiagonalization with partial reorthogonalization. + +LANBPRO computes the Lanczos bidiagonalization of a real +matrix using the with partial reorthogonalization. + +[U_k,B_k,V_k,R,ierr,work] = LANBPRO(A,K,R0,OPTIONS,U_old,B_old,V_old) +[U_k,B_k,V_k,R,ierr,work] = LANBPRO('Afun','Atransfun',M,N,K,R0, ... + OPTIONS,U_old,B_old,V_old) + +Computes K steps of the Lanczos bidiagonalization algorithm with partial +reorthogonalization (BPRO) with M-by-1 starting vector R0, producing a +lower bidiagonal K-by-K matrix B_k, an N-by-K matrix V_k, an M-by-K +matrix U_k and a M-by-1 vector such that + A*V_k = U_k*B_k + R +Partial reorthogonalization is used to keep the columns of V_K and U_k +semiorthogonal: + MAX(DIAG((EYE(K) - V_K'*V_K))) <= OPTIONS.delta +and + MAX(DIAG((EYE(K) - U_K'*U_K))) <= OPTIONS.delta. + +B_k = LANBPRO(...) returns the bidiagonal matrix only. + +The first input argument is either a real matrix, or a string +containing the name of an M-file which applies a linear operator +to the columns of a given matrix. In the latter case, the second +input must be the name of an M-file which applies the transpose of +the same linear operator to the columns of a given matrix, +and the third and fourth arguments must be M and N, the dimensions +of then problem. + +The OPTIONS structure is used to control the reorthogonalization: + OPTIONS.delta: Desired level of orthogonality + (default = sqrt(eps/K)). + OPTIONS.eta : Level of orthogonality after reorthogonalization + (default = eps^(3/4)/sqrt(K)). + OPTIONS.cgs : Flag for switching between different reorthogonalization + algorithms: + 0 = iterated modified Gram-Schmidt (default) + 1 = iterated classical Gram-Schmidt + OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local + reorthogonalization is enforced. + OPTIONS.onesided + : If OPTIONS.onesided = 0 (default) then both the left + (U) and right (V) Lanczos vectors are kept + semiorthogonal. + OPTIONS.onesided = 1 then only the columns of U are + are reorthogonalized. + OPTIONS.onesided = -1 then only the columns of V are + are reorthogonalized. + OPTIONS.waitbar + : The progress of the algorithm is display graphically. + +If both R0, U_old, B_old, and V_old are provided, they must +contain a partial Lanczos bidiagonalization of A on the form + + A V_old = U_old B_old + R0 . + +In this case the factorization is extended to dimension K x K by +continuing the Lanczos bidiagonalization algorithm with R0 as a +starting vector. + +The output array work contains information about the work used in +reorthogonalizing the u- and v-vectors. + work = [ RU PU ] + [ RV PV ] +where + RU = Number of reorthogonalizations of U. + PU = Number of inner products used in reorthogonalizing U. + RV = Number of reorthogonalizations of V. + PV = Number of inner products used in reorthogonalizing V. + +References: +R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. + +G. H. Golub & C. F. Van Loan, "Matrix Computations", +3. Ed., Johns Hopkins, 1996. Section 9.3.4. + +B. N. Parlett, ``The Symmetric Eigenvalue Problem'', +Prentice-Hall, Englewood Cliffs, NJ, 1980. + +H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', +Math. Comp. 42 (1984), no. 165, 115--142. + + +Rasmus Munk Larsen, DAIMI, 1998. diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanbpro.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanbpro.m new file mode 100644 index 0000000000000000000000000000000000000000..2e3e272ba6a1afc75f225b933aa6e1ccc1b4dba4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanbpro.m @@ -0,0 +1,699 @@ +function [U,B_k,V,p,ierr,work] = lanbpro(varargin) + +%LANBPRO Lanczos bidiagonalization with partial reorthogonalization. +% LANBPRO computes the Lanczos bidiagonalization of a real +% matrix using the with partial reorthogonalization. +% +% [U_k,B_k,V_k,R,ierr,work] = LANBPRO(A,K,R0,OPTIONS,U_old,B_old,V_old) +% [U_k,B_k,V_k,R,ierr,work] = LANBPRO('Afun','Atransfun',M,N,K,R0, ... +% OPTIONS,U_old,B_old,V_old) +% +% Computes K steps of the Lanczos bidiagonalization algorithm with partial +% reorthogonalization (BPRO) with M-by-1 starting vector R0, producing a +% lower bidiagonal K-by-K matrix B_k, an N-by-K matrix V_k, an M-by-K +% matrix U_k and an M-by-1 vector R such that +% A*V_k = U_k*B_k + R +% Partial reorthogonalization is used to keep the columns of V_K and U_k +% semiorthogonal: +% MAX(DIAG((EYE(K) - V_K'*V_K))) <= OPTIONS.delta +% and +% MAX(DIAG((EYE(K) - U_K'*U_K))) <= OPTIONS.delta. +% +% B_k = LANBPRO(...) returns the bidiagonal matrix only. +% +% The first input argument is either a real matrix, or a string +% containing the name of an M-file which applies a linear operator +% to the columns of a given matrix. In the latter case, the second +% input must be the name of an M-file which applies the transpose of +% the same linear operator to the columns of a given matrix, +% and the third and fourth arguments must be M and N, the dimensions +% of then problem. +% +% The OPTIONS structure is used to control the reorthogonalization: +% OPTIONS.delta: Desired level of orthogonality +% (default = sqrt(eps/K)). +% OPTIONS.eta : Level of orthogonality after reorthogonalization +% (default = eps^(3/4)/sqrt(K)). +% OPTIONS.cgs : Flag for switching between different reorthogonalization +% algorithms: +% 0 = iterated modified Gram-Schmidt (default) +% 1 = iterated classical Gram-Schmidt +% OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local +% reorthogonalization is enforced. +% OPTIONS.onesided +% : If OPTIONS.onesided = 0 (default) then both the left +% (U) and right (V) Lanczos vectors are kept +% semiorthogonal. +% OPTIONS.onesided = 1 then only the columns of U are +% are reorthogonalized. +% OPTIONS.onesided = -1 then only the columns of V are +% are reorthogonalized. +% OPTIONS.waitbar +% : The progress of the algorithm is display graphically. +% +% If both R0, U_old, B_old, and V_old are provided, they must +% contain a partial Lanczos bidiagonalization of A on the form +% +% A V_old = U_old B_old + R0 . +% +% In this case the factorization is extended to dimension K x K by +% continuing the Lanczos bidiagonalization algorithm with R0 as a +% starting vector. +% +% The output array work contains information about the work used in +% reorthogonalizing the u- and v-vectors. +% work = [ RU PU ] +% [ RV PV ] +% where +% RU = Number of reorthogonalizations of U. +% PU = Number of inner products used in reorthogonalizing U. +% RV = Number of reorthogonalizations of V. +% PV = Number of inner products used in reorthogonalizing V. + +% References: +% R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. +% +% G. H. Golub & C. F. Van Loan, "Matrix Computations", +% 3. Ed., Johns Hopkins, 1996. Section 9.3.4. +% +% B. N. Parlett, ``The Symmetric Eigenvalue Problem'', +% Prentice-Hall, Englewood Cliffs, NJ, 1980. +% +% H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', +% Math. Comp. 42 (1984), no. 165, 115--142. +% + +% Rasmus Munk Larsen, DAIMI, 1998. + +% Check input arguments. + +global LANBPRO_TRUTH +LANBPRO_TRUTH=0; + +if LANBPRO_TRUTH==1 + global MU NU MUTRUE NUTRUE + global MU_AFTER NU_AFTER MUTRUE_AFTER NUTRUE_AFTER +end + +if nargin<1 | length(varargin)<2 + error('Not enough input arguments.'); +end +narg=length(varargin); + +A = varargin{1}; +if isnumeric(A) | isstruct(A) + if isnumeric(A) + if ~isreal(A) + error('A must be real') + end + [m n] = size(A); + elseif isstruct(A) + [m n] = size(A.R); + end + k=varargin{2}; + if narg >= 3 & ~isempty(varargin{3}); + p = varargin{3}; + else + p = rand(m,1)-0.5; + end + if narg < 4, options = []; else options=varargin{4}; end + if narg > 4 + if narg<7 + error('All or none of U_old, B_old and V_old must be provided.') + else + U = varargin{5}; B_k = varargin{6}; V = varargin{7}; + end + else + U = []; B_k = []; V = []; + end + if narg > 7, anorm=varargin{8}; else anorm = []; end +else + if narg<5 + error('Not enough input arguments.'); + end + Atrans = varargin{2}; + if ~isstr(Atrans) + error('Afunc and Atransfunc must be names of m-files') + end + m = varargin{3}; + n = varargin{4}; + if ~isreal(n) | abs(fix(n)) ~= n | ~isreal(m) | abs(fix(m)) ~= m + error('M and N must be positive integers.') + end + k=varargin{5}; + if narg < 6, p = rand(m,1)-0.5; else p=varargin{6}; end + if narg < 7, options = []; else options=varargin{7}; end + if narg > 7 + if narg < 10 + error('All or none of U_old, B_old and V_old must be provided.') + else + U = varargin{8}; B_k = varargin{9}; V = varargin{10}; + end + else + U = []; B_k = []; V=[]; + end + if narg > 10, anorm=varargin{11}; else anorm = []; end +end + +% Quick return for min(m,n) equal to 0 or 1. +if min(m,n) == 0 + U = []; B_k = []; V = []; p = []; ierr = 0; work = zeros(2,2); + return +elseif min(m,n) == 1 + if isnumeric(A) + U = 1; B_k = A; V = 1; p = 0; ierr = 0; work = zeros(2,2); + else + U = 1; B_k = feval(A,1); V = 1; p = 0; ierr = 0; work = zeros(2,2); + end + if nargout<3 + U = B_k; + end + return +end + +% Set options. +%m2 = 3/2*(sqrt(m)+1); +%n2 = 3/2*(sqrt(n)+1); +m2 = 3/2; +n2 = 3/2; +delta = sqrt(eps/k); % Desired level of orthogonality. +eta = eps^(3/4)/sqrt(k); % Level of orth. after reorthogonalization. +cgs = 0; % Flag for switching between iterated MGS and CGS. +elr = 2; % Flag for switching extended local + % reorthogonalization on and off. +gamma = 1/sqrt(2); % Tolerance for iterated Gram-Schmidt. +onesided = 0; t = 0; waitb = 0; + +% Parse options struct +if ~isempty(options) & isstruct(options) + c = fieldnames(options); + for i=1:length(c) + if strmatch(c(i),'delta'), delta = getfield(options,'delta'); end + if strmatch(c(i),'eta'), eta = getfield(options,'eta'); end + if strmatch(c(i),'cgs'), cgs = getfield(options,'cgs'); end + if strmatch(c(i),'elr'), elr = getfield(options,'elr'); end + if strmatch(c(i),'gamma'), gamma = getfield(options,'gamma'); end + if strmatch(c(i),'onesided'), onesided = getfield(options,'onesided'); end + if strmatch(c(i),'waitbar'), waitb=1; end + end +end + +if waitb + waitbarh = waitbar(0,'Lanczos bidiagonalization in progress...'); +end + +if isempty(anorm) + anorm = []; est_anorm=1; +else + est_anorm=0; +end + +% Conservative statistical estimate on the size of round-off terms. +% Notice that {\bf u} == eps/2. +FUDGE = 1.01; % Fudge factor for ||A||_2 estimate. + +npu = 0; npv = 0; ierr = 0; +p = p(:); +% Prepare for Lanczos iteration. +if isempty(U) + V = zeros(n,k); U = zeros(m,k); + beta = zeros(k+1,1); alpha = zeros(k,1); + beta(1) = norm(p); + % Initialize MU/NU-recurrences for monitoring loss of orthogonality. + nu = zeros(k,1); mu = zeros(k+1,1); + mu(1)=1; nu(1)=1; + + numax = zeros(k,1); mumax = zeros(k,1); + force_reorth = 0; nreorthu = 0; nreorthv = 0; + j0 = 1; +else + j = size(U,2); % Size of existing factorization + % Allocate space for Lanczos vectors + U = [U, zeros(m,k-j)]; + V = [V, zeros(n,k-j)]; + alpha = zeros(k+1,1); beta = zeros(k+1,1); + alpha(1:j) = diag(B_k); if j>1 beta(2:j) = diag(B_k,-1); end + beta(j+1) = norm(p); + % Reorthogonalize p. + if j<k & beta(j+1)*delta < anorm*eps, + fro = 1; + ierr = j; + end + int = [1:j]'; + [p,beta(j+1),rr] = reorth(U,p,beta(j+1),int,gamma,cgs); + npu = rr*j; nreorthu = 1; force_reorth= 1; + + % Compute Gerscgorin bound on ||B_k||_2 + if est_anorm + anorm = FUDGE*sqrt(norm(B_k'*B_k,1)); + end + mu = m2*eps*ones(k+1,1); nu = zeros(k,1); + numax = zeros(k,1); mumax = zeros(k,1); + force_reorth = 1; nreorthu = 0; nreorthv = 0; + j0 = j+1; +end + + +if isnumeric(A) + At = A'; +end + +if delta==0 + fro = 1; % The user has requested full reorthogonalization. +else + fro = 0; +end + +if LANBPRO_TRUTH==1 + MUTRUE = zeros(k,k); NUTRUE = zeros(k-1,k-1); + MU = zeros(k,k); NU = zeros(k-1,k-1); + + MUTRUE_AFTER = zeros(k,k); NUTRUE_AFTER = zeros(k-1,k-1); + MU_AFTER = zeros(k,k); NU_AFTER = zeros(k-1,k-1); +end + +% Perform Lanczos bidiagonalization with partial reorthogonalization. +for j=j0:k + if waitb + waitbar(j/k,waitbarh) + end + + if beta(j) ~= 0 + U(:,j) = p/beta(j); + else + U(:,j) = p; + end + + % Replace norm estimate with largest Ritz value. + if j==6 + B = [[diag(alpha(1:j-1))+diag(beta(2:j-1),-1)]; ... + [zeros(1,j-2),beta(j)]]; + anorm = FUDGE*norm(B); + est_anorm = 0; + end + + %%%%%%%%%% Lanczos step to generate v_j. %%%%%%%%%%%%% + if j==1 + if isnumeric(A) + r = At*U(:,1); + elseif isstruct(A) + r = A.R\U(:,1); + else + r = feval(Atrans,U(:,1)); + end + alpha(1) = norm(r); + if est_anorm + anorm = FUDGE*alpha(1); + end + else + if isnumeric(A) + r = At*U(:,j) - beta(j)*V(:,j-1); + elseif isstruct(A) + r = A.R\U(:,j) - beta(j)*V(:,j-1); + else + r = feval(Atrans,U(:,j)) - beta(j)*V(:,j-1); + end + alpha(j) = norm(r); + + % Extended local reorthogonalization + if alpha(j)<gamma*beta(j) & elr & ~fro + normold = alpha(j); + stop = 0; + while ~stop + t = V(:,j-1)'*r; + r = r - V(:,j-1)*t; + alpha(j) = norm(r); + if beta(j) ~= 0 + beta(j) = beta(j) + t; + end + if alpha(j)>=gamma*normold + stop = 1; + else + normold = alpha(j); + end + end + end + + if est_anorm + if j==2 + anorm = max(anorm,FUDGE*sqrt(alpha(1)^2+beta(2)^2+alpha(2)*beta(2))); + else + anorm = max(anorm,FUDGE*sqrt(alpha(j-1)^2+beta(j)^2+alpha(j-1)* ... + beta(j-1) + alpha(j)*beta(j))); + end + end + + if ~fro & alpha(j) ~= 0 + % Update estimates of the level of orthogonality for the + % columns 1 through j-1 in V. + nu = update_nu(nu,mu,j,alpha,beta,anorm); + numax(j) = max(abs(nu(1:j-1))); + end + + if j>1 & LANBPRO_TRUTH + NU(1:j-1,j-1) = nu(1:j-1); + NUTRUE(1:j-1,j-1) = V(:,1:j-1)'*r/alpha(j); + end + + if elr>0 + nu(j-1) = n2*eps; + end + + % IF level of orthogonality is worse than delta THEN + % Reorthogonalize v_j against some previous v_i's, 0<=i<j. + if onesided~=-1 & ( fro | numax(j) > delta | force_reorth ) & alpha(j)~=0 + % Decide which vectors to orthogonalize against: + if fro | eta==0 + int = [1:j-1]'; + elseif force_reorth==0 + int = compute_int(nu,j-1,delta,eta,0,0,0); + end + % Else use int from last reorth. to avoid spillover from mu_{j-1} + % to nu_j. + + % Reorthogonalize v_j + [r,alpha(j),rr] = reorth(V,r,alpha(j),int,gamma,cgs); + npv = npv + rr*length(int); % number of inner products. + nu(int) = n2*eps; % Reset nu for orthogonalized vectors. + + % If necessary force reorthogonalization of u_{j+1} + % to avoid spillover + if force_reorth==0 + force_reorth = 1; + else + force_reorth = 0; + end + nreorthv = nreorthv + 1; + end + end + + + % Check for convergence or failure to maintain semiorthogonality + if alpha(j) < max(n,m)*anorm*eps & j<k, + % If alpha is "small" we deflate by setting it + % to 0 and attempt to restart with a basis for a new + % invariant subspace by replacing r with a random starting vector: + %j + %disp('restarting, alpha = 0') + alpha(j) = 0; + bailout = 1; + for attempt=1:3 + r = rand(m,1)-0.5; + if isnumeric(A) + r = At*r; + elseif isstruct(A) + r = A.R\r; + else + r = feval(Atrans,r); + end + nrm=sqrt(r'*r); % not necessary to compute the norm accurately here. + int = [1:j-1]'; + [r,nrmnew,rr] = reorth(V,r,nrm,int,gamma,cgs); + npv = npv + rr*length(int(:)); nreorthv = nreorthv + 1; + nu(int) = n2*eps; + if nrmnew > 0 + % A vector numerically orthogonal to span(Q_k(:,1:j)) was found. + % Continue iteration. + bailout=0; + break; + end + end + if bailout + j = j-1; + ierr = -j; + break; + else + r=r/nrmnew; % Continue with new normalized r as starting vector. + force_reorth = 1; + if delta>0 + fro = 0; % Turn off full reorthogonalization. + end + end + elseif j<k & ~fro & anorm*eps > delta*alpha(j) +% fro = 1; + ierr = j; + end + + if j>1 & LANBPRO_TRUTH + NU_AFTER(1:j-1,j-1) = nu(1:j-1); + NUTRUE_AFTER(1:j-1,j-1) = V(:,1:j-1)'*r/alpha(j); + end + + + if alpha(j) ~= 0 + V(:,j) = r/alpha(j); + else + V(:,j) = r; + end + + %%%%%%%%%% Lanczos step to generate u_{j+1}. %%%%%%%%%%%%% + if waitb + waitbar((2*j+1)/(2*k),waitbarh) + end + + if isnumeric(A) + p = A*V(:,j) - alpha(j)*U(:,j); + elseif isstruct(A) + p = A.Rt\V(:,j) - alpha(j)*U(:,j); + else + p = feval(A,V(:,j)) - alpha(j)*U(:,j); + end + beta(j+1) = norm(p); + % Extended local reorthogonalization + if beta(j+1)<gamma*alpha(j) & elr & ~fro + normold = beta(j+1); + stop = 0; + while ~stop + t = U(:,j)'*p; + p = p - U(:,j)*t; + beta(j+1) = norm(p); + if alpha(j) ~= 0 + alpha(j) = alpha(j) + t; + end + if beta(j+1) >= gamma*normold + stop = 1; + else + normold = beta(j+1); + end + end + end + + if est_anorm + % We should update estimate of ||A|| before updating mu - especially + % important in the first step for problems with large norm since alpha(1) + % may be a severe underestimate! + if j==1 + anorm = max(anorm,FUDGE*pythag(alpha(1),beta(2))); + else + anorm = max(anorm,FUDGE*sqrt(alpha(j)^2+beta(j+1)^2 + alpha(j)*beta(j))); + end + end + + + if ~fro & beta(j+1) ~= 0 + % Update estimates of the level of orthogonality for the columns of V. + mu = update_mu(mu,nu,j,alpha,beta,anorm); + mumax(j) = max(abs(mu(1:j))); + end + + if LANBPRO_TRUTH==1 + MU(1:j,j) = mu(1:j); + MUTRUE(1:j,j) = U(:,1:j)'*p/beta(j+1); + end + + if elr>0 + mu(j) = m2*eps; + end + + % IF level of orthogonality is worse than delta THEN + % Reorthogonalize u_{j+1} against some previous u_i's, 0<=i<=j. + if onesided~=1 & (fro | mumax(j) > delta | force_reorth) & beta(j+1)~=0 + % Decide which vectors to orthogonalize against. + if fro | eta==0 + int = [1:j]'; + elseif force_reorth==0 + int = compute_int(mu,j,delta,eta,0,0,0); + else + int = [int; max(int)+1]; + end + % Else use int from last reorth. to avoid spillover from nu to mu. + +% if onesided~=0 +% fprintf('i = %i, nr = %i, fro = %i\n',j,size(int(:),1),fro) +% end + % Reorthogonalize u_{j+1} + [p,beta(j+1),rr] = reorth(U,p,beta(j+1),int,gamma,cgs); + npu = npu + rr*length(int); nreorthu = nreorthu + 1; + + % Reset mu to epsilon. + mu(int) = m2*eps; + + if force_reorth==0 + force_reorth = 1; % Force reorthogonalization of v_{j+1}. + else + force_reorth = 0; + end + end + + % Check for convergence or failure to maintain semiorthogonality + if beta(j+1) < max(m,n)*anorm*eps & j<k, + % If beta is "small" we deflate by setting it + % to 0 and attempt to restart with a basis for a new + % invariant subspace by replacing p with a random starting vector: + %j + %disp('restarting, beta = 0') + beta(j+1) = 0; + bailout = 1; + for attempt=1:3 + p = rand(n,1)-0.5; + if isnumeric(A) + p = A*p; + elseif isstruct(A) + p = A.Rt\p; + else + p = feval(A,p); + end + nrm=sqrt(p'*p); % not necessary to compute the norm accurately here. + int = [1:j]'; + [p,nrmnew,rr] = reorth(U,p,nrm,int,gamma,cgs); + npu = npu + rr*length(int(:)); nreorthu = nreorthu + 1; + mu(int) = m2*eps; + if nrmnew > 0 + % A vector numerically orthogonal to span(Q_k(:,1:j)) was found. + % Continue iteration. + bailout=0; + break; + end + end + if bailout + ierr = -j; + break; + else + p=p/nrmnew; % Continue with new normalized p as starting vector. + force_reorth = 1; + if delta>0 + fro = 0; % Turn off full reorthogonalization. + end + end + elseif j<k & ~fro & anorm*eps > delta*beta(j+1) +% fro = 1; + ierr = j; + end + + if LANBPRO_TRUTH==1 + MU_AFTER(1:j,j) = mu(1:j); + MUTRUE_AFTER(1:j,j) = U(:,1:j)'*p/beta(j+1); + end +end +if waitb + close(waitbarh) +end + +if j<k + k = j; +end + +B_k = spdiags([alpha(1:k) [beta(2:k);0]],[0 -1],k,k); +if nargout==1 + U = B_k; +elseif k~=size(U,2) | k~=size(V,2) + U = U(:,1:k); + V = V(:,1:k); +end +if nargout>5 + work = [[nreorthu,npu];[nreorthv,npv]]; +end + + + +function mu = update_mu(muold,nu,j,alpha,beta,anorm) + +% UPDATE_MU: Update the mu-recurrence for the u-vectors. +% +% mu_new = update_mu(mu,nu,j,alpha,beta,anorm) + +% Rasmus Munk Larsen, DAIMI, 1998. + +binv = 1/beta(j+1); +mu = muold; +eps1 = 100*eps/2; +if j==1 + T = eps1*(pythag(alpha(1),beta(2)) + pythag(alpha(1),beta(1))); + T = T + eps1*anorm; + mu(1) = T / beta(2); +else + mu(1) = alpha(1)*nu(1) - alpha(j)*mu(1); +% T = eps1*(pythag(alpha(j),beta(j+1)) + pythag(alpha(1),beta(1))); + T = eps1*(sqrt(alpha(j).^2+beta(j+1).^2) + sqrt(alpha(1).^2+beta(1).^2)); + T = T + eps1*anorm; + mu(1) = (mu(1) + sign(mu(1))*T) / beta(j+1); + % Vectorized version of loop: + if j>2 + k=2:j-1; + mu(k) = alpha(k).*nu(k) + beta(k).*nu(k-1) - alpha(j)*mu(k); + %T = eps1*(pythag(alpha(j),beta(j+1)) + pythag(alpha(k),beta(k))); + T = eps1*(sqrt(alpha(j).^2+beta(j+1).^2) + sqrt(alpha(k).^2+beta(k).^2)); + T = T + eps1*anorm; + mu(k) = binv*(mu(k) + sign(mu(k)).*T); + end +% T = eps1*(pythag(alpha(j),beta(j+1)) + pythag(alpha(j),beta(j))); + T = eps1*(sqrt(alpha(j).^2+beta(j+1).^2) + sqrt(alpha(j).^2+beta(j).^2)); + T = T + eps1*anorm; + mu(j) = beta(j)*nu(j-1); + mu(j) = (mu(j) + sign(mu(j))*T) / beta(j+1); +end +mu(j+1) = 1; + + +function nu = update_nu(nuold,mu,j,alpha,beta,anorm) + +% UPDATE_MU: Update the nu-recurrence for the v-vectors. +% +% nu_new = update_nu(nu,mu,j,alpha,beta,anorm) + +% Rasmus Munk Larsen, DAIMI, 1998. + +nu = nuold; +ainv = 1/alpha(j); +eps1 = 100*eps/2; +if j>1 + k = 1:(j-1); +% T = eps1*(pythag(alpha(k),beta(k+1)) + pythag(alpha(j),beta(j))); + T = eps1*(sqrt(alpha(k).^2+beta(k+1).^2) + sqrt(alpha(j).^2+beta(j).^2)); + T = T + eps1*anorm; + nu(k) = beta(k+1).*mu(k+1) + alpha(k).*mu(k) - beta(j)*nu(k); + nu(k) = ainv*(nu(k) + sign(nu(k)).*T); +end +nu(j) = 1; + +function x = pythag(y,z) +%PYTHAG Computes sqrt( y^2 + z^2 ). +% +% x = pythag(y,z) +% +% Returns sqrt(y^2 + z^2) but is careful to scale to avoid overflow. + +% Christian H. Bischof, Argonne National Laboratory, 03/31/89. + +[m n] = size(y); +if m>1 | n>1 + y = y(:); z=z(:); + rmax = max(abs([y z]'))'; + id=find(rmax==0); + if length(id)>0 + rmax(id) = 1; + x = rmax.*sqrt((y./rmax).^2 + (z./rmax).^2); + x(id)=0; + else + x = rmax.*sqrt((y./rmax).^2 + (z./rmax).^2); + end + x = reshape(x,m,n); +else + rmax = max(abs([y;z])); + if (rmax==0) + x = 0; + else + x = rmax*sqrt((y/rmax)^2 + (z/rmax)^2); + end +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanbpro.txt b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanbpro.txt new file mode 100644 index 0000000000000000000000000000000000000000..381410b65c5b3ab25abad7765f46dd240c5bdab6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanbpro.txt @@ -0,0 +1,85 @@ +LANBPRO Lanczos bidiagonalization with partial reorthogonalization. + +LANBPRO computes the Lanczos bidiagonalization of a real +matrix using the with partial reorthogonalization. + +[U_k,B_k,V_k,R,ierr,work] = LANBPRO(A,K,R0,OPTIONS,U_old,B_old,V_old) +[U_k,B_k,V_k,R,ierr,work] = LANBPRO('Afun','Atransfun',M,N,K,R0, ... + OPTIONS,U_old,B_old,V_old) + +Computes K steps of the Lanczos bidiagonalization algorithm with partial +reorthogonalization (BPRO) with M-by-1 starting vector R0, producing a +lower bidiagonal K-by-K matrix B_k, an N-by-K matrix V_k, an M-by-K +matrix U_k and a M-by-1 vector such that + A*V_k = U_k*B_k + R +Partial reorthogonalization is used to keep the columns of V_K and U_k +semiorthogonal: + MAX(DIAG((EYE(K) - V_K'*V_K))) <= OPTIONS.delta +and + MAX(DIAG((EYE(K) - U_K'*U_K))) <= OPTIONS.delta. + +B_k = LANBPRO(...) returns the bidiagonal matrix only. + +The first input argument is either a real matrix, or a string +containing the name of an M-file which applies a linear operator +to the columns of a given matrix. In the latter case, the second +input must be the name of an M-file which applies the transpose of +the same linear operator to the columns of a given matrix, +and the third and fourth arguments must be M and N, the dimensions +of then problem. + +The OPTIONS structure is used to control the reorthogonalization: + OPTIONS.delta: Desired level of orthogonality + (default = sqrt(eps/K)). + OPTIONS.eta : Level of orthogonality after reorthogonalization + (default = eps^(3/4)/sqrt(K)). + OPTIONS.cgs : Flag for switching between different reorthogonalization + algorithms: + 0 = iterated modified Gram-Schmidt (default) + 1 = iterated classical Gram-Schmidt + OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local + reorthogonalization is enforced. + OPTIONS.onesided + : If OPTIONS.onesided = 0 (default) then both the left + (U) and right (V) Lanczos vectors are kept + semiorthogonal. + OPTIONS.onesided = 1 then only the columns of U are + are reorthogonalized. + OPTIONS.onesided = -1 then only the columns of V are + are reorthogonalized. + OPTIONS.waitbar + : The progress of the algorithm is display graphically. + +If both R0, U_old, B_old, and V_old are provided, they must +contain a partial Lanczos bidiagonalization of A on the form + + A V_old = U_old B_old + R0 . + +In this case the factorization is extended to dimension K x K by +continuing the Lanczos bidiagonalization algorithm with R0 as a +starting vector. + +The output array work contains information about the work used in +reorthogonalizing the u- and v-vectors. + work = [ RU PU ] + [ RV PV ] +where + RU = Number of reorthogonalizations of U. + PU = Number of inner products used in reorthogonalizing U. + RV = Number of reorthogonalizations of V. + PV = Number of inner products used in reorthogonalizing V. + +References: +R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. + +G. H. Golub & C. F. Van Loan, "Matrix Computations", +3. Ed., Johns Hopkins, 1996. Section 9.3.4. + +B. N. Parlett, ``The Symmetric Eigenvalue Problem'', +Prentice-Hall, Englewood Cliffs, NJ, 1980. + +H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', +Math. Comp. 42 (1984), no. 165, 115--142. + + +Rasmus Munk Larsen, DAIMI, 1998. diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/laneig.doc b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/laneig.doc new file mode 100644 index 0000000000000000000000000000000000000000..daf27309c18a72f75379330ff2a5ed2aef62ce1d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/laneig.doc @@ -0,0 +1,62 @@ +LANEIG Compute a few eigenvalues and eigenvectors. + LANEIG solves the eigenvalue problem A*v=lambda*v, when A is + real and symmetric using the Lanczos algorithm with partial + reorthogonalization (PRO). + + [V,D] = LANEIG(A) + [V,D] = LANEIG('Afun',N) + + The first input argument is either a real symmetric matrix, or a + string containing the name of an M-file which applies a linear + operator to the columns of a given matrix. In the latter case, + the second input argument must be N, the order of the problem. + + The full calling sequence is + + [V,D,ERR] = LANEIG(A,K,SIGMA,OPTIONS) + [V,D,ERR] = LANEIG('Afun',N,K,SIGMA,OPTIONS) + + On exit ERR contains the computed error bounds. K is the number of + eigenvalues desired and SIGMA is numerical shift or a two letter string + which specifies which part of the spectrum should be computed: + + SIGMA Specified eigenvalues + + 'AL' Algebraically Largest + 'AS' Algebraically Smallest + 'LM' Largest Magnitude (default) + 'SM' Smallest Magnitude (does not work when A is an m-file) + 'BE' Both Ends. Computes k/2 eigenvalues + from each end of the spectrum (one more + from the high end if k is odd.) + + The OPTIONS structure specifies certain parameters in the algorithm. + + Field name Parameter Default + + OPTIONS.tol Convergence tolerance 16*eps + OPTIONS.lanmax Dimension of the Lanczos basis. + OPTIONS.v0 Starting vector for the Lanczos rand(n,1)-0.5 + iteration. + OPTIONS.delta Level of orthogonality among the sqrt(eps/K) + Lanczos vectors. + OPTIONS.eta Level of orthogonality after 10*eps^(3/4) + reorthogonalization. + OPTIONS.cgs reorthogonalization method used 0 + '0' : iterated modified Gram-Schmidt + '1' : iterated classical Gram-Schmidt + OPTIONS.elr If equal to 1 then extended local 1 + reorthogonalization is enforced. + + See also LANPRO, EIGS, EIG. + + References: + R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. + + B. N. Parlett, ``The Symmetric Eigenvalue Problem'', + Prentice-Hall, Englewood Cliffs, NJ, 1980. + + H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', + Math. Comp. 42 (1984), no. 165, 115--142. + + Rasmus Munk Larsen, DAIMI, 1998 diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/laneig.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/laneig.m new file mode 100644 index 0000000000000000000000000000000000000000..3feee8e8cbc4510a3cfcec2ee4cd6cd500623e5b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/laneig.m @@ -0,0 +1,374 @@ +function [V,D,bnd,j,work] = laneig(A,nin,k,sigma,options) + +%LANEIG Compute a few eigenvalues and eigenvectors. +% LANEIG solves the eigenvalue problem A*v=lambda*v, when A is +% real and symmetric using the Lanczos algorithm with partial +% reorthogonalization (PRO). +% +% [V,D] = LANEIG(A) +% [V,D] = LANEIG('Afun',N) +% +% The first input argument is either a real symmetric matrix, or a +% string containing the name of an M-file which applies a linear +% operator to the columns of a given matrix. In the latter case, +% the second input argument must be N, the order of the problem. +% +% The full calling sequence is +% +% [V,D,ERR] = LANEIG(A,K,SIGMA,OPTIONS) +% [V,D,ERR] = LANEIG('Afun',N,K,SIGMA,OPTIONS) +% +% On exit ERR contains the computed error bounds. K is the number of +% eigenvalues desired and SIGMA is numerical shift or a two letter string +% which specifies which part of the spectrum should be computed: +% +% SIGMA Specified eigenvalues +% +% 'AL' Algebraically Largest +% 'AS' Algebraically Smallest +% 'LM' Largest Magnitude (default) +% 'SM' Smallest Magnitude (does not work when A is an m-file) +% 'BE' Both Ends. Computes k/2 eigenvalues +% from each end of the spectrum (one more +% from the high end if k is odd.) +% +% The OPTIONS structure specifies certain parameters in the algorithm. +% +% Field name Parameter Default +% +% OPTIONS.tol Convergence tolerance 16*eps +% OPTIONS.lanmax Dimension of the Lanczos basis. +% OPTIONS.v0 Starting vector for the Lanczos rand(n,1)-0.5 +% iteration. +% OPTIONS.delta Level of orthogonality among the sqrt(eps/K) +% Lanczos vectors. +% OPTIONS.eta Level of orthogonality after 10*eps^(3/4) +% reorthogonalization. +% OPTIONS.cgs reorthogonalization method used 0 +% '0' : iterated modified Gram-Schmidt +% '1' : iterated classical Gram-Schmidt +% OPTIONS.elr If equal to 1 then extended local 1 +% reorthogonalization is enforced. +% +% See also LANPRO, EIGS, EIG. + +% References: +% R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. +% +% B. N. Parlett, ``The Symmetric Eigenvalue Problem'', +% Prentice-Hall, Englewood Cliffs, NJ, 1980. +% +% H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', +% Math. Comp. 42 (1984), no. 165, 115--142. + +% Rasmus Munk Larsen, DAIMI, 1998 + + +%%%%%%%%%%%%%%%%%%%%% Parse and check input arguments. %%%%%%%%%%%%%%%%%%%%%% + +if ~isstr(A) + if nargin<1 + error('Not enough input arguments.'); + end + [m n] = size(A); + Aisfunc = 0; + if m~=n | ~isequal(A,A') | ~isreal(A) + error('A must be real symmetric') + end + if nargin < 4 | isempty(sigma) + options = []; + else + options = sigma; + end + if nargin < 3 | isempty(k), sigma = 'LM'; else, sigma = k; end + if nargin < 2 | isempty(nin), k = min(n,5); else, k = nin; end +else + if nargin<2 + error('Not enough input arguments.'); + end + Aisfunc = 1; + n = nin; + if nargin < 5 | isempty(options) + options.tol = 16*eps; + options.lanmax = n; + options.v0 = rand(n,1)-0.5; + end + if nargin < 4 | isempty(sigma), sigma = 'LM'; end + if nargin < 3 | isempty(k), k = min(n,5); end +end + +if ~isnumeric(k) | real(abs(fix(k)))~=k | ~isnumeric(n) | real(abs(fix(n)))~=n + error('Input arguments N and K must be positive integers.') +end + +% Quick return for n<2 or k<1 +if n < 1 | k<1 + if nargout < 2 + V = zeros(k,1); + else + V = eye(n,k); + D = zeros(k,k); + bnd =zeros(k,1); + end + return +end +if n == 1 + if ~Aisfunc + D = A; + V = 1; + bnd = 0; + else + D = feval(A,1); + V = 1; + dnb = 0; + end + if nargout<2 + V=D; + end + return +end + +% A is the matrix of all zeros (not detectable if A is a string) +if ~Aisfunc + if nnz(A)==0 + if nargout < 2 + V = zeros(k,1); + else + V = eye(n,k); + D = zeros(k,k); + bnd =zeros(k,1); + end + return + end +end + +lanmax = n; +tol = 16*eps; +r = rand(n,1)-0.5; +part = sigma; +% Parse options struct +if ~isempty(options) & isstruct(options) + c = fieldnames(options); + for i=1:length(c) + if strmatch(c(i),'v0'), r = getfield(options,'v0'); r=r(:); end + if strmatch(c(i),'tol'), tol = getfield(options,'tol'); end + if strmatch(c(i),'lanmax'), lanmax = getfield(options,'lanmax'); end + end +end + +% Protect against absurd arguments. +tol = max(tol,eps); +lanmax = min(lanmax,n); +if size(r,1)~=n + error('v0 must be a vector of length n') +end + +lanmax = min(lanmax,n); +if k>lanmax + error('K must satisfy K <= LANMAX <= N.'); +end +ksave = k; + +if strcmp(sigma,'SM') & ~isstr(A) + sigma = 0; +end + + +% Prepare for shift-and-invert if sigma is numeric. +if isnumeric(sigma) + part = 'LM'; + if isstr(A) + error('Shift-and-invert works only when the matrix A is given explicitly.'); + else + pmmd = symmmd(A); + A = A(pmmd,pmmd); + [S.L,S.U] = lu(A - sigma*speye(n)); + condU = condest(S.U); + dsigma = n * full(max(max(abs(A)))) * eps; + if sigma < 0 + sgnsig = -1; + else + sgnsig = 1; + end + sigitr = 1; + while condU > 1/eps & ((dsigma <= 1 & sigitr <= 10) | ~isfinite(condU)) + disps1 = sprintf(['sigma = %10e is near an exact eigenvalue of A,\n' ... + 'so we cannot use the LU factorization of (A-sigma*I): ' ... + ' condest(U) = %10e.\n'],sigma,condU); + if abs(sigma) < 1 + sigma = sigma + sgnsig * dsigma; + disps2 = sprintf('We are trying sigma + %10e = %10e instead.\n', ... + sgnsig*dsigma,sigma); + else + sigma = sigma * (1 + dsigma); + disps2 = sprintf('We are trying sigma * (1 + %10e) = %10e instead.\n', ... + dsigma,sigma); + end + % if nargout < 3 & dispn ~= 0 + disp([disps1 disps2]) + % end + [S.L,S.U] = lu(A - sigma*speye(n)); + condU = condest(S.U); + dsigma = 10 * dsigma; + sigitr = sigitr + 1; + end + end + A = S; +end + + +neig = 0; nrestart=-1; +if ~strcmp(part,'BE') + j = min(2*k+2,lanmax); +else + j = min(k+1,lanmax); +end + + +%%%%%%%%%%%%%%%%%%%%% Here begins the computation %%%%%%%%%%%%%%%%%%%%%% + +V = []; T = []; anorm = []; work = zeros(1,2); rnorm=-1; + + + + +while neig < k + %%%%%%%%%%%%%%%%%%%%% Compute Lanczos tridiagonalization %%%%%%%%%%%%%%%%% + j = min(lanmax,j+1-mod(j,2)); + % "Trick" to avoid unwanted zero eigenvalues when laneig is used for + % SVD calculations. (Nothing to if lanmax is odd, though.) + + if ~isstr(A) + [V,T,r,anorm,ierr,w] = lanpro(A,j,r,options,V,T,anorm); + else + [V,T,r,anorm,ierr,w] = lanpro(A,n,j,r,options,V,T,anorm); + end + work= work + w; + + if ierr<0 % Invariant subspace of dimension -ierr found. + j = -ierr; + end + + %%%%%%%%%%%%%%%%%% Compute eigenvalues and error bounds %%%%%%%%%%%%%%%%%% + % Analyze T + [D,top,bot,err] = tqlb([full(diag(T))],full([0;diag(T,1)])); + % if err>0 + % printf(['TQLB failed. Eigenvalue no. %i did not converge in 30', ... + % ' iterations'],err); + % end + % full(T) + % [P,D] = eig(full(T)); + % D = diag(D); + % bot = P(end,:)'; + % [P(1,:)' P(end,:)'] + [D,I] = sort(D); + bot = bot(I); + + % Set simple error bounds + rnorm = norm(r); + bnd = rnorm*abs(bot); + + % Use Largest Ritz value to estimate ||A||_2. This might save some + % reorth. in case of restart. + anorm = max(abs(D)); + + % Estimate gap structure and refine error bounds + bnd = refinebounds(D,bnd,n*eps*anorm); + + %%%%%%%%%%%%%%%%%%% Check convergence criterion %%%%%%%%%%%%%%%%%%%% + % Reorder eigenvalues according to SIGMA + switch part + case 'AS' + IPART = 1:j; + case 'AL' + IPART = j:-1:1; + case 'LM' + [dummy,IPART] = sort(-abs(D)); + case 'BE' + if j<k + IPART=1:j; + else + mid = floor(k/2); + par = rem(k,1); + IPART = [1:mid,(j-mid-par):j]'; + end + otherwise + error(['Illegal value for SIGMA: ',part]); + end + D = D(IPART); bnd = bnd(IPART); + if isnumeric(sigma) + D = sigma + 1./D; + end + + % Check if enough have converged. + neig = 0; + for i=1:min(j,k) + if bnd(i) <= tol*abs(D(i)) + neig = neig + 1; + end + end + + %%%%%%%%%%% Check whether to stop or to extend the Krylov basis? %%%%%%%%%% + if ierr<0 % Invariant subspace found + if j<k + warning(['Invariant subspace of dimension ',num2str(j-1),' found.']) + end + break; + end + if j>=lanmax % Maximal dimension of Krylov subspace reached => Bail out! + if neig<ksave + warning(['Maximum dimension of Krylov subspace exceeded prior',... + ' to convergence.']); + end + break; + end + + % Increase dimension of Krylov subspace and try again. + if neig>0 + % j = j + ceil(min(20,max(2,((j-1)*(k-neig+1))/(2*(neig+1))))); + j = j + min(100,max(2,0.5*(k-neig)*j/(neig+1))); + elseif neig<k + % j = j + ceil(min(20,max(8,(k-neig)/2))); + j = max(1.5*j,j+10); + end + j = min(j+1,lanmax); + nrestart = nrestart + 1; +end + + + +%%%%%%%%%%%%%%%% Lanczos converged (or failed). Prepare output %%%%%%%%%%%%%%% +k = min(ksave,j); + +if nargout>1 + j = size(T,1); + [Q,D] = eig(full(T)); D = diag(D); + [D,I] = sort(D); + % Compute and normalize Ritz vectors (overwrite V to save memory). + V = V*Q(:,I(IPART(1:k))); + for i=1:k + nq = norm(V(:,i)); + if isfinite(nq) & nq~=0 & nq~=1 + V(:,i) = V(:,i)/nq; + end + end + [D,I] = sort(D); + D = D(IPART(1:k)); + if isnumeric(sigma) + D = sigma + 1./D; + V(pmmd,:) = V; + end +end + +% Pick out desired part of the spectrum +if length(D)~=k + D = D(1:k); + bnd = bnd(1:k); +end + +if nargout<2 + V = D; +else + D = diag(D); +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/laneig.txt b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/laneig.txt new file mode 100644 index 0000000000000000000000000000000000000000..daf27309c18a72f75379330ff2a5ed2aef62ce1d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/laneig.txt @@ -0,0 +1,62 @@ +LANEIG Compute a few eigenvalues and eigenvectors. + LANEIG solves the eigenvalue problem A*v=lambda*v, when A is + real and symmetric using the Lanczos algorithm with partial + reorthogonalization (PRO). + + [V,D] = LANEIG(A) + [V,D] = LANEIG('Afun',N) + + The first input argument is either a real symmetric matrix, or a + string containing the name of an M-file which applies a linear + operator to the columns of a given matrix. In the latter case, + the second input argument must be N, the order of the problem. + + The full calling sequence is + + [V,D,ERR] = LANEIG(A,K,SIGMA,OPTIONS) + [V,D,ERR] = LANEIG('Afun',N,K,SIGMA,OPTIONS) + + On exit ERR contains the computed error bounds. K is the number of + eigenvalues desired and SIGMA is numerical shift or a two letter string + which specifies which part of the spectrum should be computed: + + SIGMA Specified eigenvalues + + 'AL' Algebraically Largest + 'AS' Algebraically Smallest + 'LM' Largest Magnitude (default) + 'SM' Smallest Magnitude (does not work when A is an m-file) + 'BE' Both Ends. Computes k/2 eigenvalues + from each end of the spectrum (one more + from the high end if k is odd.) + + The OPTIONS structure specifies certain parameters in the algorithm. + + Field name Parameter Default + + OPTIONS.tol Convergence tolerance 16*eps + OPTIONS.lanmax Dimension of the Lanczos basis. + OPTIONS.v0 Starting vector for the Lanczos rand(n,1)-0.5 + iteration. + OPTIONS.delta Level of orthogonality among the sqrt(eps/K) + Lanczos vectors. + OPTIONS.eta Level of orthogonality after 10*eps^(3/4) + reorthogonalization. + OPTIONS.cgs reorthogonalization method used 0 + '0' : iterated modified Gram-Schmidt + '1' : iterated classical Gram-Schmidt + OPTIONS.elr If equal to 1 then extended local 1 + reorthogonalization is enforced. + + See also LANPRO, EIGS, EIG. + + References: + R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. + + B. N. Parlett, ``The Symmetric Eigenvalue Problem'', + Prentice-Hall, Englewood Cliffs, NJ, 1980. + + H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', + Math. Comp. 42 (1984), no. 165, 115--142. + + Rasmus Munk Larsen, DAIMI, 1998 diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanpro.doc b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanpro.doc new file mode 100644 index 0000000000000000000000000000000000000000..38649e03c6b9ff8994c3b486ada4111212573513 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanpro.doc @@ -0,0 +1,75 @@ +LANPRO Lanczos tridiagonalization with partial reorthogonalization + LANPRO computes the Lanczos tridiagonalization of a real symmetric + matrix using the symmetric Lanczos algorithm with partial + reorthogonalization. + + [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO(A,K,R0,OPTIONS,Q_old,T_old) + [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO('Afun',N,K,R0,OPTIONS,Q_old,T_old) + + Computes K steps of the Lanczos algorithm with starting vector R0, + and returns the K x K tridiagonal T_K, the N x K matrix Q_K + with semiorthonormal columns and the residual vector R such that + + A*Q_K = Q_K*T_K + R . + + Partial reorthogonalization is used to keep the columns of Q_K + semiorthogonal: + MAX(DIAG((eye(k) - Q_K'*Q_K))) <= OPTIONS.delta. + + + The first input argument is either a real symmetric matrix, a struct with + components A.L and A.U or a string containing the name of an M-file which + applies a linear operator to the columns of a given matrix. In the latter + case, the second input argument must be N, the order of the problem. + + If A is a struct with components A.L and A.U, such that + L*U = (A - sigma*I), a shift-and-invert Lanczos iteration is performed + + The OPTIONS structure is used to control the reorthogonalization: + OPTIONS.delta: Desired level of orthogonality + (default = sqrt(eps/K)). + OPTIONS.eta : Level of orthogonality after reorthogonalization + (default = eps^(3/4)/sqrt(K)). + OPTIONS.cgs : Flag for switching between different reorthogonalization + algorithms: + 0 = iterated modified Gram-Schmidt (default) + 1 = iterated classical Gram-Schmidt + OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local + reorthogonalization is enforced. + OPTIONS.Y : The lanczos vectors are reorthogonalized against + the columns of the matrix OPTIONS.Y. + + If both R0, Q_old and T_old are provided, they must contain + a partial Lanczos tridiagonalization of A on the form + + A Q_old = Q_old T_old + R0 . + + In this case the factorization is extended to dimension K x K by + continuing the Lanczos algorithm with R0 as starting vector. + + On exit ANORM contains an approximation to ||A||_2. + IERR = 0 : K steps were performed succesfully. + IERR > 0 : K steps were performed succesfully, but the algorithm + switched to full reorthogonalization after IERR steps. + IERR < 0 : Iteration was terminated after -IERR steps because an + invariant subspace was found, and 3 deflation attempts + were unsuccessful. + On exit WORK(1) contains the number of reorthogonalizations performed, and + WORK(2) contains the number of inner products performed in the + reorthogonalizations. + + See also LANEIG, REORTH, COMPUTE_INT + + References: + R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. + + G. H. Golub & C. F. Van Loan, "Matrix Computations", + 3. Ed., Johns Hopkins, 1996. Chapter 9. + + B. N. Parlett, ``The Symmetric Eigenvalue Problem'', + Prentice-Hall, Englewood Cliffs, NJ, 1980. + + H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', + Math. Comp. 42 (1984), no. 165, 115--142. + + Rasmus Munk Larsen, DAIMI, 1998 diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanpro.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanpro.m new file mode 100644 index 0000000000000000000000000000000000000000..6b82a6dfd72066e8e087c591957cd4c8691ee8be --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanpro.m @@ -0,0 +1,445 @@ +function [Q_k,T_k,r,anorm,ierr,work] = lanpro(A,nin,kmax,r,options,... + Q_k,T_k,anorm) + +%LANPRO Lanczos tridiagonalization with partial reorthogonalization +% LANPRO computes the Lanczos tridiagonalization of a real symmetric +% matrix using the symmetric Lanczos algorithm with partial +% reorthogonalization. +% +% [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO(A,K,R0,OPTIONS,Q_old,T_old) +% [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO('Afun',N,K,R0,OPTIONS,Q_old,T_old) +% +% Computes K steps of the Lanczos algorithm with starting vector R0, +% and returns the K x K tridiagonal T_K, the N x K matrix Q_K +% with semiorthonormal columns and the residual vector R such that +% +% A*Q_K = Q_K*T_K + R . +% +% Partial reorthogonalization is used to keep the columns of Q_K +% semiorthogonal: +% MAX(DIAG((eye(k) - Q_K'*Q_K))) <= OPTIONS.delta. +% +% +% The first input argument is either a real symmetric matrix, a struct with +% components A.L and A.U or a string containing the name of an M-file which +% applies a linear operator to the columns of a given matrix. In the latter +% case, the second input argument must be N, the order of the problem. +% +% If A is a struct with components A.L and A.U, such that +% L*U = (A - sigma*I), a shift-and-invert Lanczos iteration is performed +% +% The OPTIONS structure is used to control the reorthogonalization: +% OPTIONS.delta: Desired level of orthogonality +% (default = sqrt(eps/K)). +% OPTIONS.eta : Level of orthogonality after reorthogonalization +% (default = eps^(3/4)/sqrt(K)). +% OPTIONS.cgs : Flag for switching between different reorthogonalization +% algorithms: +% 0 = iterated modified Gram-Schmidt (default) +% 1 = iterated classical Gram-Schmidt +% OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local +% reorthogonalization is enforced. +% OPTIONS.Y : The lanczos vectors are reorthogonalized against +% the columns of the matrix OPTIONS.Y. +% +% If both R0, Q_old and T_old are provided, they must contain +% a partial Lanczos tridiagonalization of A on the form +% +% A Q_old = Q_old T_old + R0 . +% +% In this case the factorization is extended to dimension K x K by +% continuing the Lanczos algorithm with R0 as starting vector. +% +% On exit ANORM contains an approximation to ||A||_2. +% IERR = 0 : K steps were performed succesfully. +% IERR > 0 : K steps were performed succesfully, but the algorithm +% switched to full reorthogonalization after IERR steps. +% IERR < 0 : Iteration was terminated after -IERR steps because an +% invariant subspace was found, and 3 deflation attempts +% were unsuccessful. +% On exit WORK(1) contains the number of reorthogonalizations performed, and +% WORK(2) contains the number of inner products performed in the +% reorthogonalizations. +% +% See also LANEIG, REORTH, COMPUTE_INT + +% References: +% R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. +% +% G. H. Golub & C. F. Van Loan, "Matrix Computations", +% 3. Ed., Johns Hopkins, 1996. Chapter 9. +% +% B. N. Parlett, ``The Symmetric Eigenvalue Problem'', +% Prentice-Hall, Englewood Cliffs, NJ, 1980. +% +% H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', +% Math. Comp. 42 (1984), no. 165, 115--142. + +% Rasmus Munk Larsen, DAIMI, 1998 + + +% Check input arguments. +if nargin<1, error('Not enough input arguments.'); end +if isnumeric(A) | isstruct(A) + if isnumeric(A) + [m n] = size(A); + if m~=n | ~isequal(A,A') | ~isreal(A) + error('A must be real symmetric') + end + elseif isstruct(A) + [m n] = size(A.L); + end + + if nargin<7 | isempty(T_k), + anorm = []; est_anorm=1; + else + anorm = T_k; est_anorm=0; + end + if nargin<6, Q_k=[]; T_k=[]; else, T_k = Q_k; Q_k = options; end + if nargin<4 | isempty(r), options = []; else, options = r; end + if nargin<3 | isempty(kmax), + r = rand(n,1)-0.5; + else + r = kmax; + end + if nargin<2 | isempty(nin); kmax = max(10,n/10); else, kmax = nin; end +else + if nargin<2 + error('Not enough input arguments.'); + end + % Check input functions and parse to create an internal object + % if an explicit expression is given. + [A, msg] = fcnchk(A); + if ~isempty(msg) + error(msg); + end + n = nin; + if nargin<8 | isempty(anorm), anorm = []; est_anorm=1; else est_anorm=0; end + if nargin<7, Q_k=[]; T_k=[]; end + if nargin<5 | isempty(options), options = []; end + if nargin<4 | isempty(r), r = rand(n,1)-0.5; end + if nargin<3 | isempty(kmax); kmax = max(10,n/10); end +end + +% Set options. +delta = sqrt(eps/kmax); % Desired level of orthogonality. +eta = eps^(3/4)/sqrt(kmax); % Level of orth. after reorthogonalization. +cgs = 0; % Flag for switching between iterated CGS and MGS. +elr = 1; % Flag for switching extended local + % reorthogonalization on and off. +deflate = 0; % Flag for deflation against OPTIONS.Y + +% Parse options struct +if ~isempty(options) & isstruct(options) + c = fieldnames(options); + for i=1:length(c) + if strmatch(c(i),'delta'), delta = getfield(options,'delta'); end + if strmatch(c(i),'eta'), eta = getfield(options,'eta'); end + if strmatch(c(i),'cgs'), cgs = getfield(options,'cgs'); end + if strmatch(c(i),'elr'), elr = getfield(options,'elr'); end + if strmatch(c(i),'Y'), deflate = ~isempty(options.Y); end + end +end + +np = 0; nr = 0; ierr=0; + +% Rule-of-thumb estimate on the size of round-off terms: +eps1 = sqrt(n)*eps/2; % Notice that {\bf u} == eps/2. +gamma = 1/sqrt(2); + +% Prepare Lanczos iteration +if isempty(Q_k) % New Lanczos tridiagonalization. + % Allocate space + alpha = zeros(kmax+1,1); beta = zeros(kmax+1,1); + Q_k = zeros(n,kmax); + q = zeros(n,1); beta(1)=norm(r); + omega = zeros(kmax,1); omega_max = omega; omega_old = omega; + omega(1) = 0; force_reorth= 0; + j0 = 1; +else % Extending existing Lanczos tridiagonalization. + j = size(Q_k,2); % Size of existing factorization + % Allocate space + Q_k = [Q_k zeros(n,kmax-j)]; + alpha = zeros(kmax+1,1); beta = zeros(kmax+1,1); + alpha(1:j) = diag(T_k); + if j>1 + beta(2:j) = diag(T_k,-1); + end + q = Q_k(:,j); + % Reorthogonalize r. + beta(j+1) = norm(r); + if j<kmax & beta(j+1)*delta < anorm*eps1, + fro = 1; + end + if isfinite(delta) + int = 1:j; + [r,beta(j+1),rr] = reorth(Q_k,r,beta(j+1),int,gamma,cgs); + np = rr*j; nr = 1; force_reorth = 1; + else + force_reorth = 0; + end + % Compute Gerscgorin bound on ||T_k||_2 as SQRT(||T_k'*T_k||_1) + if est_anorm + anorm = sqrt(norm(T_k'*T_k,1)); + end + omega = eps1*ones(kmax,1); omega_max = omega; omega_old = omega; + j0 = j+1; +end + +if delta==0 + fro = 1; % The user has requested full reorthogonalization. +else + fro = 0; +end + +for j=j0:kmax, + % Lanczos Step: + q_old = q; + if beta(j)==0 + q = r; + else + q = r / beta(j); + end + Q_k(:,j) = q; + if isnumeric(A) + u = A*q; + elseif isstruct(A) + u = A.U \ ( A.L \ q); + else + u = feval(A,q); + end + r = u - beta(j)*q_old; + alpha(j) = q'*r; + r = r - alpha(j)*q; + + + % Extended local reorthogonalization: + beta(j+1) = sqrt(r'*r); % Quick and dirty estimate. + if beta(j+1)<gamma*beta(j) & elr + if j==1 + t1=0; + for i=1:2 + t = q'*r; + r = r-q*t; + t1 = t1+t; + end + alpha(j) = alpha(j) + t1; + elseif j>1 + t1 = q_old'*r; + t2 = q'*r; + r = r - (q_old*t1 + q*t2); % Add small terms together first to + if beta(j)~=0 % reduce risk of cancellation. + beta(j) = beta(j) + t1; + end + alpha(j) = alpha(j) + t2; + end + beta(j+1) = sqrt(r'*r); % Quick and dirty estimate. + end + + % Update Gersgorin estimate of ||T_k|| if required +% if est_anorm & beta(j+1)~=0 +% T_k = spdiags([[beta(2:j);0] alpha(1:j) beta(1:j)],-1:1,j,j); +% anorm = sqrt(norm(T_k'*T_k,1)) +% end + if est_anorm & beta(j+1)~=0 + anorm = update_gbound(anorm,alpha,beta,j); + end + + % Update omega-recurrence + if j>1 & ~fro & beta(j+1)~=0 + [omega,omega_old] = update_omega(omega,omega_old,j,alpha,beta,... + eps1,anorm); + omega_max(j) = max(abs(omega)); + end + + % Reorthogonalize if required + if j>1 & (fro | force_reorth | omega_max(j)>delta) & beta(j+1)~=0 + if fro + int = 1:j; + else + if force_reorth == 0 + force_reorth= 1; % Do forced reorth to avoid spill-over from q_{j-1}. + int = compute_int(omega,j,delta,eta,0,0,0); + else + force_reorth= 0; + end + end + [r,beta(j+1),rr] = reorth(Q_k,r,beta(j+1),int,gamma,cgs); + omega(int) = eps1; + np = np + rr*length(int(:)); nr = nr + 1; + else + beta(j+1) = norm(r); % compute norm accurately. + end + + if deflate + [r,beta(j+1),rr] = reorth(options.Y,r,beta(j+1),1:size(options.Y,2), ... + gamma,cgs); + end + + if j<kmax & beta(j+1) < n*anorm*eps , + % If beta is "small" we deflate by setting the off-diagonals of T_k + % to 0 and attempt to restart with a basis for a new + % invariant subspace by replacing r with a random starting vector: + beta(j+1) = 0; + bailout = 1; + for attempt=1:3 + r = rand(n,1)-0.5; + if isnumeric(A) + r = A*r; + elseif isstruct(A) + r = A.U \ ( A.L \ r); + else + r = feval(A,r); + end + nrm=sqrt(r'*r); % not necessary to compute the norm accurately here. + int = 1:j; + [r,nrmnew,rr] = reorth(Q_k,r,nrm,int,gamma,cgs); + omega(int) = eps1; + np = np + rr*length(int(:)); nr = nr + 1; + if nrmnew > 0 + % A vector numerically orthogonal to span(Q_k(:,1:j)) was found. + % Continue iteration. + bailout=0; + break; + end + end + if bailout + ierr = -j; + break; + else + r=r/nrmnew; % Continue with new normalized r as starting vector. + force_reorth = 1; + if delta>0 + fro = 0; % Turn off full reorthogonalization. + end + end + elseif j<kmax & ~fro & beta(j+1)*delta < anorm*eps1, + % If anorm*eps1/beta(j+1) > delta then omega(j+1) will + % immediately exceed delta, and thus forcing a reorth. to occur at the + % next step. The components of omega will mainly be determined + % by the initial value and not the recurrence, and therefore we + % cannot tell reliably which components exceed eta => we might + % as well switch to full reorthogonalization to avoid trouble. + % The user is probably trying to determine pathologically + % small ( < sqrt(eps)*||A||_2 ) eigenvalues. + % warning(['Semiorthogonality cannot be maintained at iteration ', ... + % num2str(j),'. The matrix is probably ill-conditioned.', ... + % ' Switching to full reorthogonalization.']) + fro = 1; + ierr = j; + end +end + +% Set up tridiagonal T_k in sparse matrix data structure. +T_k = spdiags([[beta(2:j);0] alpha(1:j) beta(1:j)],-1:1,j,j); +if nargout<2 + Q_k = T_k; +elseif j~=size(Q_k,2) + Q_k = Q_k(:,1:j); +end +work = [nr np]; + + +function [omega,omega_old] = update_omega(omega, omega_old, j, ... + alpha,beta,eps1,anorm) +% UPDATE_OMEGA: Update Simon's omega_recurrence for the Lanczos vectors. +% +% [omega,omega_old] = update_omega(omega, omega_old,j,eps1,alpha,beta,anorm) +% + +% Rasmus Munk Larsen, DAIMI, 1998. + +% Estimate of contribution to roundoff errors from A*v +% fl(A*v) = A*v + f, +% where ||f|| \approx eps1*||A||. +% For a full matrix A, a rule-of-thumb estimate is eps1 = sqrt(n)*eps. +T = eps1*anorm; +binv = 1/beta(j+1); + +omega_old = omega; +% Update omega(1) using omega(0)==0. +omega_old(1)= beta(2)*omega(2)+ (alpha(1)-alpha(j))*omega(1) - ... + beta(j)*omega_old(1); +omega_old(1) = binv*(omega_old(1) + sign(omega_old(1))*T); +% Update remaining components. +k=2:j-2; +omega_old(k) = beta(k+1).*omega(k+1) + (alpha(k)-alpha(j)).*omega(k) ... + + beta(k).*omega(k-1) - beta(j)*omega_old(k); +omega_old(k) = binv*(omega_old(k) + sign(omega_old(k))*T); +omega_old(j-1) = binv*T; +% Swap omega and omega_old. +temp = omega; +omega = omega_old; +omega_old = omega; +omega(j) = eps1; + + +function anorm = update_gbound(anorm,alpha,beta,j) +%UPDATE_GBOUND Update Gerscgorin estimate of 2-norm +% ANORM = UPDATE_GBOUND(ANORM,ALPHA,BETA,J) updates the Gerscgorin bound +% for the tridiagonal in the Lanczos process after the J'th step. +% Applies Gerscgorins circles to T_K'*T_k instead of T_k itself +% since this gives a tighter bound. + +if j==1 % Apply Gerscgorin circles to T_k'*T_k to estimate || A ||_2 + i=j; + % scale to avoid overflow + scale = max(abs(alpha(i)),abs(beta(i+1))); + alpha(i) = alpha(i)/scale; + beta(i+1) = beta(i+1)/scale; + anorm = 1.01*scale*sqrt(alpha(i)^2+beta(i+1)^2 + abs(alpha(i)*beta(i+1))); +elseif j==2 + i=1; + % scale to avoid overflow + scale = max(max(abs(alpha(1:2)),max(abs(beta(2:3))))); + alpha(1:2) = alpha(1:2)/scale; + beta(2:3) = beta(2:3)/scale; + + anorm = max(anorm, scale*sqrt(alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1) + alpha(i+1)*beta(i+1)) + ... + abs(beta(i+1)*beta(i+2)))); + i=2; + anorm = max(anorm,scale*sqrt(abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1))) ); +elseif j==3 + % scale to avoid overflow + scale = max(max(abs(alpha(1:3)),max(abs(beta(2:4))))); + alpha(1:3) = alpha(1:3)/scale; + beta(2:4) = beta(2:4)/scale; + i=2; + anorm = max(anorm,scale*sqrt(abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1) + alpha(i+1)*beta(i+1)) + ... + abs(beta(i+1)*beta(i+2))) ); + i=3; + anorm = max(anorm,scale*sqrt(abs(beta(i)*beta(i-1)) + ... + abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1))) ); +else + % scale to avoid overflow + % scale = max(max(abs(alpha(j-2:j)),max(abs(beta(j-2:j+1))))); + % alpha(j-2:j) = alpha(j-2:j)/scale; + % beta(j-2:j+1) = beta(j-2:j+1)/scale; + + % Avoid scaling, which is slow. At j>3 the estimate is usually quite good + % so just make sure that anorm is not made infinite by overflow. + i = j-1; + anorm1 = sqrt(abs(beta(i)*beta(i-1)) + ... + abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1) + alpha(i+1)*beta(i+1)) + ... + abs(beta(i+1)*beta(i+2))); + if isfinite(anorm1) + anorm = max(anorm,anorm1); + end + i = j; + anorm1 = sqrt(abs(beta(i)*beta(i-1)) + ... + abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1))); + if isfinite(anorm1) + anorm = max(anorm,anorm1); + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanpro.txt b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanpro.txt new file mode 100644 index 0000000000000000000000000000000000000000..38649e03c6b9ff8994c3b486ada4111212573513 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lanpro.txt @@ -0,0 +1,75 @@ +LANPRO Lanczos tridiagonalization with partial reorthogonalization + LANPRO computes the Lanczos tridiagonalization of a real symmetric + matrix using the symmetric Lanczos algorithm with partial + reorthogonalization. + + [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO(A,K,R0,OPTIONS,Q_old,T_old) + [Q_K,T_K,R,ANORM,IERR,WORK] = LANPRO('Afun',N,K,R0,OPTIONS,Q_old,T_old) + + Computes K steps of the Lanczos algorithm with starting vector R0, + and returns the K x K tridiagonal T_K, the N x K matrix Q_K + with semiorthonormal columns and the residual vector R such that + + A*Q_K = Q_K*T_K + R . + + Partial reorthogonalization is used to keep the columns of Q_K + semiorthogonal: + MAX(DIAG((eye(k) - Q_K'*Q_K))) <= OPTIONS.delta. + + + The first input argument is either a real symmetric matrix, a struct with + components A.L and A.U or a string containing the name of an M-file which + applies a linear operator to the columns of a given matrix. In the latter + case, the second input argument must be N, the order of the problem. + + If A is a struct with components A.L and A.U, such that + L*U = (A - sigma*I), a shift-and-invert Lanczos iteration is performed + + The OPTIONS structure is used to control the reorthogonalization: + OPTIONS.delta: Desired level of orthogonality + (default = sqrt(eps/K)). + OPTIONS.eta : Level of orthogonality after reorthogonalization + (default = eps^(3/4)/sqrt(K)). + OPTIONS.cgs : Flag for switching between different reorthogonalization + algorithms: + 0 = iterated modified Gram-Schmidt (default) + 1 = iterated classical Gram-Schmidt + OPTIONS.elr : If OPTIONS.elr = 1 (default) then extended local + reorthogonalization is enforced. + OPTIONS.Y : The lanczos vectors are reorthogonalized against + the columns of the matrix OPTIONS.Y. + + If both R0, Q_old and T_old are provided, they must contain + a partial Lanczos tridiagonalization of A on the form + + A Q_old = Q_old T_old + R0 . + + In this case the factorization is extended to dimension K x K by + continuing the Lanczos algorithm with R0 as starting vector. + + On exit ANORM contains an approximation to ||A||_2. + IERR = 0 : K steps were performed succesfully. + IERR > 0 : K steps were performed succesfully, but the algorithm + switched to full reorthogonalization after IERR steps. + IERR < 0 : Iteration was terminated after -IERR steps because an + invariant subspace was found, and 3 deflation attempts + were unsuccessful. + On exit WORK(1) contains the number of reorthogonalizations performed, and + WORK(2) contains the number of inner products performed in the + reorthogonalizations. + + See also LANEIG, REORTH, COMPUTE_INT + + References: + R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. + + G. H. Golub & C. F. Van Loan, "Matrix Computations", + 3. Ed., Johns Hopkins, 1996. Chapter 9. + + B. N. Parlett, ``The Symmetric Eigenvalue Problem'', + Prentice-Hall, Englewood Cliffs, NJ, 1980. + + H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', + Math. Comp. 42 (1984), no. 165, 115--142. + + Rasmus Munk Larsen, DAIMI, 1998 diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lansvd.doc b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lansvd.doc new file mode 100644 index 0000000000000000000000000000000000000000..d3a73c87c0cde730e147d0f139cf41e4df0ebcf9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lansvd.doc @@ -0,0 +1,58 @@ +LANSVD Compute a few singular values and singular vectors. + LANSVD computes singular triplets (u,v,sigma) such that + A*u = sigma*v and A'*v = sigma*u. Only a few singular values + and singular vectors are computed using the Lanczos + bidiagonalization algorithm with partial reorthogonalization (BPRO). + + S = LANSVD(A) + S = LANSVD('Afun','Atransfun',M,N) + + The first input argument is either a matrix or a + string containing the name of an M-file which applies a linear + operator to the columns of a given matrix. In the latter case, + the second input must be the name of an M-file which applies the + transpose of the same operator to the columns of a given matrix, + and the third and fourth arguments must be M and N, the dimensions + of the problem. + + [U,S,V] = LANSVD(A,K,'L',...) computes the K largest singular values. + + [U,S,V] = LANSVD(A,K,'S',...) computes the K smallest singular values. + + The full calling sequence is + + [U,S,V] = LANSVD(A,K,SIGMA,OPTIONS) + [U,S,V] = LANSVD('Afun','Atransfun',M,N,K,SIGMA,OPTIONS) + + where K is the number of singular values desired and + SIGMA is 'L' or 'S'. + + The OPTIONS structure specifies certain parameters in the algorithm. + Field name Parameter Default + + OPTIONS.tol Convergence tolerance 16*eps + OPTIONS.lanmax Dimension of the Lanczos basis. + OPTIONS.p0 Starting vector for the Lanczos rand(n,1)-0.5 + iteration. + OPTIONS.delta Level of orthogonality among the sqrt(eps/K) + Lanczos vectors. + OPTIONS.eta Level of orthogonality after 10*eps^(3/4) + reorthogonalization. + OPTIONS.cgs reorthogonalization method used 0 + '0' : iterated modified Gram-Schmidt + '1' : iterated classical Gram-Schmidt + OPTIONS.elr If equal to 1 then extended local 1 + reorthogonalization is enforced. + + See also LANBPRO, SVDS, SVD + + References: + R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. + + B. N. Parlett, ``The Symmetric Eigenvalue Problem'', + Prentice-Hall, Englewood Cliffs, NJ, 1980. + + H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', + Math. Comp. 42 (1984), no. 165, 115--142. + + Rasmus Munk Larsen, DAIMI, 1998 diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lansvd.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lansvd.m new file mode 100644 index 0000000000000000000000000000000000000000..f28dee29073299cec828b2ef8d939639f8db453d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lansvd.m @@ -0,0 +1,343 @@ +function [U,S,V,bnd,j] = lansvd(varargin) + +%LANSVD Compute a few singular values and singular vectors. +% LANSVD computes singular triplets (u,v,sigma) such that +% A*u = sigma*v and A'*v = sigma*u. Only a few singular values +% and singular vectors are computed using the Lanczos +% bidiagonalization algorithm with partial reorthogonalization (BPRO). +% +% S = LANSVD(A) +% S = LANSVD('Afun','Atransfun',M,N) +% +% The first input argument is either a matrix or a +% string containing the name of an M-file which applies a linear +% operator to the columns of a given matrix. In the latter case, +% the second input must be the name of an M-file which applies the +% transpose of the same operator to the columns of a given matrix, +% and the third and fourth arguments must be M and N, the dimensions +% of the problem. +% +% [U,S,V] = LANSVD(A,K,'L',...) computes the K largest singular values. +% +% [U,S,V] = LANSVD(A,K,'S',...) computes the K smallest singular values. +% +% The full calling sequence is +% +% [U,S,V] = LANSVD(A,K,SIGMA,OPTIONS) +% [U,S,V] = LANSVD('Afun','Atransfun',M,N,K,SIGMA,OPTIONS) +% +% where K is the number of singular values desired and +% SIGMA is 'L' or 'S'. +% +% The OPTIONS structure specifies certain parameters in the algorithm. +% Field name Parameter Default +% +% OPTIONS.tol Convergence tolerance 16*eps +% OPTIONS.lanmax Dimension of the Lanczos basis. +% OPTIONS.p0 Starting vector for the Lanczos rand(n,1)-0.5 +% iteration. +% OPTIONS.delta Level of orthogonality among the sqrt(eps/K) +% Lanczos vectors. +% OPTIONS.eta Level of orthogonality after 10*eps^(3/4) +% reorthogonalization. +% OPTIONS.cgs reorthogonalization method used 0 +% '0' : iterated modified Gram-Schmidt +% '1' : iterated classical Gram-Schmidt +% OPTIONS.elr If equal to 1 then extended local 1 +% reorthogonalization is enforced. +% +% See also LANBPRO, SVDS, SVD + +% References: +% R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. +% +% B. N. Parlett, ``The Symmetric Eigenvalue Problem'', +% Prentice-Hall, Englewood Cliffs, NJ, 1980. +% +% H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', +% Math. Comp. 42 (1984), no. 165, 115--142. + +% Rasmus Munk Larsen, DAIMI, 1998 + + +%%%%%%%%%%%%%%%%%%%%% Parse and check input arguments. %%%%%%%%%%%%%%%%%%%%%% + +if nargin<1 | length(varargin)<1 + error('Not enough input arguments.'); +end + +A = varargin{1}; +if ~isstr(A) + if ~isreal(A) + error('A must be real') + end + [m n] = size(A); + if length(varargin) < 2, k=min(min(m,n),6); else k=varargin{2}; end + if length(varargin) < 3, sigma = 'L'; else sigma=varargin{3}; end + if length(varargin) < 4, options = []; else options=varargin{4}; end +else + if length(varargin)<4 + error('Not enough input arguments.'); + end + Atrans = varargin{2}; + if ~isstr(Atrans) + error('Atransfunc must be the name of a function') + end + m = varargin{3}; + n = varargin{4}; + if length(varargin) < 5, k=min(min(m,n),6); else k=varargin{5}; end + if length(varargin) < 6, sigma = 'L'; else sigma=varargin{6}; end + if length(varargin) < 7, options = []; else options=varargin{7}; end +end + +if ~isnumeric(n) | real(abs(fix(n))) ~= n | ~isnumeric(m) | ... + real(abs(fix(m))) ~= m | ~isnumeric(k) | real(abs(fix(k))) ~= k + error('M, N and K must be positive integers.') +end + + +% Quick return for min(m,n) equal to 0 or 1 or for zero A. +if min(n,m) < 1 | k<1 + if nargout<3 + U = zeros(k,1); + else + U = eye(m,k); S = zeros(k,k); V = eye(n,k); bnd = zeros(k,1); + end + return +elseif min(n,m) == 1 & k>0 + if isstr(A) + % Extract the single column or row of A + if n==1 + A = feval(A,1); + else + A = feval(Atrans,1)'; + end + end + if nargout==1 + U = norm(A); + else + [U,S,V] = svd(full(A)); + bnd = 0; + end + return +end + +% A is the matrix of all zeros (not detectable if A is defined by an m-file) +if isnumeric(A) + if nnz(A)==0 + if nargout<3 + U = zeros(k,1); + else + U = eye(m,k); S = zeros(k,k); V = eye(n,k); bnd = zeros(k,1); + end + return + end +end + +lanmax = min(m,n); +tol = 16*eps; +p = rand(m,1)-0.5; +% Parse options struct +if isstruct(options) + c = fieldnames(options); + for i=1:length(c) + if any(strcmp(c(i),'p0')), p = getfield(options,'p0'); p=p(:); end + if any(strcmp(c(i),'tol')), tol = getfield(options,'tol'); end + if any(strcmp(c(i),'lanmax')), lanmax = getfield(options,'lanmax'); end + end +end + +% Protect against absurd options. +tol = max(tol,eps); +lanmax = min(lanmax,min(m,n)); +if size(p,1)~=m + error('p0 must be a vector of length m') +end + +lanmax = min(lanmax,min(m,n)); +if k>lanmax + error('K must satisfy K <= LANMAX <= MIN(M,N).'); +end + + + +%%%%%%%%%%%%%%%%%%%%% Here begins the computation %%%%%%%%%%%%%%%%%%%%%% + +if strcmp(sigma,'S') + if isstr(A) + error('Shift-and-invert works only when the matrix A is given explicitly.'); + else + % Prepare for shift-and-invert Lanczos. + if issparse(A) + pmmd = colmmd(A); + A.A = A(:,pmmd); + else + A.A = A; + end + if m>=n + if issparse(A.A) + A.R = qr(A.A,0); + A.Rt = A.R'; + p = A.Rt\(A.A'*p); % project starting vector on span(Q1) + else + [A.Q,A.R] = qr(A.A,0); + A.Rt = A.R'; + p = A.Q'*p; % project starting vector on span(Q1) + end + else + error('Sorry, shift-and-invert for m<n not implemented yet!') + A.R = qr(A.A',0); + A.Rt = A.R'; + end + condR = condest(A.R); + if condR > 1/eps + error(['A is rank deficient or too ill-conditioned to do shift-and-' ... + ' invert.']) + end + end +end + +ksave = k; +neig = 0; nrestart=-1; +j = min(k+max(8,k)+1,lanmax); +U = []; V = []; B = []; anorm = []; work = zeros(2,2); + +while neig < k + + %%%%%%%%%%%%%%%%%%%%% Compute Lanczos bidiagonalization %%%%%%%%%%%%%%%%% + if ~isstr(A) + [U,B,V,p,ierr,w] = lanbpro(A,j,p,options,U,B,V,anorm); + else + [U,B,V,p,ierr,w] = lanbpro(A,Atrans,m,n,j,p,options,U,B,V,anorm); + end + work= work + w; + + if ierr<0 % Invariant subspace of dimension -ierr found. + j = -ierr; + end + + %%%%%%%%%%%%%%%%%% Compute singular values and error bounds %%%%%%%%%%%%%%%% + % Analyze B + resnrm = norm(p); + % We might as well use the extra info. in p. + % S = svd(full([B;[zeros(1,j-1),resnrm]]),0); + % [P,S,Q] = svd(full([B;[zeros(1,j-1),resnrm]]),0); + % S = diag(S); + % bot = min(abs([P(end,1:j);Q(end,1:j)]))'; + + [S,bot] = bdsqr(diag(B),[diag(B,-1); resnrm]); + +% Use Largest Ritz value to estimate ||A||_2. This might save some + % reorth. in case of restart. + anorm=S(1); + + % Set simple error bounds + bnd = resnrm*abs(bot); + + % Examine gap structure and refine error bounds + bnd = refinebounds(S.^2,bnd,n*eps*anorm); + + %%%%%%%%%%%%%%%%%%% Check convergence criterion %%%%%%%%%%%%%%%%%%%% + i=1; + neig = 0; + while i<=min(j,k) + if (bnd(i) <= tol*abs(S(i))) + neig = neig + 1; + i = i+1; + else + i = min(j,k)+1; + end + end + + %%%%%%%%%% Check whether to stop or to extend the Krylov basis? %%%%%%%%%% + if ierr<0 % Invariant subspace found + if j<k + warning(['Invariant subspace of dimension ',num2str(j-1),' found.']) + end + j = j-1; + break; + end + if j>=lanmax % Maximal dimension of Krylov subspace reached. Bail out + if j>=min(m,n) + neig = ksave; + break; + end + if neig<ksave + warning(['Maximum dimension of Krylov subspace exceeded prior',... + ' to convergence.']); + end + break; + end + + % Increase dimension of Krylov subspace + if neig>0 + % increase j by approx. half the average number of steps pr. converged + % singular value (j/neig) times the number of remaining ones (k-neig). + j = j + min(100,max(2,0.5*(k-neig)*j/(neig+1))); + else + % As long a very few singular values have converged, increase j rapidly. + % j = j + ceil(min(100,max(8,2^nrestart*k))); + j = max(1.5*j,j+10); + end + j = ceil(min(j+1,lanmax)); + nrestart = nrestart + 1; +end + + + +%%%%%%%%%%%%%%%% Lanczos converged (or failed). Prepare output %%%%%%%%%%%%%%% +k = min(ksave,j); + +if nargout>2 + j = size(B,2); + % Compute singular vectors + [P,S,Q] = svd(full([B;[zeros(1,j-1),resnrm]]),0); + S = diag(S); + if size(Q,2)~=k + Q = Q(:,1:k); + P = P(:,1:k); + end + % Compute and normalize Ritz vectors (overwrites U and V to save memory). + if resnrm~=0 + U = U*P(1:j,:) + (p/resnrm)*P(j+1,:); + else + U = U*P(1:j,:); + end + V = V*Q; + for i=1:k + nq = norm(V(:,i)); + if isfinite(nq) & nq~=0 & nq~=1 + V(:,i) = V(:,i)/nq; + end + nq = norm(U(:,i)); + if isfinite(nq) & nq~=0 & nq~=1 + U(:,i) = U(:,i)/nq; + end + end +end + +% Pick out desired part the spectrum +S = S(1:k); +bnd = bnd(1:k); + +if strcmp(sigma,'S') + [S,p] = sort(-1./S); + S = -S; + bnd = bnd(p); + if nargout>2 + if issparse(A.A) + U = A.A*(A.R\U(:,p)); + V(pmmd,:) = V(:,p); + else + U = A.Q(:,1:min(m,n))*U(:,p); + V = V(:,p); + end + end +end + +if nargout<3 + U = S; + S = B; % Undocumented feature - for checking B. +else + S = diag(S); +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lansvd.txt b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lansvd.txt new file mode 100644 index 0000000000000000000000000000000000000000..d3a73c87c0cde730e147d0f139cf41e4df0ebcf9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/lansvd.txt @@ -0,0 +1,58 @@ +LANSVD Compute a few singular values and singular vectors. + LANSVD computes singular triplets (u,v,sigma) such that + A*u = sigma*v and A'*v = sigma*u. Only a few singular values + and singular vectors are computed using the Lanczos + bidiagonalization algorithm with partial reorthogonalization (BPRO). + + S = LANSVD(A) + S = LANSVD('Afun','Atransfun',M,N) + + The first input argument is either a matrix or a + string containing the name of an M-file which applies a linear + operator to the columns of a given matrix. In the latter case, + the second input must be the name of an M-file which applies the + transpose of the same operator to the columns of a given matrix, + and the third and fourth arguments must be M and N, the dimensions + of the problem. + + [U,S,V] = LANSVD(A,K,'L',...) computes the K largest singular values. + + [U,S,V] = LANSVD(A,K,'S',...) computes the K smallest singular values. + + The full calling sequence is + + [U,S,V] = LANSVD(A,K,SIGMA,OPTIONS) + [U,S,V] = LANSVD('Afun','Atransfun',M,N,K,SIGMA,OPTIONS) + + where K is the number of singular values desired and + SIGMA is 'L' or 'S'. + + The OPTIONS structure specifies certain parameters in the algorithm. + Field name Parameter Default + + OPTIONS.tol Convergence tolerance 16*eps + OPTIONS.lanmax Dimension of the Lanczos basis. + OPTIONS.p0 Starting vector for the Lanczos rand(n,1)-0.5 + iteration. + OPTIONS.delta Level of orthogonality among the sqrt(eps/K) + Lanczos vectors. + OPTIONS.eta Level of orthogonality after 10*eps^(3/4) + reorthogonalization. + OPTIONS.cgs reorthogonalization method used 0 + '0' : iterated modified Gram-Schmidt + '1' : iterated classical Gram-Schmidt + OPTIONS.elr If equal to 1 then extended local 1 + reorthogonalization is enforced. + + See also LANBPRO, SVDS, SVD + + References: + R.M. Larsen, Ph.D. Thesis, Aarhus University, 1998. + + B. N. Parlett, ``The Symmetric Eigenvalue Problem'', + Prentice-Hall, Englewood Cliffs, NJ, 1980. + + H. D. Simon, ``The Lanczos algorithm with partial reorthogonalization'', + Math. Comp. 42 (1984), no. 165, 115--142. + + Rasmus Munk Larsen, DAIMI, 1998 diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/mminfo.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/mminfo.m new file mode 100644 index 0000000000000000000000000000000000000000..b01157a39782a9be9fcf769e7214361f81efb12a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/mminfo.m @@ -0,0 +1,108 @@ +function [rows, cols, entries, rep, field, symm] = mminfo(filename) +% +% function [rows, cols, entries, rep, field, symmetry] = mminfo(filename) +% +% Reads the contents of the Matrix Market file 'filename' +% and extracts size and storage information. +% +% In the case of coordinate matrices, entries refers to the +% number of coordinate entries stored in the file. The number +% of non-zero entries in the final matrix cannot be determined +% until the data is read (and symmetrized, if necessary). +% +% In the case of array matrices, entries is the product +% rows*cols, regardless of whether symmetry was used to +% store the matrix efficiently. +% +% + +mmfile = fopen(filename,'r'); +if ( mmfile == -1 ) + disp(filename); + error('File not found'); +end; + +header = fgets(mmfile); +if (header == -1 ) + error('Empty file.') +end + +% NOTE: If using a version of Matlab for which strtok is not +% defined, substitute 'gettok' for 'strtok' in the +% following lines, and download gettok.m from the +% Matrix Market site. +[head0,header] = strtok(header); % see note above +[head1,header] = strtok(header); +[rep,header] = strtok(header); +[field,header] = strtok(header); +[symm,header] = strtok(header); +head1 = lower(head1); +rep = lower(rep); +field = lower(field); +symm = lower(symm); +if ( length(symm) == 0 ) + disp('Not enough words in header line.') + disp('Recognized format: ') + disp('%%MatrixMarket matrix representation field symmetry') + error('Check header line.') +end +if ( ~ strcmp(head0,'%%MatrixMarket') ) + error('Not a valid MatrixMarket header.') +end +if ( ~ strcmp(head1,'matrix') ) + disp(['This seems to be a MatrixMarket ',head1,' file.']); + disp('This function only knows how to read MatrixMarket matrix files.'); + disp(' '); + error(' '); +end + +% Read through comments, ignoring them + +commentline = fgets(mmfile); +while length(commentline) > 0 & commentline(1) == '%', + commentline = fgets(mmfile); +end + +% Read size information, then branch according to +% sparse or dense format + +if ( strcmp(rep,'coordinate')) % read matrix given in sparse + % coordinate matrix format + + [sizeinfo,count] = sscanf(commentline,'%d%d%d'); + while ( count == 0 ) + commentline = fgets(mmfile); + if (commentline == -1 ) + error('End-of-file reached before size information was found.') + end + [sizeinfo,count] = sscanf(commentline,'%d%d%d'); + if ( count > 0 & count ~= 3 ) + error('Invalid size specification line.') + end + end + rows = sizeinfo(1); + cols = sizeinfo(2); + entries = sizeinfo(3); + +elseif ( strcmp(rep,'array') ) % read matrix given in dense + % array (column major) format + + [sizeinfo,count] = sscanf(commentline,'%d%d'); + while ( count == 0 ) + commentline = fgets(mmfile); + if (commentline == -1 ) + error('End-of-file reached before size information was found.') + end + [sizeinfo,count] = sscanf(commentline,'%d%d'); + if ( count > 0 & count ~= 2 ) + error('Invalid size specification line.') + end + end + rows = sizeinfo(1); + cols = sizeinfo(2); + entries = rows*cols; +end + +fclose(mmfile); +% Done. + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/mmread.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/mmread.m new file mode 100644 index 0000000000000000000000000000000000000000..ba1512f9ccbc2bbbeb62b1189d4009aa1bfe705e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/mmread.m @@ -0,0 +1,222 @@ +function [A,rows,cols,entries,rep,field,symm] = mmread(filename) +% +% function [A] = mmread(filename) +% +% function [A,rows,cols,entries,rep,field,symm] = mmread(filename) +% +% Reads the contents of the Matrix Market file 'filename' +% into the matrix 'A'. 'A' will be either sparse or full, +% depending on the Matrix Market format indicated by +% 'coordinate' (coordinate sparse storage), or +% 'array' (dense array storage). The data will be duplicated +% as appropriate if symmetry is indicated in the header. +% +% Optionally, size information about the matrix can be +% obtained by using the return values rows, cols, and +% entries, where entries is the number of nonzero entries +% in the final matrix. Type information can also be retrieved +% using the optional return values rep (representation), field, +% and symm (symmetry). +% + +mmfile = fopen(filename,'r'); +if ( mmfile == -1 ) + disp(filename); + error('File not found'); +end; + +header = fgets(mmfile); +if (header == -1 ) + error('Empty file.') +end + +% NOTE: If using a version of Matlab for which strtok is not +% defined, substitute 'gettok' for 'strtok' in the +% following lines, and download gettok.m from the +% Matrix Market site. +[head0,header] = strtok(header); % see note above +[head1,header] = strtok(header); +[rep,header] = strtok(header); +[field,header] = strtok(header); +[symm,header] = strtok(header); +head1 = lower(head1); +rep = lower(rep); +field = lower(field); +symm = lower(symm); +if ( length(symm) == 0 ) + disp(['Not enough words in header line of file ',filename]) + disp('Recognized format: ') + disp('%%MatrixMarket matrix representation field symmetry') + error('Check header line.') +end +if ( ~ strcmp(head0,'%%MatrixMarket') ) + error('Not a valid MatrixMarket header.') +end +if ( ~ strcmp(head1,'matrix') ) + disp(['This seems to be a MatrixMarket ',head1,' file.']); + disp('This function only knows how to read MatrixMarket matrix files.'); + disp(' '); + error(' '); +end + +% Read through comments, ignoring them + +commentline = fgets(mmfile); +while length(commentline) > 0 & commentline(1) == '%', + commentline = fgets(mmfile); +end + +% Read size information, then branch according to +% sparse or dense format + +if ( strcmp(rep,'coordinate')) % read matrix given in sparse + % coordinate matrix format + + [sizeinfo,count] = sscanf(commentline,'%d%d%d'); + while ( count == 0 ) + commentline = fgets(mmfile); + if (commentline == -1 ) + error('End-of-file reached before size information was found.') + end + [sizeinfo,count] = sscanf(commentline,'%d%d%d'); + if ( count > 0 & count ~= 3 ) + error('Invalid size specification line.') + end + end + rows = sizeinfo(1); + cols = sizeinfo(2); + entries = sizeinfo(3); + + if ( strcmp(field,'real') ) % real valued entries: + + [T,count] = fscanf(mmfile,'%f',3); + T = [T; fscanf(mmfile,'%f')]; + if ( size(T) ~= 3*entries ) + message = ... + str2mat('Data file does not contain expected amount of data.',... + 'Check that number of data lines matches nonzero count.'); + disp(message); + error('Invalid data.'); + end + T = reshape(T,3,entries)'; + A = sparse(T(:,1), T(:,2), T(:,3), rows , cols); + + elseif ( strcmp(field,'complex')) % complex valued entries: + + T = fscanf(mmfile,'%f',4); + T = [T; fscanf(mmfile,'%f')]; + if ( size(T) ~= 4*entries ) + message = ... + str2mat('Data file does not contain expected amount of data.',... + 'Check that number of data lines matches nonzero count.'); + disp(message); + error('Invalid data.'); + end + T = reshape(T,4,entries)'; + A = sparse(T(:,1), T(:,2), T(:,3) + T(:,4)*sqrt(-1), rows , cols); + + elseif ( strcmp(field,'pattern')) % pattern matrix (no values given): + + T = fscanf(mmfile,'%f',2); + T = [T; fscanf(mmfile,'%f')]; + if ( size(T) ~= 2*entries ) + message = ... + str2mat('Data file does not contain expected amount of data.',... + 'Check that number of data lines matches nonzero count.'); + disp(message); + error('Invalid data.'); + end + T = reshape(T,2,entries)'; + A = sparse(T(:,1), T(:,2), ones(entries,1) , rows , cols); + + end + +elseif ( strcmp(rep,'array') ) % read matrix given in dense + % array (column major) format + + [sizeinfo,count] = sscanf(commentline,'%d%d'); + while ( count == 0 ) + commentline = fgets(mmfile); + if (commentline == -1 ) + error('End-of-file reached before size information was found.') + end + [sizeinfo,count] = sscanf(commentline,'%d%d'); + if ( count > 0 & count ~= 2 ) + error('Invalid size specification line.') + end + end + rows = sizeinfo(1); + cols = sizeinfo(2); + entries = rows*cols; + if ( strcmp(field,'real') ) % real valued entries: + A = fscanf(mmfile,'%f',1); + A = [A; fscanf(mmfile,'%f')]; + if ( strcmp(symm,'symmetric') | strcmp(symm,'hermitian') | strcmp(symm,'skew-symmetric') ) + for j=1:cols-1, + currenti = j*rows; + A = [A(1:currenti); zeros(j,1);A(currenti+1:length(A))]; + end + elseif ( ~ strcmp(symm,'general') ) + disp('Unrecognized symmetry') + disp(symm) + disp('Recognized choices:') + disp(' symmetric') + disp(' hermitian') + disp(' skew-symmetric') + disp(' general') + error('Check symmetry specification in header.'); + end + A = reshape(A,rows,cols); + elseif ( strcmp(field,'complex')) % complx valued entries: + tmpr = fscanf(mmfile,'%f',1); + tmpi = fscanf(mmfile,'%f',1); + A = tmpr+tmpi*i; + for j=1:entries-1 + tmpr = fscanf(mmfile,'%f',1); + tmpi = fscanf(mmfile,'%f',1); + A = [A; tmpr + tmpi*i]; + end + if ( strcmp(symm,'symmetric') | strcmp(symm,'hermitian') | strcmp(symm,'skew-symmetric') ) + for j=1:cols-1, + currenti = j*rows; + A = [A(1:currenti); zeros(j,1);A(currenti+1:length(A))]; + end + elseif ( ~ strcmp(symm,'general') ) + disp('Unrecognized symmetry') + disp(symm) + disp('Recognized choices:') + disp(' symmetric') + disp(' hermitian') + disp(' skew-symmetric') + disp(' general') + error('Check symmetry specification in header.'); + end + A = reshape(A,rows,cols); + elseif ( strcmp(field,'pattern')) % pattern (makes no sense for dense) + disp('Matrix type:',field) + error('Pattern matrix type invalid for array storage format.'); + else % Unknown matrix type + disp('Matrix type:',field) + error('Invalid matrix type specification. Check header against MM documentation.'); + end +end + +% +% If symmetric, skew-symmetric or Hermitian, duplicate lower +% triangular part and modify entries as appropriate: +% + +if ( strcmp(symm,'symmetric') ) + A = A + A.' - diag(diag(A)); + entries = nnz(A); +elseif ( strcmp(symm,'hermitian') ) + A = A + A' - diag(diag(A)); + entries = nnz(A); +elseif ( strcmp(symm,'skew-symmetric') ) + A = A - A'; + entries = nnz(A); +end + +fclose(mmfile); +% Done. + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/mmwrite.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/mmwrite.m new file mode 100644 index 0000000000000000000000000000000000000000..c68970d149f9d0c5d03cc48aba768ed79cd6aca2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/mmwrite.m @@ -0,0 +1,274 @@ +function [ err ] = mmwrite(filename,A,comment,field,precision) +% +% Function: mmwrite(filename,A,comment,field,precision) +% +% Writes the sparse or dense matrix A to a Matrix Market (MM) +% formatted file. +% +% Required arguments: +% +% filename - destination file +% +% A - sparse or full matrix +% +% Optional arguments: +% +% comment - matrix of comments to prepend to +% the MM file. To build a comment matrix, +% use str2mat. For example: +% +% comment = str2mat(' Comment 1' ,... +% ' Comment 2',... +% ' and so on.',... +% ' to attach a date:',... +% [' ',date]); +% If ommitted, a single line date stamp comment +% will be included. +% +% field - 'real' +% 'complex' +% 'integer' +% 'pattern' +% If ommitted, data will determine type. +% +% precision - number of digits to display for real +% or complex values +% If ommitted, full working precision is used. +% + +if ( nargin == 5) + precision = 16; +elseif ( nargin == 4) + precision = 16; +elseif ( nargin == 3) + mattype = 'real'; % placeholder, will check after FIND-ing A + precision = 16; +elseif ( nargin == 2) + comment = ''; + % Check whether there is an imaginary part: + mattype = 'real'; % placeholder, will check after FIND-ing A + precision = 16; +end + +mmfile = fopen([filename],'w'); +if ( mmfile == -1 ) + error('Cannot open file for output'); +end; + + +[M,N] = size(A); + +%%%%%%%%%%%%% This part for sparse matrices %%%%%%%%%%%%%%%% +if ( issparse(A) ) + + [I,J,V] = find(A); + if ( sum(abs(imag(nonzeros(V)))) > 0 ) + Vreal = 0; + else + Vreal = 1; + end + + if ( ~ strcmp(mattype,'pattern') & Vreal ) + mattype = 'real'; + elseif ( ~ strcmp(mattype,'pattern') ) + mattype = 'complex'; + end +% +% Determine symmetry: +% + if ( M ~= N ) + symm = 'general'; + issymm = 0; + NZ = length(V); + else + issymm = 1; + NZ = length(V); + for i=1:NZ + if ( A(J(i),I(i)) ~= V(i) ) + issymm = 0; + break; + end + end + if ( issymm ) + symm = 'symmetric'; + ATEMP = tril(A); + [I,J,V] = find(ATEMP); + NZ = nnz(ATEMP); + else + isskew = 1; + for i=1:NZ + if ( A(J(i),I(i)) ~= - V(i) ) + isskew = 0; + break; + end + end + if ( isskew ) + symm = 'skew-symmetric'; + ATEMP = tril(A); + [I,J,V] = find(ATEMP); + NZ = nnz(ATEMP); + elseif ( strcmp(mattype,'complex') ) + isherm = 1; + for i=1:NZ + if ( A(J(i),I(i)) ~= conj(V(i)) ) + isherm = 0; + break; + end + end + if ( isherm ) + symm = 'hermitian'; + ATEMP = tril(A); + [I,J,V] = find(ATEMP); + NZ = nnz(ATEMP); + else + symm = 'general'; + NZ = nnz(A); + end + else + symm = 'general'; + NZ = nnz(A); + end + end + end + +% Sparse coordinate format: + + rep = 'coordinate'; + + + fprintf(mmfile,'%%%%MatrixMarket matrix %s %s %s\n',rep,mattype,symm); + [MC,NC] = size(comment); + if ( MC == 0 ) + fprintf(mmfile,'%% Generated %s\n',[date]); + else + for i=1:MC, + fprintf(mmfile,'%%%s\n',comment(i,:)); + end + end + fprintf(mmfile,'%d %d %d\n',M,N,NZ); + cplxformat = sprintf('%%d %%d %% .%dg %% .%dg\n',precision,precision); + realformat = sprintf('%%d %%d %% .%dg\n',precision); + if ( strcmp(mattype,'real') ) + for i=1:NZ + fprintf(mmfile,realformat,I(i),J(i),V(i)); + end; + elseif ( strcmp(mattype,'complex') ) + for i=1:NZ + fprintf(mmfile,cplxformat,I(i),J(i),real(V(i)),imag(V(i))); + end; + elseif ( strcmp(mattype,'pattern') ) + for i=1:NZ + fprintf(mmfile,'%d %d\n',I(i),J(i)); + end; + else + err = -1; + disp('Unsupported mattype:') + mattype + end; + +%%%%%%%%%%%%% This part for dense matrices %%%%%%%%%%%%%%%% +else + if ( sum(abs(imag(nonzeros(A)))) > 0 ) + Areal = 0; + else + Areal = 1; + end + if ( ~strcmp(mattype,'pattern') & Areal ) + mattype = 'real'; + elseif ( ~strcmp(mattype,'pattern') ) + mattype = 'complex'; + end +% +% Determine symmetry: +% + if ( M ~= N ) + issymm = 0; + symm = 'general'; + else + issymm = 1; + for j=1:N + for i=j+1:N + if (A(i,j) ~= A(j,i) ) + issymm = 0; + break; + end + end + if ( ~ issymm ) break; end + + end + if ( issymm ) + symm = 'symmetric'; + else + isskew = 1; + for j=1:N + for i=j+1:N + if (A(i,j) ~= - A(j,i) ) + isskew = 0; + break; + end + end + if ( ~ isskew ) break; end + end + if ( isskew ) + symm = 'skew-symmetric'; + elseif ( strcmp(mattype,'complex') ) + isherm = 1; + for j=1:N + for i=j+1:N + if (A(i,j) ~= conj(A(j,i)) ) + isherm = 0; + break; + end + end + if ( ~ isherm ) break; end + end + if ( isherm ) + symm = 'hermitian'; + else + symm = 'general'; + end + else + symm = 'general'; + end + end + end + +% Dense array format: + + rep = 'array'; + [MC,NC] = size(comment); + fprintf(mmfile,'%%%%MatrixMarket mtx %s %s %s\n',rep,mattype,symm); + for i=1:MC, + fprintf(mmfile,'%%%s\n',comment(i,:)); + end; + fprintf(mmfile,'%d %d\n',M,N); + cplxformat = sprintf('%% .%dg %% .%dg\n', precision,precision); + realformat = sprintf('%% .%dg\n', precision); + if ( ~ strcmp(symm,'general') ) + rowloop = 'j'; + else + rowloop = '1'; + end + if ( strcmp(mattype,'real') ) + for j=1:N + for i=eval(rowloop):M + fprintf(mmfile,realformat,A(i,j)); + end + end + elseif ( strcmp(mattype,'complex') ) + for j=1:N + for i=eval(rowloop):M + fprintf(mmfile,cplxformat,real(A(i,j)),imag(A(i,j))); + end + end + elseif ( strcmp(mattype,'pattern') ) + err = -2 + disp('Pattern type inconsistant with dense matrix') + else + err = -2 + disp('Unknown matrix type:') + mattype + end +end + +fclose(mmfile); diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/pythag.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/pythag.m new file mode 100644 index 0000000000000000000000000000000000000000..80ce4bf97923e7bf0dd8aea646cc846e88578be6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/pythag.m @@ -0,0 +1,31 @@ +function x = pythag(y,z) +%PYTHAG Computes sqrt( y^2 + z^2 ). +% +% x = pythag(y,z) +% +% Returns sqrt(y^2 + z^2) but is careful to scale to avoid overflow. + +% Christian H. Bischof, Argonne National Laboratory, 03/31/89. + +[m n] = size(y); +if m>1 | n>1 + y = y(:); z=z(:); + rmax = max(abs([y';z']))'; + id=find(rmax==0); + if length(id)>0 + rmax(id) = 1; + x = rmax.*sqrt((y./rmax).^2 + (z./rmax).^2); + x(id)=0; + else + x = rmax.*sqrt((y./rmax).^2 + (z./rmax).^2); + end + x = reshape(x,m,n); +else + rmax = max(abs([y;z])); + if (rmax==0) + x = 0; + else + x = rmax*sqrt((y/rmax)^2 + (z/rmax)^2); + end +end + \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/refinebounds.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/refinebounds.m new file mode 100644 index 0000000000000000000000000000000000000000..003f9ce2f0c5c07c6e2ae85e098a379f79b01e19 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/refinebounds.m @@ -0,0 +1,41 @@ +function [bnd,gap] = refinebounds(D,bnd,tol1) +%REFINEBONDS Refines error bounds for Ritz values based on gap-structure +% +% bnd = refinebounds(lambda,bnd,tol1) +% +% Treat eigenvalues closer than tol1 as a cluster. + +% Rasmus Munk Larsen, DAIMI, 1998 + +j = length(D); + +if j<=1 + return +end +% Sort eigenvalues to use interlacing theorem correctly +[D,PERM] = sort(D); +bnd = bnd(PERM); + + +% Massage error bounds for very close Ritz values +eps34 = sqrt(eps*sqrt(eps)); +[y,mid] = max(bnd); +for l=[-1,1] + for i=((j+1)-l*(j-1))/2:l:mid-l + if abs(D(i+l)-D(i)) < eps34*abs(D(i)) + if bnd(i)>tol1 & bnd(i+l)>tol1 + bnd(i+l) = pythag(bnd(i),bnd(i+l)); + bnd(i) = 0; + end + end + end +end +% Refine error bounds +gap = inf*ones(1,j); +gap(1:j-1) = min([gap(1:j-1);[D(2:j)-bnd(2:j)-D(1:j-1)]']); +gap(2:j) = min([gap(2:j);[D(2:j)-D(1:j-1)-bnd(1:j-1)]']); +gap = gap(:); +I = find(gap>bnd); +bnd(I) = bnd(I).*(bnd(I)./gap(I)); + +bnd(PERM) = bnd; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.f b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.f new file mode 100644 index 0000000000000000000000000000000000000000..e336ee0865c8ab80f2ddf665b65b203c0b480e78 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.f @@ -0,0 +1,116 @@ + subroutine reorth(n,k,V,ldv,vnew,normv,index,alpha,work, + c iflag,nre) +c +c FORTRAN 77 version of MATLAB routine REORTH: +c +c REORTH Reorthogonalize a vector using iterated Gram-Schmidt +c +c [R_NEW,NORMR_NEW,NRE] = reorth(Q,R,NORMR,INDEX,ALPHA,METHOD) +c reorthogonalizes R against the subset of columns of Q given by INDEX. +c If INDEX==[] then R is reorthogonalized all columns of Q. +c If the result R_NEW has a small norm, i.e. if norm(R_NEW) < ALPHA*NORMR, +c then a second reorthogonalization is performed. If the norm of R_NEW +c is once more decreased by more than a factor of ALPHA then R is +c numerically in span(Q(:,INDEX)) and a zero-vector is returned for R_NEW. +c +c If method==0 then iterated modified Gram-Schmidt is used. +c If method==1 then iterated classical Gram-Schmidt is used. +c +c The default value for ALPHA is 0.5. +c NRE is the number of reorthogonalizations performed (1 or 2). + +c References: +c Aake Bjorck, "Numerical Methods for Least Squares Problems", +c SIAM, Philadelphia, 1996, pp. 68-69. +c +c J.~W. Daniel, W.~B. Gragg, L. Kaufman and G.~W. Stewart, +c ``Reorthogonalization and Stable Algorithms Updating the +c Gram-Schmidt QR Factorization'', Math. Comp., 30 (1976), no. +c 136, pp. 772-795. +c +c B. N. Parlett, ``The Symmetric Eigenvalue Problem'', +c Prentice-Hall, Englewood Cliffs, NJ, 1980. pp. 105-109 + +c Rasmus Munk Larsen, DAIMI, 1998. + implicit none + integer n,k,ldv,i,iflag,nre + double precision V(ldv,*),vnew(*),normv,index(*),work(*) + double precision alpha,normv_old,dnrm2 + integer MAXTRY + parameter (MAXTRY=4) + external dgemv,dnrm2 + +c Hack: If index .ne. 1:k we do MGS to avoid reshuffling. + if (iflag.eq.1) then + do i=1,k + if (int(index(i)).ne.i) then + iflag=0 + goto 100 + endif + enddo + endif + 100 normv_old = 0 + nre = 0 + normv = dnrm2(n,vnew,1) + do while ((normv.lt.alpha*normv_old .or. nre.eq.0)) + if (iflag.eq.1) then +c CGS: + call dgemv('T',n,k,1D0,V,ldv,vnew,1,0D0,work,1) + call dgemv('N',n,k,-1D0,V,ldv,work,1,1D0,vnew,1) + else +c MGS: + call MGS(n,k,V,ldv,vnew,index) + endif + normv_old = normv + normv = dnrm2(n,vnew,1) + nre = nre + 1 + + if ( nre.gt.MAXTRY ) then +c +c vnew is numerically in span(V) => return vnew = (0,0,...,0)^T + normv = 0d0 + do i=1,n + vnew(i) = 0d0 + enddo + return + endif + enddo + end +c +c**************************************************************************** +c + + subroutine MGS(n,k,V,ldv,vnew,index) + implicit none + integer n,k,ldv + double precision V(ldv,*),vnew(*),index(*) + integer i,j,idx + double precision s + +c +c Modified Gram-Schmidt orthogonalization: +c Orthogalizes vnew against the k vectors in V by the +c iterative process +c +c FOR i=1...k DO +c vnew = vnew - DOT( V(:,i), vnew ) * V(:,i) +c + +c This simple version is faster on Pentium machines. +c Compile with "g77 -O6 -funroll-all-loops -fomit-frame-pointer" + + do i=1,k + idx = int(index(i)) + s = 0 + do j=1,n + s = s + V(j,idx)*vnew(j) + enddo + do j=1,n + vnew(j) = vnew(j) - s*V(j,idx) + enddo + enddo + end +c +c**************************************************************************** +c + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.m new file mode 100644 index 0000000000000000000000000000000000000000..b7045a1881eaf734869f2ded5f982ec029bbabef --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.m @@ -0,0 +1,102 @@ +function [r,normr,nre,s] = reorth(Q,r,normr,index,alpha,method) + +%REORTH Reorthogonalize a vector using iterated Gram-Schmidt +% +% [R_NEW,NORMR_NEW,NRE] = reorth(Q,R,NORMR,INDEX,ALPHA,METHOD) +% reorthogonalizes R against the subset of columns of Q given by INDEX. +% If INDEX==[] then R is reorthogonalized all columns of Q. +% If the result R_NEW has a small norm, i.e. if norm(R_NEW) < ALPHA*NORMR, +% then a second reorthogonalization is performed. If the norm of R_NEW +% is once more decreased by more than a factor of ALPHA then R is +% numerically in span(Q(:,INDEX)) and a zero-vector is returned for R_NEW. +% +% If method==0 then iterated modified Gram-Schmidt is used. +% If method==1 then iterated classical Gram-Schmidt is used. +% +% The default value for ALPHA is 0.5. +% NRE is the number of reorthogonalizations performed (1 or 2). + +% References: +% Aake Bjorck, "Numerical Methods for Least Squares Problems", +% SIAM, Philadelphia, 1996, pp. 68-69. +% +% J.~W. Daniel, W.~B. Gragg, L. Kaufman and G.~W. Stewart, +% ``Reorthogonalization and Stable Algorithms Updating the +% Gram-Schmidt QR Factorization'', Math. Comp., 30 (1976), no. +% 136, pp. 772-795. +% +% B. N. Parlett, ``The Symmetric Eigenvalue Problem'', +% Prentice-Hall, Englewood Cliffs, NJ, 1980. pp. 105-109 + +% Rasmus Munk Larsen, DAIMI, 1998. + +% Check input arguments. +warning('PROPACK:NotUsingMex','Using slow matlab code for reorth.') +if nargin<2 + error('Not enough input arguments.') +end +[n k1] = size(Q); +if nargin<3 | isempty(normr) +% normr = norm(r); + normr = sqrt(r'*r); +end +if nargin<4 | isempty(index) + k=k1; + index = [1:k]'; + simple = 1; +else + k = length(index); + if k==k1 & index(:)==[1:k]' + simple = 1; + else + simple = 0; + end +end +if nargin<5 | isempty(alpha) + alpha=0.5; % This choice garanties that + % || Q^T*r_new - e_{k+1} ||_2 <= 2*eps*||r_new||_2, + % cf. Kahans ``twice is enough'' statement proved in + % Parletts book. +end +if nargin<6 | isempty(method) + method = 0; +end +if k==0 | n==0 + return +end +if nargout>3 + s = zeros(k,1); +end + + +normr_old = 0; +nre = 0; +while normr < alpha*normr_old | nre==0 + if method==1 + if simple + t = Q'*r; + r = r - Q*t; + else + t = Q(:,index)'*r; + r = r - Q(:,index)*t; + end + else + for i=index, + t = Q(:,i)'*r; + r = r - Q(:,i)*t; + end + end + if nargout>3 + s = s + t; + end + normr_old = normr; +% normr = norm(r); + normr = sqrt(r'*r); + nre = nre + 1; + if nre > 4 + % r is in span(Q) to full accuracy => accept r = 0 as the new vector. + r = zeros(n,1); + normr = 0; + return + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexglx b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexglx new file mode 100644 index 0000000000000000000000000000000000000000..8ca4c63928092bd4a907c81d807c03610145212b Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexglx differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexsg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexsg new file mode 100644 index 0000000000000000000000000000000000000000..cd3513cbc53ddbe4491021f4fadec15e586d3c33 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexsg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexsg64 b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexsg64 new file mode 100644 index 0000000000000000000000000000000000000000..9f4f6a0cac39e11504bbdeec32ad61ed7ac94cd1 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexsg64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexsol b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexsol new file mode 100644 index 0000000000000000000000000000000000000000..b3d03112eb4735287e8c07cdc67bcd5084f9cb24 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth.mexsol differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth_mex.c b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth_mex.c new file mode 100644 index 0000000000000000000000000000000000000000..7556369a3f07109a7576545ff8ee5ae4630f8391 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/reorth_mex.c @@ -0,0 +1,84 @@ +/* +------------------------------------------------------------------------- + GATEWAY ROUTINE FOR CALLING REORTH FROM MATLAB. + + REORTH Reorthogonalize a vector using iterated Gram-Schmidt + + [R_NEW,NORMR_NEW,NRE] = reorth(Q,R,NORMR,INDEX,ALPHA,METHOD) + reorthogonalizes R against the subset of columns of Q given by INDEX. + If INDEX==[] then R is reorthogonalized all columns of Q. + If the result R_NEW has a small norm, i.e. if norm(R_NEW) < ALPHA*NORMR, + then a second reorthogonalization is performed. If the norm of R_NEW + is once more decreased by more than a factor of ALPHA then R is + numerically in span(Q(:,INDEX)) and a zero-vector is returned for R_NEW. + + If method==0 then iterated modified Gram-Schmidt is used. + If method==1 then iterated classical Gram-Schmidt is used. + + The default value for ALPHA is 0.5. + NRE is the number of reorthogonalizations performed (1 or 2). + + References: + Aake Bjorck, "Numerical Methods for Least Squares Problems", + SIAM, Philadelphia, 1996, pp. 68-69. + + J.~W. Daniel, W.~B. Gragg, L. Kaufman and G.~W. Stewart, + ``Reorthogonalization and Stable Algorithms Updating the + Gram-Schmidt QR Factorization'', Math. Comp., 30 (1976), no. + 136, pp. 772-795. + + B. N. Parlett, ``The Symmetric Eigenvalue Problem'', + Prentice-Hall, Englewood Cliffs, NJ, 1980. pp. 105-109 + + Rasmus Munk Larsen, DAIMI, 1998. +------------------------------------------------------------------------- + */ + +#include <string.h> +#include "mex.h" + +/* Template for reorth: */ + +void reorth_(int *n, int *k, double *V, int *ldv, double *vnew, + double *normvnew, double *index, double *alpha, double *work, + int *iflag, int *nre); + +/* Here comes the gateway function to be called by Matlab: */ +void mexFunction(int nlhs, mxArray *plhs[], + int nrhs, const mxArray *prhs[]) +{ + int n, k1, k, imethod, inre; + double *work; + + if (nrhs != 6) + mexErrMsgTxt("reorth requires 6 input arguments"); + else if (nlhs < 2) + mexErrMsgTxt("reorth requires at least 2 output arguments"); + + n = mxGetM(prhs[0]); /* get the dimensions of the input */ + k1 = mxGetN(prhs[0]); + k = mxGetM(prhs[3]) * mxGetN(prhs[3]); + + /* Create/allocate return argument, a 1x1 real-valued Matrix */ + plhs[0]=mxCreateDoubleMatrix(n,1,mxREAL); + plhs[1]=mxCreateDoubleMatrix(1,1,mxREAL); + if (nlhs>2) + plhs[2]=mxCreateDoubleMatrix(1,1,mxREAL); + + work = mxCalloc(k,sizeof(double)); + + memcpy(mxGetPr(plhs[0]),mxGetPr(prhs[1]), n*sizeof(double)); + memcpy(mxGetPr(plhs[1]),mxGetPr(prhs[2]), sizeof(double)); + imethod = (int) mxGetScalar(prhs[5]); + + reorth_(&n, &k, mxGetPr(prhs[0]), &n, mxGetPr(plhs[0]), + mxGetPr(plhs[1]), mxGetPr(prhs[3]), mxGetPr(prhs[4]), + work,&imethod,&inre); + if (nlhs>2) + *(mxGetPr(plhs[2])) = (double) inre*k; + + mxFree(work); +} + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/test.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/test.m new file mode 100644 index 0000000000000000000000000000000000000000..bb0f3714b3af73973873f557a911ac0c64524c58 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/test.m @@ -0,0 +1,327 @@ +% Script for testing singular values computed using LANSVD, LANEIG and +% EIGS. + +% Rasmus Munk Larsen, DAIMI, 1998. +global MxV MU MUTRUE NU NUTRUE +MU=[]; +MUTRUE=[]; +NU=[]; +NUTRUE=[]; +rand('state',0); +setup = 1; % set setup=1 to set up testproblem. +k=10; % Number of singular values to compute +HB_dir = 'Harwell-Boeing'; + +% TESTPROBLEMS. Uncomment the relevant line to select a problem. +%=============================================================== +% NAME DIMENSIONS +%=============================================================== + +% Discrete 1. order derivative matrix: +%problem = 'derivative';% 500 x 501 + +% Discrete 2. order derivative matrix. (symmetric) +%problem = 'laplace'; % 500 x 500 + +% Test problem from helioseismology. +%problem='helio212a'; % 212 x 100 +%problem='helio212b'; % 212 x 100 + +% Harwell-Boeing testmatrices: +%problem='abb313'; % 313 x 175 +%problem='west0479'; % 479 x 479 +%problem='rbs480a'; % 480 x 480 +%problem='illc1850'; % 1850 x 712 +%problem='qh1484'; % 1484 x 1484 +problem='mhd4800a'; % 4800 x 4800 +%problem='cry10000'; % 10000 x 10000 +%problem='fidap011'; % 16614 x 16614 +%problem='af23560'; % 23560 x 23560 +%problem='bcsstk32'; % 44609 x 44609 +%problem='s3dkt3m2'; % 90449 x 90449 + +global A C +format compact + +if setup==1, + A=[]; C=[]; Sigma=[]; + switch problem + case 'derivative' + m = 500; n=m+1; + e = ones(n,1); + A = spdiags([e -e], 0:1, n-1, n); + Sigma = -sort(-2*cos(pi/2*[m:-1:1]'./(m+1))); + Sigma1 = svd(full(A)); + case 'laplace' + m = 100; n=m; + e = ones(n,1); + A = spdiags([-e 2*e -e], -1:1, n, n); + Sigma = -sort(-4*cos(pi/2*[n:-1:1]'./(n+1)).^2); + Sigma1 = svd(full(A)); + case 'helio212a' + load 'helio.mat' + [m n] = size(A); + [U,Sigma,V] = svd(full(A)); + x = rand(m,1); x = x/norm(x); + [dummy,P1] = sort(x); + y = rand(n,1); y = y/norm(y); + [dummy,P2] = sort(y); + A = sparse(Sigma); + A = A(P1,P2); % Permute rows and columns randomly. + Sigma = diag(Sigma); + % shift = eps*min(Sigma); + shift = 0; + % Add a small perturbation to try hide that A is just + % a permuted diagonal and see if we can fool SVD into doing full + % reduction to bidiagonal form. + if shift~=0 + A = A + shift*(x*y'); + Sigma = Sigma+shift; + end + Sigma1 = svd(full(A)); + case 'helio212b' + load 'helio.mat' + [U,Sigma,V] = svd(full(A)); + A = U * Sigma *V'; + Sigma = diag(Sigma); + Sigma1 = svd(full(A)); + case 'diag' + m = 200; n=100; +% Sigma = logspace(0,-0.1,n); + Sigma = [n:-1:1]'; + Sigma(1) = 1000; + A = [spdiags(Sigma(:),0,n,n); sparse(m-n,n)]; + otherwise + cur = pwd; + cd(HB_dir) + file = [problem,'.mtx']; + [A,m,n,nz] = mmread(file); + cd(cur) + A = sparse(A); + if min(m,n)^2*max(m,n) < 300^3 + Sigma = svd(full(A)); + end + end + [m n] = size(A); + fprintf('nnz(A) = %i\n',nnz(A)); + C = sparse([[sparse(m,m),A];[A',sparse(n,n)]]); +end + +%%% Print information about matrix %%% +clc; +disp('************** PROPACK TEST ****************') +fprintf('The testmatrix %s is %i-by-%i and has %i non-zero elements.\n', ... + problem,m,n,nnz(A)); +if issparse(A) + fprintf('Here is what the sparsity pattern of the matrix looks like... \n(press a key to continue)\n') + spy(A) + title(problem) + pause +hold off +end +fprintf('Calculating %i singular triplets of the matrix.\n',k) + + +if max(m,n) < 300 +%%%%%%%%%%%%%%%%%%%% SVD %%%%%%%%%%%%%%%%%%%%%%%%%% +fprintf('-------------------------------------------------------------------\n') +fprintf('\n') +fprintf('METHOD = SVD\n') +fprintf('\n') + + +flops(0);tic; +[U,S,V] = svd(full(A),0); +Sigma=diag(S); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %e\n',flops); +fprintf('Residual norm = %e\n',norm(A*V - U*S,'fro')/norm(A,'fro')); +fprintf('Orthogonality U = %e\n',norm(eye(n) - U'*U,'fro')) +fprintf('Orthogonality V = %e\n',norm(eye(n) - V'*V,'fro')) +end + + +%%%%%%%%%%%%%%%%%%%% LANSVD %%%%%%%%%%%%%%%%%%%%%%%%%% +fprintf('-------------------------------------------------------------------\n') +fprintf('\n') +fprintf('METHOD = LANSVD\n') +fprintf('\n') + +options = []; +v0 = rand(m,1)-0.5; +options.p0 = v0; + +MxV = 0;flops(0);tic; +[U1,S1,V1] = lansvd('Afunc','Atransfunc',m,n,k,'L',options); +fprintf('Number MxV = %f\n',MxV); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %e\n',flops); +fprintf('Residual norm = %e\n',norm(A*V1 - U1*S1,'fro')/norm(A,'fro')); +fprintf('Orthogonality U = %e\n',norm(eye(k) - U1'*U1,'fro')) +fprintf('Orthogonality V = %e\n',norm(eye(k) - V1'*V1,'fro')) + +if ~isempty(Sigma) + % Compare with "true" singular values + S1 = diag(S1); + l= length(S1); + E1 = abs((S1 - Sigma(1:l))./Sigma(1:l)); + fprintf('Max rel. error = %g\n',max(E1)) + fprintf('Mean rel. error = %g\n',mean(E1)) + if exist('Sigma1') & ~isempty(Sigma1) + semilogy(abs((Sigma1(1:l) - Sigma(1:l))./Sigma(1:l)),'+'); + hold on + end + semilogy(E1,'o'); + hold off + ylabel('Relative error |\theta_i - \sigma_i| / \sigma_i') + xlabel('i') +end + +%%%%%%%%%%%%%%%%%%%% LANEIG(A'*A) %%%%%%%%%%%%%%%%%%%%%%%%%% +fprintf('-------------------------------------------------------------------\n') +fprintf('\n') +fprintf('METHOD = LANEIG(A''*A)\n') +fprintf('\n') +options=[]; +options.v0 = A'*v0; + + +flops(0);MxV=0; tic; +%S = laneig(C,k,'AL',options); +[V3,S3,b3] = laneig('AtAfunc',n,k,'AL',options); +U3 = A*V3; +for i=1:k + U3(:,i) = U3(:,i)/norm(U3(:,i)); +end + +fprintf('Number MxV = %f\n',MxV); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %e\n',flops); +fprintf('Residual norm = %e\n',norm(A'*(A*V3) - V3*S3,'fro')/norm(A'*A,'fro')); +fprintf('Orthogonality U = %e\n',norm(eye(k) - U3'*U3,'fro')) +fprintf('Orthogonality V = %e\n',norm(eye(k) - V3'*V3,'fro')) +S3 = diag(sqrt(diag(S3))); + +if ~isempty(Sigma) + S3 = diag(S3); + l= length(S3); + % Compare with "true" singular values + E3 = abs((S3 - Sigma(1:l))./Sigma(1:l)); + fprintf('Max rel. error = %g\n',max(E3)) + fprintf('Mean rel. error = %g\n',mean(E3)) + hold on + semilogy(E3,'d'); + hold off +end + +%%%%%%%%%%%%%%%%%%%% LANEIG(C) %%%%%%%%%%%%%%%%%%%%%%%%%% +fprintf('-------------------------------------------------------------------\n') +fprintf('\n') +fprintf('METHOD = LANEIG(C)\n') +fprintf('\n') +options.v0 = [v0;zeros(n,1)]; + +tic; flops(0);MxV=0; +%S = laneig(C,k,'AL',options); +[V2,S2] = laneig('Cfunc',m+n,k,'AL',options); +U2= sqrt(2)*V2(1:m,:); +V2= sqrt(2)*V2(m+1:end,:); +fprintf('Number MxV = %f\n',MxV); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %e\n',flops); +fprintf('Residual norm = %e\n',norm(A*V2 - U2*S2,'fro')/norm(A,'fro')); +fprintf('Orthogonality U = %e\n',norm(eye(k) - U2'*U2,'fro')) +fprintf('Orthogonality V = %e\n',norm(eye(k) - V2'*V2,'fro')) + + +if ~isempty(Sigma) + S2 = diag(S2); + l= length(S2); + % Compare with "true" singular values + E2 = abs((S2 - Sigma(1:l))./Sigma(1:l)); + fprintf('Max rel. error = %g\n',max(E2)) + fprintf('Mean rel. error = %g\n',mean(E2)) + hold on + semilogy(E2,'x'); + hold off + legend('SVD','BPRO','PRO(A''*A)','PRO(C)',2) +end + + +%%%%%%%%%%%%%%%%%%%% EIGS %%%%%%%%%%%%%%%%%%%%%%%% +% Try ARPACK based eigs routine: +fprintf('\n') +fprintf('-------------------------------------------------------------------\n') +fprintf('METHOD = EIGS(C)\n') +fprintf('\n') + +options =[]; +options.disp=0; +options.issym = 1; +options.v0 = [v0;zeros(n,1)]; + +tic; flops(0);MxV=0; +[V4,S4] = eigs('Cfunc',m+n,k,'LR',options); +U4= sqrt(2)*V4(1:m,:); +V4= sqrt(2)*V4(m+1:end,:); +fprintf('Number MxV = %f\n',MxV); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %e\n',flops); +fprintf('Residual norm = %e\n',norm(A*V4 - U4*S4,'fro')/norm(A,'fro')); +fprintf('Orthogonality U = %e\n',norm(eye(k) - U4'*U4,'fro')) +fprintf('Orthogonality V = %e\n',norm(eye(k) - V4'*V4,'fro')) + +if ~isempty(Sigma) + % Compare with "true" singular values + S4 = diag(S4); + l= length(S4); + E4 = abs((S4 - Sigma(1:l))./Sigma(1:l)); + fprintf('Max rel. error = %g\n',max(E4)) + fprintf('Mean rel. error = %g\n',mean(E4)) + hold on + semilogy(E4,'*'); + hold off + legend('SVD','BPRO','PRO(A''*A)','PRO(C)','EIGS',2) +end + + + +%%%%%%%%%%%%%%%%%%%% EIGS %%%%%%%%%%%%%%%%%%%%%%%% +% Try ARPACK based eigs routine: +fprintf('-------------------------------------------------------------------\n') +fprintf('\n') +fprintf('METHOD = EIGS(A''*A)\n') +fprintf('\n') + +options =[]; +options.disp=0; +options.issym = 1; +options.v0 = A'*v0; + +tic; flops(0); MxV=0; +[V5,S5] = eigs('AtAfunc',n,k,'LR',options); +U5 = A*V5; +for i=1:k + U5(:,i) = U5(:,i)/norm(U5(:,i)); +end +fprintf('Number MxV = %f\n',MxV); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %e\n',flops); +fprintf('Residual norm = %e\n',norm(A'*(A*V5) - V5*S5,'fro')/norm(A'*A,'fro')); +fprintf('Orthogonality U = %e\n',norm(eye(k) - U5'*U5,'fro')) +fprintf('Orthogonality V = %e\n',norm(eye(k) - V5'*V5,'fro')) +S5 = diag(sqrt(diag(S5))); + +if ~isempty(Sigma) + % Compare with "true" singular values + S5 = diag(S5); + l= length(S5); + E5 = abs((S5 - Sigma(1:l))./Sigma(1:l)); + fprintf('Max rel. error = %e\n',max(E5)) + fprintf('Mean rel. error = %e\n',mean(E5)) + hold on + semilogy(E5,'^'); + hold off + title('Accuracy of \sigma_i compared with output from the svd command.') + legend('BPRO','PRO(A''*A)','PRO(C)','EIGS(C)','EIGS(A''*A)',2) +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/testtqlb.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/testtqlb.m new file mode 100644 index 0000000000000000000000000000000000000000..de0ce748a8943ae5bc907ea71f3f63ea79b1ca97 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/testtqlb.m @@ -0,0 +1,55 @@ +% Script for comparing speed an accuracy of original TQLB, optimized TQLB +% and builtin EIG command. + +% Rasmus Munk Larsen, DAIMI, 1998. + +n=1000; + +% Use 2. order difference matrix as testproblem. +e = ones(n,1); +T = spdiags([-e 2*e -e], -1:1, n, n); +true = 4*cos(pi/2*[n:-1:1]'./(n+1)).^2; +alpha = 2*ones(n,1); +beta = -ones(n,1); + +fprintf('-----------------------------------------------------------------\n') +disp('Modified tqlb:') +fprintf('\n') +tic, flops(0) +[lambda,top,bot,err] = tqlb(alpha,beta); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %f\n',flops); +fprintf('Max rel. error = %e\n',max(abs((lambda-true)./true))) + + +fprintf('-----------------------------------------------------------------\n') +disp('Original tqlb:') +fprintf('\n') +tic, flops(0); +[lambda2,top,bot,err2] = tqlb_orig(alpha,beta); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %f\n',flops); +fprintf('Max rel. error = %e\n',max(abs((lambda2-true)./true))) + + +fprintf('-----------------------------------------------------------------\n') +disp('eig:') +fprintf('\n') +tic, flops(0); +lambda1 = eig(T); +lambda1 =sort(lambda1); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %f\n',flops); +fprintf('Max rel. error = %e\n',max(abs((lambda1-true)./true))) + +fprintf('-----------------------------------------------------------------\n') +disp('eig:') +fprintf('\n') +tic, flops(0); +lambda1 = eig(full(T)); +lambda1 =sort(lambda1); +fprintf('Elapsed time = %f\n',toc); +fprintf('Number of flops = %f\n',flops); +fprintf('Max rel. error = %e\n',max(abs((lambda1-true)./true))) + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.f b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.f new file mode 100644 index 0000000000000000000000000000000000000000..ef802f8a47218214be687c1788fed5d4712b5465 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.f @@ -0,0 +1,176 @@ +C +C @(#)TQLB.F 1.1 (BNP) 5/9/89 +C + SUBROUTINE TQLB(N,D,E,BND,BND2,IERR) +C + INTEGER I,J,L,M,N,II,L1,L2,MML,IERR + DOUBLE PRECISION D(N),E(N),BND(N),BND2(N) + DOUBLE PRECISION C,C2,C3,DL1,EL1,F,G,H,H1,P,R,S,S2,TST1,TST2 +C +C THIS SUBROUTINE IS A MODIFICATION OF THE ALGOL PROCEDURE TQL1, +C NUM. MATH. 11, 293-306(1968) BY BOWDLER, MARTIN, REINSCH, AND +C WILKINSON. +C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 227-240(1971). +C +C THIS SUBROUTINE FINDS THE EIGENVALUES OF A SYMMETRIC +C TRIDIAGONAL MATRIX BY THE QL METHOD. +C +C ON INPUT +C +C N IS THE ORDER OF THE MATRIX. +C +C D CONTAINS THE DIAGONAL ELEMENTS OF THE INPUT MATRIX. +C +C E CONTAINS THE SUBDIAGONAL ELEMENTS OF THE INPUT MATRIX +C IN ITS LAST N-1 POSITIONS. E(1) IS ARBITRARY. +C +C ON OUTPUT +C +C D CONTAINS THE EIGENVALUES IN ASCENDING ORDER. IF AN +C ERROR EXIT IS MADE, THE EIGENVALUES ARE CORRECT AND +C ORDERED FOR INDICES 1,2,...IERR-1, BUT MAY NOT BE +C THE SMALLEST EIGENVALUES. +C +C E HAS BEEN DESTROYED. +C +C BND WILL HOLD THE TOP ELEMENTS OF THE NORMALIZED EIGENVECTORS. +C +C IERR IS SET TO +C ZERO FOR NORMAL RETURN, +C J IF THE J-TH EIGENVALUE HAS NOT BEEN +C DETERMINED AFTER 30 ITERATIONS. +C +C calls to PYTHAG for SQRT(A*A + B*B) have been replaced by inline code. +C +C QUESTIONS AND COMMENTS SHOULD BE DIRECTED TO BURTON S. GARBOW, +C MATHEMATICS AND COMPUTER SCIENCE DIV, ARGONNE NATIONAL LABORATORY +C +C THIS VERSION DATED AUGUST 1983 (AUGUST 1998). +C +C ------------------------------------------------------------------ +C + IERR = 0 + BND(1) = 1.0D0 + IF (N .EQ. 1) GO TO 1001 + BND2(N) = 1.0D0 +C + DO 100 I = 2, N + BND(I) = 0.0D0 + BND2(I-1) = 0.0D0 + 100 E(I-1) = E(I) +C + F = 0.0D0 + TST1 = 0.0D0 + E(N) = 0.0D0 +C + DO 290 L = 1, N + J = 0 + H = ABS(D(L)) + ABS(E(L)) + IF (TST1 .LT. H) TST1 = H +C .......... LOOK FOR SMALL SUB-DIAGONAL ELEMENT .......... + DO 110 M = L, N + TST2 = TST1 + ABS(E(M)) + IF (TST2 .EQ. TST1) GO TO 120 +C .......... E(N) IS ALWAYS ZERO, SO THERE IS NO EXIT +C THROUGH THE BOTTOM OF THE LOOP .......... + 110 CONTINUE +C + 120 IF (M .EQ. L) GO TO 210 + 130 IF (J .EQ. 30) GO TO 1000 + J = J + 1 +C .......... FORM SHIFT .......... + L1 = L + 1 + L2 = L1 + 1 + G = D(L) + P = (D(L1) - G) / (2.0D0 * E(L)) + if (abs(p).le.1.0e0) then + p = p + sign(sqrt(1.0e0 + p*p),p) + else + p = p * (1.0e0 + sqrt(1.0e0 + (1.0e0/p)**2)) + endif + d(l) = e(l) / p + d(l1) = e(l) * p +c********** Original code: ******************** +c R = PYTHAG(P,1.0D0) +c D(L) = E(L) / (P + SIGN(R,P)) +c D(L1) = E(L) * (P + SIGN(R,P)) +c********************************************* + DL1 = D(L1) + H = G - D(L) + IF (L2 .GT. N) GO TO 145 +C + DO 140 I = L2, N + 140 D(I) = D(I) - H +C + 145 F = F + H +C .......... QL TRANSFORMATION .......... + P = D(M) + C = 1.0D0 + C2 = C + EL1 = E(L1) + S = 0.0D0 + MML = M - L +C .......... FOR I=M-1 STEP -1 UNTIL L DO -- .......... + DO 200 II = 1, MML + C3 = C2 + C2 = C + S2 = S + I = M - II + G = C * E(I) + H = C * P +c inlined call to PYTHAG. This code corresponds to LAPACK rutine DLAPY2. +c Speeds tqlb up by a factor of 3 on MIPS R10000. + IF(DABS(P).GE.DABS(E(I))) then + S=E(I)/P + R=SQRT(1D0+S*S) + E(I+1)=S2*P*R + C=1D0/R + S=S*C + else + C=P/E(I) + R=SQRT(1D0+C*C) + E(I+1)=S2*E(I)*R + S=1D0/R + C=C*S + endif + P = C * D(I) - S * G + D(I+1) = H + S * (C * G + S * D(I)) + H = BND(I+1) + BND(I+1) = S*BND(I)+C*H + BND(I) = C*BND(I)-S*H + H = BND2(I+1) + BND2(I+1) = S*BND2(I)+C*H + BND2(I) = C*BND2(I)-S*H + 200 CONTINUE +C + P = -S * S2 * C3 * EL1 * E(L) / DL1 + E(L) = S * P + D(L) = C * P + TST2 = TST1 + ABS(E(L)) + IF (TST2 .GT. TST1) GO TO 130 + 210 P = D(L) + F + H = BND(L) + H1 = BND2(L) +C .......... ORDER EIGENVALUES .......... + IF (L .EQ. 1) GO TO 250 +C .......... FOR I=L STEP -1 UNTIL 2 DO -- .......... + DO 230 II = 2, L + I = L + 2 - II + IF (P .GE. D(I-1)) GO TO 270 + D(I) = D(I-1) + BND(I) = BND(I-1) + BND2(I) = BND2(I-1) + 230 CONTINUE +C + 250 I = 1 + 270 D(I) = P + BND(I) = H + BND2(I)= H1 + 290 CONTINUE +C + GO TO 1001 +C .......... SET ERROR -- NO CONVERGENCE TO AN +C EIGENVALUE AFTER 30 ITERATIONS .......... + 1000 IERR = L + 1001 RETURN + END diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.m new file mode 100644 index 0000000000000000000000000000000000000000..b8b16306c8f20c3c08a1fe648214608cc6b14ed7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.m @@ -0,0 +1,35 @@ +function [lambda,top,bot,err] = tqlb(alpha,beta) + +% TQLB: Compute eigenvalues and top and bottom elements of +% eigenvectors of a symmetric tridiagonal matrix T. +% +% [lambda,top,bot,err] = tqlb(alpha,beta) +% +% Input parameters: +% alpha(1:n) : Diagonal elements. +% beta(2:n) : Off-diagonal elements. +% Output parameters: +% lambda(1:n) : Computed eigenvalues. +% top(1:n) : Top elements in eigenvectors. +% bot(1:n) : Bottom elements in eigenvectors. +% err : dummy argument. + + +% Rasmus Munk Larsen, DAIMI, 1998 + + +% +% This is a slow Matlab substitute for the +% TQLB MEX-file. +% + +warning('PROPACK:NotUsingMex','Using slow matlab code for tqlb.') +n = length(alpha); +T = spdiags([[beta(2:n);0] alpha(1:n) beta(1:n)],-1:1,n,n); + +[V,lambda] = eig(full(T)); lambda = diag(lambda); +bot = V(end,:)'; +top = V(1,:)'; +err=0; + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexglx b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexglx new file mode 100644 index 0000000000000000000000000000000000000000..5eb6fd8b5743576c260e60b43e1eb0b55e1fa709 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexglx differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexsg b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexsg new file mode 100644 index 0000000000000000000000000000000000000000..92e4d815611a2e4f8d9ff42c806aa52691092e21 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexsg differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexsg64 b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexsg64 new file mode 100644 index 0000000000000000000000000000000000000000..9d9717b14bb1f8cdb779f6ffc5febd92dafe1cd7 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexsg64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexsol b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexsol new file mode 100644 index 0000000000000000000000000000000000000000..805a0ea52b79587096b353974706d357937fa541 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb.mexsol differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb_mex.c b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb_mex.c new file mode 100644 index 0000000000000000000000000000000000000000..4fcf8e7818a6c5fbf0cf4067abfc50c7ca9128e1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/tqlb_mex.c @@ -0,0 +1,49 @@ +/* +MEX interface for TQLB. Matlab calling sequence: + [lambda,top,bot,err] = tqlb(alpha,beta) +*/ + + +#include <string.h> +#include "mex.h" + +/* Template for tqlb: */ +void tqlb_(int *n, double *d__, double *e, double *bnd, + double *bnd2, int *ierr); + +/* Here comes the gateway function to be called by Matlab: */ +void mexFunction(int nlhs, mxArray *plhs[], + int nrhs, const mxArray *prhs[]) +{ + int m, n,i, ierr; + double x, *tmp; + + if (nrhs != 2) + mexErrMsgTxt("tqlb requires two input arguments"); + else if (nlhs != 4) + mexErrMsgTxt("tqlb requires four output arguments"); + + for (i=0; i<2; i++) { + m = mxGetM(prhs[i]); /* get the dimensions of the input */ + n = mxGetN(prhs[i]); + + /* make sure input is m x 1 */ + if (n != 1) + mexErrMsgTxt("Input must be a m x 1 vectors"); + } + + /* Create/allocate return argument, a 1x1 real-valued Matrix */ + for (i=0; i<3; i++) { + plhs[i]=mxCreateDoubleMatrix(m,1,mxREAL); + } + plhs[3] = mxCreateDoubleMatrix(1,1,mxREAL); + tmp = mxCalloc(m,sizeof(double)); + + memcpy(mxGetPr(plhs[0]), mxGetPr(prhs[0]),m*sizeof(double)); + memcpy(tmp,mxGetPr(prhs[1]), m*sizeof(double)); + tqlb_(&m,mxGetPr(plhs[0]),tmp,mxGetPr(plhs[1]), + mxGetPr(plhs[2]),&ierr); + + *(mxGetPr(plhs[3])) = (double) ierr; + mxFree(tmp); +} diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/update_gbound.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/update_gbound.m new file mode 100644 index 0000000000000000000000000000000000000000..aef49f8fa477dde22a0b8d88f630182d86d2083e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/PROPACK/update_gbound.m @@ -0,0 +1,69 @@ +function anorm = update_gbound(anorm,alpha,beta,j) +%UPDATE_GBOUND Update Gerscgorin estimate of 2-norm +% ANORM = UPDATE_GBOUND(ANORM,ALPHA,BETA,J) updates the Gersgorin bound +% for the tridiagonal in the Lanczos process after the J'th step. +% Applies Gerscgorins circles to T_K'*T_k instead of T_k itself +% since this gives a tighter bound. + +if j==1 % Apply Gerscgorin circles to T_k'*T_k to estimate || A ||_2 + i=j; + % scale to avoid overflow + scale = max(abs(alpha(i)),abs(beta(i+1))); + alpha(i) = alpha(i)/scale; + beta(i) = beta(i)/scale; + anorm = 1.01*scale*sqrt(alpha(i)^2+beta(i+1)^2 + abs(alpha(i)*beta(i+1))); +elseif j==2 + i=1; + % scale to avoid overflow + scale = max(max(abs(alpha(1:2)),max(abs(beta(2:3))))); + alpha(1:2) = alpha(1:2)/scale; + beta(2:3) = beta(2:3)/scale; + + anorm = max(anorm, scale*sqrt(alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1) + alpha(i+1)*beta(i+1)) + ... + abs(beta(i+1)*beta(i+2)))); + i=2; + anorm = max(anorm,scale*sqrt(abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1))) ); +elseif j==3 + % scale to avoid overflow + scale = max(max(abs(alpha(1:3)),max(abs(beta(2:4))))); + alpha(1:3) = alpha(1:3)/scale; + beta(2:4) = beta(2:4)/scale; + i=2; + anorm = max(anorm,scale*sqrt(abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1) + alpha(i+1)*beta(i+1)) + ... + abs(beta(i+1)*beta(i+2))) ); + i=3; + anorm = max(anorm,scale*sqrt(abs(beta(i)*beta(i-1)) + ... + abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1))) ); +else + % scale to avoid overflow + % scale = max(max(abs(alpha(j-2:j)),max(abs(beta(j-2:j+1))))); + % alpha(j-2:j) = alpha(j-2:j)/scale; + % beta(j-2:j+1) = beta(j-2:j+1)/scale; + + % Avoid scaling, which is slow. At j>3 the estimate is usually quite good + % so just make sure that anorm is not made infinite by overflow. + i = j-1; + anorm1 = sqrt(abs(beta(i)*beta(i-1)) + ... + abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1) + alpha(i+1)*beta(i+1)) + ... + abs(beta(i+1)*beta(i+2))); + if isfinite(anorm1) + anorm = max(anorm,anorm1); + end + i = j; + anorm1 = sqrt(abs(beta(i)*beta(i-1)) + ... + abs(beta(i)*alpha(i-1) + alpha(i)*beta(i)) + ... + beta(i)^2+alpha(i)^2+beta(i+1)^2 + ... + abs(alpha(i)*beta(i+1))); + if isfinite(anorm1) + anorm = max(anorm,anorm1); + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/Makefile b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..303a7604fa9c698994a3f3adad11291b2bd10505 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/Makefile @@ -0,0 +1,150 @@ +#---------------------------------------------------------------------- +# +# SDDPACK: Software for the Semidiscrete Decomposition. +# Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# MODULE: Makefile +# +# DESCRIPTION: Makefile for SDDPACK. +# +# USAGE: make +# +# NOTE: Some BASIC DEFINITIONS will need to be changed for different +# systems. +# +# BUG REPORTS: Email Tamara.Kolda@na-net.ornl.gov. +# +#---------------------------------------------------------------------- + +#---------------------------------------------------------------------- +# +# BASIC DEFINITIONS +# +# Adjust these flags for your system. Several examples are listed. +# +# Note: The -DQSORTOPT flags specifies whether or not to use the +# optimized qsort that is provided with this distribution. We suggest +# that you try testscript with and without this flag and see which is +# faster and whether or not the answers differ. The answers should +# not differ; do not use -DQSORTOPT if they do. +# +#---------------------------------------------------------------------- + +### Location of RM program +RM = /bin/rm + +### Intel PC (Linux) or Sparc (SunOS or Solaris) +CC = gcc +CFLAGS = -pedantic -ansi -Wall -O3 -DQSORTOPT +LIB = -lm + +### DEC ALPHA (OSF1) +#CC = cc +#CFLAGS = -O3 -DQSORTOPT +#LIB = -lm + +### IBM RS6000 (AIX) +#CC = cc +#CFLAGS = -O3 +#LIB = -lm + +### SGI Octane (IRIX 64) +#CC = cc +#CFLAGS = -64 -ansi -O3 -DQSORTOPT +#LIB = -lm + +#---------------------------------------------------------------------- +# +# MAIN PROGRAMS (do not modify) +# +#---------------------------------------------------------------------- + +INC = -Iinclude +PROGS = decomp convertmtx convertsdd +OBJ = sdd.o + +all : $(PROGS) + @echo 'Make complete' + +convertmtx : src/convertmtx.c include/sdd.h sdd.o + $(CC) $(CFLAGS) $(INC) src/convertmtx.c sdd.o $(LIB) -o $@ + +convertsdd : src/convertsdd.c include/sdd.h sdd.o + $(CC) $(CFLAGS) $(INC) src/convertsdd.c sdd.o $(LIB) -o $@ + +decomp : src/decomp.c $(OBJ) + $(CC) $(CFLAGS) $(INC) src/decomp.c $(OBJ) $(LIB) -o $@ + +#---------------------------------------------------------------------- +# +# COMMON OBJECT FILES (do not modify) +# +#---------------------------------------------------------------------- + +sdd.o : src/sdd.c include/sdd.h include/qsortopt.h + $(CC) -c $(CFLAGS) $(INC) src/sdd.c + +#---------------------------------------------------------------------- +# +# UTILITIES (do not modify) +# +#---------------------------------------------------------------------- + +clean: + -$(RM) -f $(OBJ) core + +clobber: clean + -$(RM) -f $(PROGS) + +remake: clobber all + @echo 'Remake complete' + +#---------------------------------------------------------------------- +# CREATE TAR FILE FOR DISTRIBUTION +#---------------------------------------------------------------------- + +tarfiles: + cd .. ; tar czvf SDDPACK.tgz \ + SDDPACK/README.html \ + SDDPACK/Makefile \ + SDDPACK/gpl.txt \ + SDDPACK/include/sdd.h \ + SDDPACK/include/qsortopt.h \ + SDDPACK/src/sdd.c \ + SDDPACK/src/decomp.c \ + SDDPACK/src/convertmtx.c \ + SDDPACK/src/convertsdd.c \ + SDDPACK/matlab/mtxread.m \ + SDDPACK/matlab/mtxwrite.m \ + SDDPACK/matlab/sdd.m \ + SDDPACK/matlab/sddweight.m \ + SDDPACK/matlab/sddtensor.m \ + SDDPACK/matlab/sddfun.m \ + SDDPACK/matlab/sddweightfun.m \ + SDDPACK/testdata/test1.mtx \ + SDDPACK/testdata/test1.gif \ + SDDPACK/doc/umcp-cs-tr-4012.ps + cd .. ; tar czvf mtxfiles.tgz \ + SDDPACK/testdata/bfw62a.mtx \ + SDDPACK/testdata/impcol_c.mtx \ + SDDPACK/testdata/watson2.mtx \ + SDDPACK/testdata/west0132.mtx + /bin/mv ../SDDPACK.tgz ../mtxfiles.tgz . + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/README.html b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/README.html new file mode 100644 index 0000000000000000000000000000000000000000..227215c92a20b1031b9be30b5adb4d5204c70c29 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/README.html @@ -0,0 +1,654 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> <head> +<title>SDDPACK</title> +</head> + +<body bgcolor="#ffffff"> + +<h1 align="center"> +SDDPACK<br> +Software for the Semidiscrete Decomposition +</h1> + +<hr noshade> +<hr noshade> + +<ul> + <li> <a href="#legal">Legal and Author Information</a> + <ul> + <li> <a href="#legal">Software Copyright and License</a> + <li> <a href="#authors">Authors</a> + <li> <a href="#thanks">Support</a> + <li> <a href="#bugs">Reporting Bugs</a> + </ul> + <li> <a href="#about">About SDDPACK</a> + <ul> + <li> <a href="#about">Description</a> + <li> <a href="#download">Obtaining the Software</a> + <li> <a href="#install">Installation</a> + <li> <a href="#documentation">Documentation</a> + </ul> + <li> <a href="#matlab">Matlab Codes</a> + <ul> + <li> <a href="#matlab">SDD</a> + <li> <a href="#sddweight">Weighted SDD</a> + <li> <a href="#sddtensor">Tensor SDD</a> + </ul> + <li> <a href="#sdd">C Code for SDD</a> + <ul> + <li> <a href="#sdd">Installation</a> + <li> <a href="#sddusage">Usage</a> + </ul> + <li> <a href="#problems">Test Problems from MatrixMarket</a> +</ul> + +<hr noshade> +<hr noshade> + +<h3> +<a name = "legal">Software Copyright and License</a> +</h3> + +<p>SDDPACK: Software for the Semidiscrete Decomposition.<br> +Copyright © 1999 Tamara G. Kolda and Dianne P. O'Leary. + +<p>This program is free software; you can redistribute it and/or +modify it under the terms of the <a +href="http://www.gnu.org/copyleft/gpl.html">GNU General Public +License</a> as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +<p>This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +<p>You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +</p> + +<hr noshade> + +<h3> +<a name="authors">Authors</a> +</h3> + +<p>Tamara G. Kolda<br> +Computational Sciences and Mathematics Research Department<br> +Sandia National Labs<br> +Livermore, CA 94551<br> +<a href="mailto:tgkolda@sandia.gov">tgkolda@sandia.gov</a><br> +<a href="http://www.ca.sandia.gov/~tgkolda/">http://www.ca.sandia.gov/~tgkolda</a> + +<p>Dianne P. O'Leary<br> +Department of Computer Science<br> +University of Maryland<br> +College Park, MD 20742<br> +<a href="mailto:oleary@cs.umd.edu">oleary@cs.umd.edu</a><br> +<a href="http://www.cs.umd.edu/users/oleary">http://www.cs.umd.edu/users/oleary</a> +</p> +<hr noshade> + +<h3> +<a name="thanks">Support</a> +</h3> + +<p>Kolda's research supported by the Applied +Mathematical Sciences Research Program of Office of Energy Research in +the U.S. Department of Energy, under contract DE-AC05-96OR22464 with +Lockheed Martin Energy Research Corporation; the National Physical Sciences +Consortium in conjunction with the University of Maryland and +the National Security Agency; and the IDA Center for Computing Sciences. + +<p>O'Leary's research supported by +the National Science Foundation under Grant + CCR-97-32022 and by the Departement Informatik, ETH Zurich, + Switzerland. +</p> + +<hr noshade> + +<h3> +<a name="bugs">Bugs</a> +</h3> + +<p>Reports of bugs should be sent to +<a href="mailto:tgkolda@sandia.gov">tgkolda@sandia.gov</a>. +</p> + +<hr noshade> +<hr noshade> +<h3><a name="about">Description</a></h3> + +<p> The semidiscrete decomposition (SDD) approximates a matrix as a +weighted sum of outer products formed by vectors with entries +constrained to be in the set {-1, 0, 1}. + +<p>It is useful for image compression and for latent semantic indexing +(LSI) in information retrieval. + +<p>The primary advantage of the SDD over other types of matrix +approximations such as the truncated singular value decomposition +(SVD) is that it typically provides a more accurate approximation for +far less storage. + +<p>This package provides software in Matlab and in C to compute +the SDD.</p> + +<hr noshade> + +<h3> +<a name="download">Obtaining the Software</a> +</h3> + +<p> +The software is available for download at +<a href="http://www.cs.umd.edu/users/oleary/SDDPACK">http://www.cs.umd.edu/users/oleary/SDDPACK</a> +in the file <a href="http://www.cs.umd.edu/users/oleary/SDDPACK/SDDPACK.tgz">SDDPACK.tgz</a>. +</p> + +<hr noshade> + +<h3> +<a name="install">Installation</a> +</h3> + +<p>After downloading the file <code>SDDPACK.tgz</code>, type +"<code>gunzip -c sdd.tgz | tar xvf -</code>". This creates +a directory called SDDPACK containing the following: + +<pre> +<a href="README.html">SDDPACK/README.html</a> +<a href="Makefile">SDDPACK/Makefile</a> +<a href="gpl.txt">SDDPACK/gpl.txt</a> +<a href="include/sdd.h">SDDPACK/include/sdd.h</a> +<a href="include/qsortopt.h">SDDPACK/include/qsortopt.h</a> +<a href="src/sdd.c">SDDPACK/src/sdd.c</a> +<a href="src/decomp.c">SDDPACK/src/decomp.c</a> +<a href="src/convertmtx.c">SDDPACK/src/convertmtx.c</a> +<a href="src/convertsdd.c">SDDPACK/src/convertsdd.c</a> +<a href="matlab/mtxread.m">SDDPACK/matlab/mtxread.m</a> +<a href="matlab/mtxwrite.m">SDDPACK/matlab/mtxwrite.m</a> +<a href="matlab/sdd.m">SDDPACK/matlab/sdd.m</a> +<a href="matlab/sddweight.m">SDDPACK/matlab/sddweight.m</a> +<a href="matlab/sddtensor.m">SDDPACK/matlab/sddtensor.m</a> +<a href="matlab/sddfun.m">SDDPACK/matlab/sddfun.m</a> +<a href="matlab/sddweightfun.m">SDDPACK/matlab/sddweightfun.m</a> +<a href="testdata/test1.mtx">SDDPACK/testdata/test1.mtx</a> +<a href="testdata/test1.gif">SDDPACK/testdata/test1.gif</a> +<a href="doc/umcp-cs-tr-4012.ps">SDDPACK/doc/umcp-cs-tr-4012.ps</a> +</pre> + +<hr noshade> + +<h3> +<a name="documentation">Documentation</a> +</h3> + +<p> Most documentation to run the software is given in this file. Also, each file +contains comments with information on the code. +General information about the SDD and its variants is provided in the +included paper: +<blockquote> +Tamara G. Kolda and Dianne P. O'Leary, +<a href="doc/umcp-cs-tr-4012.ps">Computation and Uses of the Semidiscrete +Matrix Decomposition</a>, +Computer Science Department Report CS-TR-4012 +Institute for Advanced Computer Studies Report UMIACS-TR-99-22, +University of Maryland, +April 1999. +</blockquote> + +</p> + +<hr noshade> +<hr noshade> + +<h3> +<a name="matlab">SDD Matlab Code</a> +</h3> + +<p>Matlab codes are included in the directory +<a href="matlab/"><code>SDDPACK/matab</code></a>. To use these codes, be +sure to be in the <code>SDDPACK/matlab</code> directory (or add this +directory to your Matlab path). + +<p> We have included a small 5 x 5 test problem in <code><a +href="SDDPACK/testdata/test1.mtx">testdata/test1.mtx</a></code>. The matlab +routine <a href="matlab/mtxread.m"><code>mtxread</code></a>, included +in SDDPACK, reads the matrix file. + +<pre> +>> A = mtxread('../testdata/test1.mtx'); +>> full(A) + +ans = + + 0.5828 0.2259 0.2091 0.5678 0.4154 + 0.4235 0.5798 0.3798 0.7942 0.3050 + 0.5155 0.7604 0.7833 0.0592 0.8744 + 0.3340 0.5298 0.6808 0.6029 0.0150 + 0.4329 0.6405 0.4611 0.0503 0.7680 +</pre> + +<p>Using the routine <a href="matlab/sdd.m"><code>sdd</code></a>, +included in SDDPACK, we can compute the 10-term SDD using the default +settings as follows: + +<pre> +>> [D, X, Y] = sdd(A, 10) + +D = + + 0.4797 + 0.3262 + 0.1939 + 0.0847 + 0.1017 + 0.0588 + 0.0387 + 0.0324 + 0.0551 + 0.0237 + + +X = + + 1 0 -1 -1 1 1 -1 0 0 1 + 1 1 0 1 -1 1 -1 -1 0 -1 + 1 -1 1 1 0 -1 1 -1 0 -1 + 1 1 1 -1 -1 -1 0 1 0 -1 + 1 -1 0 0 0 1 1 0 1 0 + + +Y = + + 1 0 0 0 1 0 0 -1 -1 0 + 1 0 1 1 0 1 1 0 1 0 + 1 0 1 0 0 -1 1 -1 0 1 + 1 1 -1 1 0 -1 -1 1 0 0 + 1 -1 0 1 0 0 -1 -1 0 0 +</pre> + +<p>We have also included a utility called +<a href="matlab/sddfun.m"><code>sddfun</code></a> that +compares the SVD to the SDD with different starting criteria. +We show the text below; the graphic is in +<a href="testdata/test1.gif"><code>SDDPACK/testdata/test1.gif</code></a>. + +<pre> +>> sddfun(A) + +Computing SVD + +Rank of matrix: 5 + +Computing SDD with option 1 +Computing SDD with option 2 +Computing SDD with option 3 +Computing SDD with option 4 + +Method Color Line Dot +------ ----- ---- --- +SVD g - x +SDD-1 b - o +SDD-2 m : ^ +SDD-3 r -. + +SDD-4 c -- * + +Method Rel Resid Inn Its Density +------ --------- ------- ------- +SDD-1 11.92 3.20 66.00 +SDD-2 11.85 2.60 72.00 +SDD-3 13.95 2.80 84.00 +SDD-4 11.92 2.80 66.00 +</pre> + +</p> + +<hr noshade> + +<h3> +<a name="sddweight">Weighted SDD Matlab Code</a> +</h3> + +The routine <a href="matlab/sddweight.m">sddweight</a>, included with +SDDPACK, computes the weighted SDD of a given matrix. Using the same A +from the previous example, and defining W as given below, we can compute +the 5-term weighted SDD as follows: + +<pre> +>> A = full(mtxread('../testdata/test1.mtx')); +>> W = ones(5) - eye(5); +>> [D, X, Y] = sddweight(A, W, 5) + +D = + + 0.4337 + 0.3511 + 0.1909 + 0.1636 + 0.2224 + + +X = + + 1 0 -1 0 0 + 1 1 0 0 1 + 1 -1 1 0 0 + 1 1 1 0 0 + 1 -1 1 -1 0 + + +Y = + + 1 0 0 0 0 + 1 0 1 0 0 + 1 0 1 1 0 + 1 1 0 0 0 + 1 -1 0 0 1 + +</pre> + +SDDPACK also contains <a href="matlab/sddweightfun.m">sddweightfun</a>, similar to +<a href="matlab/sddfun.m">sddfun</a> described above. Sample output is given below. +This also produces a figure, but we do not include it here. + +<pre> +>> sddweightfun(A,W) + +Rank of matrix: 5 + +Computing SDDWEIGHT with option 1 +Computing SDDWEIGHT with option 2 +Computing SDDWEIGHT with option 3 +Computing SDDWEIGHT with option 4 + + Method Color Line Dot +----------- ----- ---- --- +SDDWEIGHT-1 b - o +SDDWEIGHT-2 m : ^ +SDDWEIGHT-3 r -. + +SDDWEIGHT-4 c -- * + + Method Rel Resid Inn Its Density +----------- --------- ------- ------- +SDDWEIGHT-1 13.11 3.10 52.00 +SDDWEIGHT-2 13.77 2.80 52.00 +SDDWEIGHT-3 9.85 3.40 76.00 +SDDWEIGHT-4 10.03 3.40 66.00 +</pre> + +<hr noshade> + +<h3> +<a name="sddtensor">Tensor SDD Matlab Code</a> +</h3> + +The tensor SDD can be computed with the Matlab code <a +href="matlab/sddtensor.m">sddtensor</a>, included with SDDPACK. +An example of its usage is given below. + +<pre> +>> rand('state', 0); +>> A = rand(3,4,2); +>> [D, X] = sddtensor(A, 5) + +D = + + 0.5712 + 0.3364 + 0.2278 + 0.2379 + 0.1797 + + +X = + + [3x5 double] [4x5 double] [2x5 double] + +>> X{1} + +ans = + + 1 -1 1 0 0 + 1 1 -1 -1 1 + 1 -1 -1 1 0 + +>> X{2} + +ans = + + 1 0 1 1 1 + 1 0 -1 0 1 + 1 1 0 1 -1 + 1 1 0 0 0 + +>> X{3} + +ans = + + 1 0 1 1 1 + 1 1 1 -1 1 + +</pre> + +<hr noshade> +<hr noshade> + +<h3> +<a name="sdd">Installing the SDD C Code</a> +</h3> + +<p>Change directories into <code>SDDPACK</code>. +To compile the code, check the <a +href="Makefile"><code>Makefile</code></a>. You should check the +location of the remove program and set the flags CC, CFLAGS, and LIB +for your system. Several examples have been included. Once that is +fixed, type "<code>make</code>" at the command prompt. + +<p>The flag <code>-DQSORTOPT</code> is optional. It provides an faster +qsort that the default on most machines. + +<p><strong>Special Note:</strong> If you do not have a 32- or 64-bit +architecture, than you must be sure to include the following flag in +the CFLAGS definition, e.g., <code>-DIDXSHIFT=7</code> +if 128-bit architecture. +</p> + +<hr noshade> + +<h3> +<a name="sddusage">Using the C Code</a> +</h3> +Run the code from the directory SDDPACK. A sample +is given below. Results may vary slightly from machine to machine. + +<pre> +> decomp -k 10 testdata/test1.mtx testdata/test1.sdd +*** output from decomp *** +matrix file : testdata/test1.mtx +SDD file : testdata/test1.sdd +existing SDD file : <none> +terms : 10 +accuracy : 0.000000 +tolerance : 0.010000 +max inner its : 100 +y init choice : 1 +input type : text + +Iteration Starting Residual Improvement Inner Total + Number Index Squared (beta) Its InnerIts +--------- -------- -------- ----------- ----- -------- + 1 2 1.41e+00 5.75170e+00 3 3 + 2 4 5.57e-01 8.51472e-01 3 6 + 3 7 2.19e-01 3.38517e-01 3 9 + 4 10 1.33e-01 8.60342e-02 2 11 + 5 11 1.02e-01 3.10079e-02 2 13 + 6 12 5.00e-02 5.18036e-02 4 17 + 7 17 2.60e-02 2.40155e-02 2 19 + 8 19 1.33e-02 1.26359e-02 3 22 + 9 22 7.27e-03 6.06216e-03 2 24 + 10 23 5.02e-03 2.25306e-03 2 26 + + -- SDD information -- +final residual norm : 7.0855e-02 +final relative residual norm: 0.026 +total outer iterations : 10 +average inner iterations : 2.600 +average init iterations : 2.300 + +> more testdata/test1.sdd +%% Semidiscrete Decomposition (SDD) +%% Matrix: testdata/test1.mtx Terms: 10 Accr: 0.00e+00 Tol: 1.00e-02 InnIts: 100 Init: 1 +10 5 5 +4.7965389490127563476562500e-01 +3.2624220848083496093750000e-01 +1.9394071400165557861328125e-01 +8.4672987461090087890625000e-02 +1.0166592150926589965820312e-01 +5.8767084032297134399414062e-02 +3.8742337375879287719726562e-02 +3.2449815422296524047851562e-02 +5.5055230855941772460937500e-02 +2.3733202368021011352539062e-02 + 1 1 1 1 1 + 0 1 -1 1 -1 + -1 0 1 1 0 + -1 1 1 -1 0 + 1 -1 0 -1 0 + 1 1 -1 -1 1 + -1 -1 1 0 1 + 0 -1 -1 1 0 + 0 0 0 0 1 + 1 -1 -1 -1 0 + 1 1 1 1 1 + 0 0 0 1 -1 + 0 1 1 -1 0 + 0 1 0 1 1 + 1 0 0 0 0 + 0 1 -1 -1 0 + 0 1 1 -1 -1 + -1 0 -1 1 -1 + -1 1 0 0 0 + 0 0 1 0 0 + +</pre> + +<p>Note that these results match what we got with the matlab version +of SDD on the same matrix. + +<p>By default, the SDD performs i/o in text mode. However, to get the +advantage that the SDD has in terms of size, it is best to use binary +i/o. We have included conversion programs for the matrices and SDD's. +Their usage is shown below. + +<pre> +> convertmtx testdata/test1.mtx testdata/test1.mtx.dat +*** output from convertmtx *** +Input File : testdata/test1.mtx +Output File : testdata/test1.mtx.dat +> decomp -k 10 -b testdata/test1.mtx.dat testdata/test1.sdd.dat +*** output from decomp *** +matrix file : testdata/test1.mtx.dat +SDD file : testdata/test1.sdd.dat +existing SDD file : <none> +terms : 10 +accuracy : 0.000000 +tolerance : 0.010000 +max inner its : 100 +y init choice : 1 +input type : binary + +Iteration Starting Residual Improvement Inner Total + Number Index Squared (beta) Its InnerIts +--------- -------- -------- ----------- ----- -------- + 1 2 1.41e+00 5.75170e+00 3 3 + 2 4 5.57e-01 8.51472e-01 3 6 + 3 7 2.19e-01 3.38517e-01 3 9 + 4 10 1.33e-01 8.60342e-02 2 11 + 5 11 1.02e-01 3.10079e-02 2 13 + 6 12 5.00e-02 5.18036e-02 4 17 + 7 17 2.60e-02 2.40155e-02 2 19 + 8 19 1.33e-02 1.26359e-02 3 22 + 9 22 7.27e-03 6.06216e-03 2 24 + 10 23 5.02e-03 2.25306e-03 2 26 + + -- SDD information -- +final residual norm : 7.0855e-02 +final relative residual norm: 0.026 +total outer iterations : 10 +average inner iterations : 2.600 +average init iterations : 2.300 + +> convertsdd -b testdata/test1.sdd.dat test1.sdd +*** output from convertsdd *** +Input File : testdata/test1.sdd.dat +Output File : test1.sdd + +> more testdata/test1.sdd +%% Semidiscrete Decomposition (SDD) +%% Matrix: testdata/test1.mtx Terms: 10 Accr: 0.00e+00 Tol: 1.00e-02 InnIts: 100 Init: 1 +10 5 5 +4.7965389490127563476562500e-01 +3.2624220848083496093750000e-01 +1.9394071400165557861328125e-01 +8.4672987461090087890625000e-02 +1.0166592150926589965820312e-01 +5.8767084032297134399414062e-02 +3.8742337375879287719726562e-02 +3.2449815422296524047851562e-02 +5.5055230855941772460937500e-02 +2.3733202368021011352539062e-02 + 1 1 1 1 1 + 0 1 -1 1 -1 + -1 0 1 1 0 + -1 1 1 -1 0 + 1 -1 0 -1 0 + 1 1 -1 -1 1 + -1 -1 1 0 1 + 0 -1 -1 1 0 + 0 0 0 0 1 + 1 -1 -1 -1 0 + 1 1 1 1 1 + 0 0 0 1 -1 + 0 1 1 -1 0 + 0 1 0 1 1 + 1 0 0 0 0 + 0 1 -1 -1 0 + 0 1 1 -1 -1 + -1 0 -1 1 -1 + -1 1 0 0 0 + 0 0 1 0 0 +</pre> + +<p> Even this example demonstrates how much room can be saved using +binary mode rather than text: The file <code>test1.sdd</code> requires +772 bytes of storage, while <code>test1.sdd.dat</code> requires only +236 bytes.</p> + +<hr noshade> +<hr noshade> + +<h3> +<a name="problems">MatrixMarket Test Problems</a> +</h3> + +We used four <a +href="http://math.nist.gov/MatrixMarket/">MatrixMarket</a> matrices in +the examples in our paper. These are included in the tar file +<a href="http://www.cs.umd.edu/users/oleary/SDDPACK/mtxfiles.tgz"><code>mtxfiles.tgz</code></a>. +Type "gunzip -c mtxfiles.tgz | tar xvf -" to unzip them. +<p> + +<hr noshade> +<hr noshade> +<p> +Copyright © 1999 Tamara G. Kolda and Dianne P. O'Leary<br> +Comments? <a href="mailto:tgkolda@sandia.gov">tgkolda@sandia.gov</a><br> +<!-- hhmts start --> +Last modified: Tue Dec 7 10:21:33 PST 1999 +<!-- hhmts end --> +</p> +</body> </html> diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/doc/umcp-cs-tr-4012.ps b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/doc/umcp-cs-tr-4012.ps new file mode 100644 index 0000000000000000000000000000000000000000..d3e401ba7c3eb39d999bbaa954c5824940ea99a2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/doc/umcp-cs-tr-4012.ps @@ -0,0 +1,7814 @@ +%!PS-Adobe-2.0 +%%Creator: dvipsk 5.58f Copyright 1986, 1994 Radical Eye Software +%%Title: whole.dvi +%%Pages: 25 +%%PageOrder: Ascend +%%BoundingBox: 0 0 596 842 +%%DocumentPaperSizes: A4 +%%EndComments +%DVIPSCommandLine: /pub/tetex/0.4pl8/bin/sparc-solaris2.5/dvips -f +%+ whole.dvi +%DVIPSParameters: dpi=300, comments removed +%DVIPSSource: TeX output 1999.04.06:1109 +%%BeginProcSet: tex.pro +/TeXDict 250 dict def TeXDict begin /N{def}def /B{bind def}N /S{exch}N +/X{S N}B /TR{translate}N /isls false N /vsize 11 72 mul N /hsize 8.5 72 +mul N /landplus90{false}def /@rigin{isls{[0 landplus90{1 -1}{-1 1} +ifelse 0 0 0]concat}if 72 Resolution div 72 VResolution div neg scale +isls{landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div +hsize mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul +TR[matrix currentmatrix{dup dup round sub abs 0.00001 lt{round}if} +forall round exch round exch]setmatrix}N /@landscape{/isls true N}B +/@manualfeed{statusdict /manualfeed true put}B /@copies{/#copies X}B +/FMat[1 0 0 -1 0 0]N /FBB[0 0 0 0]N /nn 0 N /IE 0 N /ctr 0 N /df-tail{ +/nn 8 dict N nn begin /FontType 3 N /FontMatrix fntrx N /FontBBox FBB N +string /base X array /BitMaps X /BuildChar{CharBuilder}N /Encoding IE N +end dup{/foo setfont}2 array copy cvx N load 0 nn put /ctr 0 N[}B /df{ +/sf 1 N /fntrx FMat N df-tail}B /dfs{div /sf X /fntrx[sf 0 0 sf neg 0 0] +N df-tail}B /E{pop nn dup definefont setfont}B /ch-width{ch-data dup +length 5 sub get}B /ch-height{ch-data dup length 4 sub get}B /ch-xoff{ +128 ch-data dup length 3 sub get sub}B /ch-yoff{ch-data dup length 2 sub +get 127 sub}B /ch-dx{ch-data dup length 1 sub get}B /ch-image{ch-data +dup type /stringtype ne{ctr get /ctr ctr 1 add N}if}B /id 0 N /rw 0 N +/rc 0 N /gp 0 N /cp 0 N /G 0 N /sf 0 N /CharBuilder{save 3 1 roll S dup +/base get 2 index get S /BitMaps get S get /ch-data X pop /ctr 0 N ch-dx +0 ch-xoff ch-yoff ch-height sub ch-xoff ch-width add ch-yoff +setcachedevice ch-width ch-height true[1 0 0 -1 -.1 ch-xoff sub ch-yoff +.1 sub]{ch-image}imagemask restore}B /D{/cc X dup type /stringtype ne{]} +if nn /base get cc ctr put nn /BitMaps get S ctr S sf 1 ne{dup dup +length 1 sub dup 2 index S get sf div put}if put /ctr ctr 1 add N}B /I{ +cc 1 add D}B /bop{userdict /bop-hook known{bop-hook}if /SI save N @rigin +0 0 moveto /V matrix currentmatrix dup 1 get dup mul exch 0 get dup mul +add .99 lt{/QV}{/RV}ifelse load def pop pop}N /eop{SI restore userdict +/eop-hook known{eop-hook}if showpage}N /@start{userdict /start-hook +known{start-hook}if pop /VResolution X /Resolution X 1000 div /DVImag X +/IE 256 array N 0 1 255{IE S 1 string dup 0 3 index put cvn put}for +65781.76 div /vsize X 65781.76 div /hsize X}N /p{show}N /RMat[1 0 0 -1 0 +0]N /BDot 260 string N /rulex 0 N /ruley 0 N /v{/ruley X /rulex X V}B /V +{}B /RV statusdict begin /product where{pop product dup length 7 ge{0 7 +getinterval dup(Display)eq exch 0 4 getinterval(NeXT)eq or}{pop false} +ifelse}{false}ifelse end{{gsave TR -.1 .1 TR 1 1 scale rulex ruley false +RMat{BDot}imagemask grestore}}{{gsave TR -.1 .1 TR rulex ruley scale 1 1 +false RMat{BDot}imagemask grestore}}ifelse B /QV{gsave newpath transform +round exch round exch itransform moveto rulex 0 rlineto 0 ruley neg +rlineto rulex neg 0 rlineto fill grestore}B /a{moveto}B /delta 0 N /tail +{dup /delta X 0 rmoveto}B /M{S p delta add tail}B /b{S p tail}B /c{-4 M} +B /d{-3 M}B /e{-2 M}B /f{-1 M}B /g{0 M}B /h{1 M}B /i{2 M}B /j{3 M}B /k{ +4 M}B /w{0 rmoveto}B /l{p -4 w}B /m{p -3 w}B /n{p -2 w}B /o{p -1 w}B /q{ +p 1 w}B /r{p 2 w}B /s{p 3 w}B /t{p 4 w}B /x{0 S rmoveto}B /y{3 2 roll p +a}B /bos{/SS save N}B /eos{SS restore}B end +%%EndProcSet +%%BeginProcSet: special.pro +TeXDict begin /SDict 200 dict N SDict begin /@SpecialDefaults{/hs 612 N +/vs 792 N /ho 0 N /vo 0 N /hsc 1 N /vsc 1 N /ang 0 N /CLIP 0 N /rwiSeen +false N /rhiSeen false N /letter{}N /note{}N /a4{}N /legal{}N}B +/@scaleunit 100 N /@hscale{@scaleunit div /hsc X}B /@vscale{@scaleunit +div /vsc X}B /@hsize{/hs X /CLIP 1 N}B /@vsize{/vs X /CLIP 1 N}B /@clip{ +/CLIP 2 N}B /@hoffset{/ho X}B /@voffset{/vo X}B /@angle{/ang X}B /@rwi{ +10 div /rwi X /rwiSeen true N}B /@rhi{10 div /rhi X /rhiSeen true N}B +/@llx{/llx X}B /@lly{/lly X}B /@urx{/urx X}B /@ury{/ury X}B /magscale +true def end /@MacSetUp{userdict /md known{userdict /md get type +/dicttype eq{userdict begin md length 10 add md maxlength ge{/md md dup +length 20 add dict copy def}if end md begin /letter{}N /note{}N /legal{} +N /od{txpose 1 0 mtx defaultmatrix dtransform S atan/pa X newpath +clippath mark{transform{itransform moveto}}{transform{itransform lineto} +}{6 -2 roll transform 6 -2 roll transform 6 -2 roll transform{ +itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll curveto}}{{ +closepath}}pathforall newpath counttomark array astore /gc xdf pop ct 39 +0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack}if}N +/txpose{pxs pys scale ppr aload pop por{noflips{pop S neg S TR pop 1 -1 +scale}if xflip yflip and{pop S neg S TR 180 rotate 1 -1 scale ppr 3 get +ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip yflip +not and{pop S neg S TR pop 180 rotate ppr 3 get ppr 1 get neg sub neg 0 +TR}if yflip xflip not and{ppr 1 get neg ppr 0 get neg TR}if}{noflips{TR +pop pop 270 rotate 1 -1 scale}if xflip yflip and{TR pop pop 90 rotate 1 +-1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg +TR}if xflip yflip not and{TR pop pop 90 rotate ppr 3 get ppr 1 get neg +sub neg 0 TR}if yflip xflip not and{TR pop pop 270 rotate ppr 2 get ppr +0 get neg sub neg 0 S TR}if}ifelse scaleby96{ppr aload pop 4 -1 roll add +2 div 3 1 roll add 2 div 2 copy TR .96 dup scale neg S neg S TR}if}N /cp +{pop pop showpage pm restore}N end}if}if}N /normalscale{Resolution 72 +div VResolution 72 div neg scale magscale{DVImag dup scale}if 0 setgray} +N /psfts{S 65781.76 div N}N /startTexFig{/psf$SavedState save N userdict +maxlength dict begin /magscale true def normalscale currentpoint TR +/psf$ury psfts /psf$urx psfts /psf$lly psfts /psf$llx psfts /psf$y psfts +/psf$x psfts currentpoint /psf$cy X /psf$cx X /psf$sx psf$x psf$urx +psf$llx sub div N /psf$sy psf$y psf$ury psf$lly sub div N psf$sx psf$sy +scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub TR +/showpage{}N /erasepage{}N /copypage{}N /p 3 def @MacSetUp}N /doclip{ +psf$llx psf$lly psf$urx psf$ury currentpoint 6 2 roll newpath 4 copy 4 2 +roll moveto 6 -1 roll S lineto S lineto S lineto closepath clip newpath +moveto}N /endTexFig{end psf$SavedState restore}N /@beginspecial{SDict +begin /SpecialSave save N gsave normalscale currentpoint TR +@SpecialDefaults count /ocount X /dcount countdictstack N}N /@setspecial +{CLIP 1 eq{newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto +closepath clip}if ho vo TR hsc vsc scale ang rotate rwiSeen{rwi urx llx +sub div rhiSeen{rhi ury lly sub div}{dup}ifelse scale llx neg lly neg TR +}{rhiSeen{rhi ury lly sub div dup scale llx neg lly neg TR}if}ifelse +CLIP 2 eq{newpath llx lly moveto urx lly lineto urx ury lineto llx ury +lineto closepath clip}if /showpage{}N /erasepage{}N /copypage{}N newpath +}N /@endspecial{count ocount sub{pop}repeat countdictstack dcount sub{ +end}repeat grestore SpecialSave restore end}N /@defspecial{SDict begin} +N /@fedspecial{end}B /li{lineto}B /rl{rlineto}B /rc{rcurveto}B /np{ +/SaveX currentpoint /SaveY X N 1 setlinecap newpath}N /st{stroke SaveX +SaveY moveto}N /fil{fill SaveX SaveY moveto}N /ellipse{/endangle X +/startangle X /yrad X /xrad X /savematrix matrix currentmatrix N TR xrad +yrad scale 0 0 1 startangle endangle arc savematrix setmatrix}N end +%%EndProcSet +TeXDict begin 39158280 55380996 1000 300 300 (whole.dvi) +@start /Fa 31 122 df<60F0F070101020204040040A7D960B>39 +D<60F0F070101020204040040A7D830B>44 D<60F0F06004047D830B>46 +D<00FC100383300600F00C00701C0070380030780030780010700010F00010F00000F000 +00F00000F00000F00000F000107000107800107800103800201C00200C00400600800383 +0000FC0014197E971A>67 D<FFFF001C03C01C00E01C00701C00381C00381C001C1C001C +1C001E1C001E1C001E1C001E1C001E1C001E1C001E1C001C1C001C1C003C1C00381C0070 +1C00E01C03C0FFFF0017177F961C>I<FFFFE01C00E01C00601C00201C00101C00101C00 +101C04001C04001C04001C0C001FFC001C0C001C04001C04001C04001C00001C00001C00 +001C00001C00001C0000FFC00014177F9618>70 D<00FC100383300600F00C00701C0070 +380030780030780010700010F00010F00000F00000F00000F00000F007FCF00070700070 +7800707800703800701C00700C00700600B003831000FC0016197E971C>I<FF83FE1C00 +701C00701C00701C00701C00701C00701C00701C00701C00701C00701FFFF01C00701C00 +701C00701C00701C00701C00701C00701C00701C00701C0070FF83FE17177F961B>I<0F +F800E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E0E0 +E0E0E0C0C041C023801E000D187E9613>74 D<FF80FE1C00781C00601C00401C00801C01 +001C06001C08001C10001C38001C78001C9C001D0E001E0E001C07001C03801C01C01C01 +C01C00E01C00701C00781C007CFF81FF18177F961C>I<FFC0001C00001C00001C00001C +00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C00201C00201C +00201C00601C00601C00401C00C01C03C0FFFFC013177F9617>I<00FC000387000E01C0 +1C00E01C00E0380070780078700038700038F0003CF0003CF0003CF0003CF0003CF0003C +F0003C7000387800787800783800701C00E01C00E00E01C003870000FC0016197E971C> +79 D<FFFE001C03801C01C01C00E01C00F01C00F01C00F01C00F01C00E01C01C01C0380 +1FFE001C00001C00001C00001C00001C00001C00001C00001C00001C00001C0000FF8000 +14177F9619>I<FFFC001C07801C01C01C00E01C00F01C00F01C00F01C00F01C00E01C01 +C01C07801FFC001C06001C03001C01801C01C01C01C01C01E01C01E01C01E11C01F11C00 +F1FF807200003C18187F961B>82 D<0F88305860384018C018C008C008C008E00070007F +003FE01FF003F80038001C001C800C800C800CC00CC008E010D82087C00E197E9714>I< +7FFFF8603818403808403808803804803804803804003800003800003800003800003800 +00380000380000380000380000380000380000380000380000380000380007FFC016177F +961A>I<FF80FE3C00381C00101C00100E00200E00200F00600700400700400380800380 +8003808001C10001C10001E10000E20000E2000074000074000074000038000038000038 +0000100017187F961B>86 D<FFFFF00FC00EC01C801C80388078007000E000E001C003C0 +0380070007010E011E011C03380238027006F01EFFFE10177E9616>90 +D<00800001C00001C00001C00002E00002E00002E0000470000470000878000838000FF8 +00101C00101C00101C00301E00F83F8011117F9014>97 D<FFF0381C380C380E380E380E +381C38383FFC380E3807380738073807380E381CFFF810117F9013>I<FFF000381C0038 +06003803003803803801803801C03801C03801C03801C03801C038018038038038030038 +0700381C00FFF00012117F9015>100 D<FFFC380C3804380638023822382038603FE038 +6038213821380138023802380EFFFE10117F9013>I<03F1000E0F001803003003007001 +00600100E00000E00000E00000E03FC0E007006007007007003007001807000E0B0003F1 +0012117F9015>103 D<FF801C001C001C001C001C001C001C001C001C001C001C001C00 +1C001C001C00FF80091180900A>105 D<FF003800380038003800380038003800380038 +00380438043804380C38083838FFF80E117F9011>108 D<FC00FC3C00F02E01702E0170 +2E017027027027027023847023847023847021C87021C87020F07020F07020F070706070 +F861FC16117F9019>I<F80F803C07003E02002E020027020023820023C20021C20020E2 +00207200207A00203A00201E00200E00200E00700600F8020011117F9014>I<03F0000E +1C00180600300300700380600180E001C0E001C0E001C0E001C0E001C060018070038030 +03001806000E1C0003F00012117F9015>I<FFE000383800380C00380E00380E00380E00 +380C003838003FE000383800381C00381C00381C00381C00381C40380C40FE078012117F +9014>114 D<FE0F80380700380200380200380200380200380200380200380200380200 +3802003802003802001804001C04000E180003E00011117F9014>117 +D<FF07E01C03801E03000E020007040007840003880003D80001D00000E00000E00000E0 +0000E00000E00000E00000E00003F8001311809014>121 D E /Fb +15 88 df<00700000F80000F80001BC00019C00019C00039E00031E00030E00070F0006 +0F000E07800E07800C07801C03C01FFFC03FFFE03801E03801E07000F07000F06000F0E0 +007815177F9618>65 D<00FF0003FFC00F83C01E00C03C00003C0000780000780000F000 +00F00000F00000F00000F00000F00000F000007800007800003C00003C00401E00C00F81 +C003FF8000FE0012177E9617>67 D<FFF000FFFC00F03E00F00F00F00780F00380F003C0 +F001C0F001E0F001E0F001E0F001E0F001E0F001E0F001E0F001C0F003C0F003C0F00780 +F00F00F03E00FFFC00FFF00013177D9619>I<FFFEFFFEF000F000F000F000F000F000F0 +00F000FFFCFFFCF000F000F000F000F000F000F000F000F000FFFFFFFF10177D9615>I< +FFFEFFFEF000F000F000F000F000F000F000F000FFF8FFF8F000F000F000F000F000F000 +F000F000F000F000F0000F177D9614>I<00FE0003FF800F83C01E00C03C00C03C000078 +0000780000F00000F00000F00000F00000F01FE0F01FE0F000E07800E07800E03C00E03C +00E01E00E00F81E003FFC000FE0013177E9618>I<F001E0F003C0F00780F00F00F01E00 +F03C00F07800F0F000F1E000F3E000F7E000FFF000FEF800FC7800F83C00F03E00F01F00 +F00F00F00F80F007C0F003C0F001E0F001F014177D9619>75 D<F000F000F000F000F000 +F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000FFFCFFFC +0E177D9613>I<FC003FFC003FFC003FEE006FEE006FEF00EFE700CFE700CFE781CFE781 +CFE3818FE3C38FE3C38FE1C30FE1C30FE1E70FE0E60FE0E60FE0E60FE0640FE07C0FE07C +0FE0380F18177D961F>I<FC01C0FC01C0FE01C0EE01C0EF01C0E701C0E781C0E781C0E3 +C1C0E3C1C0E1C1C0E1E1C0E0E1C0E0F1C0E0F1C0E079C0E079C0E039C0E03DC0E01DC0E0 +1FC0E00FC0E00FC012177D9619>I<01FC0007FF000F07801E03C03C01E03800E07800F0 +700070F00078F00078F00078F00078F00078F00078F000787800F07800F03800E03C01E0 +1E03C00F078007FF0001FC0015177E961A>I<FFF000FFFC00F01E00F00F00F00780F007 +80F00780F00780F00F00F01E00FFFC00FFF000F0F000F07800F07800F03C00F03C00F01E +00F00E00F00F00F00780F00780F003C012177D9617>82 D<07E01FF8383C700CE00CE000 +E000F000F8007F803FF01FF807FC007C001E000E000E000EC00CE01CF8387FF00FC00F17 +7E9614>I<FFFFF8FFFFF800780000780000780000780000780000780000780000780000 +780000780000780000780000780000780000780000780000780000780000780000780000 +780015177F9618>I<F007C01CF007C01CF007C01C780DC018780CE038780CE038780CE0 +383C1CF0703C18F0703C1870701C1870601E3878E01E3078E01E3038E00E3038C00F703C +C00F601DC007601D8007601D8007401D8003C00F0003C00F0003800F001E177F9621>87 +D E /Fc 28 122 df<70F8F8F8700505788416>46 D<000180000380000780000700000F +00000E00001E00001C00003C0000380000780000700000F00000E00001E00001C00001C0 +0003C0000380000780000700000F00000E00001E00001C00003C00003800007800007000 +00F00000E00000E0000011207E9C16>I<03E0000FF8001FFC001E3C00380E00780F0070 +0700700700E00380E00380E00380E00380E00380E00380E00380E00380F0078070070070 +0700780F003C1E001E3C001FFC000FF80003E00011197E9816>I<030007000F000F001F +00FF00FF00F70007000700070007000700070007000700070007000700070007000700FF +F8FFF8FFF80D197B9816>I<07E0001FF8007FFE00783F00F00F00F00780F00380F00380 +000380000380000780000700000F00001E00003C0000780000F00003E0000780000F0000 +1E03803C03807FFF80FFFF807FFF8011197E9816>I<07E0001FFC007FFE00781F00780F +00780700000700000F00000F00003E0007FC0007F80007FC00001E000007000007800003 +80000380F00380F00780F00700F81F007FFE003FFC0007E00011197E9816>I<00F80003 +FE000FFF001F0F003E0F003C0F00780600700000F00000E7F800FFFE00FFFE00F80F00F0 +0780F00780E00380F00380F00380700380780780780F003C1F001FFE000FF80003E00011 +197E9816>54 D<70F8F8F870000000000000000070F8F8F8700512789116>58 +D<1FE0007FF8007FFC00783E00301E00000E00003E0007FE003FFE007FCE00F80E00E00E +00E00E00F01E00F83E007FFFE03FF7E00FC3E013127E9116>97 D<FC0000FC0000FC0000 +1C00001C00001C00001C00001C7C001DFF001FFF801F07C01E03C01E01E01C01E01C00E0 +1C00E01C00E01C00E01E01E01E01C01F03C01F07801FFF801DFE000CF80013197F9816> +I<03F80FFE1FFE3C1E780C7000F000E000E000E000E000F000700778073E0F1FFE0FFC03 +F010127D9116>I<003F00003F00003F0000070000070000070000070003E7000FFF003F +FF003C1F00780F00700F00F00700E00700E00700E00700E00700F00F00F00F00781F007C +3F003FFFE01FF7E007C7E013197F9816>I<03F0000FFC001FFE003E1F00780700700780 +F00380FFFF80FFFF80FFFF80E00000F000007003807803803E0F801FFF000FFE0003F800 +11127E9116>I<001F0000FF8001FF8003C7800383000380000380007FFF00FFFF00FFFF +000380000380000380000380000380000380000380000380000380000380000380000380 +007FFC00FFFE007FFC0011197F9816>I<FC0000FC0000FC00001C00001C00001C00001C +00001CF8001FFE001FFF001F0F001E07001E07001C07001C07001C07001C07001C07001C +07001C07001C07001C0700FF8FE0FF9FE0FF8FE013197F9816>104 +D<03000780078003000000000000000000FF80FF80FF8003800380038003800380038003 +8003800380038003800380FFFCFFFEFFFC0F1A7C9916>I<7FC000FFC0007FC00001C000 +01C00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C000 +01C00001C00001C00001C00001C00001C0007FFF00FFFF807FFF0011197E9816>108 +D<FBC780FFEFC0FFFFE03E7CE03C78E03870E03870E03870E03870E03870E03870E03870 +E03870E03870E03870E0FE7CF8FE7CF8FE7CF81512809116>I<FCF800FFFE00FFFF001F +0F001E07001E07001C07001C07001C07001C07001C07001C07001C07001C07001C0700FF +8FE0FF9FE0FF8FE013127F9116>I<03E0000FF8001FFC003C1E00780F00700700E00380 +E00380E00380E00380E00380F00780700700780F003C1E001FFC000FF80003E00011127E +9116>I<FC7C00FDFF00FFFF801F07C01E03C01E01E01C01E01C00E01C00E01C00E01C00 +E01E01E01E01C01F03C01F07801FFF801DFE001CF8001C00001C00001C00001C00001C00 +001C0000FF8000FF8000FF8000131B7F9116>I<7F0F80FF3FE07FFFE007F1E007E0C007 +C0000780000780000700000700000700000700000700000700000700007FFC00FFFC007F +FC0013127F9116>114 D<0FEC3FFC7FFCF03CE01CE01CF0007F801FF007FC003EE00EE0 +0EF00EF81EFFFCFFF8C7E00F127D9116>I<0300000700000700000700000700007FFF00 +FFFF00FFFF00070000070000070000070000070000070000070000070100070380070380 +07078007878003FF0003FE0000F80011177F9616>I<FC3F00FC3F00FC3F001C07001C07 +001C07001C07001C07001C07001C07001C07001C07001C07001C0F001E1F001FFFE00FFF +E007E7E013127F9116>I<FF1FE0FF1FE0FF1FE038038038038038038038038039F38039 +F38019F30019B30019B30019B3001DB7001D17001F1F000F1E000E0E0013127F9116> +119 D<7F1FC07F3FC07F1FC00F1E00073C0003B80003F00001F00000E00001E00001F000 +03B800073C00071C000E0E007F1FC0FF3FE07F1FC013127F9116>I<7F1FC0FF9FE07F1F +C01C07000E07000E0E000E0E00070E00071C00071C00039C00039C0003980001B80001B8 +0000F00000F00000F00000E00000E00000E00001C00079C0007BC0007F80007F00003C00 +00131B7F9116>I E /Fd 37 122 df<18387838081010204080050A7E830B>44 +D<FFFFFE08037D870D>I<3078F06005047D830B>I<0020006000E001C01FC001C001C003 +8003800380038007000700070007000E000E000E000E001C00FFC00B157C9412>49 +D<00F00318040C090C090E110E110E221C241C1838003000600080030004001800200420 +0C7FF8C3F081E00F157D9412>I<00F8010C020E050E090E090E0A0C0E1C0018007003E0 +00300030003000386070E070C06080E041803F000F157D9412>I<007801840304061C0C +1C18003800300073C074207830F038E038E038E038E070C070C06060C061801E000E157C +9412>54 D<000180000180000380000380000780000780000B800013800013800021C000 +21C00041C00081C00081C00101C001FFC00201C00201C00401C00801C00801C01801E0FE +07F815177E961A>65 D<003F0400E0880380580600380C00381C00103800103000107000 +10600000E00000E00000E00000C00000C00040C00040C00080E00080E001006002003004 +0018180007E00016177A961A>67 D<03FFF000E01800E00C00E00600E00701C00301C003 +01C00301C00303800703800703800703800707000E07000E07000C07001C0E00180E0030 +0E00600E00C01C0380FFFC0018177E961B>I<03FFFE00E00E00E00400E00400E00401C0 +0401C00401C08001C08003810003830003FF000383000702000702080702080700100E00 +100E00300E00200E00601C01C0FFFFC017177E9618>I<07FE00E000E000E000E001C001 +C001C001C0038003800380038007000700070007000E000E000E000E001C00FF800F177E +960E>73 D<03FE0000E00000E00000E00000E00001C00001C00001C00001C00003800003 +80000380000380000700000700200700200700400E00400E00C00E00800E01801C0780FF +FF0013177E9616>76 D<03F0003F8000F000780000B800780000B800B80000B801380001 +38017000013802700001380270000138047000023808E000021C08E000021C10E000021C +10E000041C21C000041C41C000041C41C000041C81C000081D038000081D038000080E03 +8000080E038000180C070000FE083FE00021177E9620>I<007C40018280030180060180 +0601800C01000C01000E00000E00000FC00007F80003FC00007C00000E00000E00000600 +200600400C00400C00600800601000D8600087C00012177D9614>83 +D<1FFFFC38381C20380860380840380840700880700800700000700000E00000E00000E0 +0000E00001C00001C00001C00001C0000380000380000380000380000700007FF0001617 +7A961A>I<073018F03070707060E0E0E0E0E0E0E0C1C0C1C8C1C8C1C867D038E00D0E7C +8D12>97 D<7E001C001C001C001C003800380038003800778078C070C070E0E0E0E0E0E0 +E0E0E0C1C0C1C0C180C30066003C000B177C9610>I<07C00C6038E030E07000E000E000 +E000C000C000C020C04061803E000B0E7C8D10>I<007E001C001C001C001C0038003800 +380038077018F03070707060E0E0E0E0E0E0E0C1C0C1C8C1C8C1C867D038E00F177C9612 +>I<07801C40382070206040FF80E000E000C000C000C020E04061803E000B0E7C8D10>I< +001C0036007E007C006000E000E000E000E00FFC01C001C001C001C001C0038003800380 +03800380030007000700070006006600EC00C80070000F1D81960B>I<01CC063C0C1C1C +1C1838383838383838307030703070307019E00EE000E000E061C0E1C0C3807E000E147E +8D10>I<1F8007000700070007000E000E000E000E001CF01F381C181C18383838383838 +38387070707270E270E4E06460380F177E9612>I<030706000000000000182C4E4E9C1C +383838727274643808177D960B>I<3F0E0E0E0E1C1C1C1C3838383870707070E0E8E8E8 +F07008177D9609>108 D<387C3C004C8ECE004F0706004E0706009C0E0E001C0E0E001C +0E0E001C0E0E00381C1C00381C1C80381C3880381C39007038190030180E00190E7D8D1D +>I<38784D9C4E0C4E0C9C1C1C1C1C1C1C1C38383839387138727032301C100E7D8D14>I< +07C00C60183030387038E038E038E038C070C070C0E0E0C063803E000D0E7C8D12>I<0E +3C13461386138727070707070707070E0E0E0E0E0C0E181E301DE01C001C003800380038 +00FE0010147F8D12>I<38F04D184E384E309C001C001C001C0038003800380038007000 +30000D0E7D8D0F>114 D<07800C4018E018E038003F001F800FC001C060C0E0C0C080C3 +003E000B0E7D8D0F>I<060007000E000E000E000E00FF801C001C001C00380038003800 +3800700071007100720076003C0009147D930C>I<1C0C261C4E1C4E1C8E381C381C381C +38387038723872387218F40F380F0E7D8D13>I<1C0C302E1C784E1C384E1C188E38101C +38101C38101C38103870203870203870201870401CB8800F0F00150E7D8D18>119 +D<0F1C11A621CE21CC438003800380038007000708C708E710CB2071C00F0E7E8D10>I< +1C0C261C4E1C4E1C8E381C381C381C38387038703870387018E00FE000E000C0E1C0E380 +47003C000E147D8D11>I E /Fe 1 1 df<FFFEFFFE0F027D8516>0 +D E /Ff 1 1 df<FFFFC0FFFFC012027D8618>0 D E /Fg 11 121 +df<0408103020606040C0C0C0C0C0C0C0C0C0C04060602030100804061A7D920C>40 +D<80402030101818080C0C0C0C0C0C0C0C0C0C0818181030204080061A7F920C>I<00C0 +0000C00000C00000C00000C00000C00000C00000C00000C000FFFF80FFFF8000C00000C0 +0000C00000C00000C00000C00000C00000C00000C00011147E8F17>43 +D<1F00318060C04040C060C060C060C060C060C060C060C060404060C031801F000B107F +8F0F>48 D<187898181818181818181818181818FF08107E8F0F>I<3F006180F0C0F0E0 +6060006000E000C00180030006000C00102020207FC0FFC00B107F8F0F>I<3E00730071 +8001800F8031804180C190C19063903DE00C0B7F8A0F>97 D<20702000000000F0303030 +303030303030FC0612809108>105 D<F3C3C03C2C203838303030303030303030303030 +30303030303030303030FCFCFC160B7F8A1A>109 D<F3C03C6030603060306030603060 +306030603060FCF80D0B7F8A11>I<F8F030C0188019000E0006000F00198011C020C0F1 +F00C0B7F8A10>120 D E /Fh 8 111 df<0FFFE003806003802007002007002007042007 +04000E08000FF8000E08000E08001C10001C00001C00001C0000380000FF000013117E90 +13>70 D<3FFFC03070C040704040E04080E04080E04000E00001C00001C00001C00001C0 +000380000380000380000380000700003FF00012117E9012>84 D<FE3FC3E0380E008038 +0E0100380F0100380F020038170600382704003C2708001C4708001CC710001C8720001D +07A0001D03C0001E0380001C0380000C030000080300001B117D901D>87 +D<0C0E0C00000000305898983030606464683007127E910B>105 +D<006000E000400000000000000000038004C008C008C000C00180018001800180030003 +0003006300E600EC0078000B1780910D>I<3C000C000C00180018001800187031B03270 +346038007F00618061906190C1A0C0C00C117E9010>I<71F1F09A1A189C1C1898181818 +1818303030303030303032303062606064606038170B7E8A1B>109 +D<71F09A189C18981818183030303030323062606460380F0B7E8A13>I +E /Fi 18 122 df<03F0000E1820181C20300E40700E40E00E40E00E80E00F00C00F00C0 +0E00C00E006017003067401F8380130E7F8D17>11 D<000F0000318000C0C00100C00100 +C00201C00401C00401C0040380083F00084700083D800801C01001C01001C01001C01001 +C0300380300380300700280E0044180043E0004000004000008000008000008000008000 +00121D7F9614>I<00F8018C030606070E071C071C071C07380E380E381C3818747073C0 +70007000E000E000E000C00010147F8D12>26 D<60F0F06004047D830A>58 +D<60F0F070101020204040040A7D830A>I<C00000F000003C00000E000007800001E000 +007800001E000007000003C00000F00000F00003C0000700001E0000780001E000078000 +0E00003C0000F00000C0000014167D921B>62 D<0000C00000C00001C00001C00003C000 +05C00005E00008E00018E00010E00020E00020E00040E00080E00080E001FFF001007002 +0070040070040070080070180070FE03FE17177F961A>65 D<07FFF00000E01C0000E00E +0000E00F0000E0070001C00F0001C00F0001C00F0001C01E0003803C000380F00003FF80 +000380C000070060000700600007007000070070000E00F0000E00F0000E00F0800E00F0 +801C007100FF803E0019177F961B>82 D<FF83FC1FC01C00E007001C00E006001C00E004 +001C01E008001C02E008001C02E010001C04F010001C047020001C087040001C08704000 +1C107080000E207080000E207100000E407100000E407200000E807400000F807400000F +007800000E007800000E007000000C003000000C0020000022177E9621>87 +D<001F80000700000700000700000700000E00000E00000E00000E0007DC000C3C00183C +00301C00703800E03800E03800E03800C07000C07200C07200E0F2006174003E38001117 +7F9612>100 D<000C001C000800000000000000000000000000E0033004380438087000 +700070007000E000E000E000E001C001C001C001C06380E300C6007C000E1D80960E> +106 D<1F8007000700070007000E000E000E000E001C0E1C331C471C863B003C003F8039 +C070E070E270E270E2E064603810177F9612>I<3F0E0E0E0E1C1C1C1C38383838707070 +70E0E4E4E4E87008177F960B>I<383C004CC7004F03004E03009C07001C07001C07001C +0700380E00380E40381C40381C80700C80300700120E7F8D15>110 +D<07C00C201870187038003F801FC00FE000E06060E060C0C0C1803F000C0E7E8D10> +115 D<1C0C2E1E4E0E4E068E041C041C041C0438083808381018201C6007800F0E7F8D11 +>118 D<070F0019D18020E38020E30041C00001C00001C00001C000038000038200C382 +00E78400C5880078F000110E7F8D14>120 D<1C032E074E074E078E0E1C0E1C0E1C0E38 +1C381C381C183C1C7807B800380070707070E021801E0010147F8D11>I +E /Fj 3 51 df<00C00000C00000C00000C00000C00000C00000C00000C000FFFF80FFFF +8000C00000C00000C00000C00000C00000C00000C00000C00011127E8D15>43 +D<18F818181818181818181818FF080D7D8C0E>49 D<3E00418080C0C0C000C000C00180 +03000400084030407F80FF800A0D7E8C0E>I E /Fk 30 122 df<70F8FCFC7404040408 +08102040060D7C9C0D>39 D<70F8F8F87005057C840D>46 D<030007003F00C700070007 +000700070007000700070007000700070007000700070007000700070007000700070007 +00070007000F80FFF80D1C7B9B17>49 D<07E000183800201C00400E00400F00F00780F8 +0780F80780F80780700780000780000F00000F00000E00001C0000380000300000600000 +C0000180000300000600800C00800800801001003FFF007FFF00FFFF00111C7D9B17>I< +07E000083800301C00200E00780F00780F00780F00380F00000E00000E00001C00001800 +00700007E000003800001C00000E00000700000780000780700780F80780F80780F80780 +F00700400E00201C0018380007E000111D7D9B17>I<000C00000C00001C00003C00003C +00005C0000DC00009C00011C00031C00021C00041C000C1C00081C00101C00301C00201C +00401C00C01C00FFFFE0001C00001C00001C00001C00001C00001C00001C0001FFC0131C +7E9B17>I<3806003FFC003FF8003FE00020000020000020000020000020000020000023 +E000241800280C00300E00200700000700000780000780000780600780F00780F00780F0 +0700800700400F00400E00201C0018380007E000111D7D9B17>I<00F800038600060200 +0C07001C0F00380F00380600780000700000700000F1E000F61800F40C00F80E00F80700 +F00700F00780F00780F00780F00780700780700780700780700700380700180E001C0C00 +0E180003E000111D7D9B17>I<4000007FFFC07FFF807FFF804001008002008002008004 +0000080000100000100000200000600000400000C00000C00001C0000180000180000380 +00038000038000078000078000078000078000078000078000030000121D7D9B17>I<03 +E0000C18001004002006002003006003006003007003007003007C06003F0C001F98000F +E00007F00007FC0008FE00303F00201F00600780C00380C00180C00180C00180C0018060 +01006002003004001C180007E000111D7D9B17>I<03E0000E3800181C00380E00700E00 +700700F00700F00700F00780F00780F00780F00780F00780700780700F80380F80181780 +0C378003C780000700000700000700300E00780E00780C007018002030001060000F8000 +111D7D9B17>I<FFF00FF00F0003C00F0003000F0002000F0004000F0008000F0010000F +0060000F0080000F0100000F0200000F0700000F0F80000F1780000F23C0000F43E0000F +81E0000F00F0000F00F8000F0078000F003C000F001E000F001F000F000F000F0007800F +0007C00F0007E0FFF01FF81D1C7D9B23>75 D<FFF8000F00000F00000F00000F00000F00 +000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00 +000F00040F00040F00040F000C0F000C0F00080F00180F00380F00F8FFFFF8161C7D9B1C +>I<001FC00000F0780001800C00070007000E0003801C0001C01C0001C0380000E07800 +00F0780000F070000070F0000078F0000078F0000078F0000078F0000078F0000078F000 +0078F0000078780000F0780000F0780000F03C0001E01C0001C01E0003C00E0003800700 +070003C01E0000F07800001FC0001D1E7D9C23>79 D<FFFFC0000F0078000F001C000F00 +0E000F0007000F0007800F0007800F0007800F0007800F0007800F0007000F000E000F00 +1C000F0078000FFFC0000F0000000F0000000F0000000F0000000F0000000F0000000F00 +00000F0000000F0000000F0000000F0000000F000000FFF00000191C7D9B1F>I<7FFFFF +C0700F01C0600F00C0400F0040400F0040C00F0020800F0020800F0020800F0020000F00 +00000F0000000F0000000F0000000F0000000F0000000F0000000F0000000F0000000F00 +00000F0000000F0000000F0000000F0000000F0000000F0000000F0000001F800003FFFC +001B1C7D9B21>84 D<FEFEC0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +C0C0C0C0C0C0C0C0C0C0C0C0FEFE07297B9E0D>91 D<FEFE060606060606060606060606 +06060606060606060606060606060606060606060606060606FEFE07297F9E0D>93 +D<00200000700000700000700000B80000B80000B800011C00011C00031E00020E00020E +0004070007FF000407000803800803801803C01801C03801C0FC07F815157F9419>97 +D<FFFC001C07001C01C01C00E01C00E01C00701C00701C00781C00781C00781C00781C00 +781C00781C00781C00701C00701C00E01C00E01C01C01C0700FFFC0015157F941A>100 +D<FFFF801C03801C00801C00801C00401C00401C08401C08001C08001C18001FF8001C18 +001C08001C08201C08201C00201C00601C00401C00C01C01C0FFFFC013157F9417>I<FF +FF801C03801C00801C00801C00401C00401C08401C08001C08001C18001FF8001C18001C +08001C08001C08001C00001C00001C00001C00001C0000FFC00012157F9416>I<00FC20 +0782600E01E01C00E0380060780020700020F00020F00000F00000F00000F00FF8F000E0 +F000E07000E07800E03800E01C00E00E00E007836000FC2015157E941B>I<FF8FF81C01 +C01C01C01C01C01C01C01C01C01C01C01C01C01C01C01C01C01FFFC01C01C01C01C01C01 +C01C01C01C01C01C01C01C01C01C01C01C01C0FF8FF815157F9419>I<FFC0001C00001C +00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C00001C00801C +00801C00801C01801C01001C03001C0700FFFF0011157F9415>108 +D<FE000FE01E000F00170017001700170017001700138027001380270011C0470011C047 +0011C0470010E0870010E08700107107001071070010710700103A0700103A0700101C07 +00101C0700381C0700FE083FE01B157F941F>I<FC03F81E00E01E004017004013804013 +C04011C04010E040107040107040103840101C40101C40100E401007401007C01003C010 +01C01000C03800C0FE004015157F9419>I<01F800070E000C03001C03803801C07801E0 +7000E0F000F0F000F0F000F0F000F0F000F0F000F0F000F07000E07801E03801C01C0380 +1E0780070E0001F80014157E941A>I<FFF8001C0E001C07801C03801C03C01C03C01C03 +C01C03801C07801C0E001FF8001C1C001C0E001C07001C07001C07001C07801C07841C07 +C41C03CCFF80F816157F9419>114 D<FF80FE1E00380E00200F006007004003808003C0 +8001C10001E20000E200007400007C000038000038000038000038000038000038000038 +0000380001FF001715809419>121 D E /Fl 5 51 df<FFFFC0FFFFC012027D871A>0 +D<60F0F06004047E880A>I<C003E007700E381C1C380E7007E003C003C007E00E701C38 +381C700EE007C00310107C8E1A>I<040004000400C460F5E03F800E003F80F5E0C46004 +00040004000B0D7E8D11>I<03FC0FFC1C00380070006000E000C000C000FFFCFFFCC000 +C000E0006000700038001C000FFC03FC0E147D9016>50 D E /Fm +5 111 df<7FFF8060C08040C08040C08081810001800001800001800003000003000003 +00000300000600003FC000110E7F8D11>84 D<00C0008000000000000000000700198011 +80030003000300030006000600060006008C00F0000A137F8E0C>106 +D<3800180018001800300030C03360344078007E0063006320C340C1800B0E7E8D10>I< +73C7009C68809830C038618030618030618030631060C32060C1C014097D8819>109 +D<73809C40986030C030C030C03188619060E00D097D8812>I E +/Fn 13 121 df<02040818103030606060E0E0E0E0E0E0E0E0E0E0606060303010180804 +02071E7D950D>40 D<804020301018180C0C0C0E0E0E0E0E0E0E0E0E0E0C0C0C18181030 +204080071E7E950D>I<0060000060000060000060000060000060000060000060000060 +00006000FFFFF0FFFFF00060000060000060000060000060000060000060000060000060 +0000600014167E9119>43 D<0FC01860303060186018E01CE01CE01CE01CE01CE01CE01C +E01CE01C60186018303018600FC00E137F9211>48 D<06001E00EE000E000E000E000E00 +0E000E000E000E000E000E000E000E000E000E000E00FFE00B137D9211>I<1F0021C040 +E0C070E070E0700070006000E000C00180030006000C10081010303FE07FE0FFE00C137E +9211>I<FFFFF0FFFFF0000000000000000000000000000000000000FFFFF0FFFFF0140A +7E8B19>61 D<183C66C308047C9311>94 D<3F8070E070602070007007F03C707070E070 +E072E07270FE3F3C0F0D7F8C11>97 D<3078783000000000F83838383838383838383838 +FE07157F940A>105 D<F9F0F8003A190C003C1E0E00381C0E00381C0E00381C0E00381C +0E00381C0E00381C0E00381C0E00381C0E00381C0E00FE7F3F80190D7F8C1C>109 +D<F9E03A303C38383838383838383838383838383838383838FE7E0F0D7F8C12>I<FC7C +38701C601CC00E8007000780078005C008E010F03070F8FE0F0D7F8C11>120 +D E /Fo 25 126 df<00200040008001000300060006000C000C00180018003800300030 +007000700070006000E000E000E000E000E000E000E000E000E000E000E000E000E00060 +00700070007000300030003800180018000C000C0006000600030001000080004000200B +317A8113>0 D<800040002000100018000C000C00060006000300030003800180018001 +C001C001C000C000E000E000E000E000E000E000E000E000E000E000E000E000E000C001 +C001C001C001800180038003000300060006000C000C00180010002000400080000B317F +8113>I<FFFFC0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0FFFF0831798111>I<FFFF03030303030303030303 +0303030303030303030303030303030303030303030303030303030303030303030303FF +FF08317F8111>I<0000300000600000C0000180000380000700000E00000C00001C0000 +380000380000700000E00000E00001C00001C00003C0000380000380000700000700000F +00000E00000E00001E00001E00001C00001C00003C00003C00003C000038000078000078 +0000780000780000780000780000700000F00000F00000F00000F00000F00000F00000F0 +0000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F0 +0000F00000F000007000007800007800007800007800007800007800003800003C00003C +00003C00001C00001C00001E00001E00000E00000E00000F000007000007000003800003 +800003C00001C00001C00000E00000E000007000003800003800001C00000C00000E0000 +07000003800001800000C0000060000030146377811F>18 D<C000006000003000001800 +001C00000E000007000003000003800001C00001C00000E0000070000070000038000038 +00003C00001C00001C00000E00000E00000F000007000007000007800007800003800003 +800003C00003C00003C00001C00001E00001E00001E00001E00001E00001E00000E00000 +F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000 +F00000F00000F00000F00000F00000F00000F00000F00000F00000E00001E00001E00001 +E00001E00001E00001E00001C00003C00003C00003C00003800003800007800007800007 +00000700000F00000E00000E00001C00001C00003C0000380000380000700000700000E0 +0001C00001C0000380000300000700000E00001C0000180000300000600000C000001463 +7F811F>I<0000700001F00003E0000780000F00001E00003C0000780000780000F00000 +F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000 +F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000 +F00000F00000F00000F00000F00000F00001E00001E00001C00003C0000780000700000E +00003C0000700000E000007000003C00000E000007000007800003C00001C00001E00001 +E00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000 +F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000 +F00000F00000F00000F00000F00000F00000F00000F000007800007800003C00001E0000 +0F000007800003E00001F000007014637B811F>26 D<00000C0000180000380000300000 +600000E00000C00001C0000380000380000700000700000E00000E00001C00001C000038 +0000380000780000700000F00000F00000E00001E00001E00003C00003C00003C00003C0 +000780000780000780000F80000F00000F00000F00001F00001F00001E00001E00001E00 +003E00003E00003E00003E00003C00003C00003C00007C00007C00007C00007C00007C00 +007C00007C00007C0000780000780000F80000F80000F80000F80000F80000F80000F800 +00F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000164B748024 +>48 D<C000006000007000003000001800001C00000C00000E0000070000070000038000 +03800001C00001C00000E00000E000007000007000007800003800003C00003C00001C00 +001E00001E00000F00000F00000F00000F000007800007800007800007C00003C00003C0 +0003C00003E00003E00001E00001E00001E00001F00001F00001F00001F00000F00000F0 +0000F00000F80000F80000F80000F80000F80000F80000F80000F800007800007800007C +00007C00007C00007C00007C00007C00007C00007C00007C00007C00007C00007C00007C +00007C00007C00007C00007C164B7F8024>I<FFFCFFFCFFFCE000E000E000E000E000E0 +00E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E0 +00E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E0 +00E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E0 +00E000E000E000E000E000E000E000E000E000E000E0000E4A73801C>I<FFFCFFFCFFFC +001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C +001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C +001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C +001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C0E4A +80801C>I<E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E0 +00E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E0 +00E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E0 +00E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E0 +00E000FFFCFFFCFFFC0E4A73811C>I<001C001C001C001C001C001C001C001C001C001C +001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C +001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C +001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C +001C001C001C001C001C001C001CFFFCFFFCFFFC0E4A80811C>I<E0E0E0E0E0E0E0E0E0 +E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0031B73801C>I<E0E0E0E0E0E0E0E0E0E0E0 +E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0031B75801C>I<F80000F80000F80000F80000F8 +0000F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000F80000F8 +00007800007800007C00007C00007C00007C00007C00007C00007C00007C00003C00003C +00003C00003E00003E00003E00003E00001E00001E00001E00001F00001F00000F00000F +00000F00000F800007800007800007800003C00003C00003C00003C00001E00001E00000 +E00000F00000F000007000007800003800003800001C00001C00000E00000E0000070000 +07000003800003800001C00000C00000E000006000003000003800001800000C164B7482 +24>64 D<00007C00007C00007C00007C00007C00007C00007C00007C00007C00007C0000 +7C00007C00007C00007C00007C00007C00007C0000780000780000F80000F80000F80000 +F80000F80000F80000F80000F80000F00000F00000F00001F00001F00001F00001F00001 +E00001E00001E00003E00003E00003C00003C00003C00007C0000780000780000780000F +00000F00000F00000F00001E00001E00001C00003C00003C000038000078000070000070 +0000E00000E00001C00001C0000380000380000700000700000E00000C00001C00001800 +00300000700000600000C00000164B7F8224>I<FFFFFFFFF0FFFFFFFFF07800000FF87C +000000F83E000000381F0000001C0F0000000C0F8000000407C000000603C000000203E0 +00000001F000000000F80000000078000000007C000000003E000000001E000000001F00 +0000000F8000000007C000000003C000000003C000000001800000000380000000030000 +000006000000000C000000001800000000380000000030000000006000000000C0000002 +01800000060380000004030000000C060000001C0C0000003818000000F83800000FF83F +FFFFFFF87FFFFFFFF0FFFFFFFFF0272A7E7F2C>80 D<FFFFFFFFC0FFFFFFFFC01F00003E +000F00003C000F00003C000F00003C000F00003C000F00003C000F00003C000F00003C00 +0F00003C000F00003C000F00003C000F00003C000F00003C000F00003C000F00003C000F +00003C000F00003C000F00003C000F00003C000F00003C000F00003C000F00003C000F00 +003C000F00003C000F00003C000F00003C000F00003C000F00003C000F00003C000F0000 +3C000F00003C000F00003C000F00003C000F00003C000F00003C000F00003C000F00003C +001F80007E00FFF003FFC0FFF003FFC0222A7E7F27>I<FFFFFFFFFFFFC0FFFFFFFFFFFF +E07F00000001FFE07F800000001FE03F8000000003F01FC000000000F00FE00000000038 +0FE0000000001807F0000000000C03F8000000000403FC000000000401FC000000000200 +FE0000000000007F0000000000007F0000000000003F8000000000001FC000000000000F +E000000000000FE0000000000007F0000000000003F8000000000003FC000000000001FC +000000000000FE0000000000007F0000000000007F0000000000003F8000000000001FC0 +00000000001FE000000000000FE0000000000007C0000000000003800000000000070000 +000000000E0000000000001C000000000000380000000000003800000000000070000000 +000000E0000000000001C000000000000380000000000007000000000000070000000000 +000E0000000000001C0000000002003800000000040070000000000400E0000000000C00 +E0000000001801C00000000038038000000000F8070000000001F00E000000000FF01C00 +000001FFF01FFFFFFFFFFFE03FFFFFFFFFFFE07FFFFFFFFFFFE0FFFFFFFFFFFFC0373A7E +7F3C>88 D<FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0FFC00003FF003FC00003FC001 +FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001 +FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001 +FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001 +FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001 +FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001 +FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001 +FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001 +FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8001FC00003F8003 +FE00007FC00FFF8001FFF0FFFFF81FFFFFFFFFF81FFFFFFFFFF81FFFFF303A7E7F35>I< +0001F8000FF8003FF800FFF803FFF807FC000FC0001F00003C0000780000700000E00000 +C00000150D818413>122 D<FC0000FF8000FFE000FFF800FFFE0001FF00001F800007C0 +0001E00000F0000070000038000018150D818413>I<C00000E000006000007000003800 +001E00000F800007E00003FE0001FFF800FFF8003FF8000FF80001F8150E818D13>I<00 +00180000380000300000700000E00003C0000F80003F0003FE00FFFC00FFF800FFE000FF +8000FC0000150E818D13>I E /Fp 16 124 df<60F0F06004047E830A>58 +D<07FFE000E07001C01801C00C01C00C01C00E03800E03800E03800E03800E07001C0700 +1C07001C0700380E00300E00700E00E00E01C01C0700FFFC0017147F931B>68 +D<07FFFC00E01C01C00C01C00C01C00C01C00803810803810003830003FF000702000702 +000702000700000E00000E00000E00000E00001C0000FFC00016147F9315>70 +D<07FC00E001C001C001C001C0038003800380038007000700070007000E000E000E000E +001C00FF800E147F930F>73 D<00FF80000E00001C00001C00001C00001C000038000038 +0000380000380000700000700000700000700000E00070E000F0E000E1C000C380003E00 +0011147E9312>I<1FFFF8381C1820381820380840380840381080701000700000700000 +700000E00000E00000E00000E00001C00001C00001C00001C0000380003FF80015148093 +14>84 D<FF1FE0FC38038030380380203807804038078040380B8080380B808038138100 +382382003C2382001C43C4001C41C4001C81C8001D01D0001D01D0001E01E0001E01E000 +1C01C00018018000180180001E147E931F>87 D<07FC3F8000E01C0000F0100000702000 +007040000038800000390000003E0000001C0000001E0000001E0000003F000000670000 +00C7000001838000030380000603C0000401C0001C01E000FE07F80019147F931B>I<FF +80FC1C00301E00400E00C00F01800F010007020007840003880003900003E00001C00001 +C00001C0000380000380000380000380000700003FE00016147F9314>I<060706000000 +00384C4C8C98181830323264643808147F930C>105 D<00300038003000000000000000 +0001C002600430046008600060006000C000C000C000C001800180018001806300E300C6 +0078000D1A81930E>I<1E0006000C000C000C000C0018001838185C189C311836003800 +3F8061C060C860C860C8C0D0C0600E147F9312>I<30F87C00590C86004E0D06009C0E06 +00980C0600180C0600180C060030180C0030180C8030181880301818806030190060300E +00190D7F8C1D>109 D<30F8590C4E0C9C0C980C180C180C30183019303130316032601C +100D7F8C15>I<0C78168C130426062606060606060C0C0C0C0C080C101A2019C0180018 +00300030003000FC000F13818C11>112 D<384C4C8C981818303232646438070D7F8C0C> +123 D E /Fq 57 123 df<1C3E3E3E3A0204040808106080070D779C0D>39 +D<00030006000800180030006000C000C0018003000300060006000C000C001C00180018 +00380030003000700070006000600060006000E000E000E000E000E00060006000600060 +00600020003000100008000800102A7B9E11>I<001000100008000C0004000600060006 +00060006000700070007000700070006000600060006000E000E000C000C001C00180018 +0038003000300060006000C000C001800300030006000C00180010006000C000102A809E +11>I<1C3C3C3C3C0408081010204080060D7D840D>44 D<FFC0FFC0FFC00A037D890F>I< +70F8F8F0E005057B840D>I<003E0000E1800181C00300C00700C00600C00E00E00C00E0 +1C00C01C00C01801C03801C03801C03801C0700380700380700380700380600700E00700 +E00600E00E00E00E00E00C00E0180060380060700030C0001F0000131D7C9B15>48 +D<0004000C00180038007807B8007000700070007000E000E000E000E001C001C001C001 +C0038003800380038007000700070007000F00FFF00E1C7B9B15>I<003E000041800080 +C00100C00200E00440E00440E00840E00840E00840E01081C01081C01103800E03000006 +00000C000018000060000080000300000400000800401000802000802001007F070043FE +0081FC00807800131D7D9B15>I<001F000060C00080C00100600200600240600440E004 +40E00440E00481C00301C000038000070000FC00001C0000060000060000070000070000 +0700300700780700F00E00E00E00801C0040180040300020E0001F8000131D7D9B15>I< +00806001FFC001FF8001FE0001000002000002000002000002000004000004F000050C00 +060C000C0E00080E00000E00000F00000E00001E00301E00781E00781C00F03C00803800 +80780040700040E0002180001E0000131D7C9B15>53 D<09C0400FE0801FE1801C610030 +2600201A00600400400C0080080080180000300000300000600000600000C00000C00001 +C0000180000380000300000700000700000700000E00000E00000E00001C00001C000018 +0000121D799B15>55 D<001F000060C00080600100600300300300300700600700600700 +C00780C007E10003F60001FC0000FC0001FE00063F000C1F00180F803007802003806003 +80600380C00300C00300C002006004006008003830000FC000141D7D9B15>I<003E0000 +E1000181800300C00600C00E00C00C00C01C00C01C00C01C01C03801C03801C03801C038 +03C0180380180780080B800C330003C700000700000E00000C00601C00F01800F03000E0 +600080C0004180003E0000121D7C9B15>I<000018000000180000003800000038000000 +7800000078000000F800000178000001780000027C0000023C0000043C00000C3C000008 +3C0000103C0000103C0000203C0000203C0000403C0000FFFC0000803C0001003C000100 +3E0002001E0002001E0004001E000C001E001C003E00FF01FFC01A1D7E9C1F>65 +D<0003F020001E0C60003002E000E003C001C001C0038001C0070000C00E0000801E0000 +801C0000803C0000803C000000780000007800000078000000F0000000F0000000F00000 +00F0000000F0000400F0000400F0000400F0000800700008007000100038002000180040 +000C0180000706000001F800001B1E7A9C1E>67 D<01FFFF00003E03C0003C00E0003C00 +E0003C0070003C00700078007800780038007800380078007800F0007800F0007800F000 +7800F0007801E000F001E000F001E000F001E000E003C001E003C001C003C003C003C003 +800780070007800E0007801C00078038000F00E000FFFF80001D1C7E9B1F>I<01FFFFF0 +003E00F0003C0030003C0020003C0020003C002000780020007800200078082000780800 +00F0100000F0100000F0300000FFF00001E0200001E0200001E0200001E0200003C04000 +03C0000003C0000003C00000078000000780000007800000078000000F800000FFF80000 +1C1C7E9B1B>70 D<01FFE7FF80003E00F800003C00F000003C00F000003C00F000003C00 +F000007801E000007801E000007801E000007801E00000F003C00000F003C00000F003C0 +0000FFFFC00001E007800001E007800001E007800001E007800003C00F000003C00F0000 +03C00F000003C00F000007801E000007801E000007801E000007801E00000F803E0000FF +F3FFC000211C7E9B1F>72 D<03FF80007C0000780000780000780000780000F00000F000 +00F00000F00001E00001E00001E00001E00003C00003C00003C00003C000078000078000 +0780000780000F00000F00000F00000F00001F0000FFE000111C7D9B10>I<01FFE07F80 +003E001E00003C001800003C002000003C004000003C0080000078010000007804000000 +78080000007810000000F020000000F060000000F1E0000000F3E0000001E4F0000001E8 +F0000001E0F0000001E078000003C078000003C078000003C03C000003C03C000007803C +000007801E000007801E000007801E00000F801F0000FFF0FFC000211C7E9B20>75 +D<01FFE0003E00003C00003C00003C00003C0000780000780000780000780000F00000F0 +0000F00000F00001E00001E00001E00001E00003C00203C00203C00203C0040780040780 +0C0780180780380F00F0FFFFF0171C7E9B1A>I<01FF0003FE003F0003E0002F0007C000 +2F000BC0002F000BC0002F0013C0004F001780004F002780004F004780004F004780008F +008F000087808F000087810F000087810F000107821E000107841E000107841E00010788 +1E000207883C000207903C000207A03C000207A03C000403C078000403C0780004038078 +000C030078001C0300F800FF820FFF00271C7E9B25>I<0007F000001C1C0000700E0000 +E0070001C0038003800380070003800E0003C01E0003C01C0003C03C0003C03C0003C078 +0003C0780003C0780003C0F0000780F0000780F0000780F0000F00F0000F00F0000E00F0 +001E00F0003C0070003800700070007800E0003801C0001C0380000E0E000003F800001A +1E7A9C20>79 D<01FFFE00003E0380003C01C0003C00E0003C00E0003C00E0007801E000 +7801E0007801E0007801C000F003C000F0038000F0070000F01C0001FFF00001E0000001 +E0000001E0000003C0000003C0000003C0000003C0000007800000078000000780000007 +8000000F800000FFF000001B1C7E9B1C>I<01FFFE00003E0780003C01C0003C01E0003C +00E0003C00E0007801E0007801E0007801E0007803C000F0038000F0070000F01C0000FF +E00001E0380001E01C0001E01E0001E01E0003C01E0003C01E0003C01E0003C01E000780 +3C0007803C2007803C2007803C200F803C40FFF01C8000000F001B1D7E9B1E>82 +D<000F8400304C00603C00C01801801803801803801807001007001007000007800007C0 +0007F80003FF0001FF8000FF80001FC00003C00003C00001C00001C02001C02001C06003 +80600380600300600600F00C00CC180083E000161E7D9C17>I<1FFFFFC01C0781C0300F +00C0200F0080600F0080400F0080401E0080801E0080801E0080001E0000003C0000003C +0000003C0000003C00000078000000780000007800000078000000F0000000F0000000F0 +000000F0000001E0000001E0000001E0000001E0000003E000007FFF00001A1C799B1E> +I<FFC01FC03E0007001E0004001E0004001E0008001E0010001E0010001E0020001E0020 +001E0040001E0080001F0080000F0100000F0100000F0200000F0400000F0400000F0800 +000F0800000F1000000F2000000FA0000007C0000007C000000780000007000000070000 +0006000000060000001A1D779B1F>86 D<01FFC1FE003F00F0001E0060001E0080001F01 +80000F0100000F0200000F840000078800000790000007E0000003E0000003C0000003E0 +000001E0000003E0000005F0000008F0000010F0000030F8000060780000407C0000807C +0001003C0002003E0006003E001E003E00FF80FFC01F1C7E9B1F>88 +D<003F80007F0000600000600000600000C00000C00000C00000C0000180000180000180 +000180000300000300000300000300000600000600000600000600000C00000C00000C00 +000C00001800001800001800001800003000003000003000003000006000006000006000 +00600000C00000C00000FE0000FE000011297E9E0D>91 D<003F80007F00000300000300 +000300000600000600000600000600000C00000C00000C00000C00001800001800001800 +00180000300000300000300000300000600000600000600000600000C00000C00000C000 +00C000018000018000018000018000030000030000030000030000060000060000FE0000 +FE00001129819E0D>93 D<01E307170C0F180F380E300E700E700EE01CE01CE01CE01CE0 +39E039E0396079319A1E0C10127C9115>97 D<3F00070007000E000E000E000E001C001C +001C001C0039E03A183C0C380C700C700E700E700EE01CE01CE01CE018E038E030E06060 +C031801E000F1D7C9C13>I<00F803040E0C1C1E183C301870007000E000E000E000E000 +E000E0046008601030600F800F127C9113>I<0007E00000E00000E00001C00001C00001 +C00001C000038000038000038000038001E7000717000C0F00180F00380E00300E00700E +00700E00E01C00E01C00E01C00E01C00E03900E03900E03900607900319A001E0C00131D +7C9C15>I<00F807040C0418023804300470087FF0E000E000E000E000E0006004600830 +1030600F800F127C9113>I<0003C0000660000CF0001DE0001CC0001C00003800003800 +00380000380000380003FF8000700000700000700000700000700000E00000E00000E000 +00E00000E00001C00001C00001C00001C00001C000038000038000038000030000030000 +670000F60000F60000EC00007800001425819C0D>I<0078C001C5C00303C00603C00E03 +800C03801C03801C0380380700380700380700380700380E00380E00380E00181E000C7C +00079C00001C00001C00003800603800F03000F07000E1C0007F0000121A7E9113>I<0F +C00001C00001C0000380000380000380000380000700000700000700000700000E3E000E +C3000F03800E03801E03801C03801C03801C0380380700380700380700380E00700E4070 +0E40701C40701C80E00C80600700121D7E9C15>I<018003C00380030000000000000000 +00000000001C002600470047008E008E000E001C001C001C003800380071007100710072 +0072003C000A1C7C9B0D>I<0FC00001C00001C000038000038000038000038000070000 +0700000700000700000E07800E08800E11C00E23C01C47801C83001D00001E00003FC000 +38E000387000387000707100707100707100707200E03200601C00121D7E9C13>107 +D<1F800380038007000700070007000E000E000E000E001C001C001C001C003800380038 +0038007000700070007000E200E200E200E40064003800091D7D9C0B>I<1C1E07802663 +18C04683A0E04703C0E08E0380E08E0380E00E0380E00E0380E01C0701C01C0701C01C07 +01C01C070380380E0388380E0388380E0708380E0710701C0320300C01C01D127C9122> +I<383E004CC3004D03804E03809E03809C03801C03801C0380380700380700380700380E +00700E40700E40701C40701C80E00C8060070012127C9117>I<00F800030C000E06001C +0300180300300300700380700380E00700E00700E00700E00E00E00E00E01C0060180060 +300030E0000F800011127C9115>I<03878004C86004D03004E03009C03009C03801C038 +01C0380380700380700380700380600700E00700C00701800783000E86000E78000E0000 +0E00001C00001C00001C00001C0000380000FF0000151A809115>I<01E107130C0F180F +380E300E700E700EE01CE01CE01CE01CE038E038E038607831F01E700070007000E000E0 +00E000E001C00FF8101A7C9113>I<1C3C26C24706470F8E1E8E0C0E000E001C001C001C +001C0038003800380038007000300010127C9112>I<01F006080C080C1C18181C001F00 +1FC00FF007F0007820387030F030F030806060C01F000E127D9111>I<03000700070007 +000E000E000E000E00FFE01C001C001C0038003800380038007000700070007000E080E0 +80E100E100660038000B1A7C990E>I<1C01802E03804E03804E03808E07008E07001C07 +001C0700380E00380E00380E00380E00301C80301C80301C80383C80184D000F86001112 +7C9116>I<1C062E0E4E064E068E028E021C021C02380438043804380830083008301038 +2018400F800F127C9113>I<1E01832703874703874703838707018707010E07010E0701 +1C0E021C0E021C0E021C0E04180C04181C04181C081C1E080C263007C3C018127C911C> +I<0387800CC8400870C01071E020E3C020E18000E00000E00001C00001C00001C00001C0 +00638100F38100F38200E5820085840078780013127E9113>I<0E00C01701C02701C027 +01C04703804703800E03800E03801C07001C07001C07001C0700180E00180E00180E001C +1E000C3C0007DC00001C00001800603800F03000F06000E0C0004180003E0000121A7D91 +14>I<01C107E10FF6081C10080010002000400080010002000400080410042C0C73F841 +F080E010127E9111>I E /Fr 44 124 df<00FC000386000603020E03821C01843801C4 +7801C87801C8F001D0F001D0F001E0F001C0F001C0F001C07003C03005C41838C80FC070 +17127F911B>11 D<0001F000061800080C00100C00200E00400E00800E00801C01001C01 +0018010038020FF00210E0020FF002003804003804003804003C04003808007808007808 +00780800701800F01800E01401C0140380230E0020F80020000020000040000040000040 +000040000080000080000017257F9C17>I<0780101FC0103FE0207FF020603040C01840 +800880000880000480000500000500000600000600000600000400000400000400000C00 +000C00000C00001800001800001800001800003000003000002000141B7F9115>I<0FFF +F81FFFF83FFFF8608400418400810400010400030C00030C00020C00060C00060C000E0C +000C0C001C0E001C0E00380E0018060015127E9118>25 D<001F0000718000C0C001C0E0 +0380E00300E00700F00700F00E01E00E01E00E01E00E01C01C03C01C03801C07001E0E00 +3B1C0038F000380000380000700000700000700000700000E00000E00000C00000141B7F +9115>I<00FFFC03FFFC07FFFC0E0F001C0700380700700300700700E00700E00700E007 +00E00600E00E00E00C0060180060300030E0000F800016127F9118>I<70F8F8F8700505 +7D840C>58 D<70F0F8F8780808081010202040050D7D840C>I<00000180000007800000 +1E00000078000001E00000078000001E00000038000000F0000003C000000F0000003C00 +0000F0000000F00000003C0000000F00000003C0000000F0000000380000001E00000007 +80000001E0000000780000001E000000078000000180191A7D9620>I<00030003000700 +060006000E000C001C0018001800380030003000700060006000E000C000C001C0018003 +80030003000700060006000E000C000C001C001800180038003000700060006000E000C0 +00C00010297E9E15>I<C0000000F00000003C0000000F00000003C0000000F00000003C +0000000E0000000780000001E0000000780000001E00000007800000078000001E000000 +78000001E00000078000000E0000003C000000F0000003C000000F0000003C000000F000 +0000C0000000191A7D9620>I<003E0000C3000101C00200C00300E00780600780700300 +7000007000007000007000F8700386F00702F00E01F01C01F03C01E03801E07801E07801 +C0F003C0F003C0F00380F00780E00700E00600E00E00701C003038001860000F8000141F +7E9D16>64 D<00000C0000000C0000001C0000001C0000003C0000007C0000007C000000 +BE0000009E0000011E0000021E0000021E0000041E0000041E0000081E0000101E000010 +1E0000201F0000200F00007FFF0000800F0000800F0001000F0001000F0002000F000400 +0F0004000F001C000F80FF807FF01C1D7F9C1F>I<01FFFF80003E00E0003C0070003C00 +78003C0038003C0038007800380078007800780078007800F000F001E000F003C000F00F +0000FFFE0001E0078001E003C001E001E001E001E003C001E003C001E003C001E003C001 +E0078003C0078003800780070007801E000F003C00FFFFE0001D1C7F9B1F>I<01FFFF80 +003E01E0003C0070003C0038003C003C003C001C0078001C0078001E0078001E0078001E +00F0001E00F0001E00F0001E00F0001E01E0003C01E0003C01E0003C01E0003803C00078 +03C0007003C000F003C000E0078001C0078003800780070007801C000F007800FFFFC000 +1F1C7E9B22>68 D<01FFFFF0003E00F0003C0030003C0020003C0020003C002000780020 +00780020007808200078080000F0100000F0100000F0300000FFF00001E0200001E02000 +01E0200001E0200003C0400003C0000003C0000003C00000078000000780000007800000 +078000000F800000FFF800001C1C7E9B1B>70 D<01FFE0003E00003C00003C00003C0000 +3C0000780000780000780000780000F00000F00000F00000F00001E00001E00001E00001 +E00003C00003C00003C00003C0000780000780000780000780000F8000FFF000131C7F9B +12>73 D<001FFE0001F00001E00001E00001E00001E00003C00003C00003C00003C00007 +80000780000780000780000F00000F00000F00000F00001E00001E00001E00781E00783C +00F83C00F83800E0780040F00061C0001F0000171D7E9B17>I<01FFFE00003E03C0003C +00E0003C00F0003C0070003C0070007800F0007800F0007800F0007801E000F001C000F0 +078000F01E0000FFF00001E03C0001E00E0001E00F0001E00F0003C00F0003C00F0003C0 +0F0003C00F0007801E0007801E0807801E0807801E100F800E10FFF00E20000003C01D1D +7E9B20>82 D<000FC100383300600F00C006018006038006038006070004070004078000 +07800007E00007FC0003FF8001FFC000FFE0001FF00001F00000F00000F0000070200070 +2000706000E06000E06001C0600180F00300CC0E0083F800181E7E9C19>I<FFE00FF01E +0003801E0003001E0002001E0002001E0004001F0008001F0008000F0010000F0030000F +0020000F0040000F0040000F0080000F8100000F81000007820000078400000784000007 +880000078800000790000007E0000003E0000003C0000003800000038000000300000003 +0000001C1D7D9B18>86 D<FFE1FFC0FF3E003C003C1E003C00101E003C00301E003C0020 +1E003C00401E003C00401E007C00801E007C00801E00BC01001E013C03001E013C02001E +023E04001F021E04000F041E08000F0C1E08000F081E10000F101E20000F101E20000F20 +1E40000F201E40000F401E80000F801E80000F801F00000F001E00000F001E00000E000C +000006000C00000400080000281D7D9B27>I<01FFE0FF80001F003C00001F003000001F +002000000F004000000F808000000781000000078200000007C400000003C800000003F8 +00000001F000000001E000000001F000000000F000000001F80000000278000000047800 +0000087C000000103C000000203E000000403E000000801E000001801F000003000F0000 +06000F00001E001F8000FF807FF000211C7F9B22>I<FFF007F80F8001E00F0001800F80 +0100078002000780040007C0080003C0180003C0100003E0200001E0400001F0800001F1 +000000F2000000FE000000FC0000007800000078000000F0000000F0000000F0000000F0 +000001E0000001E0000001E0000001E0000003C000003FFC00001D1C7F9B18>I<00F180 +030B800E07801C07803C0700380700780700780700F00E00F00E00F00E00F00E00F01C40 +E01C40701C40703C4030CC800F070012127F9116>97 D<3F00070007000E000E000E000E +001C001C001C001C0039E03A383C18381C701C701E701E701EE03CE03CE03CE038E078E0 +70E0E060C023801E000F1D7E9C12>I<0003F00000700000700000E00000E00000E00000 +E00001C00001C00001C00001C000F380030B800E07801C07803C07003807007807007807 +00F00E00F00E00F00E00F00E00F01C40E01C40701C40703C4030CC800F0700141D7F9C16 +>100 D<00F803840E041C023C04380478187FE0F000F000F000F000F000700270043008 +18300FC00F127F9113>I<01C003C003C001800000000000000000000000001C00270047 +004700870087000E000E001C001C001C003800388038807080710032001C000A1C7E9B0E +>105 D<0007000F000F00060000000000000000000000000078009C010C020C021C041C +001C001C0038003800380038007000700070007000E000E000E000E001C061C0F180F300 +E6007C001024809B11>I<0FC00001C00001C00003800003800003800003800007000007 +00000700000700000E07000E08800E11C00E23C01C47801C83001D00001E00003FC00038 +E000387000387000707100707100707100707200E03200601C00121D7E9C16>I<1F8003 +80038007000700070007000E000E000E000E001C001C001C001C00380038003800380070 +00700070007000E200E200E200E40064003800091D7F9C0C>I<381F81F04E20C6184640 +E81C4680F01C8F00F01C8E00E01C0E00E01C0E00E01C1C01C0381C01C0381C01C0381C01 +C0703803807138038071380380E1380380E2700700643003003820127E9124>I<3C1F00 +4E61804681C04701C08F01C08E01C00E01C00E01C01C03801C03801C03801C0700380710 +380710380E10380E2070064030038014127E9119>I<0783C009CC6008D03008E03811C0 +3811C03801C03C01C03C0380780380780380780380700700F00700E00701C00783800EC7 +000E3C000E00000E00001C00001C00001C00001C00003C0000FF0000161A819115>112 +D<01E107130E0F1C0F3C0E380E780E780EF01CF01CF01CF01CF038E038E038707831F01E +700070007000E000E000E000E001C00FF8101A7F9113>I<3C3C4E424687470F8E1E8E0C +0E000E001C001C001C001C0038003800380038007000300010127E9113>I<01F0060C0C +040C0E180C1C001F000FE00FF003F80038201C7018F018F010803060601F800F127E9113 +>I<1C00C02701C04701C04701C08703808703800E03800E03801C07001C07001C07001C +0700180E20180E20180E201C1E200C264007C38013127E9118>117 +D<1C06270F470F470F870387030E010E011C021C021C021C041804180818081C100C2007 +C010127E9114>I<1C00C1802701C3C04701C3C04701C3C0870380C0870380C00E038040 +0E0380401C0700801C0700801C0700801C07010018060100180601001C0E02001C0F0400 +0E13080003E1F0001A127E911E>I<07878008C84010F0C020F1E020E3C040E18000E000 +00E00001C00001C00001C00001C000638080F38080F38100E5810084C60078780013127E +9118>I<1C00C02701C04701C04701C08703808703800E03800E03801C07001C07001C07 +001C0700180E00180E00180E001C1E000C3C0007DC00001C00001800603800F03000F060 +00E0C0004180003E0000121A7E9114>I<1C00270047004700870087000E000E001C001C +001C003800388038807080710032001C0009127E910D>123 D E +/Fs 23 121 df<FFFFFF80FFFFFF8019027D8A20>0 D<70F8F8F87005057D8C0C>I<C000 +60E000E07001C03803801C07000E0E00071C0003B80001F00000E00000E00001F00003B8 +00071C000E0E001C07003803807001C0E000E0C0006013147A9320>I<003F800000C060 +000300180004000400080002001400050022000880210010804080204040404040802080 +2080110020800A00208004002080040020800A0020801100208020802040404040408020 +4021001080220008801400050008000200040004000300180000C06000003F80001B1C7E +9720>10 D<07E01FF8381C700E6006E007C003C003C003C003E0076006700E381C1FF807 +E010107E9115>14 D<FFFFFFE0FFFFFFE000000000000000000000000000000000000000 +00000000000000000000000000FFFFFFE0FFFFFFE0000000000000000000000000000000 +0000000000000000000000000000000000FFFFFFE0FFFFFFE01B167E9420>17 +D<000001800000078000001E00000078000001E00000078000000E0000003C000000F000 +0003C000000F0000003C000000F0000000F00000003C0000000F00000003C0000000F000 +0000380000001E0000000780000001E0000000780000001E000000078000000180000000 +0000000000000000000000000000000000000000000000000000000000FFFFFF80FFFFFF +8019247D9920>20 D<C0000000F00000003C0000000F00000003C0000000F00000003800 +00001E0000000780000001E0000000780000001E00000007800000078000001E00000078 +000001E00000078000000E0000003C000000F0000003C000000F0000003C000000F00000 +00C000000000000000000000000000000000000000000000000000000000000000000000 +00FFFFFF80FFFFFF8019247D9920>I<0F8000201FE000203FF0002070780060601E0060 +C00F00C0C007C1C08001FF808000FF0080003E000F8000201FE000203FF0002070780060 +601E0060C00F00C0C007C1C08001FF808000FF0080003E001B147E9320>25 +D<000007003800000E007000003C01E00000F007800001C00E000007803C00001E00F000 +003801C00000F007800001C00E000007803C00001E00F000003801C00000F007800000F0 +078000003801C000001E00F0000007803C000001C00E000000F0078000003801C000001E +00F0000007803C000001C00E000000F0078000003C01E000000E00700000070038251C7E +972A>28 D<00000030000000001800000000180000000018000000000C000000000C0000 +000006000000000300000000038000000000C0FFFFFFFFF8FFFFFFFFF800000000C00000 +000380000000030000000006000000000C000000000C0000000018000000001800000000 +1800000000300025167E942A>33 D<007FF801FFF80780000E00001C0000380000300000 +700000600000E00000C00000C00000FFFFF8FFFFF8C00000C00000E00000600000700000 +3000003800001C00000E000007800001FFF8007FF8151A7D961C>50 +D<0000600000600000E00000C00001C0000180000380000300000700000600000600000E +00000C00001C0000180000380000300000700000600000E00000C00000C00001C0000180 +000380000300000700000600000E00000C00000C00001C00001800003800003000007000 +00600000E00000C00000C0000013287A9D00>54 D<0000F8001E037C00230C3C0041903E +0081E01E0081E01F0081E00F00C1E00F8061E0078031E007C019E003C009F001E005F001 +C005F0070005FFF80005F0F0008DF0F00089F0F00089F0F00071F0F00001E0F00001E0F0 +0001E0780001E0780001E0780061E0F000C1C0F00041C078402180798011803E000E001C +001B1F7E9D1E>60 D<0001FC000007FF0000183F8000300F800070078000E0078000E007 +0001E0040001E0000001F0000001F8000000FC0000007E0000003F8000001FE0000007F0 +000001F8000000FC000C007C0038003C0070003C0070003C00F0003800F0003800F80070 +00F80060007C00C0007F0300003FFC00000FF00000191E7F9C19>83 +D<C00006C00006C00006C00006C00006C00006C00006C00006C00006C00006C00006C000 +06C00006C00006C00006C00006C00006C00006C00006E0000E60000C70001C3800381F01 +F007FFC000FE00171A7E981C>91 D<FFC0FFC0C000C000C000C000C000C000C000C000C0 +00C000C000C000C000C000C000C000C000C000C000C000C000C000C000C000C000C000C0 +00C000C000C000C000C000C000C000C000C000C000C000C000C0000A2A7A9E12>100 +D<FFC0FFC000C000C000C000C000C000C000C000C000C000C000C000C000C000C000C000 +C000C000C000C000C000C000C000C000C000C000C000C000C000C000C000C000C000C000 +C000C000C000C000C000C000C00A2A7F9E12>I<003C00E001C001800380038003800380 +038003800380038003800380038003800380030007001C00F0001C000700030003800380 +03800380038003800380038003800380038003800380018001C000E0003C0E297D9E15> +I<F0001C0007000300038003800380038003800380038003800380038003800380038001 +8001C000E0003C00E001C001800380038003800380038003800380038003800380038003 +800380030007001C00F0000E297D9E15>I<C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C002297B9E0C>106 +D<C030C030C030C030C030C030C030C030C030C030C030C030C030C030C030C030C030C0 +30C030C030C030C030C030C030C030C030C030C030C030C030C030C030C030C030C030C0 +30C030C030C030C030C030C0300C2A7C9E15>I<1F00308070406060E0E0E0E0E040E000 +60007000300018001C003300718061C0E0C0E0E0E0E0E0E060E070C031C0198007000300 +018001C000C000E040E0E0E0E0E0C0C041C021801F000B257D9C12>120 +D E /Ft 84 127 df<007E1F0001C1B1800303E3C00703C3C00E03C1800E01C0000E01C0 +000E01C0000E01C0000E01C0000E01C000FFFFFC000E01C0000E01C0000E01C0000E01C0 +000E01C0000E01C0000E01C0000E01C0000E01C0000E01C0000E01C0000E01C0000E01C0 +000E01C0000E01C0000E01C0007F87FC001A1D809C18>11 D<007E0001C1800301800703 +C00E03C00E01800E00000E00000E00000E00000E0000FFFFC00E01C00E01C00E01C00E01 +C00E01C00E01C00E01C00E01C00E01C00E01C00E01C00E01C00E01C00E01C00E01C00E01 +C07F87F8151D809C17>I<007FC001C1C00303C00703C00E01C00E01C00E01C00E01C00E +01C00E01C00E01C0FFFFC00E01C00E01C00E01C00E01C00E01C00E01C00E01C00E01C00E +01C00E01C00E01C00E01C00E01C00E01C00E01C00E01C07FCFF8151D809C17>I<003F07 +E00001C09C18000380F018000701F03C000E01E03C000E00E018000E00E000000E00E000 +000E00E000000E00E000000E00E00000FFFFFFFC000E00E01C000E00E01C000E00E01C00 +0E00E01C000E00E01C000E00E01C000E00E01C000E00E01C000E00E01C000E00E01C000E +00E01C000E00E01C000E00E01C000E00E01C000E00E01C000E00E01C007FC7FCFF80211D +809C23>I<7070F8F8FCFCFCFC7474040404040404080808081010202040400E0D7F9C15> +34 D<0F0000C0188001C030600380703807806027FF00E0100600E0100E00E0101C00E0 +101800E0103800E0103000E01070006020E0007020C0003041C000188380000F0303C000 +070620000E0C10000C1C08001C18080038380400303804007038040060380400E0380401 +C03804018038040380180807001C0806000C100E0006200C0003C01E217E9E23>37 +D<70F8FCFC740404040808102040060D7D9C0C>39 D<00800100020006000C000C001800 +18003000300030006000600060006000E000E000E000E000E000E000E000E000E000E000 +E000E0006000600060006000300030003000180018000C000C000600020001000080092A +7C9E10>I<8000400020003000180018000C000C00060006000600030003000300030003 +800380038003800380038003800380038003800380038003000300030003000600060006 +000C000C00180018003000200040008000092A7E9E10>I<000600000006000000060000 +000600000006000000060000000600000006000000060000000600000006000000060000 +00060000FFFFFFE0FFFFFFE0000600000006000000060000000600000006000000060000 +000600000006000000060000000600000006000000060000000600001B1C7E9720>43 +D<70F0F8F8780808081010202040050D7D840C>I<FFE0FFE00B0280890E>I<70F8F8F870 +05057D840C>I<03C00C301818381C300C700E700E700EF00FF00FF00FF00FF00FF00FF0 +0FF00FF00FF00FF00FF00FF00F700E700E700E300C381C18180C3007E0101D7E9B15>48 +D<010007003F00C700070007000700070007000700070007000700070007000700070007 +00070007000700070007000700070007000700FFF80D1C7C9B15>I<07C01830201C401C +400EF00FF80FF80FF80F700F000F001E001E001C00380030007000C00180010002000401 +0801100130023FFE7FFEFFFE101C7E9B15>I<07E01870203C201C781E781E781E381E00 +1C001C00380030006007C00030001C001C000E000F000F700FF80FF80FF80FF00E401C20 +1C183007C0101D7E9B15>I<000C00000C00001C00003C00003C00005C0000DC00009C00 +011C00031C00021C00041C000C1C00081C00101C00301C00201C00401C00C01C00FFFFC0 +001C00001C00001C00001C00001C00001C00001C0001FFC0121C7F9B15>I<300C3FF83F +F03FC020002000200020002000200023E02C303018301C200E000E000F000F000F600FF0 +0FF00FF00F800E401E401C2038187007C0101D7E9B15>I<00F0030C06040C0E181E381E +380C700070007000F3E0F430F818F81CF80EF00EF00FF00FF00FF00FF00F700F700F700E +380E381C18180C3003E0101D7E9B15>I<4000007FFF807FFF007FFF0040020080040080 +040080080000100000100000200000600000400000C00000C00001C00001800001800003 +8000038000038000038000078000078000078000078000078000078000030000111D7E9B +15>I<03E00C301008200C200660066006700670067C0C3E183FB01FE007F007F818FC30 +7E601E600FC007C003C003C003C00360026004300C1C1007E0101D7E9B15>I<03C00C30 +1818381C700C700EF00EF00EF00FF00FF00FF00FF00F700F701F381F181F0C2F07CF000E +000E000E301C781C78187038207010C00F80101D7E9B15>I<70F8F8F870000000000000 +000070F8F8F87005127D910C>I<70F8F8F870000000000000000070F0F8F87808080810 +10202040051A7D910C>I<FFFFFFE0FFFFFFE00000000000000000000000000000000000 +000000000000000000000000000000FFFFFFE0FFFFFFE01B0C7E8F20>61 +D<000600000006000000060000000F0000000F0000000F000000178000001780000037C0 +000023C0000023C0000043E0000041E0000041E0000080F0000080F0000080F000010078 +000100780001FFF80002003C0002003C0002003C0004001E0004001E000C001F000C000F +001E001F00FF00FFF01C1D7F9C1F>65 D<FFFFC0000F0078000F003C000F001E000F000E +000F000F000F000F000F000F000F000F000F000E000F001E000F003C000F00F8000FFFF0 +000F003C000F001E000F000F000F0007000F0007800F0007800F0007800F0007800F0007 +800F000F000F000F000F001E000F007800FFFFE000191C7F9B1D>I<001F808000E06180 +01801980070007800E0003801C0003801C00018038000180780000807800008070000080 +F0000000F0000000F0000000F0000000F0000000F0000000F0000000F000000070000080 +7800008078000080380000801C0001001C0001000E000200070004000180080000E03000 +001FC000191E7E9C1E>I<FFFFC0000F00F0000F003C000F000E000F0007000F0007000F +0003800F0003C00F0001C00F0001C00F0001E00F0001E00F0001E00F0001E00F0001E00F +0001E00F0001E00F0001E00F0001C00F0001C00F0003C00F0003800F0007800F0007000F +000E000F001C000F007000FFFFC0001B1C7E9B20>I<FFFFFC0F003C0F000C0F00040F00 +040F00060F00020F00020F01020F01000F01000F01000F03000FFF000F03000F01000F01 +000F01000F01010F00010F00020F00020F00020F00060F00060F000C0F003CFFFFFC181C +7E9B1C>I<FFFFF80F00780F00180F00080F00080F000C0F00040F00040F01040F01000F +01000F01000F03000FFF000F03000F01000F01000F01000F01000F00000F00000F00000F +00000F00000F00000F00000F0000FFF800161C7E9B1B>I<001F808000E0618001801980 +070007800E0003801C0003801C00018038000180780000807800008070000080F0000000 +F0000000F0000000F0000000F0000000F0000000F000FFF0F0000F807000078078000780 +78000780380007801C0007801C0007800E00078007000B800180118000E06080001F8000 +1C1E7E9C21>I<FFF0FFF00F000F000F000F000F000F000F000F000F000F000F000F000F +000F000F000F000F000F000F000F000F000F000F000F000FFFFF000F000F000F000F000F +000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F +000F000F000F00FFF0FFF01C1C7F9B1F>I<FFF00F000F000F000F000F000F000F000F00 +0F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F00 +FFF00C1C7F9B0F>I<FFF01FE00F0007800F0006000F0004000F0008000F0010000F0020 +000F0040000F0080000F0100000F0200000F0600000F0F00000F1780000F2780000F43C0 +000F81E0000F01E0000F00F0000F0078000F0078000F003C000F003E000F001E000F000F +000F000F800F000FC0FFF03FF01C1C7F9B20>75 D<FFF8000F80000F00000F00000F0000 +0F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F0000 +0F00000F00080F00080F00080F00180F00180F00100F00300F00700F01F0FFFFF0151C7E +9B1A>I<FF8000FF800F8000F8000F8000F8000BC00178000BC00178000BC001780009E0 +02780009E002780008F004780008F004780008F004780008780878000878087800087808 +7800083C107800083C107800083C107800081E207800081E207800081E207800080F4078 +00080F40780008078078000807807800080780780008030078001C03007800FF8307FF80 +211C7E9B26>I<FF001FF00F8003800FC001000BC0010009E0010008F0010008F0010008 +780100083C0100083E0100081E0100080F0100080F8100080781000803C1000801E10008 +01F1000800F1000800790008007D0008003D0008001F0008001F0008000F000800070008 +0003001C000300FF8001001C1C7F9B1F>I<003F800000E0E0000380380007001C000E00 +0E001C0007003C00078038000380780003C0780003C0700001C0F00001E0F00001E0F000 +01E0F00001E0F00001E0F00001E0F00001E0F00001E0700001C0780003C0780003C03800 +03803C0007801C0007000E000E0007001C000380380000E0E000003F80001B1E7E9C20> +I<FFFF800F00E00F00780F003C0F001C0F001E0F001E0F001E0F001E0F001E0F001C0F00 +3C0F00780F00E00FFF800F00000F00000F00000F00000F00000F00000F00000F00000F00 +000F00000F00000F0000FFF000171C7E9B1C>I<FFFF00000F01E0000F0078000F003C00 +0F001C000F001E000F001E000F001E000F001E000F001C000F003C000F0078000F01E000 +0FFF00000F01E0000F0070000F0078000F003C000F003C000F003C000F003C000F003C00 +0F003C000F003C100F003C100F001C100F001C10FFF00E20000003C01C1D7E9B1F>82 +D<07E0801C1980300580300380600180E00180E00080E00080E00080F00000F800007C00 +007FC0003FF8001FFE0007FF0000FF80000F800007C00003C00001C08001C08001C08001 +C0C00180C00180E00300D00200CC0C0083F800121E7E9C17>I<7FFFFFC0700F01C0600F +00C0400F0040400F0040C00F0020800F0020800F0020800F0020000F0000000F0000000F +0000000F0000000F0000000F0000000F0000000F0000000F0000000F0000000F0000000F +0000000F0000000F0000000F0000000F0000000F0000001F800003FFFC001B1C7F9B1E> +I<FFF01FF00F0003800F0001000F0001000F0001000F0001000F0001000F0001000F0001 +000F0001000F0001000F0001000F0001000F0001000F0001000F0001000F0001000F0001 +000F0001000F0001000F0001000F00010007000200078002000380040001C0040000E018 +0000706000000F80001C1D7F9B1F>I<FFE00FF01F0003C01F0001800F0001000F000100 +078002000780020007C0020003C0040003C0040003E00C0001E0080001E0080000F01000 +00F0100000F810000078200000782000003C4000003C4000003C4000001E8000001E8000 +001F8000000F0000000F00000006000000060000000600001C1D7F9B1F>I<FFE1FFC0FF +1F003E003C1E003C00180F001E00100F001E00100F001E001007801F002007801F002007 +801F002003C027804003C027804003C027804001E043C08001E043C08001E043C08000F0 +81E10000F081E10000F081E10000F900F300007900F200007900F200007E007E00003E00 +7C00003E007C00003C003C00001C003800001C00380000180018000008001000281D7F9B +2B>I<FFF07FC00FC01E0007800C0007C0080003C0100001E0200001F0200000F0400000 +788000007C8000003D0000003E0000001F0000000F0000000F8000000F80000013C00000 +23E0000021E0000040F0000080F8000080780001007C0002003E0002001E0006001F001F +001F80FF807FF01C1C7F9B1F>I<FFF003FC0F8001E0078000C007C0008003C0010003E0 +030001E0020000F0040000F8040000780800007C1800003C1000003E2000001F2000000F +4000000FC000000780000007800000078000000780000007800000078000000780000007 +8000000780000007800000078000007FF8001E1C809B1F>I<7FFFF07C01F07001E06003 +C06003C0400780400F80400F00401E00001E00003C00007C0000780000F00000F00001E0 +0003E00003C0100780100780100F00101F00301E00203C00203C00607800E0F803E0FFFF +E0141C7E9B19>I<FEFEC0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0 +C0C0C0C0C0C0C0C0C0C0C0FEFE07297C9E0C>I<08081010202040404040808080808080 +B8B8FCFCFCFC7C7C38380E0D7B9C15>I<FEFE0606060606060606060606060606060606 +0606060606060606060606060606060606060606FEFE0729809E0C>I<0C001E00330061 +8080400A057B9B15>I<0810204040808080B8FCFC7C38060D7E9C0C>96 +D<0FE0001838003C1C003C0E00180E00000E00000E0001FE000F8E003C0E00780E00700E +00F00E20F00E20F00E20701E203827400FC38013127F9115>I<FC00001C00001C00001C +00001C00001C00001C00001C00001C00001C00001C00001C7C001D87001E03801C01C01C +01E01C00E01C00F01C00F01C00F01C00F01C00F01C00F01C00E01C01E01C01C01E038019 +070010FC00141D7F9C17>I<03F80E0C1C1E381E780C7000F000F000F000F000F000F000 +7000780238021C040E1803E00F127F9112>I<001F800003800003800003800003800003 +8000038000038000038000038000038003F3800E0B801C0780380380780380700380F003 +80F00380F00380F00380F00380F003807003807803803803801C07800E1B8003E3F0141D +7F9C17>I<07E00C301818381C701E700EF00EFFFEF000F000F000F00070007002380218 +040E1803E00F127F9112>I<00F8018C071E061E0E0C0E000E000E000E000E000E00FFE0 +0E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E007FE00F1D +809C0D>I<00038007E4C00C38C0381C80381C00781E00781E00781E00781E00381C0038 +1C001C300037E0002000003000003000003FF8001FFF001FFF803003806001C0C000C0C0 +00C0C000C06001803003001C0E0007F800121C7F9215>I<FC00001C00001C00001C0000 +1C00001C00001C00001C00001C00001C00001C00001C7C001C87001D03001E03801C0380 +1C03801C03801C03801C03801C03801C03801C03801C03801C03801C03801C03801C0380 +FF9FF0141D7F9C17>I<38007C007C007C003800000000000000000000000000FC001C00 +1C001C001C001C001C001C001C001C001C001C001C001C001C001C001C00FF80091D7F9C +0C>I<01C003E003E003E001C000000000000000000000000007E000E000E000E000E000 +E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E060E0F0C0F1 +C061803E000B25839C0D>I<FC00001C00001C00001C00001C00001C00001C00001C0000 +1C00001C00001C00001C0FE01C07801C06001C0C001C10001C20001C40001CE0001DE000 +1E70001C78001C38001C3C001C1C001C0E001C0F001C0F80FF9FE0131D7F9C16>I<FC00 +1C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C00 +1C001C001C001C001C001C001C001C001C00FF80091D7F9C0C>I<FC7E07E0001C838838 +001D019018001E01E01C001C01C01C001C01C01C001C01C01C001C01C01C001C01C01C00 +1C01C01C001C01C01C001C01C01C001C01C01C001C01C01C001C01C01C001C01C01C001C +01C01C00FF8FF8FF8021127F9124>I<FC7C001C87001D03001E03801C03801C03801C03 +801C03801C03801C03801C03801C03801C03801C03801C03801C03801C0380FF9FF01412 +7F9117>I<03F0000E1C00180600380700700380700380F003C0F003C0F003C0F003C0F0 +03C0F003C07003807003803807001C0E000E1C0003F00012127F9115>I<FC7C001D8700 +1E03801C01C01C01E01C00E01C00F01C00F01C00F01C00F01C00F01C00F01C01E01C01E0 +1C01C01E03801D07001CFC001C00001C00001C00001C00001C00001C00001C0000FF8000 +141A7F9117>I<03E0800E19801C0580380780780380780380F00380F00380F00380F003 +80F00380F003807003807803803807801C07800E1B8003E3800003800003800003800003 +80000380000380000380001FF0141A7F9116>I<FCE01D381E781E781C301C001C001C00 +1C001C001C001C001C001C001C001C001C00FFC00D127F9110>I<1F9020704030C010C0 +10E010F8007F803FE00FF000F880388018C018C018E010D0608FC00D127F9110>I<0400 +0400040004000C000C001C003C00FFE01C001C001C001C001C001C001C001C001C001C10 +1C101C101C101C100C100E2003C00C1A7F9910>I<FC1F801C03801C03801C03801C0380 +1C03801C03801C03801C03801C03801C03801C03801C03801C03801C07800C07800E1B80 +03E3F014127F9117>I<FF07E03C03801C01001C01000E02000E02000F06000704000704 +0003880003880003C80001D00001D00000E00000E00000E00000400013127F9116>I<FF +3FC7E03C0703C01C0701801C0701001C0B01000E0B82000E0B82000E1182000711C40007 +11C4000720C40003A0E80003A0E80003C0680001C0700001C0700001803000008020001B +127F911E>I<FF0FE01E07001C06000E040007080003900003B00001E00000E00000F000 +01F000013800021C00041C000C0E001807003C0780FE1FF014127F9116>I<FF07E03C03 +801C01001C01000E02000E02000F060007040007040003880003880003C80001D00001D0 +0000E00000E00000E000004000004000008000008000F08000F10000F300006600003800 +00131A7F9116>I<7FFC70386038407040F040E041C003C0038007000F040E041C043C0C +380870087038FFF80E127F9112>I<FFFFF01401808B15>I<FFFFFFFFFF802901808B2A> +I<1C043F0843F080E00E047D9B15>126 D E /Fu 1 2 df<387CFEFEFE7C3807077B9111 +>1 D E /Fv 36 122 df<E0E0E060404040C003087C990B>39 D<E0E0E003037C820B> +46 D<07E00FF01FF83C3C781E700E700EE007E007E007E007E007E007E007E007E007E0 +07E007E007700E700E781E3C3C1FF80FF007E0101A7F9813>48 D<01000700FF00FF0007 +000700070007000700070007000700070007000700070007000700070007000700070007 +007FF07FF00C197D9813>I<07C01FF03878703CE01CE01E401E400E000E000E001E001C +003C0038007000F001E003C0078007000E001C0038007FFE7FFE0F197F9813>I<07E01F +F83C3C701C201E200E001E001E001C003C007807F007E007F8003C001E000E000F000F00 +0F800FC00E601E383C1FF807E0101A7F9813>I<007800F800B801B801B8033807380738 +0E380E381C381C38383878387038F038FFFFFFFF00380038003800380038003810187F97 +13>I<3FFC3FFC3800380038003800380038003BC03FF03FF83C3C383C381C001E001E00 +1E001E001E401EC03C603878781FE00FC00F197F9713>I<01F807FC0F041C0018003800 +7000700071F0E7F8EFFCFC1EF80EF00FE007E007E007E007600770077006300E381C1C38 +0FF003E0101A7F9813>I<FFFFFFFF0007000E001C00380078007000F000E001E001C003 +C003C007800780078007800F000F000F000F000F000F0010187F9713>I<07E01FF83C3C +381C700E700E700E700E700E381C1E780FF00FF01FF8381C700EE007E007E007E007E007 +700E700E3C3C1FF807E0101A7F9813>I<07E00FF01C38381C700C600EE00EE007E007E0 +07E007E007F00F701F783F3FF71FE70F86000E000E001C001C103830701FE00F80101A7F +9813>I<FFFC00FFFF00F00F80F003C0F001E0F000F0F00070F00078F00078F0003CF000 +3CF0003CF0003CF0003CF0003CF0003CF0003CF00038F00078F00078F000F0F001E0F003 +C0F00F80FFFF00FFFC00161A7D991C>68 D<007F0001FFE003C0F00F00701E00301C0000 +3C0000780000780000780000F00000F00000F00000F00000F00000F007F8F007F8F00038 +7800387800387800383C00381C00381E00380F003803C0F801FFE0007F80151C7E9A1A> +71 D<F00078F000F0F001E0F003C0F00780F00F00F01E00F03C00F07800F0F000F1E000 +F3F000F7F000FF7800FE7C00FC3C00F81E00F01E00F00F00F00F80F00780F003C0F003E0 +F001E0F000F0F000F8151A7D991B>75 D<F000F000F000F000F000F000F000F000F000F0 +00F000F000F000F000F000F000F000F000F000F000F000F000F000F000FFFEFFFE0F1A7D +9915>I<FC0007E0FC0007E0FC0007E0EE000DE0EE000DE0EF001DE0E70019E0E70019E0 +E78039E0E38031E0E3C071E0E3C071E0E1C061E0E1E0E1E0E1E0E1E0E0E0C1E0E0F1C1E0 +E07181E0E07181E0E07B81E0E03B01E0E03B01E0E01E01E0E01E01E0E01E01E0E00001E0 +1B1A7D9922>I<00FE0003FF8007FFC00F83E01F01F03E00F83C007878003C78003C7800 +3CF0001EF0001EF0001EF0001EF0001EF0001EF0001EF0001E78003C78003C78003C3C00 +783E00F81F01F00F83E007FFC003FF8000FE00171C7E9A1C>79 D<FFF800FFFE00F00F80 +F003C0F003C0F001E0F001E0F001E0F001E0F001E0F003C0F003C0F00F80FFFF00FFFC00 +F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000131A7D +9919>I<07F01FFC3C1E700E6006E000E000E000E000F00078007F003FE01FF807FC00FE +001E000F000F000700070007C007C00EE00C783C3FF007E0101C7E9A15>83 +D<FFFFFEFFFFFE003C00003C00003C00003C00003C00003C00003C00003C00003C00003C +00003C00003C00003C00003C00003C00003C00003C00003C00003C00003C00003C00003C +00003C00003C00171A7F991A>I<0FC03FF07FF87038401C001C001C01FC1FFC7FDCF01C +E01CE01CF07C7FFC3FDC1F1C0E117F9012>97 D<07E00FF81FFC3C1C70047000E000E000 +E000E000E000700070003C0C1FFC0FFC07F00E117F9011>99 D<000E000E000E000E000E +000E000E000E000E07CE1FEE3FFE7C1E700EF00EE00EE00EE00EE00EE00EF00E701E7C3E +3FFE1FEE078E0F1A7F9914>I<07C01FF03FF078387018E01CFFFCFFFCFFFCE000E00070 +0070003C0C3FFC1FFC07F00E117F9011>I<F0F0F0F00000000000007070707070707070 +707070707070707070041B7E9A0A>105 D<E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +E0E0E0E0E0E0E0E0031A7D990A>108 D<E3C0F0EFF3FCFFF7FCF87E1EF03C0EE0380EE0 +380EE0380EE0380EE0380EE0380EE0380EE0380EE0380EE0380EE0380EE0380E17117D90 +1E>I<E3C0EFF0FFF0F878F038E038E038E038E038E038E038E038E038E038E038E038E0 +380D117D9014>I<07E01FF83FFC3C3C700E700EE007E007E007E007E007F00F700E7C3E +3FFC1FF807E010117F9013>I<E3E0EFF0FFF8F87CE01CE01EE00EE00EE00EE00EE00EE0 +1CE03CF078FFF8EFF0E7C0E000E000E000E000E000E000E0000F187D9014>I<E1C0E7C0 +EFC0FE00F800F000F000E000E000E000E000E000E000E000E000E000E0000A117E900D> +114 D<1F803FE07FE0E060E000E000F8007F803FC00FE000F000708070E0F0FFE07FC01F +800C117F900F>I<3800380038003800FFC0FFC038003800380038003800380038003800 +38003800380038403FE01FE00F800B157F940E>I<700700780E00381C001C3C000E3800 +07700003E00003C00001C00003E0000770000E30000C38001C1C00380E00700700F00780 +1111809012>120 D<E00EE00E700E701C781C383838381C381C700C700E600E6006E006 +C003C0038003800380030003000600FE00FC00F8000F187F9012>I +E /Fw 47 122 df<018007800F001E003C00380078007000F000E000E000E000E000E000 +E000E000F0007000780038003C001E000F000780018009197B9612>40 +D<C000F00078003C001E000E000F00070007800380038003800380038003800380078007 +000F000E001E003C007800F000C00009197D9612>I<FFF8FFF8FFF80D037E8B12>45 +D<70F8F8F87005057A8412>I<07C00FE01C703838701C701CE00EE00EE00EE00EE00EE0 +0EE00EE01E701C701C38381C700FE007C00F147F9312>48 D<06000E000E003E00FE00EE +000E000E000E000E000E000E000E000E000E000E000E000E00FFE0FFE00B147D9312>I< +0F803FE070F0F078E038E038403800380078007000F001E003C007800F001E0038387038 +FFF8FFF80D147E9312>I<0FC03FF0783C701C701C001C003C007807F007F0003C001C00 +0E000EE00EE00EE01CF83C3FF00FC00F147F9312>I<7FF07FF070007000700070007000 +70007F807FE060F0007800384038E038E038E07070F03FC01F000D147E9312>53 +D<01F007F81E3C3C1C781C7000F000E7C0FFF0F83CF01CF01EE00EE00EF00E701E781C3C +3C1FF007C00F147F9312>I<E000FFFEFFFEE03CE078007000E001E001C003C003800780 +070007000F000E000E000E000E000E000E000F157F9412>I<0038007800F801E007C00F +801F003C00F800F000F8003C001F000F8007C001E000F8007800380D137E9312>60 +D<FFFEFFFEFFFE000000000000FFFEFFFEFFFE0F097F8E12>I<E000F000F8003C001F00 +0F8007C001E000F8007800F801E007C00F801F003C00F800F000E0000D137E9312>I<1F +C07FF0F078E038E07800F003E007800700070007000700000000000000000006000F000F +0006000D147E9312>I<03E00FF81E3C3C1C78FE71FEF39EE79EE70EE70EE70EE70EE79E +F39C71F878F03C001E0E0FFE03F80F147F9312>I<038007C007C006C006C00EE00EE00E +E00EE00C601C701C701C701FF01FF0383838383838FEFEFEFE0F147F9312>I<FFC0FFF0 +38783838381C381C381E380E380E380E380E380E380E380E381C381C38383878FFF0FFC0 +0F147F9312>68 D<FEFEFEFE3E383A383B383B383B383B383B383B3839B839B839B839B8 +39B839B838B838F8FEF8FEF80F147F9312>78 D<3FE07FF07070E038E038E038E038E038 +E038E038E038E038E038E038E038E038E03870707FF03FE00D147E9312>I<FF80FFE038 +F03878383838383838387838F03FE03FE038F0387038703870387038773877FE3FFE1C10 +147F9312>82 D<FCFCFCFC3C701CF01EE00FE00FC007C007800380078007C00FC00EE01E +E01C701C703838FEFEFEFE0F147F9312>88 D<FFC0FFC0E000E000E000E000E000E000E0 +00E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000FFC0FFC00A +1A7A9612>91 D<FFC0FFC001C001C001C001C001C001C001C001C001C001C001C001C001 +C001C001C001C001C001C001C001C001C001C0FFC0FFC00A1A7F9612>93 +D<1FC0003FF000383800101C00001C0007FC003FFC00781C00F01C00E01C00E01C00F03C +007FFF801FCF80110E7F8D12>97 D<FC00FC001C001C001C001C001DF01FF81F1E1E0E1C +0F1C071C071C071C071C0F1E0E1F1C1FF81DE01014809312>I<07F01FF838387010F000 +E000E000E000E000F000703838781FF007E00D0E7E8D12>I<01F801F800380038003800 +3807B81FF838787078F038E038E038E038E038F038707878F81FFF0FBF10147F9312>I< +07801FE038F07078F038E038FFF8FFF8E000F000703838781FF007C00D0E7E8D12>I<00 +7E01FF03C7038203800380FFFEFFFE03800380038003800380038003800380038003807F +FC7FFC1014809312>I<0F9E1FFF38E7707070707070707038E03FC07F8070003FE03FF8 +7FFCF01EE00EE00EE00EF01E783C3FF80FE010167F8D12>I<FC0000FC00001C00001C00 +001C00001C00001CF0001FF8001F1C001E1C001C1C001C1C001C1C001C1C001C1C001C1C +001C1C001C1C00FF9F80FF9F801114809312>I<06000F000F000600000000000000FF00 +FF000700070007000700070007000700070007000700FFF8FFF80D157D9412>I<FC0000 +FC00001C00001C00001C00001C00001DFF001DFF001C78001CF0001DE0001FC0001FE000 +1FE0001EF0001C78001C3C001C3C00FF3F80FF3F801114809312>107 +D<FF00FF0007000700070007000700070007000700070007000700070007000700070007 +00FFF8FFF80D147E9312>I<FB8E00FFFF803EFB803CF38038E38038E38038E38038E380 +38E38038E38038E38038E380FEFBE0FEFBE0130E818D12>I<FCF000FFF8001F1C001E1C +001C1C001C1C001C1C001C1C001C1C001C1C001C1C001C1C00FF9F80FF9F80110E808D12 +>I<0F803FE038E07070E038E038E038E038E038F078707038E03FE00F800D0E7E8D12>I< +FDF0FFF81F1E1E0E1C0F1C071C071C071C071C0F1E0E1F1C1FF81DE01C001C001C001C00 +1C00FF80FF801015808D12>I<FE3CFEFE0FCE0F840F000E000E000E000E000E000E000E +00FFF0FFF00F0E7F8D12>114 D<1FF07FF0E070C070E000FF003FE00FF00078E018E018 +F038FFF0DFC00D0E7E8D12>I<0E000E000E000E00FFF8FFF80E000E000E000E000E000E +000E000E1C0E1C0F3C07F801E00E127F9112>I<FCFC00FCFC001C1C001C1C001C1C001C +1C001C1C001C1C001C1C001C1C001C1C001C3C000FFF8007DF80110E808D12>I<FEFEFE +FE383838381C701C701C700EE00EE00EE00EE007C007C003800F0E7F8D12>I<FF7F80FF +7F80380E00380E00380E00180C001DDC001FFC001FFC001D5C001C5C000E78000E78000E +7800110E808D12>I<FCFEFCFE1CF00EE00FC007C00380078007C00EE01EF01C70FEFEFE +FE0F0E7F8D12>I<FEFEFEFE38381C381C701C700E700E600EE006E006E007C003C003C0 +03800380038077007F007E0038000F157F8D12>I E /Fx 34 122 +df<FFE0FFE0FFE00B0380880E>45 D<78FCFCFCFC7806067E850B>I<07F0001FFC003E3E +007C1F00780F00780F00F80F80F80F80F80F80F80F80F80F80F80F80F80F80F80F80F80F +80780F00780F007C1F003E3E001FFC0007F00011157F9414>48 D<01800780FF80FF8007 +8007800780078007800780078007800780078007800780078007800780FFF8FFF80D157D +9414>I<1FC07FF0FCF8FC7CFC7EFC3E783E007E007C007C00F801E001C0038006060C06 +180E3FFC7FFCFFFCFFFC0F157E9414>I<0FC01FF038F87C7C7C7C7C7C3CFC10F801F00F +E00FE000F8007C787EFC7EFC7EFC7EF87C70F83FF00FC00F157E9414>I<001C00003C00 +007C0000FC0001FC0001BC00033C00063C000E3C001C3C00383C00703C00E03C00FFFF80 +FFFF80003C00003C00003C00003C0003FF8003FF8011157F9414>I<700C7FFC7FF87FF0 +7FE07F006000600067E07FF07878603C003E003E783EF83EF83EF83C70783FF01FC00F15 +7E9414>I<03F00FF81E183C3C3C7C787C7838F800FBF0FFF8FC3CF83EF83EF83EF83E78 +3E783E783C3C381FF007E00F157E9414>I<60007FFF7FFF7FFE7FFCE018C030C0600060 +00C001C003C003800780078007800F800F800F800F800F80070010167E9514>I<07E01F +F03838701C701C781C7E1C7FB83FF01FF01FF83BFC70FEE07EE01EE00EE00EF00C781C3F +F00FE00F157E9414>I<0FC01FF03C78783CF83CF83CF83EF83EF83EF83E787E3FFE1FBE +003E383C7C3C7C3C787830F03FE00F800F157E9414>I<00060000000F0000000F000000 +1F8000001F8000003FC0000037C0000037C0000063E0000063E00000C3F00000C1F00001 +C1F8000180F8000180F80003FFFC0003FFFC0006003E0006003E000E003F000C001F00FF +80FFF0FF80FFF01C177F961F>65 D<FFFFC0FFFFF01F00FC1F007C1F007E1F007E1F007E +1F007E1F007C1F01F81FFFF01FFFF81F00FC1F007E1F003F1F003F1F003F1F003F1F003F +1F007E1F00FCFFFFF8FFFFE018177E961D>I<FFE0FFE01F001F001F001F001F001F001F +001F001F001F001F001F001F001F001F001F001F001F001F00FFE0FFE00B177E960F>73 +D<FF001FE0FF801FE01FC003001BE003001BF0030019F8030018FC0300187E0300183E03 +00181F0300180F8300180FC3001807E3001803F3001801FB001800FB0018007F0018003F +0018001F0018001F0018000F00FF000700FF0003001B177E9620>78 +D<07F0801FFF80380F80700380F00380F00180F00180F80000FF80007FF8003FFE001FFF +0007FF80007F80000FC00007C0C003C0C003C0C003C0E00780F80F00FFFE0087F8001217 +7E9617>83 D<FFE00FF0FFE00FF01F8001800F8003000FC0030007C0060007C0060003E0 +0C0003E00C0001F0180001F0180001F8380000F8300000FC7000007C6000007EE000003E +C000003FC000001F8000001F8000000F0000000F0000000600001C177F961F>86 +D<1FE0003FF8007C3C007C1E007C1E00101E0003FE001FDE007C1E00F81E00F81E00F81E +007C2E007FCFC01F87C0120F7F8E14>97 D<FC0000FC00003C00003C00003C00003C0000 +3C00003C00003CFC003FFF003F0F803C07C03C03C03C03E03C03E03C03E03C03E03C03E0 +3C03C03C07C03F0F803BFF0030FC0013177E9617>I<07F81FFC3E3E7C3E783EF808F800 +F800F800F80078007C063E0C1FF807F00F0F7F8E12>I<07F01FF83C1C781E780FF80FFF +FFFFFFF800F80078007C033E061FFC03F0100F7F8E13>101 D<00F807FC0F3E1E3E1E3E +1E1C1E001E00FFC0FFC01E001E001E001E001E001E001E001E001E001E001E007F807F80 +0F1780960C>I<0FE7001FFF80383B80783F00783C00783C00783C003838001FF0002FE0 +002000007000003FF8003FFE001FFF007FFF80E00780E00380E00380780F003FFE000FF8 +0011167F8E14>I<3C7E7E7E7E3C000000FCFC3C3C3C3C3C3C3C3C3C3C3CFFFF08187F97 +0B>105 D<FCFC3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C3CFFFF08177F960B>108 +D<FC7E0FC0FDFF3FE03F0FE1F03E07C0F03C0780F03C0780F03C0780F03C0780F03C0780 +F03C0780F03C0780F03C0780F03C0780F0FF1FE3FCFF1FE3FC1E0F7E8E23>I<FC7C00FD +FE003F0F003E0F003C0F003C0F003C0F003C0F003C0F003C0F003C0F003C0F003C0F00FF +3FC0FF3FC0120F7E8E17>I<07F0001FFC003C1E00780F00780F00F80F80F80F80F80F80 +F80F80F80F80780F00780F003C1E001FFC0007F000110F7F8E14>I<F8F0F9F83B7C3A7C +3E7C3C103C003C003C003C003C003C003C00FF80FF800E0F7F8E11>114 +D<1FF07FF06030E030E000FF007FC03FF00FF80078C038C038F070FFE0CFC00D0F7F8E10 +>I<0C000C000C001C001C003C00FFE0FFE03C003C003C003C003C003C003C003C303C30 +3C303C701FE00F800C157F9410>I<FC3F00FC3F003C0F003C0F003C0F003C0F003C0F00 +3C0F003C0F003C0F003C0F003C0F003C3F001FEFC00FCFC0120F7E8E17>I<FE07C0FE07 +C03C03001E06001E06000F0C000F0C000F9C0007980007F80003F00003F00001E00001E0 +0000C00070C000F98000F98000C700007E00003C000012157F8E15>121 +D E /Fy 10 108 df<FFFFF0FFFFF014027D881B>0 D<60F0F06004047D890A>I<003000 +003000003000003000003000003000003000003000003000003000003000FFFFFCFFFFFC +003000003000003000003000003000003000003000003000003000FFFFFCFFFFFC16187E +961B>6 D<00FC0007038008004010002028005024009044008842010881020480840480 +480480300480300480480480840481020442010844008824009028005010002008004007 +038000FC0016187E931B>10 D<0F803FE070706030E038C018C018C018C018E038603070 +703FE00F800D0E7E8E12>14 D<03000000030000000300000006000000060000000C0000 +001800000030000000FFFFFFF8FFFFFFF830000000180000000C00000006000000060000 +000300000003000000030000001D127D9023>32 D<00FF8003FF800F00001C0000380000 +700000600000600000E00000C00000FFFF80FFFF80C00000E00000600000600000700000 +3800001C00000F000003FF8000FF8011167D9218>50 D<000300070006000E000C001C00 +18003800300070006000E000C001C00180018003800300070006000E000C001C00180038 +00300070006000E000C000101E7B9600>54 D<0007F0001FF80060F800C07801C07003C0 +4003C00003E00003F00001FC0000FF00003F80000FC00007E00C03E03001E07001E0F001 +C0F00180F80300FE0E007FF8001FC0001517809615>83 D<C060C060C060C060C060C060 +C060C060C060C060C060C060C060C060C060C060C060C060C060C060C060C060C060C060 +C060C060C060C060C060C060C060C060C060C0600B227D9812>107 +D E /Fz 79 128 df<00FC000782000E07001C07001C02001C00001C00001C00001C0000 +FFFF001C07001C07001C07001C07001C07001C07001C07001C07001C07001C07001C0700 +1C07007F1FC01217809614>12 D<00FC7E000703C1000E0783801C0703801C0701001C07 +00001C0700001C0700001C070000FFFFFF801C0703801C0703801C0703801C0703801C07 +03801C0703801C0703801C0703801C0703801C0703801C0703801C0703807F1FCFE01B17 +80961D>14 D<FFF80D017E9212>22 D<1C00183200386180706161F0E09EE0E080C0E081 +C0E08180E08380E08700610600610E00321C001C18380038640070C20060C200E1C101C1 +C10181C10381C10301C10701C10E00C20C00C21C0064180038181B7E981D>37 +D<60F0F070101020204040040A7D960A>39 D<0102040C1818303070606060E0E0E0E0E0 +E0E0E0E0E060606070303018180C04020108227D980E>I<8040203018180C0C0E060606 +070707070707070707070606060E0C0C18183020408008227E980E>I<00300000300000 +3000003000003000003000003000003000003000003000003000FFFFFCFFFFFC00300000 +300000300000300000300000300000300000300000300000300000300016187E931B>43 +D<60F0F070101020204040040A7D830A>I<FF80FF80090280870C>I<60F0F06004047D83 +0A>I<0018001800380030003000700060006000E000C001C00180018003800300030007 +00060006000E000C000C001C001800380030003000700060006000E000C000C0000D217E +9812>I<07C018303018701C600C600CE00EE00EE00EE00EE00EE00EE00EE00EE00E600C +600C701C30181C7007C00F157F9412>I<06000E00FE000E000E000E000E000E000E000E +000E000E000E000E000E000E000E000E000E000E00FFE00B157D9412>I<0F8030E04070 +8070C038E038403800780070007000E000C00180030006000C08180810183FF07FF0FFF0 +0D157E9412>I<0FE030706038703C701C003C00380030006007C000700038001C001E00 +1EE01EE01EC01C403830700FC00F157F9412>I<00300030007000F001F0017002700470 +08701870107020704070C070FFFE0070007000700070007003FE0F157F9412>I<60307F +E07FC07F8040004000400040004F8070E040700030003800384038E038E0388030406020 +C01F000D157E9412>I<01F00608080C181C301C70006000E000E3E0EC30F018F00CE00E +E00EE00E600E600E300C3018183007C00F157F9412>I<40007FFE7FFC7FF8C008801080 +200040008000800100030003000200060006000E000E000E000E000E0004000F167E9512 +>I<07E018302018600C600C700C78183E101F6007C00FF018F8607C601EC00EC006C006 +C004600C38300FE00F157F9412>I<07C0183030186018E00CE00CE00EE00EE00E601E30 +1E186E0F8E000E000C001C70187018603020E01F800F157F9412>I<60F0F06000000000 +000060F0F060040E7D8D0A>I<60F0F06000000000000060F0F07010102020404004147D +8D0A>I<FFFFFCFFFFFC000000000000000000000000000000000000FFFFFCFFFFFC160A +7E8C1B>61 D<001000003800003800003800005C00005C00005C00008E00008E00008E00 +01070001070002038002038002038007FFC00401C00401C00800E00800E01800F03800F0 +FE03FE17177F961A>65 D<FFFE001C03801C01E01C00E01C00F01C00F01C00F01C00F01C +01E01C03C01FFF801FFFC01C01E01C00F01C00701C00781C00781C00781C00781C00F01C +00E01C03C0FFFF0015177F9619>I<00FC100383300600F01C00701C0030380030780010 +700010F00010F00000F00000F00000F00000F00000F000107000107800103800201C0020 +1C004006008003830000FC0014177E9619>I<FFFF001C03C01C00E01C00701C00381C00 +381C001C1C001C1C001E1C001E1C001E1C001E1C001E1C001E1C001E1C001C1C001C1C00 +3C1C00381C00701C00E01C03C0FFFF0017177F961B>I<FFFFE01C00E01C00601C00201C +00101C00101C00101C04001C04001C04001C0C001FFC001C0C001C04001C04081C04081C +00081C00181C00101C00101C00301C00F0FFFFF015177F9618>I<FFFFE01C00E01C0060 +1C00201C00101C00101C00101C04001C04001C04001C0C001FFC001C0C001C04001C0400 +1C04001C00001C00001C00001C00001C00001C0000FFC00014177F9617>I<007E080381 +980700780C00381C0018380018780008700008F00008F00000F00000F00000F00000F003 +FEF000387000387800383800381C00380C00380700380380D8007F0817177E961C>I<FF +83FE1C00701C00701C00701C00701C00701C00701C00701C00701C00701C00701FFFF01C +00701C00701C00701C00701C00701C00701C00701C00701C00701C0070FF83FE17177F96 +1A>I<FFE00E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E +000E000E000E000E000E00FFE00B177F960D>I<0FF800E000E000E000E000E000E000E0 +00E000E000E000E000E000E000E000E000E000E0E0E0E0E0C1C061801F000D177E9612> +I<FF80FE1C00781C00601C00401C00801C01001C06001C08001C10001C38001C78001C9C +001D0E001E0E001C07001C03801C01C01C01C01C00E01C00701C00781C007CFF80FF1817 +7F961B>I<FFC0001C00001C00001C00001C00001C00001C00001C00001C00001C00001C +00001C00001C00001C00001C00201C00201C00201C00601C00601C00401C00C01C03C0FF +FFC013177F9616>I<FE0003F81E0003C0170005C0170005C0170005C0138009C0138009 +C011C011C011C011C011C011C010E021C010E021C0107041C0107041C0107041C0103881 +C0103881C0101D01C0101D01C0100E01C0100E01C0380E01C0FE040FF81D177F9620>I< +FC00FE1E00381F001017001013801011C01011C01010E010107010103810103810101C10 +100E10100F101007101003901001D01001D01000F0100070100030380030FE001017177F +961A>I<00FC000387000E01C01C00E0380070380070780078700038F0003CF0003CF000 +3CF0003CF0003CF0003CF0003C7000387800783800703C00F01C00E00E01C003870000FC +0016177E961B>I<FFFE001C03801C01C01C00E01C00F01C00F01C00F01C00F01C00E01C +01C01C03801FFE001C00001C00001C00001C00001C00001C00001C00001C00001C00001C +0000FF800014177F9618>I<FFFC001C07801C01C01C00E01C00F01C00F01C00F01C00F0 +1C00E01C01C01C07801FFC001C06001C03001C01801C01C01C01C01C01E01C01E01C01E1 +1C01F11C00F2FF803C18177F961A>82 D<0FC4302C601C400CC004C004C004E00070007F +003FE00FF801FC001C000E0006800680068006C004E008D81087E00F177E9614>I<7FFF +F86038184038084038088038048038048038040038000038000038000038000038000038 +0000380000380000380000380000380000380000380000380000380003FF8016177F9619 +>I<FF80FE1C00381C00101C00101C00101C00101C00101C00101C00101C00101C00101C +00101C00101C00101C00101C00101C00101C00100E0020060020030040018180007E0017 +177F961A>I<FF007E3C00381C00101C00100E00200E00200F0060070040070040038080 +03808003C18001C10001C10000E20000E20000F200007400007400003800003800003800 +00100017177F961A>I<FF07FC3F803C00E00E001C00E004001C00E004001C017004000E +017008000E017008000E023808000702381000070238100007041C100003841C20000384 +1C200003880E200001C80E400001C80E400001D007400000F007800000F007800000F007 +800000E00380000060030000006003000021177F9624>I<FF803F801E001C000E000800 +07001000078030000380200001C0400001E0400000E0800000F1800000710000003A0000 +003E0000001C0000001C0000001C0000001C0000001C0000001C0000001C0000001C0000 +001C000000FF8000191780961A>89 D<FFFF80F00700C00700C00E00801E00801C008038 +0000780000700000E00000E00001C0000380000380000700800F00800E00801C01803C01 +00380100700300700F00FFFF0011177E9616>I<FCFCC0C0C0C0C0C0C0C0C0C0C0C0C0C0 +C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0FCFC06217D980A>I<FCFC0C0C0C0C0C0C0C0C0C0C +0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0CFCFC062180980A>93 +D<3FC0706070302038003803F81E3830387038E039E039E07970FF1F1E100E7F8D12>97 +D<F8000038000038000038000038000038000038000038000038000039F0003E0C003806 +00380700380300380380380380380380380380380300380700380600361C0021F0001117 +7F9614>I<07F01838303870106000E000E000E000E000600070083008183007C00D0E7F +8D10>I<003E00000E00000E00000E00000E00000E00000E00000E00000E0007CE001C3E +00300E00700E00600E00E00E00E00E00E00E00E00E00600E00700E00301E00182E0007CF +8011177F9614>I<0FC0186030307038E018FFF8E000E000E000600070083010183007C0 +0D0E7F8D10>I<03E006700E701C201C001C001C001C001C00FF801C001C001C001C001C +001C001C001C001C001C001C001C007F800C1780960B>I<0F9E18E33060707070707070 +306018C02F80200060003FE03FF83FFC600EC006C006C006600C38380FE010157F8D12> +I<F8000038000038000038000038000038000038000038000038000038F8003B1C003C0E +00380E00380E00380E00380E00380E00380E00380E00380E00380E00380E00FE3F801117 +7F9614>I<307878300000000000F8383838383838383838383838FE07177F960A>I<0300 +078007800300000000000000000000001F80038003800380038003800380038003800380 +0380038003800380038003804380E300E7007C00091D82960B>I<F80038003800380038 +003800380038003800383E383838303840388039803FC039E038E038F03878383C383CFE +7F10177F9613>I<F8383838383838383838383838383838383838383838FE07177F960A> +I<F8F83E003B1CC7003C0F0380380E0380380E0380380E0380380E0380380E0380380E03 +80380E0380380E0380380E0380380E0380FE3F8FE01B0E7F8D1E>I<F8F8003B1C003C0E +00380E00380E00380E00380E00380E00380E00380E00380E00380E00380E00FE3F80110E +7F8D14>I<07C018303018600C600CE00EE00EE00EE00EE00E701C3018183007C00F0E7F +8D12>I<F9F0003E1C003806003807003803003803803803803803803803803803003807 +00380E003E1C0039F000380000380000380000380000380000FE000011147F8D14>I<07 +C2001C2600381E00700E00600E00E00E00E00E00E00E00E00E00600E00700E00301E001C +2E0007CE00000E00000E00000E00000E00000E00003F8011147F8D13>I<F9E03A703C70 +3820380038003800380038003800380038003800FF000C0E7F8D0E>I<1F4060C0C040C0 +40E000FF007F801FC001E080608060C060E0C09F000B0E7F8D0E>I<0800080008001800 +18003800FFC0380038003800380038003800380038403840384038401C800F000A147F93 +0E>I<F83E00380E00380E00380E00380E00380E00380E00380E00380E00380E00380E00 +381E001C2E0007CF80110E7F8D14>I<FE1F380E3C0C1C081C080E100E100720072007E0 +03C003C001800180100E7F8D13>I<FEFE7C383838383810383C101C3C201C4C201E4E60 +0ECE400E8740078780070380070380030300020100160E7F8D19>I<FE3F3C1C1C100E20 +074007C0038001C002E004F008701838383CFC7F100E7F8D13>I<FE1F380E3C0C1C081C +080E100E100720072007E003C003C00180018001000100E200E200A400780010147F8D13 +>I<FFF0C0E080E081C08380878007000E001E081C08381870107030FFF00D0E7F8D10>I< +FFFF801101808812>I<60C0F1E0F1E060C00B047D9612>127 D E +/FA 54 122 df<0003C001F3C003F3C007F3C00700000E00000E00000E00000E00000E00 +000E00000E0000FFF1C0FFF1C0FFF1C00E01C00E01C00E01C00E01C00E01C00E01C00E01 +C00E01C00E01C00E01C00E01C00E01C00E01C00E01C00E01C0121E809D16>12 +D<7878787838307060E005097D9C0C>39 D<F0F0F0F004047C830C>46 +D<010007003F00FF00FF00C7000700070007000700070007000700070007000700070007 +000700070007000700070007000700FFF8FFF8FFF80D1C7C9B15>49 +D<07C01FF03FF8787C701EE00EE00F400F40070007000F000F000E001E001C0038007000 +E001C0038007000E001C0038007000FFFFFFFFFFFF101C7E9B15>I<07C01FF03FF8783C +E01E601E400E001E001E001C003C007807F007E007F8003C001E001E000F000F000F000F +800FC01EE01E783C3FF81FF007C0101D7E9B15>I<003C00007C00005C0000DC0001DC00 +019C00039C00039C00071C000F1C000E1C001E1C001C1C003C1C00781C00701C00F01C00 +FFFFC0FFFFC0FFFFC0001C00001C00001C00001C00001C00001C00001C00121B7F9A15> +I<3FFF003FFF003FFF0038000038000038000038000038000038000039F0003FF8003FFC +003F1E003C0F003C0F00380780000780000780000780000780000780400780600F00F00F +00783E003FFC001FF80007E000111C7F9A15>I<00F803FC07FC0F041C00380038007000 +700071F0E7F8EFFCFC3CF80EF00EF007E007E007E007E007E00770077007700E381E3C3C +1FF80FF003E0101D7E9B15>I<FFFFFFFFFFFF0007000E001C003C00380078007000F000 +E001E001C003C003C0038007800780078007800F000F000F000F000F000F00101B7E9A15 +>I<07E01FF83FFC781E700EE007E007E007E007E007700E3C3C1FF807E01FF83C3C700E +700EE007E007E007E007E007700E700E3C3C3FFC1FF807E0101D7E9B15>I<001C000000 +3E0000003E0000002E0000006700000067000000E7800000C7800000C3800001C3C00001 +83C0000181C0000381E0000301E0000700F0000700F0000600F0000E0078000FFFF8000F +FFF8001FFFFC001C003C0018003C0038001E0038001E0070001F0070000F0060000F00E0 +000780191D7F9C1C>65 D<003FC001FFF803FFF807C0780F00001E00003E00003C000078 +0000780000780000F00000F00000F00000F00000F00000F00000F00000F00000F0000078 +00007800007800003C00003E00001E00000F000807C07803FFF801FFF0003F80151F7D9D +1B>67 D<FFFC00FFFF00FFFF80F00FE0F003F0F000F0F00078F00078F0003CF0003CF000 +1CF0001EF0001EF0001EF0001EF0001EF0001EF0001EF0001EF0003CF0003CF0007CF000 +78F000F0F001F0F007E0FFFFC0FFFF00FFFC00171D7C9C1E>I<FFFFC0FFFFC0FFFFC0F0 +0000F00000F00000F00000F00000F00000F00000F00000F00000FFFF80FFFF80FFFF80F0 +0000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000FFFFC0FF +FFC0FFFFC0121D7C9C19>I<FFFF80FFFF80FFFF80F00000F00000F00000F00000F00000 +F00000F00000F00000F00000F00000FFFF00FFFF00FFFF00F00000F00000F00000F00000 +F00000F00000F00000F00000F00000F00000F00000F00000F00000111D7C9C18>I<003F +C000FFF803FFFC07E07C0F800C1F00001E00003C00003C0000780000780000F00000F000 +00F00000F00000F00000F00000F003FCF003FCF003FC78001C78001C3C001C3C001C1E00 +1C1F001C0F801C07E03C03FFFC00FFF8003FC0161F7E9D1C>I<F000F0F000F0F000F0F0 +00F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0FFFFF0FFFFF0FFFFF0F0 +00F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F000F0F0 +00F0F000F0141D7C9C1D>I<F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0 +F0F0F0F0F0041D7C9C0C>I<F0003CF00078F000F0F001E0F003C0F00780F00F00F01E00 +F03C00F07800F0F000F0E000F1F000F3F000F77800FE7C00FC3C00FC1E00F81F00F00F00 +F00F80F00780F003C0F003E0F001E0F000F0F000F0F00078F0007C161D7C9C1D>75 +D<F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F000F0 +00F000F000F000F000F000F000F000F000FFFFFFFFFFFF101D7D9C16>I<FC0007E0FC00 +07E0FC0007E0EE000DE0EE000DE0EE000DE0E70019E0E70019E0E70019E0E78039E0E380 +31E0E3C071E0E3C071E0E1C061E0E1C061E0E1E0E1E0E1E0E1E0E0E0C1E0E0F1C1E0E071 +81E0E07181E0E07181E0E03B01E0E03B01E0E03B01E0E01E01E0E01E01E0E01E01E0E000 +01E01B1D7C9C24>I<FC0070FC0070FE0070EE0070EF0070E70070E70070E78070E38070 +E3C070E3C070E1E070E1E070E0E070E0F070E07070E07870E07870E03C70E03C70E01C70 +E01E70E00E70E00E70E00F70E00770E007F0E003F0E003F0141D7C9C1D>I<003F000001 +FFE00003FFF00007C0F8000F807C001E001E003E001F003C000F00780007807800078078 +000780F00003C0F00003C0F00003C0F00003C0F00003C0F00003C0F00003C0F00003C0F8 +0007C078000780780007807C000F803C000F003E001F001F003E000F807C0007C0F80003 +FFF00001FFE000003F00001A1F7E9D1F>I<FFFC00FFFF00FFFF80F00FC0F003E0F001E0 +F000F0F000F0F000F0F000F0F000F0F001E0F003E0F00FC0FFFF80FFFF00FFFC00F00000 +F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000F00000141D7C +9C1B>I<FFF800FFFF00FFFF80F007C0F001E0F000E0F000F0F000F0F000F0F000F0F000 +E0F001E0F007C0FFFF80FFFF00FFF800F03C00F01C00F01E00F00F00F00F00F00780F007 +80F003C0F003C0F001E0F000F0F000F0F00078151D7C9C1B>82 D<03F8000FFE001FFF00 +3E0F00780300780000F00000F00000F00000F00000F800007C00007F00003FE0001FFC00 +07FE0001FF00001F800007800007C00003C00003C00003C00003C00003C0C00780E00780 +FC1F007FFE001FFC0007F000121F7E9D17>I<FFFFFF80FFFFFF80FFFFFF80001E000000 +1E0000001E0000001E0000001E0000001E0000001E0000001E0000001E0000001E000000 +1E0000001E0000001E0000001E0000001E0000001E0000001E0000001E0000001E000000 +1E0000001E0000001E0000001E0000001E0000001E0000001E0000191D7F9C1C>I<F000 +70F00070F00070F00070F00070F00070F00070F00070F00070F00070F00070F00070F000 +70F00070F00070F00070F00070F00070F00070F00070F00070F00070F000F07800E07801 +E03C03C01F07800FFF8007FE0001F800141E7C9C1D>I<F000F80070F000F80070F000F8 +00707800B8006078019C00E078019C00E078019C00E03C039C01C03C031E01C03C030E01 +C01E030E01801E070F03801E060F03801E060703800F060703000F0E0787000F0C078700 +070C038600070C038600079C03CE00079803CE00039801CC00039801CC00039801CC0001 +D000C80001D000D80001F000F80001E000F80000E0007000241D7F9C27>87 +D<0FC03FF07FF87038401C001C001C00FC0FFC3FFC781CE01CE01CE01CF07C7FFC7FDC3F +1C0E127E9114>97 D<E000E000E000E000E000E000E000E000E000E000E000E3E0EFF8FF +FCF83EE01EE00EE007E007E007E007E007E007E00EF01EF83CFFF8EFF0E3E0101D7D9C15 +>I<03F00FFC1FFE3C0E78027000E000E000E000E000E000E000700078023C0E1FFE0FFC +03F00F127F9112>I<0007000700070007000700070007000700070007000707C71FF73F +FF3C1F78077007E007E007E007E007E007E0077007780F3C1F3FFF1FF707C7101D7F9C15 +>I<07E00FF03FF83C3C700C700EFFFEFFFEFFFEE000E000E000700078023C0E1FFE0FFC +03F00F127F9112>I<00FC01FC03FC07000E000E000E000E000E000E000E00FFE0FFE0FF +E00E000E000E000E000E000E000E000E000E000E000E000E000E000E000E000E1D809C0D +>I<07C3C00FFFC01FFFC0383800701C00701C00701C00701C00701C003838003FF0003F +E00077C0007000007000003FFC003FFF007FFF80700780E001C0E001C0E001C0F003C07C +0F803FFF001FFE0007F800121B7F9115>I<E000E000E000E000E000E000E000E000E000 +E000E000E3E0EFF0FFF8F83CF01CE01CE01CE01CE01CE01CE01CE01CE01CE01CE01CE01C +E01CE01C0E1D7D9C15>I<F0F0F0F0000000000000007070707070707070707070707070 +70707070041D7E9C0A>I<03C003C003C003C0000000000000000000000000000001C001 +C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001C001 +C001C001C0C3C0FF80FF003E000A25839C0B>I<E000E000E000E000E000E000E000E000 +E000E000E000E03CE078E0F0E1E0E3C0E780EF00FF00FF80FB80F9C0F1E0E0E0E0F0E078 +E038E03CE01E0F1D7D9C14>I<E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0 +E0E0E0E0E0E0031D7D9C0A>I<E3F03F00EFF8FF80FFFDFFC0F81F81E0F00F00E0E00E00 +E0E00E00E0E00E00E0E00E00E0E00E00E0E00E00E0E00E00E0E00E00E0E00E00E0E00E00 +E0E00E00E0E00E00E0E00E00E01B127D9122>I<E3E0EFF0FFF8F83CF01CE01CE01CE01C +E01CE01CE01CE01CE01CE01CE01CE01CE01CE01C0E127D9115>I<03F0000FFC001FFE00 +3C0F00780780700380E001C0E001C0E001C0E001C0E001C0F003C07003807807803C0F00 +1FFE000FFC0003F00012127F9115>I<E3E0EFF8FFFCF83EE01EE00EE007E007E007E007 +E007E00FE00EF01EF87CFFF8EFF0E3E0E000E000E000E000E000E000E000E000101A7D91 +15>I<E380E780EF80FC00F800F000F000E000E000E000E000E000E000E000E000E000E0 +00E00009127D910E>114 D<1FC03FF07FF0F030E000E000F0007F003FC01FE001F00038 +00388038F078FFF07FE01FC00D127F9110>I<1C001C001C001C001C001C00FFE0FFE0FF +E01C001C001C001C001C001C001C001C001C001C001C001C201FF00FF007C00C187F970F +>I<E01CE01CE01CE01CE01CE01CE01CE01CE01CE01CE01CE01CE01CE01CE07CFFFC7FDC +3F1C0E127D9115>I<E007E007F007700E700E381C381C381C1C381C381C380E700E7006 +60076007E003C003C010127F9113>I<E03E0380E03E0380E03E03807037030070770700 +707707007073070038E38E0038E38E0038E38E0018E18C001CC1CC001DC1DC001DC1DC00 +0D80D8000F80F8000F80F8000780700019127F911C>I<7003807807003C0E001C1C000E +1C0007380003F00001E00001C00001E00003F0000738000618000E1C001C0E0038070070 +0380F003C01212809113>I<E007E007700E700E780E381C381C1C1C1C380C380E300E70 +06700760036003C001C001C001800180030003000700FE00FC00F800101A7F9113>I +E /FB 21 121 df<00007FE0000003FFFC00000FFFFF80001FFFFFC0003FFFFFC0007FC0 +3FC001FF00078001FC00018003F800008007F00000000FE00000000FC00000001FC00000 +001F800000003F000000003F000000007F000000007E000000007E000000007E00000000 +FE00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC00000000FC +00000000FC00000000FC00000000FC00000000FE000000007E000000007E000000007E00 +0000007F000000003F000000003F000000001F800000001FC00000000FC00000000FE000 +000007F000000003F800002001FC0000E001FF0003E0007FC01FE0003FFFFFE0001FFFFF +C0000FFFFF000003FFFC0000007FE00023347CB22B>67 D<FFFFFC0000FFFFFF8000FFFF +FFE000FFFFFFF000FC000FF800FC0003FC00FC0000FE00FC00007F00FC00003F80FC0000 +1FC0FC00000FC0FC000007E0FC000007E0FC000003F0FC000003F0FC000001F0FC000001 +F8FC000001F8FC000001F8FC000000F8FC000000FCFC000000FCFC000000FCFC000000FC +FC000000FCFC000000FCFC000000FCFC000000FCFC000000FCFC000000FCFC000000FCFC +000000F8FC000001F8FC000001F8FC000001F8FC000003F0FC000003F0FC000007E0FC00 +0007E0FC00000FC0FC00001FC0FC00001F80FC00003F00FC0000FF00FC0001FE00FC000F +FC00FFFFFFF000FFFFFFE000FFFFFF8000FFFFFC000026327AB131>I<FF80000007FCFF +C000000FFCFFC000000FFCFFC000000FFCFFE000001FFCFDE000001EFCFDE000001EFCFD +F000003EFCFDF000003EFCFCF000003CFCFCF800007CFCFCF800007CFCFCF800007CFCFC +7C0000F8FCFC7C0000F8FCFC7C0000F8FCFC7E0001F8FCFC3E0001F0FCFC3E0001F0FCFC +3F0003F0FCFC1F0003E0FCFC1F0003E0FCFC1F8007E0FCFC1F8007E0FCFC0F8007C0FCFC +0FC00FC0FCFC0FC00FC0FCFC07C00F80FCFC07E01F80FCFC07E01F80FCFC03E01F00FCFC +03F03F00FCFC03F03F00FCFC01F03E00FCFC01F03E00FCFC01F87E00FCFC00F87C00FCFC +00F87C00FCFC00FCFC00FCFC007CF800FCFC007CF800FCFC007CF800FCFC003CF000FCFC +003FF000FCFC003FF000FCFC001FE000FCFC001FE000FCFC001FE000FCFC000FC000FCFC +00000000FC2E327AB13B>77 D<001FF000007FFE0001FFFF0003FFFFC007FFFFE00FF01F +E01FC003E01F8001C03F0000C03F0000407E0000007E0000007E0000007E0000007E0000 +007E0000007F0000003F0000003F8000003F8000001FE000000FFC00000FFF800007FFF0 +0003FFFC0000FFFE00003FFF000007FF800000FFC000001FE000000FE0000007F0000003 +F0000003F8000001F8000001F8000001F8000001F8000001F8000001F8000001F8400003 +F0600003F0700007F0FC0007E0FF000FC0FFE03FC07FFFFF801FFFFF000FFFFE0001FFF8 +00003FE0001D347DB225>83 D<FC00001F80FC00001F80FC00001F80FC00001F80FC0000 +1F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F +80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80 +FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC +00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00001F80FC00 +001F80FC00001F80FC00001F80FC00001F80FC00001F807E00003F007E00003F007E0000 +3F003F00007E003F00007E001F8000FC000FC001F80007E003F00007FC1FF00001FFFFC0 +0000FFFF8000003FFE00000007F0000021337AB12E>85 D<007F8003FFE00FFFF01FFFF8 +1FFFFC1F00FE1C007E10007F00003F00003F00003F00003F00003F000FFF00FFFF07FFFF +1FFFFF3FE03F7F803F7E003FFC003FFC003FFC003FFC007FFE00FF7F83FF7FFFFF3FFFFF +1FFFBF0FFE3F07F03F181F7E9E20>97 D<001FE00000FFFC0001FFFF0007FFFF800FFFFF +800FF01F801FC007003F8001003F0000007E0000007E000000FE000000FC000000FC0000 +00FC000000FC000000FC000000FC000000FC000000FE0000007E0000007E0000003F0000 +003F8000801FC003800FF01F800FFFFF8007FFFF8001FFFF0000FFFC00001FE000191F7E +9E1E>99 D<000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007 +E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007E0000007 +E0000007E0000007E0007E07E001FFC7E007FFF7E00FFFFFE00FFFFFE01FF03FE03FC00F +E03F8007E07F0007E07E0007E07E0007E0FE0007E0FC0007E0FC0007E0FC0007E0FC0007 +E0FC0007E0FC0007E0FC0007E0FC0007E07E0007E07E0007E07F0007E03F000FE03FC01F +E01FF07FE01FFFFFE00FFFF7E007FFE7E001FF87E0007E07E01B327EB123>I<003F8000 +00FFE00003FFF80007FFFC000FFFFC001FE0FE003F807E003F003F007F001F007E001F00 +7E000F80FFFFFF80FFFFFF80FFFFFF80FFFFFF80FC000000FC000000FC000000FC000000 +FC0000007E0000007E0000003F0000003F8000801FC003801FF01F800FFFFF8007FFFF80 +01FFFF0000FFFC00001FE000191F7E9E1E>I<0007FC001FFC003FFC00FFFC00FFFC01FC +0003F00003E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E0 +0007E000FFFFC0FFFFC0FFFFC0FFFFC007E00007E00007E00007E00007E00007E00007E0 +0007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E0 +0007E00007E00007E00007E00007E00007E00007E00007E00016327FB115>I<FC0000FC +0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC0000FC +0000FC0000FC0000FC0000FC0000FC0000FC0FE0FC3FF8FCFFFCFDFFFCFFFFFEFFC1FEFF +007FFF003FFE003FFE003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC +003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC +003F18327BB123>104 D<FCFCFCFCFCFC0000000000000000000000FCFCFCFCFCFCFCFC +FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC06307CAF0F>I<FC0FE003F800 +FC3FF80FFE00FCFFFC3FFF00FDFFFC7FFF00FFFFFEFFFF80FFC1FFF07F80FF007FC01FC0 +FF003FC00FC0FE003F800FC0FE003F800FC0FC003F000FC0FC003F000FC0FC003F000FC0 +FC003F000FC0FC003F000FC0FC003F000FC0FC003F000FC0FC003F000FC0FC003F000FC0 +FC003F000FC0FC003F000FC0FC003F000FC0FC003F000FC0FC003F000FC0FC003F000FC0 +FC003F000FC0FC003F000FC0FC003F000FC0FC003F000FC0FC003F000FC0FC003F000FC0 +2A1F7B9E35>109 D<FC0FE0FC3FF8FCFFFCFDFFFCFFFFFEFFC1FEFF007FFF003FFE003F +FE003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003F +FC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003F181F7B9E23> +I<001FC00000FFF80001FFFC0007FFFF000FFFFF801FF07FC01FC01FC03F0007E03F0007 +E07E0003F07E0003F07C0001F0FC0001F8FC0001F8FC0001F8FC0001F8FC0001F8FC0001 +F8FC0001F8FE0003F87E0003F07E0003F03F0007E03F800FE01FC01FC01FF07FC00FFFFF +8007FFFF0001FFFC0000FFF800001FC0001D1F7E9E22>I<FC0FE000FC3FF800FCFFFC00 +FFFFFE00FFFFFF00FFC1FF00FF007F80FE003F80FC001FC0FC000FC0FC000FC0FC000FE0 +FC0007E0FC0007E0FC0007E0FC0007E0FC0007E0FC0007E0FC0007E0FC000FE0FC000FC0 +FC001FC0FC001FC0FE003F80FF007F80FF81FF00FFFFFE00FFFFFC00FCFFF800FC7FF000 +FC1FC000FC000000FC000000FC000000FC000000FC000000FC000000FC000000FC000000 +FC000000FC000000FC000000FC000000FC000000FC0000001B2D7B9E23>I<FC0FFC3FFC +7FFCFFFDFFFFF8FFC0FF80FF00FF00FE00FE00FC00FC00FC00FC00FC00FC00FC00FC00FC +00FC00FC00FC00FC00FC00FC00FC00FC00FC00FC00101F7B9E17>114 +D<01FF000FFFE01FFFF83FFFF87FFFF87E00F0FC0010FC0000FC0000FC0000FE0000FF00 +007FF8003FFF001FFFC00FFFE007FFF000FFF8000FF80001FC0000FC0000FC0000FC4000 +FC7001FCFE03F8FFFFF8FFFFF07FFFE01FFFC001FE00161F7E9E1A>I<07E00007E00007 +E00007E00007E00007E00007E00007E00007E000FFFFE0FFFFE0FFFFE0FFFFE007E00007 +E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007E00007 +E00007E00007E00007E00007E00007E00007E00007F02007F0E003FFF003FFF003FFF001 +FFC000FE0014287FA718>I<FC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003F +FC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003FFC003F +FC003FFC003FFC003FFC007FFC00FFFE03FFFFFFFF7FFFBF7FFF3F3FFC3F0FE03F181F7B +9E23>I<7F0003F83F0007F03F800FE01FC00FC00FE01FC007E03F8007F07F0003F87E00 +01FCFC0000FDFC00007FF800007FF000003FE000001FE000000FC000000FC000001FE000 +003FE000007FF000007DF80000FCFC0001F87E0003F07E0003F03F0007E01F800FC01FC0 +1FC00FC01F8007E03F0007F07F0003F8FE0001FC1E1F809E1F>120 +D E end +%%EndProlog +%%BeginSetup +%%Feature: *Resolution 300dpi +TeXDict begin +%%PaperSize: A4 + +%%EndSetup +%%Page: 1 1 +1 0 bop 225 194 a FB(Computation)24 b(and)e(Uses)g(of)g(the)h +(Semidiscrete)i(Matrix)225 277 y(Decomp)r(osition)225 +394 y FA(T)m(ama)o(ra)12 b(G.)i(Kolda)225 452 y(Sandia)h(National)f +(Lab)q(o)o(rato)o(ries)225 510 y(and)225 568 y(Dianne)h(P)m(.)d(O'Lea)o +(ry)225 626 y(Universit)o(y)i(of)g(Ma)o(ryland)p 225 +752 1495 1 v 225 835 a Fz(W)m(e)g(deriv)o(e)d(algorithms)g(for)i +(computing)d(a)j(semidiscrete)d(appro)o(ximatio)o(n)g(to)j(a)h(matrix)d +(in)i(the)g(F)m(rob)q(enius)225 876 y(and)c(w)o(eigh)o(ted)f(norms.)13 +b(The)d(appro)o(ximatio)o(n)d(is)j(formed)e(as)h(a)h(w)o(eigh)o(ted)e +(sum)h(of)h(outer)e(pro)q(ducts)g(of)h(v)o(ectors)225 +918 y(whose)14 b(elemen)o(ts)f(are)h Fy(\006)p Fz(1)h(or)f(0,)i(so)e +(the)g(storage)f(required)g(b)o(y)h(the)g(appro)o(ximat)o(ion)d(is)k +(quite)f(small.)23 b(W)m(e)225 959 y(also)10 b(presen)o(t)f(a)h +(related)f(algorithm)e(for)j(appro)o(ximatio)o(n)e(of)i(a)g(tensor.)k +(Applications)8 b(of)i(the)g(algorithms)d(are)225 1001 +y(presen)o(ted)i(to)i(data)g(compression)o(,)e(\014ltering,)g(and)i +(information)d(retriev)n(al;)i(and)g(soft)o(w)o(are)h(is)g(pro)o(vided) +f(in)h(C)225 1042 y(and)g(in)g(Matlab.)225 1128 y(Categories)h(and)i +(Sub)r(ject)e(Descriptors:)18 b(G.1.2)13 b([)p Fx(Numerical)h(Analysis) +p Fz(]:)21 b(Appro)o(ximatio)o(n;)13 b(H.3.3)g([)p Fx(In-)225 +1170 y(formation)g(Systems)p Fz(]:)h(Informatio)o(n)9 +b(Searc)o(h)g(and)i(Retriev)n(al)225 1231 y(General)f(T)m(erms:)k +(Matrix)d(Decomp)q(ositio)o(n)225 1292 y(Additional)e(Key)h(W)m(ords)h +(and)f(Phrases:)j(Singular)c(V)m(alue)h(Decomp)q(osition)o(,)e +(Semidiscrete)g(Decomp)q(ositi)o(on,)225 1333 y(Laten)o(t)i(Seman)o +(tic)f(Indexing,)g(Compression)p 225 1386 V 225 1484 +V 225 1524 a(Kolda's)i(w)o(ork)h(w)o(as)g(p)q(erformed)d(while)i(she)h +(w)o(as)g(a)g(p)q(ostdo)q(ctora)o(l)d(fello)o(w)j(at)f(Oak)h(Ridge)f +(National)f(Lab)q(ora-)225 1565 y(tory)g(and)g(w)o(as)i(supp)q(orted)c +(through)h(the)i(Applied)f(Mathematical)e(Sciences)h(Researc)o(h)g +(Program,)g(O\016ce)j(of)225 1607 y(Energy)g(Researc)o(h,)g(U.S.)h +(Departmen)o(t)d(of)j(Energy)m(,)f(under)g(con)o(tract)f(DE-A)o +(C05-96OR22464)g(with)j(Lo)q(c)o(k-)225 1648 y(heed)e(Martin)g(Energy)f +(Researc)o(h)g(Corp)q(oration.)17 b(O'Leary's)12 b(w)o(ork)h(w)o(as)g +(supp)q(orted)d(b)o(y)j(the)f(National)g(Sci-)225 1690 +y(ence)g(F)m(oundation)e(under)i(Gran)o(t)g(CCR-97-32022)f(and)h(b)o(y) +h(the)f(Departemen)o(t)e(Informatik,)g(ETH)15 b(Z)q(\177)-19 +b(uric)o(h,)225 1731 y(Switzerland.)225 1773 y(Name:)15 +b(T)m(amara)10 b(G.)h(Kolda)225 1856 y(Address:)21 b(Computationa)o(l) +12 b(Science)h(and)h(Mathematics)e(Departmen)o(t,)h(Sandia)f(National)i +(Lab)q(oratories,)225 1897 y(Liv)o(ermore,)9 b(CA)k(94551-9214)o(,)c +Fw(tgkolda@sa)o(nd)o(ia.)o(gov)o Fz(.)225 1980 y(Name:)15 +b(Dianne)10 b(P)m(.)h(O'Leary)225 2063 y(Address:)17 +b(Computer)11 b(Science)g(Departmen)o(t)f(and)i(Institute)e(for)j(Adv)n +(anced)e(Computer)g(Studies,)g(Univ)o(er-)225 2105 y(sit)o(y)g(of)g +(Maryland,)f(College)g(P)o(ark,)h(MD)h(20742,)d Fw(oleary@cs.um)o(d.)o +(edu)o Fz(.)225 2188 y(P)o(ermission)e(to)h(mak)o(e)g(digital)f(or)i +(hard)f(copies)g(of)g(part)g(or)h(all)g(of)f(this)h(w)o(ork)f(for)h(p)q +(ersonal)e(or)i(classro)q(om)d(use)j(is)225 2229 y(gran)o(ted)d +(without)h(fee)g(pro)o(vided)f(that)h(copies)g(are)g(not)g(made)g(or)g +(distributed)f(for)h(pro\014t)g(or)g(direct)g(commercial)225 +2271 y(adv)n(an)o(tage)j(and)j(that)f(copies)g(sho)o(w)h(this)g(notice) +f(on)g(the)h(\014rst)g(page)f(or)h(initial)e(screen)h(of)h(a)g(displa)o +(y)f(along)225 2312 y(with)g(the)f(full)g(citation.)k(Cop)o(yrigh)o(ts) +10 b(for)h(comp)q(onen)o(ts)e(of)j(this)f(w)o(ork)h(o)o(wned)f(b)o(y)h +(others)e(than)h(A)o(CM)j(m)o(ust)225 2354 y(b)q(e)f(honored.)21 +b(Abstracting)12 b(with)h(credit)g(is)h(p)q(ermitted.)20 +b(T)m(o)14 b(cop)o(y)f(otherwise,)g(to)g(republish,)f(to)i(p)q(ost)f +(on)225 2395 y(serv)o(ers,)8 b(to)i(redistribute)c(to)j(lists,)h(or)f +(to)g(use)g(an)o(y)g(comp)q(onen)o(t)d(of)k(this)f(w)o(ork)g(in)g +(other)g(w)o(orks,)g(requires)f(prior)225 2437 y(sp)q(eci\014c)13 +b(p)q(ermission)e(and/or)i(a)h(fee.)23 b(P)o(ermissions)12 +b(ma)o(y)h(b)q(e)h(requested)e(from)h(Publications)e(Dept,)j(A)o(CM)225 +2478 y(Inc.,)9 b(1515)f(Broadw)o(a)o(y)m(,)g(New)j(Y)m(ork,)e(NY)i +(10036)d(USA,)i(fax)e(+1)i(\(212\))e(869-0481,)f(or)i +Fw(permissions)o(@ac)o(m.o)o(rg)p Fz(.)p eop +%%Page: 2 2 +2 1 bop 225 125 a Fv(2)71 b Fu(\001)78 b Fv(T.)13 b(G.)f(Kolda)g(and)h +(D.)f(P)m(.)g(O'Lea)o(ry)225 233 y FA(1.)20 b(INTRODUCTION)225 +299 y Ft(A)14 b(semidiscrete)h(decomp)q(osition)e(\(SDD\))h(appro)o +(ximates)f(a)h(matrix)e(as)i(a)g(w)o(eigh)o(ted)h(sum)e(of)225 +349 y(outer)19 b(pro)q(ducts)g(formed)e(b)o(y)h(v)o(ectors)h(with)f(en) +o(tries)h(constrained)g(to)f(b)q(e)h(in)e(the)i(set)g +Fs(S)j Ft(=)225 399 y Fs(f\000)p Ft(1)p Fr(;)7 b Ft(0)p +Fr(;)g Ft(1)p Fs(g)p Ft(.)20 b(O'Leary)15 b(and)h(P)o(eleg)f([1983])e +(in)o(tro)q(duced)j(the)g(SDD)f(in)g(the)h(con)o(text)g(of)e(image)225 +449 y(compression,)d(and)g(Kolda)g(and)g(O'Leary)g([1998,)f(1999])g +(used)i(the)g(SDD)e(for)h(laten)o(t)g(seman)o(tic)225 +498 y(indexing)i(\(LSI\))h(in)g(information)d(retriev)n(al;)i(these)i +(applications)e(are)i(discussed)g(in)f Fs(x)p Ft(5.)267 +548 y(The)i(primary)f(adv)n(an)o(tage)g(of)h(the)g(SDD)g(o)o(v)o(er)g +(other)h(t)o(yp)q(es)g(of)f(matrix)e(appro)o(ximations)225 +598 y(suc)o(h)d(as)f(the)h(truncated)g(singular)f(v)n(alue)f(decomp)q +(osition)g(\(SVD\))h(is)g(that,)g(as)h(w)o(e)f(will)f(demon-)225 +648 y(strate)k(with)f(n)o(umerical)f(examples)h(in)f +Fs(x)p Ft(7,)i(it)f(t)o(ypically)f(pro)o(vides)h(a)g(more)f(accurate)j +(appro)o(x-)225 698 y(imation)d(for)j(far)f(less)i(storage.)267 +747 y(W)m(e)d(describ)q(e)i(the)g(SDD,)e(ho)o(w)g(to)h(calculate)f(it,) +h(and)f(its)h(prop)q(erties)h(in)f Fs(x)p Ft(2.)k(The)d +Fq(weighte)n(d)225 797 y Ft(and)g Fq(tensor)f Ft(SDDs)h(are)g(presen)o +(ted)i(in)e Fs(x)p Ft(3)g(and)g Fs(x)p Ft(4,)f(resp)q(ectiv)o(ely)m(.) +267 847 y(A)18 b(storage-e\016cien)o(t)g(implemen)o(tation)d(for)i(the) +i(SDD)e(is)h(presen)o(ted)i(in)d Fs(x)p Ft(6.)31 b(Numerical)225 +897 y(results)15 b(with)f(our)f(soft)o(w)o(are)h(are)h(presen)o(ted)h +(in)d Fs(x)p Ft(7.)225 988 y FA(2.)20 b(THE)14 b(SDD)225 +1054 y Ft(An)g(SDD)f(of)h(an)f Fr(m)d Fs(\002)f Fr(n)14 +b Ft(matrix)e Fr(A)i Ft(is)g(a)g(decomp)q(osition)e(of)h(the)i(form)397 +1215 y Fr(A)428 1221 y Fp(k)461 1215 y Ft(=)535 1181 +y Fo(\002)558 1215 y Fr(x)582 1221 y Fn(1)613 1215 y +Fr(x)637 1221 y Fn(2)668 1215 y Fs(\001)7 b(\001)g(\001)k +Fr(x)753 1221 y Fp(k)779 1181 y Fo(\003)858 1094 y(2)858 +1167 y(6)858 1192 y(6)858 1217 y(6)858 1244 y(4)892 1126 +y Fr(d)914 1132 y Fn(1)954 1126 y Ft(0)22 b Fs(\001)7 +b(\001)g(\001)22 b Ft(0)902 1176 y(0)g Fr(d)967 1182 +y Fn(2)997 1176 y Fs(\001)7 b(\001)g(\001)22 b Ft(0)906 +1220 y(.)906 1237 y(.)906 1253 y(.)959 1220 y(.)959 1237 +y(.)959 1253 y(.)1000 1224 y(.)1016 1237 y(.)1032 1249 +y(.)1073 1220 y(.)1073 1237 y(.)1073 1253 y(.)902 1303 +y(0)31 b(0)22 b Fs(\001)7 b(\001)g(\001)k Fr(d)1080 1309 +y Fp(k)1106 1094 y Fo(3)1106 1167 y(7)1106 1192 y(7)1106 +1217 y(7)1106 1244 y(5)1168 1094 y(2)1168 1167 y(6)1168 +1192 y(6)1168 1217 y(6)1168 1244 y(4)1202 1126 y Fr(y)1223 +1111 y Fp(T)1222 1136 y Fn(1)1202 1176 y Fr(y)1223 1161 +y Fp(T)1222 1186 y Fn(2)1220 1220 y Ft(.)1220 1237 y(.)1220 +1253 y(.)1202 1303 y Fr(y)1223 1288 y Fp(T)1222 1315 +y(k)1256 1094 y Fo(3)1256 1167 y(7)1256 1192 y(7)1256 +1217 y(7)1256 1244 y(5)1296 1215 y Ft(=)1361 1163 y Fp(k)1341 +1176 y Fo(X)1344 1264 y Fp(i)p Fn(=1)1408 1215 y Fr(d)1430 +1221 y Fp(i)1443 1215 y Fr(x)1467 1221 y Fp(i)1480 1215 +y Fr(y)1501 1198 y Fp(T)1500 1225 y(i)1535 1215 y Fr(:)506 +1370 y Fo(|)p 525 1370 122 5 v 122 w({z)p 685 1370 V +122 w(})643 1410 y Fp(X)670 1414 y Fm(k)837 1370 y Fo(|)p +856 1370 V 122 w({z)p 1016 1370 V 122 w(})973 1410 y +Fp(D)1000 1414 y Fm(k)1177 1370 y Fo(|)p 1196 1370 12 +5 v 12 w({z)p 1246 1370 V 12 w(})1201 1414 y Fp(Y)1227 +1404 y Fm(T)1221 1425 y(k)225 1489 y Ft(Here)k(eac)o(h)g +Fr(x)441 1495 y Fp(i)469 1489 y Ft(is)f(an)g Fr(m)p Ft(-v)o(ector)h +(with)f(en)o(tries)h(from)e(the)i(set)g Fs(S)g Ft(=)e +Fs(f\000)p Ft(1)p Fr(;)7 b Ft(0)p Fr(;)g Ft(1)p Fs(g)p +Ft(,)k(eac)o(h)k Fr(y)1605 1495 y Fp(i)1633 1489 y Ft(is)g(an)225 +1539 y Fr(n)p Ft(-v)o(ector)g(with)f(en)o(tries)i(from)d(the)i(set)h +Fs(S)s Ft(,)e(and)h(eac)o(h)g Fr(d)1107 1545 y Fp(i)1135 +1539 y Ft(is)f(a)h(p)q(ositiv)o(e)f(scalar.)20 b(W)m(e)14 +b(call)g(this)225 1589 y(a)g Fr(k)q Ft(-term)f(SDD.)267 +1639 y(Although)g(ev)o(ery)i(matrix)d(can)i(b)q(e)g(expressed)i(as)e +(an)g Fr(mn)p Ft(-term)f(SDD)788 1744 y Fr(A)f Ft(=)890 +1692 y Fp(m)874 1705 y Fo(X)878 1793 y Fp(i)p Fn(=1)961 +1692 y Fp(n)941 1705 y Fo(X)943 1793 y Fp(j)r Fn(=1)1008 +1744 y Fr(a)1030 1750 y Fp(ij)1059 1744 y Fr(e)1078 1750 +y Fp(i)1093 1744 y Fr(e)1112 1727 y Fp(T)1112 1754 y(j)1145 +1744 y Fr(;)225 1860 y Ft(where)h Fr(e)362 1866 y Fp(k)395 +1860 y Ft(is)g(the)f Fr(k)q Ft(-th)h(unit)f(v)o(ector,)h(the)f +(usefulness)i(of)e(the)h(SDD)e(is)h(in)g(dev)o(eloping)g(appro)o(x-)225 +1910 y(imations)g(that)i(ha)o(v)o(e)f(far)h(few)o(er)g(terms.)267 +1960 y(Since)f(the)g(storage)g(requiremen)o(t)g(for)g(a)f +Fr(k)q Ft(-term)g(SDD)g(is)h Fr(k)h Ft(\015oating)e(p)q(oin)o(t)g(n)o +(um)o(b)q(ers)g(plus)225 2010 y Fr(k)q Ft(\()p Fr(m)s +Ft(+)s Fr(n)p Ft(\))e(en)o(tries)i(from)d Fs(S)s Ft(,)i(it)f(is)g +(inexp)q(ensiv)o(e)h(to)g(store)g(quite)g(a)f(large)g(n)o(um)o(b)q(er)g +(of)g(terms.)17 b(F)m(or)225 2060 y(example,)10 b(for)i(a)g(dense,)h +(single)e(precision)i(matrix)d(of)h(size)h(10)p Fr(;)7 +b Ft(000)e Fs(\002)g Ft(10)p Fr(;)i Ft(000,)i(almost)h(80)p +Fr(;)d Ft(000)225 2110 y(SDD)17 b(terms)h(can)g(b)q(e)h(stored)g(in)e +(the)i(space)g(of)e(the)h(original)f(data,)h(and)f(almost)f(160)p +Fr(;)7 b Ft(000)225 2159 y(terms)14 b(can)g(b)q(e)g(stored)h(for)f(a)f +(double)h(precision)g(matrix)e(of)i(the)g(same)f(size.)225 +2242 y FA(2.1)20 b(Computing)13 b(an)h(SDD)225 2309 y +Ft(An)h(SDD)f(appro)o(ximation)e(can)j(b)q(e)g(formed)f(iterativ)o(ely) +g(via)g(a)h(greedy)g(algorithm.)k(Let)c Fr(A)1699 2315 +y Fp(k)225 2358 y Ft(denote)e(the)g Fr(k)q Ft(-term)f(appro)o(ximation) +e(\()p Fr(A)885 2364 y Fn(0)915 2358 y Fs(\021)i Ft(0\).)17 +b(Let)c Fr(R)1130 2364 y Fp(k)1163 2358 y Ft(b)q(e)g(the)g +Fq(r)n(esidual)f Ft(at)g(the)h Fr(k)q Ft(th)g(step;)225 +2408 y(that)h(is,)g Fr(R)401 2414 y Fp(k)433 2408 y Ft(=)e +Fr(A)e Fs(\000)f Fr(A)590 2414 y Fp(k)q Fl(\000)p Fn(1)653 +2408 y Ft(.)19 b(Then)c(the)g(optimal)c(c)o(hoice)k(of)f(the)g(next)h +(triplet)f(\()p Fr(d)1519 2414 y Fp(k)1539 2408 y Fr(;)7 +b(x)1582 2414 y Fp(k)1602 2408 y Fr(;)g(y)1641 2414 y +Fp(k)1661 2408 y Ft(\))14 b(is)225 2458 y(the)g(solution)g(to)f(the)i +(subproblem)408 2532 y(min)h Fr(F)522 2538 y Fp(k)542 +2532 y Ft(\()p Fr(d;)7 b(x;)g(y)q Ft(\))k Fs(\021)h(k)p +Fr(R)787 2538 y Fp(k)816 2532 y Fs(\000)d Fr(dxy)924 +2515 y Fp(T)951 2532 y Fs(k)972 2515 y Fn(2)972 2543 +y Fp(F)1036 2532 y Ft(s.t.)18 b Fr(x)11 b Fs(2)g(S)1212 +2515 y Fp(m)1244 2532 y Fr(;)18 b(y)c Fs(2)d(S)1375 2515 +y Fp(n)1398 2532 y Fr(;)18 b(d)11 b(>)h Ft(0)p Fr(:)128 +b Ft(\(1\))p eop +%%Page: 3 3 +3 2 bop 965 125 a Fv(Semidiscrete)12 b(Matrix)g(Decomp)q(osition)77 +b Fu(\001)70 b Fv(3)225 233 y Ft(This)13 b(is)g(a)g(mixed)f(in)o(teger) +i(programming)c(problem.)16 b(Note)e(that)f(if)g(the)h(in)o(teger)g +(constrain)o(ts)225 283 y(w)o(ere)19 b(replaced)g(b)o(y)f +Fs(k)p Fr(x)p Fs(k)g Ft(=)i(1)d(and)i Fs(k)p Fr(y)q Fs(k)g +Ft(=)g(1,)f(the)h(solution)f(w)o(ould)f(b)q(e)i(the)g(rank-1)e(SVD)225 +332 y(appro)o(ximation)11 b(to)j Fr(R)585 338 y Fp(k)605 +332 y Ft(.)267 382 y(W)m(e)f(can)h(simplify)d(the)k(optimization)c +(problem)h(sligh)o(tly)h(as)h(follo)o(ws.)267 458 y Fk(Theorem)21 +b(1.)g Fq([O'L)n(e)n(ary)12 b(and)j(Pele)n(g)e(1983])h(Solving)g(the)f +(mixe)n(d)h(inte)n(ger)e(pr)n(o)n(gr)n(am)h(\(1\))h(is)225 +507 y(e)n(quivalent)h(to)g(solving)g(the)g(inte)n(ger)f(pr)n(o)n(gr)n +(am)479 608 y Ft(max)584 598 y(~)575 608 y Fr(F)602 614 +y Fp(k)622 608 y Ft(\()p Fr(x;)7 b(y)q Ft(\))12 b Fs(\021)g +Ft(max)874 580 y(\()p Fr(x)914 565 y Fp(T)940 580 y Fr(R)972 +586 y Fp(k)992 580 y Fr(y)q Ft(\))1029 565 y Fn(2)p 874 +599 175 2 v 878 637 a Fs(k)p Fr(x)p Fs(k)944 622 y Fn(2)944 +648 y(2)963 637 y Fs(k)p Fr(y)q Fs(k)1026 622 y Fn(2)1026 +648 y(2)1092 608 y Ft(s.t.)18 b Fr(x)11 b Fs(2)g(S)1268 +591 y Fp(m)1300 608 y Fr(;)18 b(y)c Fs(2)d(S)1431 591 +y Fp(n)1454 608 y Fr(:)200 b Ft(\(2\))267 709 y Fk(Pr)o(oof.)21 +b Ft(W)m(e)14 b(can)g(eliminate)e Fr(d)h Ft(as)h(follo)o(ws.)j(First)d +(rewrite)h Fr(F)1266 715 y Fp(k)1286 709 y Ft(\()p Fr(d;)7 +b(x;)g(y)q Ft(\))13 b(as)550 784 y Fr(F)577 790 y Fp(k)597 +784 y Ft(\()p Fr(d;)7 b(x;)g(y)q Ft(\))k(=)h Fs(k)p Fr(R)842 +790 y Fp(k)861 784 y Fs(k)882 767 y Fn(2)882 794 y Fp(F)919 +784 y Fs(\000)d Ft(2)p Fr(dx)1027 767 y Fp(T)1053 784 +y Fr(R)1085 790 y Fp(k)1105 784 y Fr(y)i Ft(+)e Fr(d)1199 +767 y Fn(2)1217 784 y Fs(k)p Fr(x)p Fs(k)1283 767 y Fn(2)1283 +794 y(2)1301 784 y Fs(k)p Fr(y)q Fs(k)1364 767 y Fn(2)1364 +794 y(2)1383 784 y Fr(:)271 b Ft(\(3\))225 860 y(A)o(t)14 +b(the)g(optimal)e(solution,)g Fr(@)r(F)728 866 y Fp(k)749 +860 y Fr(=@)r(d)f Ft(=)h(0,)h(so)h(the)g(optimal)e(v)n(alue)h(of)g +Fr(d)h Ft(is)f(giv)o(en)h(b)o(y)831 963 y Fr(d)853 946 +y Fl(\003)883 963 y Ft(=)953 935 y Fr(x)977 920 y Fp(T)1002 +935 y Fr(R)1034 941 y Fp(k)1054 935 y Fr(y)p 932 953 +166 2 v 932 991 a Fs(k)p Fr(x)p Fs(k)998 977 y Fn(2)998 +1002 y(2)1015 991 y Fs(k)p Fr(y)q Fs(k)1078 977 y Fn(2)1078 +1002 y(2)1102 963 y Fr(:)225 1063 y Ft(Substituting)g +Fr(d)485 1048 y Fl(\003)517 1063 y Ft(in)g(\(3\))g(yields)659 +1166 y Fr(F)686 1172 y Fp(k)706 1166 y Ft(\()p Fr(d)744 +1149 y Fl(\003)763 1166 y Fr(;)7 b(x;)g(y)q Ft(\))k(=)h +Fs(k)p Fr(R)970 1172 y Fp(k)990 1166 y Fs(k)1011 1149 +y Fn(2)1011 1176 y Fp(F)1048 1166 y Fs(\000)1094 1138 +y Ft(\()p Fr(x)1134 1123 y Fp(T)1160 1138 y Fr(R)1192 +1144 y Fp(k)1212 1138 y Fr(y)q Ft(\))1249 1123 y Fn(2)p +1094 1157 175 2 v 1098 1195 a Fs(k)p Fr(x)p Fs(k)1164 +1180 y Fn(2)1164 1206 y(2)1182 1195 y Fs(k)p Fr(y)q Fs(k)1245 +1180 y Fn(2)1245 1206 y(2)1274 1166 y Fr(:)380 b Ft(\(4\))225 +1267 y(Th)o(us)14 b(solving)f(\(1\))h(is)g(equiv)n(alen)o(t)f(to)g +(solving)g(\(2\).)p 1071 1242 29 2 v 1071 1267 2 25 v +1097 1267 V 1071 1269 29 2 v 267 1342 a(The)h(in)o(teger)g(program)e +(\(2\))i(has)g(3)817 1327 y Fn(\()p Fp(m)p Fn(+)p Fp(n)p +Fn(\))934 1342 y Ft(feasible)f(p)q(oin)o(ts,)h(so)f(the)i(cost)f(of)f +(an)h(exhaustiv)o(e)225 1392 y(searc)o(h)19 b(for)e(the)h(optimal)c +(solution)j(gro)o(ws)g(exp)q(onen)o(tially)f(with)i Fr(m)f +Ft(and)g Fr(n)p Ft(.)29 b(Rather)17 b(than)225 1442 y(doing)c(this,)g +(w)o(e)i(use)f(an)g Fq(alternating)h(algorithm)e Ft(to)g(generate)j(an) +d Fq(appr)n(oximate)h Ft(solution)f(to)225 1492 y(the)g(subproblem.)k +(First)c Fr(y)i Ft(is)d(\014xed)h(and)g(\(2\))f(is)h(solv)o(ed)f(for)h +Fr(x)p Ft(,)f(then)h(that)g Fr(x)f Ft(is)h(\014xed)g(and)f(\(2\))225 +1541 y(is)i(solv)o(ed)g(for)f Fr(y)q Ft(.)19 b(The)14 +b(pro)q(cess)i(is)e(iterated.)267 1591 y(Solving)d(\(2\))h(can)h(b)q(e) +g(done)g(exactly)g(when)g(either)g Fr(x)g Ft(or)f Fr(y)j +Ft(is)d(\014xed.)18 b(If)12 b Fr(y)j Ft(is)d(\014xed,)h(then)g(\(2\)) +225 1641 y(b)q(ecomes)731 1733 y(max)832 1705 y(\()p +Fr(x)872 1690 y Fp(T)898 1705 y Fr(s)p Ft(\))933 1690 +y Fn(2)p 832 1724 121 2 v 850 1762 a Fs(k)p Fr(x)p Fs(k)916 +1747 y Fn(2)916 1773 y(2)994 1733 y Ft(s.t.)18 b Fr(x)11 +b Fs(2)g(S)1170 1716 y Fp(m)1202 1733 y Fr(;)452 b Ft(\(5\))225 +1835 y(where)20 b Fr(s)g Ft(=)h Fr(R)474 1841 y Fp(k)494 +1835 y Fr(y)q(=)p Fs(k)p Fr(y)q Fs(k)599 1820 y Fn(2)599 +1846 y(2)618 1835 y Ft(.)33 b(The)19 b(solution)g(to)f(this)h(problem)f +(can)h(b)q(e)g(easily)g(computed)f(as)225 1885 y(follo)o(ws.)267 +1961 y Fk(Theorem)j(2.)g Fq([O'L)n(e)n(ary)12 b(and)h(Pele)n(g)f(1983]) +h(If)f(the)h(solution)f(to)h(the)f(inte)n(ger)g(pr)n(o)n(gr)n(am)g +(\(5\))225 2011 y(has)j(exactly)g Fr(J)k Fq(nonzer)n(os,)c(then)h(the)f +(solution)g(is)642 2109 y Fr(x)666 2115 y Fp(i)678 2119 +y Fm(j)707 2109 y Ft(=)750 2050 y Fo(\032)792 2083 y +Ft(sign\()p Fr(s)899 2089 y Fp(i)911 2093 y Fm(j)929 +2083 y Ft(\))20 b(if)13 b(1)f Fs(\024)g Fr(j)i Fs(\024)d +Fr(J)792 2133 y Ft(0)152 b(if)13 b Fr(J)h Ft(+)9 b(1)j +Fs(\024)f Fr(j)j Fs(\024)e Fr(m)1291 2109 y(;)225 2207 +y Fq(wher)n(e)i(the)h(elements)g(of)g Fr(s)g Fq(in)g(sorte)n(d)g(or)n +(der)f(ar)n(e)745 2282 y Fs(j)p Fr(s)776 2288 y Fp(i)788 +2292 y Fj(1)806 2282 y Fs(j)d(\025)h(j)p Fr(s)904 2288 +y Fp(i)916 2292 y Fj(2)934 2282 y Fs(j)f(\025)g(\001)c(\001)g(\001)j +(\025)i(j)p Fr(s)1135 2288 y Fp(i)1147 2292 y Fm(m)1177 +2282 y Fs(j)p Fr(:)267 2357 y Fk(Pr)o(oof.)21 b Ft(See)15 +b(O'Leary)f(and)g(P)o(eleg)g([1983].)j(This)d(result)h(is)e(also)h(a)f +(sp)q(ecial)i(case)g(of)e(The-)225 2407 y(orem)g(8.)p +401 2382 29 2 v 401 2407 2 25 v 428 2407 V 401 2409 29 +2 v 267 2483 a(Th)o(us)20 b(there)i(are)f(only)f Fr(m)h +Ft(p)q(ossible)f Fr(x)p Ft(-v)o(ectors)h(to)g(c)o(hec)o(k)g(to)g +(determine)f(the)h(optimal)225 2532 y(solution)13 b(for)h(\(5\).)p +eop +%%Page: 4 4 +4 3 bop 225 125 a Fv(4)71 b Fu(\001)78 b Fv(T.)13 b(G.)f(Kolda)g(and)h +(D.)f(P)m(.)g(O'Lea)o(ry)267 233 y Ft(Tw)o(o)i(t)o(yp)q(es)j(of)e +(stopping)g(criteria)h(can)f(b)q(e)h(used)h(in)e(the)h(alternating)f +(algorithm)e(for)i(the)225 283 y(solution)e(of)g(\(2\).)18 +b(Since)d(from)d(\(4\))664 386 y Fs(k)p Fr(R)717 392 +y Fp(k)q Fn(+1)778 386 y Fs(k)799 369 y Fn(2)799 397 +y Fp(F)838 386 y Ft(=)g Fs(k)p Fr(R)935 392 y Fp(k)955 +386 y Fs(k)976 369 y Fn(2)976 397 y Fp(F)1012 386 y Fs(\000)1065 +358 y Ft(\()p Fr(x)1105 343 y Fp(T)1105 370 y(k)1131 +358 y Fr(R)1163 364 y Fp(k)1183 358 y Fr(y)1203 364 y +Fp(k)1224 358 y Ft(\))1240 343 y Fn(2)p 1059 377 206 +2 v 1059 415 a Fs(k)p Fr(x)1104 421 y Fp(k)1124 415 y +Fs(k)1145 401 y Fn(2)1145 426 y(2)1163 415 y Fs(k)p Fr(y)1204 +421 y Fp(k)1225 415 y Fs(k)1246 401 y Fn(2)1246 426 y(2)1269 +386 y Fr(;)385 b Ft(\(6\))225 485 y(the)14 b(inner)h(iteration)e(can)h +(b)q(e)h(stopp)q(ed)g(when)834 587 y Fr(\014)f Fs(\021)920 +559 y Ft(\()p Fr(x)960 544 y Fp(T)986 559 y Fr(R)1018 +565 y Fp(k)1038 559 y Fr(y)q Ft(\))1075 544 y Fn(2)p +920 577 175 2 v 924 615 a Fs(k)p Fr(x)p Fs(k)990 601 +y Fn(2)990 626 y(2)1008 615 y Fs(k)p Fr(y)q Fs(k)1071 +601 y Fn(2)1071 626 y(2)1099 587 y Fr(;)225 685 y Ft(b)q(ecomes)e +(nearly)g(constan)o(t.)17 b(Alternativ)o(ely)m(,)11 b(a)h(maxim)n(um)7 +b(n)o(um)o(b)q(er)k(of)g(inner)h(iterations)g(can)225 +735 y(b)q(e)j(sp)q(eci\014ed.)k(These)c(t)o(w)o(o)f(stopping)f +(criteria)h(can)h(b)q(e)f(used)h(in)e(conjunction.)267 +785 y(As)h(long)f(as)g(the)i(inner)f(iterations)g(are)g(terminated)f +(whenev)o(er)i(a)f(\014xed)g(p)q(oin)o(t)f(is)h(encoun-)225 +835 y(tered,)f(the)g(inner)f(lo)q(op)f(is)h(guaran)o(teed)h(to)f(b)q(e) +g(\014nite)h(since)f(no)g(iteration)g(mak)o(es)f(the)h(residual)225 +885 y(larger)i(and)g(there)h(are)f(only)f(a)h(\014nite)g(n)o(um)o(b)q +(er)f(of)g(p)q(ossible)h(v)o(ectors)h Fr(x)f Ft(and)g +Fr(y)q Ft(.)267 935 y(Figure)h(1)g(sho)o(ws)g(the)h(algorithm)d(to)i +(generate)h(an)f(SDD)g(appro)o(ximation.)k(The)c(metho)q(d)225 +984 y(will)f(generate)j(an)e(appro)o(ximation)d Fr(A)841 +990 y Fp(k)877 984 y Ft(for)j(whic)o(h)g Fr(k)g Ft(=)f +Fr(k)1167 990 y Fn(max)1245 984 y Ft(or)i Fs(k)p Fr(A)10 +b Fs(\000)g Fr(A)1433 990 y Fp(k)1454 984 y Fs(k)k Fr(<)g(\032)1556 +990 y Fn(min)1614 984 y Ft(.)22 b(The)225 1034 y(w)o(ork)17 +b(of)g(eac)o(h)i(inner)f(iteration)f(is)g(con)o(trolled)h(b)o(y)f(the)i +(parameters)e Fr(l)1370 1040 y Fn(max)1434 1034 y Ft(,)h(the)h(maxim)n +(um)225 1084 y(n)o(um)o(b)q(er)14 b(of)g(allo)o(w)o(ed)f(inner)i +(iterations,)f(and)h Fr(\013)986 1090 y Fn(min)1042 1084 +y Ft(,)g(the)g(relativ)o(e)f(impro)o(v)o(emen)o(t)e(threshold.)225 +1134 y(The)19 b(appro)o(ximation)c Fr(A)627 1140 y Fp(k)666 +1134 y Ft(in)j(Step)g(\(2e\))h(is)f(usually)g(not)g(formed)f +(explicitly;)i(rather,)h(the)225 1184 y(individual)c(elemen)o(ts)h(\()p +Fr(d)635 1190 y Fp(k)656 1184 y Ft(,)h Fr(x)710 1190 +y Fp(k)730 1184 y Ft(,)g Fr(y)780 1190 y Fp(k)801 1184 +y Ft(\))g(are)g(stored.)31 b(Similarly)l(,)16 b Fr(R)1283 +1190 y Fp(k)q Fn(+1)1362 1184 y Ft(in)i(Step)g(\(2f\))g(can)g(b)q(e)225 +1234 y(applied)13 b(in)h(Steps)h(\(2\(b\)i\),)e(\(2\(b\)ii\),)g +(\(2\(b\)iii\),)f(and)i(\(2d\))g(without)f(explicitly)g(forming)f(it.) +225 1318 y FA(2.2)20 b(Convergence)c(of)d(the)i(SDD)225 +1384 y Ft(W)m(e)e(sho)o(w)h(that)g(the)g(norm)f(of)g(the)h(residual)g +(generated)h(b)o(y)f(the)g(SDD)f(algorithm)e(is)j(strictly)225 +1434 y(decreasing)i(and)e(that)h(under)h(certain)f(circumstances,)g +(the)h(appro)o(ximation)c(generated)k(b)o(y)225 1484 +y(the)e(SDD)g(algorithm)d(con)o(v)o(erges)k(linearly)e(to)h(the)g +(original)e(matrix.)267 1560 y Fk(Lemma)21 b([O'Lear)m(y)d(and)f(Peleg) +e(1983].)21 b Fq(The)e(r)n(esidual)g(matric)n(es)f(gener)n(ate)n(d)h +(by)g(the)225 1610 y(SDD)d(algorithm)e(satisfy)554 1686 +y Fs(k)p Fr(R)607 1692 y Fp(k)q Fn(+1)669 1686 y Fs(k)690 +1692 y Fp(F)728 1686 y Fr(<)e Fs(k)p Fr(R)825 1692 y +Fp(k)845 1686 y Fs(k)866 1692 y Fp(F)908 1686 y Fq(for)i(al)r(l)h +Fr(k)h Fq(such)f(that)g Fr(R)1283 1692 y Fp(k)1314 1686 +y Fs(6)p Ft(=)d(0)p Fr(:)267 1762 y Fk(Pr)o(oof.)21 b +Ft(A)o(t)15 b(the)g(end)g(of)f(the)h(inner)f(iterations,)g(w)o(e)h(are) +g(guaran)o(teed)g(to)f(ha)o(v)o(e)g(found)g Fr(x)1699 +1768 y Fp(k)225 1812 y Ft(and)g Fr(y)326 1818 y Fp(k)360 +1812 y Ft(suc)o(h)h(that)f Fr(x)568 1797 y Fp(T)568 1824 +y(k)594 1812 y Fr(R)626 1818 y Fp(k)646 1812 y Fr(y)666 +1818 y Fp(k)698 1812 y Fr(>)e Ft(0.)18 b(The)c(result)h(follo)o(ws)d +(from)g(\(6\).)p 1332 1787 29 2 v 1332 1812 2 25 v 1359 +1812 V 1332 1814 29 2 v 267 1888 a(Sev)o(eral)j(strategies)h(can)f(b)q +(e)h(used)g(to)f(initialize)e Fr(y)k Ft(in)e(Step)g(\(2a\))g(in)g(the)h +(SDD)e(algorithm)225 1938 y(\(Figure)g(1\):)225 2015 +y(\(1\))21 b Fq(Maximum)16 b(element)e Ft(\(MAX\))i(initialization)11 +b(initializes)j Fr(y)1244 2021 y Fp(k)1277 2015 y Ft(=)f +Fr(e)1341 2021 y Fp(j)1359 2015 y Ft(,)h(where)i Fr(j)h +Ft(is)e(the)g(col-)299 2065 y(umn)h(con)o(taining)h(the)h(largest)g +(magnitude)e(en)o(try)j(in)e Fr(R)1222 2071 y Fp(k)1242 +2065 y Ft(.)30 b(The)18 b(MAX)g(initialization)299 2115 +y(sc)o(heme)d(leads)g(to)g(a)g(linearly)f(con)o(v)o(ergen)o(t)i +(algorithm)c(\(Theorem)j(3\))g(but)g(is)g(computa-)299 +2164 y(tionally)d(exp)q(ensiv)o(e)j(if)e Fr(R)707 2170 +y Fp(k)741 2164 y Ft(is)g(stored)i(implicitly)c(as)j +Fr(A)9 b Fs(\000)h Fr(A)1257 2170 y Fp(k)1277 2164 y +Ft(.)225 2224 y(\(2\))21 b Fq(Cycling)15 b Ft(\(CYC\))h(initialization) +e(sets)j Fr(y)936 2230 y Fp(k)971 2224 y Ft(=)e Fr(e)1037 +2230 y Fp(i)1067 2224 y Ft(where)i Fr(i)e Ft(=)g(\()p +Fr(k)g Ft(mo)q(d)e Fr(n)p Ft(\))d(+)h(1.)23 b(Unfortu-)299 +2274 y(nately)m(,)13 b(the)h(rate)g(of)g(con)o(v)o(ergence)h(can)f(b)q +(e)h(as)f(slo)o(w)f(as)h Fr(n)p Ft(-step)h(linear)e([Kolda)g(1997].)225 +2333 y(\(3\))21 b Fq(Thr)n(eshold)12 b Ft(\(THR\))g(initialization)d +(also)j(cycles)h(through)f(the)h(unit)f(v)o(ectors,)h(but)g(it)f(do)q +(es)299 2383 y(not)20 b(accept)i(a)f(giv)o(en)f(v)o(ector)i(unless)f +(it)g(satis\014es)g Fs(k)p Fr(R)1194 2389 y Fp(k)1214 +2383 y Fr(e)1233 2389 y Fp(j)1251 2383 y Fs(k)1272 2368 +y Fn(2)1272 2393 y(2)1313 2383 y Fs(\025)i(k)p Fr(R)1421 +2389 y Fp(k)1441 2383 y Fs(k)1462 2368 y Fn(2)1462 2394 +y Fp(F)1489 2383 y Fr(=n)p Ft(.)39 b(W)m(e)20 b(are)299 +2433 y(guaran)o(teed)12 b(that)f(at)h(least)f(one)h(unit)f(v)o(ector)i +(will)d(satisfy)h(this)g(inequalit)o(y)f(b)o(y)i(de\014nition)299 +2483 y(of)h(the)i(F-norm.)i(Ev)o(en)d(though)g Fr(R)861 +2489 y Fp(k)895 2483 y Ft(is)g(stored)h(implicitl)o(y)m(,)10 +b(this)k(threshold)h(test)g(is)f(easy)299 2532 y(to)h(p)q(erform)f(b)q +(ecause)j(w)o(e)e(only)f(need)i(to)f(m)o(ultiply)d Fr(R)1167 +2538 y Fp(k)1202 2532 y Ft(b)o(y)j(a)g(v)o(ector.)22 +b(F)m(urthermore,)15 b(if)p eop +%%Page: 5 5 +5 4 bop 965 125 a Fv(Semidiscrete)12 b(Matrix)g(Decomp)q(osition)77 +b Fu(\001)70 b Fv(5)300 552 y Fz(\(1\))28 b(Let)11 b +Fi(R)464 558 y Fh(k)494 552 y Fz(denote)f(the)h(residual,)e(and)i +(initialize)e Fi(R)1049 557 y Fg(1)1075 552 y Fy( )h +Fi(A)p Fz(.)374 594 y(Let)h Fi(\032)455 600 y Fh(k)484 +594 y Fz(=)f Fy(k)p Fi(R)566 600 y Fh(k)584 594 y Fy(k)602 +582 y Fg(2)602 606 y Fh(F)639 594 y Fz(b)q(e)h(the)g(norm)f(of)h(the)g +(residual,)e(and)i(initialize)e Fi(\032)1312 599 y Fg(1)1339 +594 y Fy( )h(k)p Fi(R)1429 599 y Fg(1)1446 594 y Fy(k)1464 +582 y Fg(2)1464 606 y Fh(F)1489 594 y Fz(.)374 635 y(Let)h +Fi(A)463 641 y Fh(k)494 635 y Fz(denote)f(the)g Fi(k)q +Fz(-term)h(appro)o(ximat)o(ion)o(,)e(and)h(initialize)g +Fi(A)1267 640 y Fg(0)1294 635 y Fy( )g Fz(0.)374 677 +y(Cho)q(ose)g Fi(k)514 681 y Fg(max)573 677 y Fz(,)h(the)g(maxim)o(um)e +(n)o(um)o(b)q(er)g(of)i(terms)g(in)g(the)g(appro)o(xima)o(tion)o(.)374 +718 y(Cho)q(ose)f Fi(\032)514 723 y Fg(min)567 718 y +Fz(,)h(the)g(desired)f(accuracy)f(of)i(the)g(appro)o(ximat)o(ion.)374 +760 y(Cho)q(ose)f Fi(l)507 764 y Fg(max)565 760 y Fz(,)i(the)e(maxim)o +(um)f(allo)o(w)o(able)h(inner)g(iterations.)374 801 y(Cho)q(ose)g +Fi(\013)519 806 y Fg(min)571 801 y Fz(,)i(the)f(minim)o(um)e(relativ)o +(e)g(impro)o(v)o(emen)n(t,)g(and)h(set)h Fi(\013)f(>)g +Fz(2)p Fi(\013)1393 806 y Fh(min)1452 801 y Fz(.)300 +859 y(\(2\))28 b(F)m(or)11 b Fi(k)g Fz(=)f(1)p Fi(;)5 +b Fz(2)p Fi(;)h(:)f(:)h(:)g(;)f(k)650 863 y Fg(max)709 +859 y Fz(,)12 b(while)f Fi(\032)841 865 y Fh(k)870 859 +y Fi(>)f(\032)925 864 y Fg(min)978 859 y Fz(,)h(do)374 +913 y(\(a\))30 b(Cho)q(ose)10 b Fi(y)k Fz(so)d(that)g +Fi(R)750 919 y Fh(k)768 913 y Fi(y)h Fy(6)p Fz(=)e(0.)374 +967 y(\(b\))28 b(F)m(or)11 b Fi(l)f Fz(=)g(1)p Fi(;)5 +b Fz(2)p Fi(;)g(:)h(:)g(:)g(;)f(l)711 971 y Fg(max)769 +967 y Fz(,)12 b(while)f Fi(\013)e(>)h(\013)975 972 y +Fg(min)1028 967 y Fz(,)h(do)450 1050 y(i.)56 b(Set)10 +b Fi(s)h Fy( )666 1027 y Fi(R)693 1033 y Fh(k)712 1027 +y Fi(y)p 663 1043 72 2 v 663 1075 a Fy(k)p Fi(y)q Fy(k)717 +1064 y Fg(2)717 1087 y(2)739 1050 y Fz(.)526 1143 y(Solv)o(e)f(max)704 +1120 y(\()p Fi(x)738 1108 y Fh(T)762 1120 y Fi(s)p Fz(\))792 +1108 y Fg(2)p 704 1135 106 2 v 721 1168 a Fy(k)p Fi(x)p +Fy(k)777 1156 y Fg(2)777 1179 y(2)846 1143 y Fz(s.t.)15 +b Fi(x)9 b Fy(2)h(S)995 1129 y Fh(m)1025 1143 y Fi(:)450 +1281 y Fz(ii.)46 b(Set)10 b Fi(s)h Fy( )663 1254 y Fi(R)690 +1243 y Fh(T)690 1267 y(k)715 1254 y Fi(x)p 663 1273 73 +2 v 663 1306 a Fy(k)p Fi(x)p Fy(k)719 1294 y Fg(2)719 +1317 y(2)740 1281 y Fz(.)526 1373 y(Solv)o(e)f(max)704 +1350 y(\()p Fi(y)736 1338 y Fh(T)761 1350 y Fi(s)p Fz(\))791 +1338 y Fg(2)p 704 1366 105 2 v 721 1398 a Fy(k)p Fi(y)q +Fy(k)775 1387 y Fg(2)775 1409 y(2)845 1373 y Fz(s.t.)k +Fi(y)e Fy(2)d(S)992 1359 y Fh(n)1014 1373 y Fi(:)450 +1495 y Fz(iii.)36 b Fi(\014)11 b Fy( )607 1472 y Fz(\()p +Fi(x)641 1461 y Fh(T)665 1472 y Fi(R)692 1478 y Fh(k)711 +1472 y Fi(y)q Fz(\))743 1461 y Fg(2)p 607 1488 154 2 +v 612 1520 a Fy(k)p Fi(x)p Fy(k)668 1509 y Fg(2)668 1532 +y(2)684 1520 y Fy(k)p Fi(y)q Fy(k)738 1509 y Fg(2)738 +1532 y(2)765 1495 y Fz(.)450 1587 y(iv.)37 b(If)11 b +Fi(l)f(>)g Fz(1:)15 b Fi(\013)10 b Fy( )745 1564 y Fi(\014)f +Fy(\000)814 1555 y Fz(\026)809 1564 y Fi(\014)p 745 1579 +87 2 v 782 1603 a Fz(\026)777 1612 y Fi(\014)836 1587 +y Fz(.)450 1663 y(v.)531 1654 y(\026)526 1663 y Fi(\014)i +Fy( )f Fi(\014)r Fz(.)450 1717 y(End)h Fi(l)p Fz(-lo)q(op.)374 +1771 y(\(c\))32 b Fi(x)470 1777 y Fh(k)498 1771 y Fy( )10 +b Fi(x)p Fz(,)i Fi(y)602 1777 y Fh(k)631 1771 y Fy( )e +Fi(y)q Fz(.)374 1851 y(\(d\))28 b Fi(d)468 1857 y Fh(k)497 +1851 y Fy( )574 1825 y Fi(x)594 1813 y Fh(T)594 1837 +y(k)618 1825 y Fi(R)645 1831 y Fh(k)664 1825 y Fi(y)681 +1831 y Fh(k)p 547 1843 181 2 v 547 1876 a Fy(k)p Fi(x)585 +1882 y Fh(k)603 1876 y Fy(k)621 1864 y Fg(2)621 1887 +y(2)638 1876 y Fy(k)p Fi(y)673 1882 y Fh(k)692 1876 y +Fy(k)710 1864 y Fg(2)710 1887 y(2)732 1851 y Fz(.)374 +1933 y(\(e\))k Fi(A)476 1939 y Fh(k)505 1933 y Fy( )10 +b Fi(A)576 1939 y Fh(k)q Ff(\000)p Fg(1)643 1933 y Fz(+)e +Fi(d)696 1939 y Fh(k)715 1933 y Fi(x)735 1939 y Fh(k)754 +1933 y Fi(y)772 1921 y Fh(T)771 1945 y(k)797 1933 y Fz(.)374 +1986 y(\(f)s(\))34 b Fi(R)477 1992 y Fh(k)q Fg(+1)544 +1986 y Fy( )10 b Fi(R)616 1992 y Fh(k)642 1986 y Fy(\000)e +Fi(d)695 1992 y Fh(k)715 1986 y Fi(x)735 1992 y Fh(k)754 +1986 y Fi(y)772 1975 y Fh(T)771 1999 y(k)796 1986 y Fz(.)374 +2040 y(\(g\))30 b Fi(\032)468 2046 y Fh(k)q Fg(+1)535 +2040 y Fy( )10 b Fi(\032)598 2046 y Fh(k)625 2040 y Fy(\000)e +Fi(\014)r Fz(.)374 2107 y(End)i Fi(k)q Fz(-lo)q(op.)751 +2190 y(Fig.)h(1.)35 b(Computing)9 b(an)i(SDD)p eop +%%Page: 6 6 +6 5 bop 225 125 a Fv(6)71 b Fu(\001)78 b Fv(T.)13 b(G.)f(Kolda)g(and)h +(D.)f(P)m(.)g(O'Lea)o(ry)299 233 y Ft(the)17 b(\014rst)g(v)o(ector)g +(tried)g(is)g(accepted,)h(no)e(extra)h(computational)e(exp)q(ense)j(is) +e(incurred)299 283 y(b)q(ecause)21 b(the)f(computed)f(v)o(ector)h +Fr(s)h Ft(=)g Fr(R)987 289 y Fp(k)1007 283 y Fr(y)g Ft(is)e(used)h(in)f +(the)h(inner)g(iteration.)33 b(This)299 332 y(sc)o(heme)14 +b(is)g(sho)o(wn)g(to)f(b)q(e)i(linearly)e(con)o(v)o(ergen)o(t)h +(\(Theorem)g(4\).)225 390 y(\(4\))21 b Fq(SVD)d Ft(initialization)c +(uses)k(a)f(discrete)i(v)o(ersion)f(of)e(the)i(left)f(singular)g(v)o +(ector)h Fr(v)g Ft(of)f Fr(R)1688 396 y Fp(k)1708 390 +y Ft(,)299 440 y(corresp)q(onding)h(to)f(the)i(largest)e(singular)g(v)n +(alue,)g(to)g(initialize)f(the)i(iteration.)29 b(If)17 +b(the)299 490 y(in)o(teger)g(restriction)g(on)f(our)g(problem)f(\(1\))i +(is)f(remo)o(v)o(ed,)g(then)h(the)g(singular)e(v)o(ector)i(is)299 +540 y(optimal,)9 b(and)j(w)o(e)g(can)g(form)e(a)i(discrete)i(appro)o +(ximation)8 b(to)k(it)g(b)o(y)g(\014nding)f Fr(y)i Fs(2)f(S)1609 +524 y Fp(n)1643 540 y Ft(that)299 589 y(is)i(a)f(discrete)j(appro)o +(ximation)11 b(to)i Fr(v)q Ft(;)h(that)g(is,)f(\014nd)h(a)g +Fr(y)i Ft(that)e(solv)o(es)655 663 y(min)j Fs(k)s Ft(^)-24 +b Fr(y)11 b Fs(\000)e Fr(v)q Fs(k)878 669 y Fn(2)934 +663 y Ft(s.t.)18 b Fr(y)13 b Fs(2)f(S)1109 646 y Fp(n)1131 +663 y Fr(;)e Ft(^)-24 b Fr(y)13 b Fs(\021)f Fr(y)q(=)p +Fs(k)p Fr(y)q Fs(k)1332 669 y Fn(2)1352 663 y Fr(:)302 +b Ft(\(7\))299 737 y(This)14 b(also)f(yields)h(a)f(linearly)g(con)o(v)o +(ergen)o(t)i(algorithm)c(\(Theorem)i(6\).)225 810 y(W)m(e)g(conclude)i +(this)f(section)h(with)e(the)i(pro)q(of)e(of)h(these)h(con)o(v)o +(ergence)g(results.)267 884 y Fk(Theorem)21 b(3.)g Fq([Kolda)15 +b(1997])h(The)f(se)n(quenc)n(e)g Fs(f)p Fr(A)1083 890 +y Fp(k)1104 884 y Fs(g)f Fq(gener)n(ate)n(d)i(by)f(the)g(SDD)h +(algorithm)225 933 y(with)g(MAX)h(initialization)e(c)n(onver)n(ges)i +(to)g Fr(A)g Fq(in)g(the)g(F)m(r)n(ob)n(enius)f(norm.)24 +b(F)m(urthermor)n(e,)16 b(the)225 983 y(r)n(ate)e(of)h(c)n(onver)n +(genc)n(e)h(is)e(at)h(le)n(ast)g(line)n(ar.)267 1056 +y Fk(Pr)o(oof.)21 b Ft(Without)13 b(loss)h(of)f(generalit)o(y)m(,)f +(assume)i(that)f Fr(R)1187 1062 y Fp(k)1219 1056 y Fs(6)p +Ft(=)e(0)j(for)f(all)f Fr(k)q Ft(;)i(otherwise,)g(the)225 +1106 y(algorithm)d(terminates)j(at)g(the)g(exact)h(solution.)i +(Consider)e(a)e(\014xed)i(index)f Fr(k)q Ft(,)f(and)h(let)g(\()p +Fr(i;)7 b(j)r Ft(\))225 1156 y(b)q(e)14 b(the)f(index)h(of)e(the)i +(largest)f(magnitude)e(elemen)o(t)i(in)g Fr(R)1150 1162 +y Fp(k)1170 1156 y Ft(.)k(Then)d(the)g(MAX)f(initialization)225 +1206 y(sc)o(heme)h(c)o(ho)q(oses)h Fr(y)e Ft(=)f Fr(e)611 +1212 y Fp(j)629 1206 y Ft(.)18 b(Since)c(the)g(\014rst)h(part)e(of)g +(the)i(inner)f(iteration)f(pic)o(ks)h(the)g(optimal)225 +1256 y Fr(x)p Ft(,)f(it)h(m)o(ust)e(b)q(e)j(as)f(least)g(as)g(go)q(o)q +(d)f(as)h(c)o(ho)q(osing)g Fr(x)d Ft(=)h Fr(e)1093 1262 +y Fp(i)1107 1256 y Ft(,)i(so)594 1327 y(\()p Fr(x)634 +1312 y Fp(T)634 1339 y(k)660 1327 y Fr(R)692 1333 y Fp(k)712 +1327 y Fr(y)732 1333 y Fp(k)752 1327 y Ft(\))768 1312 +y Fn(2)p 588 1345 206 2 v 588 1383 a Fs(k)p Fr(x)633 +1389 y Fp(k)653 1383 y Fs(k)674 1369 y Fn(2)674 1395 +y(2)692 1383 y Fs(k)p Fr(y)733 1389 y Fp(k)754 1383 y +Fs(k)775 1369 y Fn(2)775 1395 y(2)809 1355 y Fs(\025)861 +1327 y Ft(\()p Fr(e)896 1312 y Fp(T)896 1338 y(i)922 +1327 y Fr(R)954 1333 y Fp(k)974 1327 y Fr(e)993 1333 +y Fp(j)1011 1327 y Ft(\))1027 1312 y Fn(2)p 858 1345 +191 2 v 858 1383 a Fs(k)p Fr(e)898 1389 y Fp(i)912 1383 +y Fs(k)933 1369 y Fn(2)933 1395 y(2)952 1383 y Fs(k)p +Fr(e)992 1389 y Fp(j)1009 1383 y Fs(k)1030 1369 y Fn(2)1030 +1395 y(2)1065 1355 y Fs(\025)e Fr(r)1129 1338 y Fn(2)1128 +1365 y Fp(ij)1168 1355 y Fs(\025)1217 1327 y(k)p Fr(R)1270 +1333 y Fp(k)1290 1327 y Fs(k)1311 1312 y Fn(2)1311 1338 +y Fp(F)p 1217 1345 122 2 v 1247 1383 a Fr(mn)1350 1355 +y(:)304 b Ft(\(8\))225 1452 y(Th)o(us)267 1551 y Fs(k)p +Fr(R)320 1557 y Fp(k)q Fn(+1)382 1551 y Fs(k)403 1534 +y Fn(2)403 1561 y Fp(F)442 1551 y Ft(=)12 b Fs(k)p Fr(R)539 +1557 y Fp(k)558 1551 y Fs(k)579 1534 y Fn(2)579 1561 +y Fp(F)616 1551 y Fs(\000)668 1523 y Ft(\()p Fr(x)708 +1508 y Fp(T)708 1534 y(k)734 1523 y Fr(R)766 1529 y Fp(k)786 +1523 y Fr(y)806 1529 y Fp(k)827 1523 y Ft(\))843 1508 +y Fn(2)p 662 1541 206 2 v 662 1579 a Fs(k)p Fr(x)707 +1585 y Fp(k)727 1579 y Fs(k)748 1565 y Fn(2)748 1590 +y(2)767 1579 y Fs(k)p Fr(y)808 1585 y Fp(k)828 1579 y +Fs(k)849 1565 y Fn(2)849 1590 y(2)884 1551 y Fs(\024)928 +1492 y Fo(\022)958 1551 y Ft(1)d Fs(\000)1055 1523 y +Ft(1)p 1035 1541 62 2 v 1035 1579 a Fr(mn)1101 1492 y +Fo(\023)1139 1551 y Fs(k)p Fr(R)1192 1557 y Fp(k)1211 +1551 y Fs(k)1232 1534 y Fn(2)1232 1561 y Fp(F)1271 1551 +y Fs(\024)1315 1492 y Fo(\022)1346 1551 y Ft(1)g Fs(\000)1442 +1523 y Ft(1)p 1422 1541 V 1422 1579 a Fr(mn)1489 1492 +y Fo(\023)1519 1501 y Fp(k)1546 1551 y Fs(k)p Fr(R)1599 +1557 y Fn(0)1617 1551 y Fs(k)1638 1534 y Fn(2)1638 1561 +y Fp(F)1666 1551 y Fr(:)225 1650 y Ft(Hence)15 b Fs(k)p +Fr(R)401 1656 y Fp(k)421 1650 y Fs(k)442 1656 y Fp(F)481 +1650 y Fs(!)c Ft(0,)i(and)h(the)g(rate)h(of)e(con)o(v)o(ergence)j(is)d +(at)h(least)g(linear.)p 1437 1625 29 2 v 1437 1650 2 +25 v 1464 1650 V 1437 1652 29 2 v 267 1723 a Fk(Theorem)21 +b(4.)g Fq([Kolda)15 b(1997])h(The)f(se)n(quenc)n(e)g +Fs(f)p Fr(A)1083 1729 y Fp(k)1104 1723 y Fs(g)f Fq(gener)n(ate)n(d)i +(by)f(the)g(SDD)h(algorithm)225 1773 y(with)h(THR)g(initialization)f(c) +n(onver)n(ges)i(to)f Fr(A)h Fq(in)f(the)g(F)m(r)n(ob)n(enius)h(norm.)26 +b(F)m(urthermor)n(e,)16 b(the)225 1823 y(r)n(ate)e(of)h(c)n(onver)n +(genc)n(e)h(is)e(at)h(le)n(ast)g(line)n(ar.)267 1896 +y Fk(Pr)o(oof.)21 b Ft(The)15 b(pro)q(of)e(is)h(similar)d(to)j(that)g +(for)g(Theorem)f(3)h(and)f(so)h(is)g(omitted.)p 1582 +1871 V 1582 1896 2 25 v 1609 1896 V 1582 1898 29 2 v +267 1969 a(Using)c(argumen)o(ts)g(similar)e(to)j(those)h(in)e(Theorem)g +(2,)h(w)o(e)g(can)g(see)h(that)f(the)g(discretization)225 +2019 y(of)i(the)i(singular)e(v)o(ector)i(for)e(SVD)h(initialization)d +(can)j(b)q(e)h(computed)e(easily)m(.)267 2092 y Fk(Theorem)21 +b(5.)g Fq([Kolda)13 b(1997])h(F)m(or)f(the)g(inte)n(ger)g(pr)n(o)n(gr)n +(am)f(\(7\),)i(if)e(it)h(is)g(known)h(that)f Fr(y)i Fq(has)225 +2142 y(exactly)g Fr(J)k Fq(nonzer)n(os,)c(then)g(the)g(closest)g +Fr(y)e Fs(2)e(S)984 2127 y Fp(n)1022 2142 y Fq(to)k Fr(v)h +Fq(is)f(given)g(by)648 2238 y Fr(y)668 2244 y Fp(i)680 +2248 y Fm(j)709 2238 y Ft(=)753 2180 y Fo(\032)794 2213 +y Fq(sign)p Ft(\()p Fr(v)902 2219 y Fp(i)914 2223 y Fm(j)932 +2213 y Ft(\))21 b Fq(if)14 b Ft(1)e Fs(\024)f Fr(j)j +Fs(\024)e Fr(J)794 2263 y Ft(0)154 b Fq(if)14 b Fr(J)f +Ft(+)d(1)h Fs(\024)h Fr(j)i Fs(\024)e Fr(n)1285 2238 +y(;)225 2335 y Fq(wher)n(e)i(the)h(elements)g(of)g Fr(v)h +Fq(have)g(b)n(e)n(en)f(sorte)n(d)f(so)i(that)744 2409 +y Fs(j)p Fr(v)776 2415 y Fp(i)788 2419 y Fj(1)805 2409 +y Fs(j)11 b(\025)h(j)p Fr(v)904 2415 y Fp(i)916 2419 +y Fj(2)934 2409 y Fs(j)f(\025)h(\001)7 b(\001)g(\001)j(\025)i(j)p +Fr(v)1137 2415 y Fp(i)1149 2419 y Fm(m)1178 2409 y Fs(j)p +Fr(:)267 2483 y Ft(Therefore,)i(there)h(are)f(only)f +Fr(n)h Ft(p)q(ossible)g Fr(y)q Ft(-v)o(ectors)h(to)f(c)o(hec)o(k)g(to)g +(determine)g(the)g(optimal)225 2532 y(solution)f(for)h(\(7\).)p +eop +%%Page: 7 7 +7 6 bop 965 125 a Fv(Semidiscrete)12 b(Matrix)g(Decomp)q(osition)77 +b Fu(\001)70 b Fv(7)267 233 y Fk(Theorem)21 b(6.)g Fq([Kolda)15 +b(1997])h(The)f(se)n(quenc)n(e)g Fs(f)p Fr(A)1083 239 +y Fp(k)1104 233 y Fs(g)f Fq(gener)n(ate)n(d)i(by)f(the)g(SDD)h +(algorithm)225 283 y(with)h(SVD)h(initialization)f(c)n(onver)n(ges)h +(to)g Fr(A)g Fq(in)f(the)h(F)m(r)n(ob)n(enius)g(norm.)27 +b(F)m(urthermor)n(e,)17 b(the)225 332 y(r)n(ate)d(of)h(c)n(onver)n +(genc)n(e)h(is)e(at)h(le)n(ast)g(line)n(ar.)267 406 y +Fk(Pr)o(oof.)21 b Ft(Let)13 b(\()p Fr(\033)o(;)7 b(u;)g(v)q +Ft(\))12 b(b)q(e)h(the)g(\014rst)g(singular)f(triplet)h(of)f +Fr(R)1222 412 y Fp(k)1241 406 y Ft(.)18 b(Denote)13 b(the)g(\()p +Fr(i;)7 b(j)r Ft(\))13 b(en)o(try)g(of)225 455 y Fr(R)257 +461 y Fp(k)292 455 y Ft(b)o(y)i Fr(r)370 461 y Fp(ij)399 +455 y Ft(.)21 b(Cho)q(ose)16 b(an)f(initial)e Fr(y)k +Ft(that)e(solv)o(es)g(\(7\).)22 b(Without)14 b(loss)h(of)g(generalit)o +(y)m(,)f(assume)225 505 y(that)g(the)g(elemen)o(ts)g(of)f +Fr(v)j Ft(are)e(ordered)h(so)f(that)765 579 y Fs(j)p +Fr(v)797 585 y Fn(1)815 579 y Fs(j)d(\025)h(j)p Fr(v)914 +585 y Fn(2)932 579 y Fs(j)f(\025)h Fr(:)7 b(:)g(:)j Fs(\025)i(j)p +Fr(v)1135 585 y Fp(n)1157 579 y Fs(j)p Fr(:)225 653 y +Ft(Let)i Fr(J)k Ft(b)q(e)d(the)f(n)o(um)o(b)q(er)f(of)h(nonzeros)h(in)e +Fr(y)q Ft(.)19 b(Then)536 765 y Fr(\033)12 b Ft(=)g Fr(u)640 +748 y Fp(T)666 765 y Fr(Rv)h Ft(=)794 714 y Fp(J)775 +726 y Fo(X)776 814 y Fp(j)r Fn(=1)842 765 y Fr(v)862 +771 y Fp(j)901 714 y(m)886 726 y Fo(X)889 814 y Fp(i)p +Fn(=1)953 765 y Fr(r)972 771 y Fp(ij)1001 765 y Fr(u)1025 +771 y Fp(i)1048 765 y Ft(+)1131 714 y Fp(n)1111 726 y +Fo(X)1089 815 y Fp(j)r Fn(=)p Fp(J)s Fn(+1)1200 765 y +Fr(v)1220 771 y Fp(j)1260 714 y(m)1245 726 y Fo(X)1248 +814 y Fp(i)p Fn(=1)1312 765 y Fr(r)1331 771 y Fp(ij)1360 +765 y Fr(u)1384 771 y Fp(i)1397 765 y Fr(;)225 882 y +Ft(and)g(the)g(largest)g(magnitude)f(elemen)o(ts)g(of)h +Fr(v)h Ft(m)o(ust)e(corresp)q(ond)j(to)d(the)i(largest)f(magnitude)225 +932 y(elemen)o(ts)h(of)f Fr(Ru)g Ft(\(since)i Fr(v)e +Ft(=)f Fr(\033)q(Ru)p Ft(\),)i(so)796 995 y Fp(J)777 +1007 y Fo(X)778 1095 y Fp(j)r Fn(=1)844 1046 y Fr(v)864 +1052 y Fp(j)904 995 y(m)888 1007 y Fo(X)891 1095 y Fp(i)p +Fn(=1)955 1046 y Fr(r)974 1052 y Fp(ij)1003 1046 y Fr(u)1027 +1052 y Fp(i)1052 1046 y Fs(\025)1101 1018 y Fr(J)p 1101 +1037 28 2 v 1102 1075 a(n)1133 1046 y(\033)o(:)225 1162 +y Ft(Eac)o(h)i Fr(v)350 1168 y Fp(i)380 1162 y Ft(is)g(less)g(than)g +(or)g(equal)g(to)f(one)h(in)g(magnitude,)e(so)i(substituting)g +Fr(y)i Ft(in)d(place)h(of)g Fr(v)225 1212 y Ft(yields)635 +1271 y Fp(J)616 1284 y Fo(X)617 1372 y Fp(j)r Fn(=1)683 +1323 y Fr(y)703 1329 y Fp(j)743 1271 y(m)728 1284 y Fo(X)731 +1372 y Fp(i)p Fn(=1)794 1323 y Fr(r)813 1329 y Fp(ij)842 +1323 y Fr(u)866 1329 y Fp(i)892 1323 y Ft(=)951 1271 +y Fp(m)935 1284 y Fo(X)938 1372 y Fp(i)p Fn(=1)1002 1323 +y Fr(u)1026 1329 y Fp(i)1066 1271 y(J)1047 1284 y Fo(X)1048 +1372 y Fp(j)r Fn(=1)1114 1323 y Fr(r)1133 1329 y Fp(ij)1162 +1323 y Fr(y)1182 1329 y Fp(j)1211 1323 y Fs(\025)1260 +1295 y Fr(J)t(\033)p 1260 1313 53 2 v 1273 1351 a(n)1317 +1323 y(:)225 1440 y Ft(\(Note)e(that)g(this)g(guaran)o(tees)h(that)f +Fr(Ry)f Fs(6)p Ft(=)f(0.\))18 b(Th)o(us)c(there)h(exists)d(^)-18 +b Fr({)14 b Ft(suc)o(h)h(that)805 1547 y Fr(u)827 1553 +y Fn(^)-15 b Fp({)869 1495 y(n)849 1508 y Fo(X)850 1596 +y Fp(j)r Fn(=1)916 1547 y Fr(r)933 1553 y Fn(^)g Fp({)o(j)964 +1547 y Fr(y)984 1553 y Fp(j)1013 1547 y Fs(\025)1066 +1519 y Fr(J)t(\033)p 1062 1537 62 2 v 1062 1576 a(mn)1128 +1547 y(:)225 1663 y Ft(Therefore,)15 b(setting)f Fr(x)d +Ft(=)h Fr(e)657 1669 y Fn(^)-15 b Fp({)687 1663 y Ft(giv)o(es)491 +1734 y(\()p Fr(x)531 1719 y Fp(T)531 1746 y(k)557 1734 +y Fr(R)589 1740 y Fp(k)609 1734 y Fr(y)629 1740 y Fp(k)649 +1734 y Ft(\))665 1719 y Fn(2)p 485 1753 206 2 v 485 1791 +a Fs(k)p Fr(x)530 1797 y Fp(k)550 1791 y Fs(k)571 1777 +y Fn(2)571 1802 y(2)589 1791 y Fs(k)p Fr(y)630 1797 y +Fp(k)651 1791 y Fs(k)672 1777 y Fn(2)672 1802 y(2)707 +1762 y Fs(\025)783 1734 y Fr(J)810 1719 y Fn(2)828 1734 +y Fr(\033)853 1719 y Fn(2)p 755 1753 145 2 v 755 1791 +a Fr(J)782 1779 y Fn(2)801 1791 y Fr(m)837 1779 y Fn(2)856 +1791 y Fr(n)881 1779 y Fn(2)916 1762 y Fs(\025)992 1734 +y Fr(\033)1017 1719 y Fn(2)p 965 1753 99 2 v 965 1791 +a Fr(m)1001 1779 y Fn(2)1020 1791 y Fr(n)1045 1779 y +Fn(2)1080 1762 y Ft(=)1228 1734 y Fs(k)p Fr(R)1281 1740 +y Fp(k)1301 1734 y Fs(k)1322 1719 y Fn(2)1322 1746 y +Fp(F)p 1129 1753 320 2 v 1129 1791 a Ft(min)n Fs(f)p +Fr(m;)7 b(n)p Fs(g)i(\001)f Fr(m)1385 1779 y Fn(2)1404 +1791 y Fr(n)1429 1779 y Fn(2)1453 1762 y Fr(:)201 b Ft(\(9\))225 +1859 y(The)14 b(pro)q(of)g(concludes)h(using)e(the)i(same)e(argumen)o +(ts)g(as)h(in)g(Theorem)f(3.)p 1439 1834 29 2 v 1439 +1859 2 25 v 1466 1859 V 1439 1861 29 2 v 267 1932 a(An)i(implemen)o +(tation)d(discussion)k(is)g(giv)o(en)f(in)g Fs(x)p Ft(6,)h(and)f(n)o +(umerical)f(comparisons)h(of)g(the)225 1982 y(di\013eren)o(t)g +(initialization)c(strategies)k(are)f(presen)o(ted)i(in)e +Fs(x)p Ft(7.)225 2072 y FA(3.)20 b(THE)14 b(WEIGHTED)g(SDD)225 +2138 y Ft(Let)f Fr(A)f Fs(2)f(<)410 2123 y Fp(m)p Fl(\002)p +Fp(n)501 2138 y Ft(b)q(e)j(a)e(giv)o(en)h(matrix,)e(and)i(let)g +Fr(W)k Fs(2)11 b(<)1108 2123 y Fp(m)p Fl(\002)p Fp(n)1199 +2138 y Ft(b)q(e)j(a)e(giv)o(en)h(matrix)e(of)h(nonneg-)225 +2188 y(ativ)o(e)i(w)o(eigh)o(ts.)20 b(The)15 b Fq(weighte)n(d)h(appr)n +(oximation)g(pr)n(oblem)e Ft(is)g(to)h(\014nd)g(a)f(matrix)f +Fr(B)i Fs(2)d(<)1641 2173 y Fp(m)p Fl(\002)p Fp(n)225 +2238 y Ft(that)i(solv)o(es)825 2311 y(min)j Fs(k)p Fr(A)9 +b Fs(\000)h Fr(B)r Fs(k)1070 2293 y Fn(2)1070 2321 y +Fp(W)1108 2311 y Fr(;)225 2383 y Ft(sub)r(ject)15 b(to)f(some)f +(constrain)o(ts)i(on)e Fr(B)r Ft(.)19 b(Here)c(the)g +Fq(weighte)n(d)f(norm)g Fs(k)9 b(\001)g(k)1375 2389 y +Fp(W)1426 2383 y Ft(is)14 b(de\014ned)h(as)762 2490 y +Fs(k)p Fr(A)p Fs(k)835 2473 y Fn(2)835 2501 y Fp(W)884 +2490 y Ft(=)943 2438 y Fp(m)927 2451 y Fo(X)930 2539 +y Fp(i)p Fn(=1)1014 2438 y Fp(n)994 2451 y Fo(X)996 2539 +y Fp(j)r Fn(=1)1061 2490 y Fr(a)1083 2473 y Fn(2)1083 +2501 y Fp(ij)1112 2490 y Fr(w)1142 2496 y Fp(ij)1171 +2490 y Fr(:)p eop +%%Page: 8 8 +8 7 bop 225 125 a Fv(8)71 b Fu(\001)78 b Fv(T.)13 b(G.)f(Kolda)g(and)h +(D.)f(P)m(.)g(O'Lea)o(ry)267 233 y Ft(The)f(case)h(where)h +Fr(B)g Ft(is)f(a)e(lo)o(w)h(rank)g(matrix)e(has)j(b)q(een)g(considered) +h(b)o(y)e(Gabriel)f(and)h(Zamir)225 283 y([1979])d(and)j(others,)g(and) +g(they)g(obtain)e(a)h(solution)g(with)g(some)g(similariti)o(es)f(to)h +(the)h(truncated)225 332 y(singular)j(v)n(alue)h(decomp)q(osition,)e +(although)h(computation)f(is)i(m)o(uc)o(h)f(more)g(exp)q(ensiv)o(e.)23 +b(W)m(e)225 382 y(sho)o(w)17 b(ho)o(w)g(to)g(generate)i(a)d(w)o(eigh)o +(ted)i(appro)o(ximation)c(of)j(the)g(form)f Fr(dxy)1433 +367 y Fp(T)1459 382 y Ft(.)28 b(As)18 b(with)f(the)225 +432 y(regular)12 b(SDD,)f(w)o(e)h(form)f(the)i(1-term)e(appro)o +(ximations)e(iterativ)o(ely)j(and)f(add)h(these)i(appro)o(x-)225 +482 y(imations)9 b(together)k(to)f(build)e(up)i(a)g Fr(k)q +Ft(-term)e(appro)o(ximation.)15 b(A)o(t)c(eac)o(h)i(step,)f(then,)h(w)o +(e)f(solv)o(e)225 532 y(the)i(problem)402 606 y(min)j +Fr(F)517 612 y Fp(k)537 606 y Ft(\()p Fr(d;)7 b(x;)g(y)q +Ft(\))k Fs(\021)h(k)p Fr(R)782 612 y Fp(k)811 606 y Fs(\000)d +Fr(dxy)919 589 y Fp(T)946 606 y Fs(k)967 589 y Fn(2)967 +616 y Fp(W)1041 606 y Ft(s.t.)18 b Fr(x)11 b Fs(2)h(S)1218 +589 y Fp(m)1249 606 y Fr(;)18 b(y)c Fs(2)d(S)1380 589 +y Fp(n)1403 606 y Fr(;)18 b(d)11 b(>)h Ft(0)p Fr(:)103 +b Ft(\(10\))225 686 y(Here)20 b Fr(R)360 692 y Fp(k)398 +686 y Fs(\021)f Fr(A)13 b Fs(\000)537 655 y Fo(P)581 +665 y Fp(k)q Fl(\000)p Fn(1)581 699 y Fp(i)p Fn(=1)651 +686 y Fr(d)673 692 y Fp(i)686 686 y Fr(x)710 692 y Fp(i)724 +686 y Fr(y)745 671 y Fp(T)744 697 y(i)790 686 y Ft(is)18 +b(the)h(residual)f(matrix.)30 b(As)18 b(with)g(the)h(regular)f(SDD,)225 +736 y(this)e(is)f(a)h(mixed)e(in)o(teger)i(programming)c(problem)j +(that)g(can)h(b)q(e)h(rewritten)g(as)e(an)h(in)o(teger)225 +786 y(program.)29 b(First,)18 b(recall)g(the)h(de\014nition)e(of)h(the) +g Fq(Hadamar)n(d)g Ft(or)g Fq(elementwise)g(pr)n(o)n(duct)g +Ft(of)225 835 y(matrices;)13 b(that)h(is,)f(\()p Fr(A)d +Fs(\016)f Fr(B)r Ft(\))682 841 y Fp(ij)723 835 y Ft(=)j +Fr(a)789 841 y Fp(ij)818 835 y Fr(b)836 841 y Fp(ij)865 +835 y Ft(.)267 909 y Fk(Theorem)21 b(7.)g Fq(Solving)14 +b(the)g(mixe)n(d)g(inte)n(ger)f(pr)n(o)n(gr)n(am)g(\(10\))h(is)f(e)n +(quivalent)h(to)g(solving)f(the)225 959 y(inte)n(ger)h(pr)n(o)n(gr)n +(am)455 1070 y Ft(max)560 1060 y(~)551 1070 y Fr(F)578 +1076 y Fp(k)598 1070 y Ft(\()p Fr(x;)7 b(y)q Ft(\))12 +b Fs(\021)761 1006 y Fo(\002)779 1040 y Fr(x)803 1025 +y Fp(T)829 1040 y Ft(\()p Fr(R)877 1046 y Fp(k)906 1040 +y Fs(\016)d Fr(W)d Ft(\))12 b Fr(y)1030 1006 y Fo(\003)1048 +1015 y Fn(2)p 754 1061 320 2 v 754 1099 a Ft(\()p Fr(x)d +Fs(\016)g Fr(x)p Ft(\))873 1087 y Fp(T)906 1099 y Fr(W)k +Ft(\()p Fr(y)e Fs(\016)e Fr(y)q Ft(\))1116 1070 y(s.t.)18 +b Fr(x)12 b Fs(2)f(S)1293 1053 y Fp(m)1325 1070 y Fr(;)18 +b(y)13 b Fs(2)e(S)1455 1053 y Fp(n)1478 1070 y Fr(:)156 +b Ft(\(11\))267 1167 y Fk(Pr)o(oof.)21 b Ft(The)15 b(pro)q(of)e(is)h +(analogous)f(to)g(that)h(of)g(Theorem)f(1)h(except)h(that)754 +1267 y Fr(d)776 1249 y Fl(\003)806 1267 y Ft(=)889 1238 +y Fr(x)913 1223 y Fp(T)939 1238 y Ft(\()p Fr(R)987 1244 +y Fp(k)1016 1238 y Fs(\016)9 b Fr(W)d Ft(\))11 b Fr(y)p +855 1257 V 855 1295 a Ft(\()p Fr(x)e Fs(\016)g Fr(x)p +Ft(\))974 1283 y Fp(T)1007 1295 y Fr(W)k Ft(\()p Fr(y)e +Fs(\016)e Fr(y)q Ft(\))1179 1267 y Fr(:)p 265 1334 29 +2 v 265 1359 2 25 v 291 1359 V 265 1361 29 2 v 267 1433 +a Ft(As)19 b(with)f(the)h(regular)g(SDD,)e(an)i(alternating)f(metho)q +(d)f(will)h(b)q(e)h(used)g(to)g(generate)h(an)225 1483 +y(appro)o(ximate)12 b(solution)h(to)h(\(11\).)k(Assuming)12 +b(that)i Fr(y)i Ft(is)e(\014xed,)1256 1472 y(~)1246 1483 +y Fr(F)1273 1489 y Fp(k)1307 1483 y Ft(can)h(b)q(e)f(written)g(as)788 +1586 y(~)779 1596 y Fr(F)806 1602 y Fp(k)826 1596 y Ft(\()p +Fr(x;)7 b(y)q Ft(\))12 b(=)1003 1532 y Fo(\000)1022 1566 +y Fr(x)1046 1550 y Fp(T)1072 1566 y Fr(s)1091 1532 y +Fo(\001)1110 1541 y Fn(2)p 982 1587 167 2 v 982 1625 +a Ft(\()p Fr(x)e Fs(\016)f Fr(x)p Ft(\))1102 1613 y Fp(T)1128 +1625 y Fr(v)1154 1596 y(;)480 b Ft(\(12\))225 1695 y(where)20 +b Fr(s)h Fs(\021)g Ft(\()p Fr(R)491 1701 y Fp(k)524 1695 +y Fs(\016)12 b Fr(W)6 b Ft(\))h Fr(y)22 b Ft(and)d Fr(v)j +Fs(\021)e Fr(W)13 b Ft(\()p Fr(y)i Fs(\016)e Fr(y)q Ft(\).)35 +b(T)m(o)18 b(determine)h(the)h(maxim)n(um)o(,)d(2)1643 +1680 y Fp(m)1687 1695 y Fs(\000)225 1745 y Ft(1)h(p)q(ossibilities)g(m) +o(ust)g(b)q(e)h(c)o(hec)o(k)o(ed.)33 b(Again,)19 b(this)g(can)f(b)q(e)i +(reduced)g(to)e(just)h(c)o(hec)o(king)g Fr(m)225 1795 +y Ft(p)q(ossibilities,)13 b(although)g(the)h(pro)q(of)g(is)f(more)g +(di\016cult)h(than)f(that)h(for)g(Theorem)f(2.)267 1868 +y Fk(Theorem)21 b(8.)g Fq(F)m(or)16 b(the)h(inte)n(ger)f(pr)n(o)n(gr)n +(am)g(\(12\),)h(if)f(it)g(is)g(known)h(that)g Fr(x)f +Fq(has)h(exactly)f Fr(J)225 1918 y Fq(nonzer)n(os,)f(then)g(the)g +(solution)g(is)g(given)g(by)642 2015 y Fr(x)666 2021 +y Fp(i)678 2025 y Fm(j)707 2015 y Ft(=)750 1957 y Fo(\032)792 +1990 y Ft(sign\()p Fr(s)899 1996 y Fp(i)911 2000 y Fm(j)929 +1990 y Ft(\))20 b(if)13 b(1)f Fs(\024)g Fr(j)i Fs(\024)d +Fr(J)792 2040 y Ft(0)152 b(if)13 b Fr(J)h Ft(+)9 b(1)j +Fs(\024)f Fr(j)j Fs(\024)e Fr(m)1291 2015 y(;)225 2114 +y Fq(wher)n(e)i(the)h(p)n(airs)g(of)f Ft(\()p Fr(s)597 +2120 y Fp(i)612 2114 y Fr(;)7 b(v)651 2120 y Fp(i)664 +2114 y Ft(\))15 b Fq(have)h(b)n(e)n(en)f(sorte)n(d)f(so)h(that)735 +2185 y Fs(j)p Fr(s)766 2191 y Fp(i)778 2195 y Fj(1)796 +2185 y Fs(j)p 735 2203 73 2 v 746 2241 a Fr(v)766 2247 +y Fp(i)778 2251 y Fj(1)824 2213 y Fs(\025)873 2185 y(j)p +Fr(s)904 2191 y Fp(i)916 2195 y Fj(2)934 2185 y Fs(j)p +873 2203 V 884 2241 a Fr(v)904 2247 y Fp(i)916 2251 y +Fj(2)962 2213 y Fs(\025)c(\001)c(\001)g(\001)j(\025)1114 +2185 y(j)p Fr(s)1145 2191 y Fp(i)1157 2195 y Fm(m)1187 +2185 y Fs(j)p 1114 2203 84 2 v 1125 2241 a Fr(v)1145 +2247 y Fp(i)1157 2251 y Fm(m)1203 2213 y Fr(:)267 2333 +y Fk(Pr)o(oof.)21 b Ft(First)14 b(note)f(that)g(if)f +Fr(s)767 2339 y Fp(i)794 2333 y Ft(is)g(zero,)i(then)f(a)g(nonzero)g(v) +n(alue)f(of)h Fr(x)1390 2339 y Fp(i)1416 2333 y Ft(cannot)g(a\013ect)h +(the)225 2383 y(n)o(umerator)h(of)488 2373 y(~)478 2383 +y Fr(F)6 b Ft(,)16 b(and)g Fr(x)646 2389 y Fp(i)674 2383 +y Ft(=)f(0)h(minim)o(izes)e(the)j(denominator,)d(so)i +Fr(x)1361 2389 y Fp(i)1389 2383 y Ft(=)g(0)f(is)h(optimal.)22 +b(If)225 2433 y Fr(v)245 2439 y Fp(i)271 2433 y Ft(=)12 +b(0,)i(then)h Fr(s)476 2439 y Fp(i)502 2433 y Ft(=)d(0,)i(so)g(c)o(ho)q +(ose)h Fr(x)800 2439 y Fp(i)825 2433 y Ft(=)e(0.)18 b(Therefore,)d(w)o +(e)g(need)g(only)e(consider)i(indices)g(for)225 2483 +y(whic)o(h)d Fr(s)361 2489 y Fp(i)387 2483 y Ft(and)g +Fr(v)486 2489 y Fp(i)512 2483 y Ft(are)g(nonzero,)h(and)f(without)g +(loss)g(of)f(generalit)o(y)m(,)g(w)o(e)h(will)f(assume)h(that)g(the)225 +2532 y Fr(s)244 2538 y Fp(i)272 2532 y Ft(are)i(all)f(p)q(ositiv)o(e)h +(and)f(ordered)j(so)d(that)h Fr(i)938 2538 y Fp(j)968 +2532 y Ft(=)e Fr(j)r Ft(,)h Fr(j)h Ft(=)e(1)p Fr(;)7 +b(:)g(:)g(:)e(;)i(m)p Ft(.)p eop +%%Page: 9 9 +9 8 bop 965 125 a Fv(Semidiscrete)12 b(Matrix)g(Decomp)q(osition)77 +b Fu(\001)70 b Fv(9)300 583 y Fz(\(1\))28 b(Let)11 b +Fi(R)464 589 y Fh(k)494 583 y Fz(denote)f(the)h(residual,)e(and)i +(initialize)e Fi(R)1049 588 y Fg(1)1075 583 y Fy( )h +Fi(A)p Fz(.)374 624 y(Let)h Fi(\032)455 630 y Fh(k)484 +624 y Fz(=)f Fy(k)p Fi(R)566 630 y Fh(k)584 624 y Fy(k)602 +613 y Fg(2)602 636 y Fh(W)648 624 y Fz(b)q(e)h(the)g(norm)f(of)h(the)g +(residual,)f(and)g(initialize)f Fi(\032)1321 629 y Fg(1)1348 +624 y Fy( )i(k)p Fi(R)1439 629 y Fg(1)1455 624 y Fy(k)1473 +613 y Fg(2)1473 636 y Fh(W)1508 624 y Fz(.)374 666 y(Let)g +Fi(A)463 672 y Fh(k)494 666 y Fz(denote)f(the)g Fi(k)q +Fz(-term)h(appro)o(ximat)o(ion)o(,)e(and)h(initialize)g +Fi(A)1267 671 y Fg(0)1294 666 y Fy( )g Fz(0.)374 708 +y(Cho)q(ose)g Fi(k)514 712 y Fg(max)573 708 y Fz(,)h(the)g(maxim)o(um)e +(n)o(um)o(b)q(er)g(of)i(terms)g(in)g(the)g(appro)o(xima)o(tion)o(.)374 +749 y(Cho)q(ose)f Fi(\032)514 754 y Fg(min)567 749 y +Fz(,)h(the)g(desired)f(accuracy)f(of)i(the)g(appro)o(ximat)o(ion.)374 +791 y(Cho)q(ose)f Fi(l)507 795 y Fg(max)565 791 y Fz(,)i(the)e(maxim)o +(um)f(allo)o(w)o(able)h(inner)g(iterations.)374 832 y(Cho)q(ose)g +Fi(\013)519 837 y Fg(min)571 832 y Fz(,)i(the)f(minim)o(um)e(relativ)o +(e)g(impro)o(v)o(emen)n(t,)g(and)h(set)h Fi(\013)f(>)g +Fz(2)p Fi(\013)1393 837 y Fh(min)1452 832 y Fz(.)300 +890 y(\(2\))28 b(F)m(or)11 b Fi(k)g Fz(=)f(1)p Fi(;)5 +b Fz(2)p Fi(;)h(:)f(:)h(:)g(;)f(k)650 894 y Fg(max)709 +890 y Fz(,)12 b(while)f Fi(\032)841 896 y Fh(k)870 890 +y Fi(>)f(\032)925 895 y Fg(min)978 890 y Fz(,)h(do)374 +944 y(\(a\))30 b(Cho)q(ose)10 b Fi(y)k Fz(so)d(that)g(\()p +Fi(R)764 950 y Fh(k)790 944 y Fy(\016)c Fi(W)e Fz(\))p +Fi(y)12 b Fy(6)p Fz(=)e(0..)374 998 y(\(b\))28 b(F)m(or)11 +b Fi(l)f Fz(=)g(1)p Fi(;)5 b Fz(2)p Fi(;)g(:)h(:)g(:)g(;)f(l)711 +1002 y Fg(max)769 998 y Fz(,while)11 b Fi(\013)e(>)i(\013)964 +1003 y Fg(min)1016 998 y Fz(,)g(do)450 1065 y(i.)56 b(Set)10 +b Fi(s)h Fy( )f Fz(\()p Fi(R)699 1071 y Fh(k)725 1065 +y Fy(\016)d Fi(W)e Fz(\))h Fi(y)q Fz(,)12 b Fi(v)g Fy( )e +Fi(W)h Fz(\()p Fi(y)e Fy(\016)e Fi(y)q Fz(\))q(.)526 +1129 y(Solv)o(e)j(max)723 1106 y(\()p Fi(x)757 1094 y +Fh(T)781 1106 y Fi(s)p Fz(\))811 1094 y Fg(2)p 704 1121 +144 2 v 704 1154 a Fz(\()p Fi(x)e Fy(\016)f Fi(x)p Fz(\))805 +1144 y Fh(T)829 1154 y Fi(v)884 1129 y Fz(s.t.)15 b Fi(x)9 +b Fy(2)h(S)1033 1115 y Fh(m)1063 1129 y Fi(:)450 1249 +y Fz(ii.)46 b(Set)10 b Fi(s)h Fy( )f Fz(\()p Fi(R)699 +1255 y Fh(k)725 1249 y Fy(\016)d Fi(W)e Fz(\))802 1235 +y Fh(T)827 1249 y Fi(x)p Fz(,)11 b Fi(v)g Fy( )f Fi(W)979 +1237 y Fh(T)1004 1249 y Fz(\()p Fi(x)d Fy(\016)h Fi(x)p +Fz(\))o(.)526 1314 y(Solv)o(e)i(max)704 1290 y(\()p Fi(y)736 +1279 y Fh(T)761 1290 y Fi(s)p Fz(\))791 1279 y Fg(2)p +704 1306 105 2 v 721 1339 a Fy(k)p Fi(y)q Fy(k)775 1327 +y Fg(2)775 1350 y(2)845 1314 y Fz(s.t.)k Fi(y)e Fy(2)d(S)992 +1300 y Fh(n)1014 1314 y Fi(:)450 1454 y Fz(iii.)36 b +Fi(\014)11 b Fy( )608 1392 y Fo(\002)625 1423 y Fi(x)645 +1411 y Fh(T)669 1423 y Fz(\()p Fi(R)710 1429 y Fh(k)737 +1423 y Fy(\016)c Fi(W)e Fz(\))h Fi(y)838 1392 y Fo(\003)856 +1400 y Fg(2)p 607 1446 267 2 v 607 1479 a Fz(\()p Fi(x)i +Fy(\016)f Fi(x)p Fz(\))708 1469 y Fh(T)732 1479 y Fi(W)k +Fz(\()p Fi(y)e Fy(\016)f Fi(y)q Fz(\))879 1454 y(.)450 +1542 y(iv.)37 b(If)11 b Fi(l)f(>)g Fz(1:)15 b Fi(\013)10 +b Fy( )745 1519 y Fi(\014)f Fy(\000)814 1510 y Fz(\026)809 +1519 y Fi(\014)p 745 1535 87 2 v 782 1559 a Fz(\026)777 +1567 y Fi(\014)836 1542 y Fz(.)450 1618 y(v.)531 1610 +y(\026)526 1618 y Fi(\014)i Fy( )f Fi(\014)r Fz(.)450 +1672 y(End)h Fi(l)p Fz(-lo)q(op.)374 1726 y(\(c\))32 +b Fi(x)470 1732 y Fh(k)498 1726 y Fy( )10 b Fi(x)p Fz(,)i +Fi(y)602 1732 y Fh(k)631 1726 y Fy( )e Fi(y)q Fz(.)374 +1806 y(\(d\))28 b Fi(d)468 1812 y Fh(k)497 1806 y Fy( )565 +1780 y Fi(x)585 1768 y Fh(T)585 1792 y(k)609 1780 y Fz(\()p +Fi(R)650 1786 y Fh(k)676 1780 y Fy(\016)7 b Fi(W)e Fz(\))h +Fi(y)776 1786 y Fh(k)p 547 1799 267 2 v 547 1831 a Fz(\()p +Fi(x)h Fy(\016)h Fi(x)p Fz(\))648 1822 y Fh(T)672 1831 +y Fi(W)j Fz(\()p Fi(y)e Fy(\016)e Fi(y)q Fz(\))819 1806 +y(.)374 1885 y(\(e\))32 b Fi(A)476 1891 y Fh(k)505 1885 +y Fy( )10 b Fi(A)576 1891 y Fh(k)q Ff(\000)p Fg(1)643 +1885 y Fz(+)e Fi(d)696 1891 y Fh(k)715 1885 y Fi(x)735 +1891 y Fh(k)754 1885 y Fi(y)772 1873 y Fh(T)771 1897 +y(k)797 1885 y Fz(.)374 1939 y(\(f)s(\))34 b Fi(R)477 +1945 y Fh(k)q Fg(+1)544 1939 y Fy( )10 b Fi(R)616 1945 +y Fh(k)642 1939 y Fy(\000)e Fi(d)695 1945 y Fh(k)715 +1939 y Fi(x)735 1945 y Fh(k)754 1939 y Fi(y)772 1927 +y Fh(T)771 1951 y(k)796 1939 y Fz(.)374 1993 y(\(g\))30 +b Fi(\032)468 1999 y Fh(k)q Fg(+1)535 1993 y Fy( )10 +b Fi(\032)598 1999 y Fh(k)625 1993 y Fy(\000)e Fi(\014)r +Fz(.)374 2059 y(End)i Fi(k)q Fz(-lo)q(op.)705 2209 y(Fig.)h(2.)35 +b(W)m(eigh)o(ted)10 b(SDD)h(Algorithm)p eop +%%Page: 10 10 +10 9 bop 225 125 a Fv(10)71 b Fu(\001)78 b Fv(T.)13 b(G.)f(Kolda)g(and) +h(D.)g(P)m(.)e(O'Lea)o(ry)267 233 y Ft(W)m(e)17 b(complete)h(the)g(pro) +q(of)g(b)o(y)g(sho)o(wing)f(that)i(if)e(the)i(optimal)c(solution)i(has) +i(nonzero)q(es)225 283 y(with)14 b(indices)g(in)f(some)g(set)i +Fr(I)s Ft(,)f(and)g(if)f Fr(q)f Fs(2)f Fr(I)18 b Ft(and)c +Fr(p)d(<)h(q)q Ft(,)h(then)i Fr(p)c Fs(2)g Fr(I)s Ft(.)267 +333 y(Assume)i(to)h(the)g(con)o(trary)m(,)f(and)h(partition)f +Fr(I)k Ft(in)o(to)c Fr(I)1107 339 y Fn(1)1134 333 y Fs([)c +Fr(I)1189 339 y Fn(2)1208 333 y Ft(,)k(where)i(indices)f(in)f +Fr(I)1555 339 y Fn(1)1588 333 y Ft(are)h(less)225 382 +y(than)f Fr(p)f Ft(and)h(those)g(in)g Fr(I)607 388 y +Fn(2)638 382 y Ft(are)h(greater)f(than)g Fr(p)p Ft(.)18 +b(The)13 b(case)g Fr(p)f Ft(=)g(1)g(is)h(left)f(to)h(the)g(reader;)h +(here)225 432 y(w)o(e)g(assume)g Fr(p)d(>)h Ft(1.)267 +482 y(F)m(or)h(ease)i(of)e(notation,)g(let)729 567 y +Fr(S)754 573 y Fn(1)784 567 y Ft(=)831 528 y Fo(X)828 +617 y Fp(i)p Fl(2)p Fp(I)877 621 y Fj(1)900 567 y Fr(s)919 +573 y Fp(i)933 567 y Fr(;)55 b(V)1024 573 y Fn(1)1055 +567 y Ft(=)1101 528 y Fo(X)1098 617 y Fp(i)p Fl(2)p Fp(I)1147 +621 y Fj(1)1170 567 y Fr(v)1190 573 y Fp(i)1204 567 y +Fr(;)225 688 y Ft(and)14 b(de\014ne)h Fr(S)451 694 y +Fn(2)484 688 y Ft(and)e Fr(V)588 694 y Fn(2)621 688 y +Ft(analogously)m(.)267 738 y(By)20 b(the)g(ordering)h(of)e(the)i +(ratios)e Fr(s=v)q Ft(,)j(w)o(e)e(kno)o(w)g(that)g Fr(s)1230 +744 y Fp(i)1244 738 y Fr(v)1264 744 y Fp(p)1305 738 y +Fr(<)i(s)1378 744 y Fp(p)1398 738 y Fr(v)1418 744 y Fp(i)1452 +738 y Ft(for)e(all)f Fr(i)j Fs(2)f Fr(I)1689 744 y Fn(2)1708 +738 y Ft(;)225 788 y(therefore,)853 862 y Fr(S)878 868 +y Fn(2)897 862 y Fr(v)917 868 y Fp(p)948 862 y Fr(<)12 +b(s)1011 868 y Fp(p)1030 862 y Fr(V)1054 868 y Fn(2)1080 +862 y Fr(:)554 b Ft(\(13\))225 937 y(Since)14 b Fr(I)k +Ft(is)13 b(optimal,)e(w)o(e)j(kno)o(w)g(that)812 1013 +y Fr(S)839 997 y Fn(2)837 1023 y(1)p 812 1031 47 2 v +814 1069 a Fr(V)838 1075 y Fn(1)875 1041 y Fs(\024)924 +1013 y Ft(\()p Fr(S)965 1019 y Fn(1)993 1013 y Ft(+)c +Fr(S)1060 1019 y Fn(2)1079 1013 y Ft(\))1095 997 y Fn(2)p +924 1031 190 2 v 951 1069 a Fr(V)975 1075 y Fn(1)1003 +1069 y Ft(+)f Fr(V)1068 1075 y Fn(2)1126 1041 y Ft(;)225 +1138 y(therefore,)15 b(b)o(y)f(cross-m)o(ultiplying)d(and)j(canceling)g +(terms,)f(w)o(e)h(obtain)745 1217 y Fr(S)772 1200 y Fn(2)770 +1227 y(1)791 1217 y Fr(V)815 1223 y Fn(2)846 1217 y Fs(\024)d +Fr(S)916 1200 y Fn(2)914 1227 y(2)936 1217 y Fr(V)960 +1223 y Fn(1)988 1217 y Ft(+)e(2)p Fr(S)1075 1223 y Fn(1)1094 +1217 y Fr(S)1119 1223 y Fn(2)1138 1217 y Fr(V)1162 1223 +y Fn(1)1188 1217 y Fr(:)446 b Ft(\(14\))225 1296 y(Similarly)l(,)696 +1367 y(\()p Fr(S)737 1373 y Fn(1)765 1367 y Ft(+)10 b +Fr(S)832 1373 y Fn(2)860 1367 y Ft(+)g Fr(s)921 1373 +y Fp(p)940 1367 y Ft(\))956 1352 y Fn(2)p 696 1386 280 +2 v 722 1424 a Fr(V)746 1430 y Fn(1)774 1424 y Ft(+)g +Fr(V)840 1430 y Fn(2)868 1424 y Ft(+)f Fr(v)929 1430 +y Fp(p)992 1395 y Fs(\024)1040 1367 y Ft(\()p Fr(S)1081 +1373 y Fn(1)1110 1367 y Ft(+)g Fr(S)1176 1373 y Fn(2)1195 +1367 y Ft(\))1211 1352 y Fn(2)p 1040 1386 190 2 v 1067 +1424 a Fr(V)1091 1430 y Fn(1)1119 1424 y Ft(+)h Fr(V)1185 +1430 y Fn(2)1242 1395 y Fr(;)225 1482 y Ft(so)452 1562 +y Fr(s)471 1545 y Fn(2)471 1572 y Fp(p)491 1562 y Ft(\()p +Fr(V)531 1568 y Fn(1)559 1562 y Ft(+)g Fr(V)625 1568 +y Fn(2)643 1562 y Ft(\))g(+)f(2)p Fr(S)756 1568 y Fn(1)775 +1562 y Fr(s)794 1568 y Fp(p)814 1562 y Ft(\()p Fr(V)854 +1568 y Fn(1)882 1562 y Ft(+)g Fr(V)947 1568 y Fn(2)966 +1562 y Ft(\))h(+)f(2)p Fr(S)1079 1568 y Fn(2)1098 1562 +y Fr(s)1117 1568 y Fp(p)1137 1562 y Ft(\()p Fr(V)1177 +1568 y Fn(1)1205 1562 y Ft(+)g Fr(V)1270 1568 y Fn(2)1289 +1562 y Ft(\))840 1630 y Fs(\024)j Fr(S)911 1613 y Fn(2)909 +1640 y(1)931 1630 y Fr(v)951 1636 y Fp(p)979 1630 y Ft(+)e +Fr(S)1048 1613 y Fn(2)1046 1640 y(2)1067 1630 y Fr(v)1087 +1636 y Fp(p)1116 1630 y Ft(+)f(2)p Fr(S)1203 1636 y Fn(1)1222 +1630 y Fr(S)1247 1636 y Fn(2)1266 1630 y Fr(v)1286 1636 +y Fp(p)782 1692 y Fs(\024)i Fr(S)852 1675 y Fn(2)850 +1703 y(1)872 1692 y Fr(v)892 1698 y Fp(p)921 1692 y Ft(+)e +Fr(S)987 1698 y Fn(2)1006 1692 y Fr(s)1025 1698 y Fp(p)1045 +1692 y Fr(V)1069 1698 y Fn(2)1097 1692 y Ft(+)g(2)p Fr(S)1184 +1698 y Fn(1)1203 1692 y Fr(s)1222 1698 y Fp(p)1242 1692 +y Fr(V)1266 1698 y Fn(2)1340 1692 y Ft(b)o(y)14 b(\(13\))491 +1767 y Fs(\024)d Ft(\()p Fr(S)577 1750 y Fn(2)575 1777 +y(2)597 1767 y Fr(V)621 1773 y Fn(1)649 1767 y Ft(+)f(2)p +Fr(S)737 1773 y Fn(1)755 1767 y Fr(S)780 1773 y Fn(2)799 +1767 y Fr(V)823 1773 y Fn(1)842 1767 y Ft(\))865 1739 +y Fr(v)885 1745 y Fp(p)p 863 1757 43 2 v 863 1795 a Fr(V)887 +1801 y Fn(2)921 1767 y Ft(+)f Fr(S)987 1773 y Fn(2)1006 +1767 y Fr(s)1025 1773 y Fp(p)1045 1767 y Fr(V)1069 1773 +y Fn(2)1097 1767 y Ft(+)g(2)p Fr(S)1184 1773 y Fn(1)1203 +1767 y Fr(s)1222 1773 y Fp(p)1242 1767 y Fr(V)1266 1773 +y Fn(2)1340 1767 y Ft(b)o(y)14 b(\(14\))513 1849 y Fs(\024)d +Ft(\()p Fr(S)597 1855 y Fn(2)617 1849 y Fr(s)636 1855 +y Fp(p)655 1849 y Fr(V)679 1855 y Fn(1)707 1849 y Ft(+)f(2)p +Fr(S)795 1855 y Fn(1)814 1849 y Fr(s)833 1855 y Fp(p)852 +1849 y Fr(V)876 1855 y Fn(1)895 1849 y Ft(\))g(+)f Fr(S)987 +1855 y Fn(2)1006 1849 y Fr(s)1025 1855 y Fp(p)1045 1849 +y Fr(V)1069 1855 y Fn(2)1097 1849 y Ft(+)g(2)p Fr(S)1184 +1855 y Fn(1)1203 1849 y Fr(s)1222 1855 y Fp(p)1242 1849 +y Fr(V)1266 1855 y Fn(2)1340 1849 y Ft(b)o(y)14 b(\(13\))225 +1991 y(Canceling)f(terms)h(in)f(this)h(inequalit)o(y)f(w)o(e)h(obtain) +670 2070 y Fr(s)689 2053 y Fn(2)689 2080 y Fp(p)709 2070 +y Ft(\()p Fr(V)749 2076 y Fn(1)777 2070 y Ft(+)c Fr(V)843 +2076 y Fn(2)861 2070 y Ft(\))g(+)f Fr(S)953 2076 y Fn(2)972 +2070 y Fr(s)991 2076 y Fp(p)1011 2070 y Ft(\()p Fr(V)1051 +2076 y Fn(1)1079 2070 y Ft(+)h Fr(V)1145 2076 y Fn(2)1164 +2070 y Ft(\))h Fs(\024)h Ft(0)7 b Fr(;)225 2149 y Ft(a)14 +b(con)o(tradiction.)p 550 2124 29 2 v 550 2149 2 25 v +576 2149 V 550 2151 29 2 v 267 2229 a(The)i(algorithm)d(for)i(the)i(w)o +(eigh)o(ted)e(SDD,)g(sho)o(wn)h(in)f(Figure)h(2,)g(is)f(nearly)h(the)g +(same)f(as)225 2278 y(the)f(algorithm)e(for)h(the)i(regular)f(SDD,)e +(sho)o(wn)i(in)g(Figure)g(1.)225 2366 y FA(3.1)20 b(Convergence)c(of)d +(the)i(W)o(eighted)g(SDD)225 2433 y Ft(As)c(with)g(the)g(regular)g +(SDD,)f(w)o(e)h(sho)o(w)g(that)g(the)h(w)o(eigh)o(ted)f(norm)e(of)i +(the)g(residual)g(generated)225 2483 y(b)o(y)e(the)h(w)o(eigh)o(ted)g +(SDD)f(algorithm)e(is)i(strictly)h(decreasing)h(and,)e(furthermore,)h +(the)g(w)o(eigh)o(ted)225 2532 y(SDD)j(appro)o(ximation)e(con)o(v)o +(erges)k(linearly)e(to)h(the)g(original)e(matrix.)p eop +%%Page: 11 11 +11 10 bop 946 125 a Fv(Semidiscrete)12 b(Matrix)f(Decomp)q(osition)78 +b Fu(\001)70 b Fv(11)267 233 y Fk(Lemma)21 b(2.)g Fq(The)15 +b(r)n(esidual)g(matric)n(es)f(gener)n(ate)n(d)i(by)f(the)g(weighte)n(d) +g(SDD)h(algorithm)f(sat-)225 283 y(isfy)544 352 y Fs(k)p +Fr(R)597 358 y Fp(k)q Fn(+1)658 352 y Fs(k)679 358 y +Fp(W)728 352 y Fr(<)d Fs(k)p Fr(R)825 358 y Fp(k)845 +352 y Fs(k)866 358 y Fp(W)918 352 y Fq(for)j(al)r(l)f +Fr(k)i Fq(such)f(that)g Fr(R)1293 358 y Fp(k)1325 352 +y Fs(6)p Ft(=)c(0)p Fr(:)267 421 y Fk(Pr)o(oof.)21 b +Ft(The)15 b(pro)q(of)e(is)h(similar)d(to)j(Lemma)d(1)j(and)g(is)f +(therefore)j(omitted.)p 1525 396 29 2 v 1525 421 2 25 +v 1551 421 V 1525 423 29 2 v 267 492 a(As)22 b(with)h(the)g(SDD,)e(sev) +o(eral)i(di\013eren)o(t)h(strategies)f(can)g(b)q(e)g(used)g(to)g +(initialize)e Fr(y)j Ft(in)225 542 y(Step)18 b(\(2a\))f(in)g(the)h(w)o +(eigh)o(ted)f(SDD)g(algorithm)d(\(Figure)k(2\).)28 b(Here,)19 +b(w)o(e)e(only)g(presen)o(t)i(the)225 592 y(di\013erences)f(b)q(et)o(w) +o(een)g(these)g(sc)o(hemes)f(and)f(those)h(for)f(the)g(SDD.)g(The)g +(same)g(con)o(v)o(ergence)225 641 y(results)f(hold,)e(and)h(the)g(pro)q +(ofs)g(are)g(similar)e(to)h(those)i(giv)o(en)e(for)h(the)g(SDD.)225 +713 y(\(1\))21 b(MAX:)14 b(Cho)q(ose)g Fr(e)588 719 y +Fp(j)620 713 y Ft(suc)o(h)g(that)g Fr(j)j Ft(is)c(the)i(index)f(of)f +(the)h(column)f(con)o(taining)g(the)h(largest)299 762 +y(magnitude)e(en)o(try)j(in)e Fr(R)693 768 y Fp(k)722 +762 y Fs(\016)c Fr(R)784 768 y Fp(k)813 762 y Fs(\016)g +Fr(W)d Ft(.)225 820 y(\(2\))21 b(CYC:)13 b(No)h(di\013erence.)225 +877 y(\(3\))21 b(THR:)13 b(Accept)i(a)f(giv)o(en)f(unit)h(v)o(ector)h +(only)e(if)g(it)g(satis\014es)i Fs(k)p Fr(R)1287 883 +y Fp(k)1307 877 y Fr(e)1326 883 y Fp(j)1344 877 y Fs(k)1365 +862 y Fn(2)1365 888 y Fp(W)1414 877 y Fs(\025)d(k)p Fr(R)1511 +883 y Fp(k)1530 877 y Fs(k)1551 862 y Fn(2)1551 888 y +Fp(W)1589 877 y Fr(=n)p Ft(.)267 948 y(Note)k(that)h(there)h(is)e(no)h +(SVD)f(starting)g(strategy)i(since)f(there)h(is)e(no)g(simple)f(analog) +g(to)225 998 y(the)f(SVD)g(in)g(the)g(w)o(eigh)o(ted)g(case.)225 +1085 y FA(4.)20 b(THE)14 b(TENSOR)g(SDD)225 1152 y Ft(Let)e +Fr(A)g Ft(b)q(e)h(an)f Fr(m)487 1158 y Fn(1)511 1152 +y Fs(\002)5 b Fr(m)584 1158 y Fn(2)609 1152 y Fs(\002)g(\001)i(\001)g +(\001)e(\002)g Fr(m)774 1158 y Fp(n)809 1152 y Fq(tensor)12 +b Ft(o)o(v)o(er)g Fs(<)p Ft(.)17 b(The)c Fq(or)n(der)e +Ft(of)g Fr(A)h Ft(is)g Fr(n)p Ft(.)17 b(The)c Fq(dimension)225 +1201 y Ft(of)e Fr(A)h Ft(is)g Fr(m)g Fs(\021)444 1170 +y Fo(Q)484 1181 y Fp(n)484 1214 y(j)r Fn(=1)550 1201 +y Fr(m)586 1207 y Fp(j)604 1201 y Ft(,)g(and)f Fr(m)742 +1207 y Fp(j)772 1201 y Ft(is)g(the)i Fr(j)r Ft(th)f Fq(sub)n(dimension) +p Ft(.)18 b(An)12 b(elemen)o(t)f(of)g Fr(A)h Ft(is)g(sp)q(eci\014ed)225 +1251 y(as)891 1320 y Fr(A)922 1326 y Fp(i)934 1330 y +Fj(1)950 1326 y Fp(i)962 1330 y Fj(2)978 1326 y Fl(\001\001\001)p +Fp(i)1020 1330 y Fm(n)1042 1320 y Fr(;)225 1390 y Ft(where)j +Fr(i)359 1396 y Fp(j)388 1390 y Fs(2)d(f)p Ft(1)p Fr(;)7 +b Ft(2)p Fr(;)g(:)g(:)g(:)s(;)g(m)637 1396 y Fp(j)654 +1390 y Fs(g)14 b Ft(for)g Fr(j)g Ft(=)d(1)p Fr(;)c(:)g(:)g(:)e(;)i(n)p +Ft(.)17 b(A)d(matrix)e(is)i(a)g(tensor)h(of)e(order)h(t)o(w)o(o.)267 +1440 y(As)g(with)f(matrices,)f(w)o(e)i(ma)o(y)e(b)q(e)i(in)o(terested)h +(in)e(a)h(storage-e\016cien)o(t)g(appro)o(ximation)d(of)i(a)225 +1489 y(giv)o(en)i(tensor.)24 b(W)m(e)15 b(extend)i(the)f(notion)e(of)h +(the)h(SDD)f(to)h(a)f Fq(tensor)g Ft(SDD.)g(First)h(w)o(e)f(de\014ne) +225 1539 y(some)e(notation)g(for)h(tensors,)g(consisten)o(t)h(with)f +([Kolda)f(1999].)225 1620 y FA(4.1)20 b(Notation)225 +1687 y Ft(If)13 b Fr(A)g Ft(and)g Fr(B)i Ft(are)f(t)o(w)o(o)e(tensors)j +(of)d(the)i(same)e(size)h(\(that)h(is,)e(the)i(order)g +Fr(n)f Ft(and)f(all)g(sub)q(dimen-)225 1737 y(sions)i +Fr(m)363 1743 y Fp(j)395 1737 y Ft(are)g(equal\),)f(then)i(the)f +Fq(inner)h(pr)n(o)n(duct)f Ft(of)f Fr(A)h Ft(and)g Fr(B)i +Ft(is)e(de\014ned)h(as)595 1845 y Fr(A)10 b Fs(\001)e +Fr(B)15 b Fs(\021)758 1792 y Fp(m)787 1796 y Fj(1)750 +1805 y Fo(X)745 1894 y Fp(i)757 1898 y Fj(1)773 1894 +y Fn(=1)834 1792 y Fp(m)863 1796 y Fj(2)827 1805 y Fo(X)822 +1894 y Fp(i)834 1898 y Fj(2)850 1894 y Fn(=1)899 1845 +y Fs(\001)7 b(\001)g(\001)967 1792 y Fp(m)996 1796 y +Fm(n)962 1805 y Fo(X)955 1894 y Fp(i)967 1898 y Fm(n)987 +1894 y Fn(=1)1036 1845 y Fr(A)1067 1851 y Fp(i)1079 1855 +y Fj(1)1095 1851 y Fp(i)1107 1855 y Fj(2)1123 1851 y +Fl(\001\001\001)o Fp(i)1164 1855 y Fm(n)1186 1845 y Fr(B)1217 +1851 y Fp(i)1229 1855 y Fj(1)1246 1851 y Fp(i)1258 1855 +y Fj(2)1274 1851 y Fl(\001\001\001)o Fp(i)1315 1855 y +Fm(n)1337 1845 y Fr(:)225 1960 y Ft(W)m(e)13 b(de\014ne)i(the)g +Fq(norm)f Ft(of)f Fr(A)p Ft(,)h Fs(k)p Fr(A)p Fs(k)p +Ft(,)f(to)g(b)q(e)599 2067 y Fs(k)p Fr(A)p Fs(k)672 2050 +y Fn(2)702 2067 y Fs(\021)e Fr(A)f Fs(\001)f Fr(A)i Ft(=)905 +2015 y Fp(m)934 2019 y Fj(1)898 2027 y Fo(X)893 2116 +y Fp(i)905 2120 y Fj(1)921 2116 y Fn(=1)982 2015 y Fp(m)1011 +2019 y Fj(2)975 2027 y Fo(X)970 2116 y Fp(i)982 2120 +y Fj(2)998 2116 y Fn(=1)1047 2067 y Fs(\001)c(\001)g(\001)1114 +2015 y Fp(m)1143 2019 y Fm(n)1109 2027 y Fo(X)1102 2116 +y Fp(i)1114 2120 y Fm(n)1134 2116 y Fn(=1)1183 2067 y +Fr(A)1214 2050 y Fn(2)1214 2077 y Fp(i)1226 2081 y Fj(1)1242 +2077 y Fp(i)1254 2081 y Fj(2)1270 2077 y Fl(\001\001\001)p +Fp(i)1312 2081 y Fm(n)1334 2067 y Fr(:)267 2180 y Ft(Supp)q(ose)13 +b Fr(B)j Ft(is)d(an)g Fr(m)609 2186 y Fn(1)635 2180 y +Fs(\002)8 b(\001)f(\001)g(\001)f(\002)h Fr(m)806 2186 +y Fp(j)r Fl(\000)p Fn(1)874 2180 y Fs(\002)h Fr(m)950 +2186 y Fp(j)r Fn(+1)1017 2180 y Fs(\002)g(\001)f(\001)g(\001)f(\002)h +Fr(m)1188 2186 y Fp(n)1224 2180 y Ft(tensor)14 b(of)f(order)g +Fr(n)8 b Fs(\000)f Ft(1.)18 b(Then)225 2230 y(the)c Fr(i)310 +2236 y Fp(j)328 2230 y Ft(th)g(\(1)e Fs(\024)g Fr(i)488 +2236 y Fp(j)517 2230 y Fs(\024)g Fr(m)597 2236 y Fp(j)615 +2230 y Ft(\))i(elemen)o(t)f(of)g(the)i Fq(c)n(ontr)n(acte)n(d)g(pr)n(o) +n(duct)f Ft(of)f Fr(A)h Ft(and)f Fr(B)k Ft(is)d(de\014ned)h(as)321 +2342 y(\()p Fr(A)10 b Fs(\001)f Fr(B)r Ft(\))448 2348 +y Fp(i)460 2352 y Fm(j)489 2342 y Fs(\021)545 2290 y +Fp(m)574 2294 y Fj(1)538 2303 y Fo(X)533 2391 y Fp(i)545 +2395 y Fj(1)561 2391 y Fn(=1)610 2342 y Fs(\001)e(\001)g(\001)677 +2286 y Fp(m)706 2290 y Fm(j)q Fe(\000)p Fj(1)688 2303 +y Fo(X)665 2391 y Fp(i)677 2395 y Fm(j)q Fe(\000)p Fj(1)729 +2391 y Fn(=1)790 2286 y Fp(m)819 2290 y Fm(j)q Fj(+1)800 +2303 y Fo(X)778 2391 y Fp(i)790 2395 y Fm(j)q Fj(+1)841 +2391 y Fn(=1)890 2342 y Fs(\001)g(\001)g(\001)957 2290 +y Fp(m)986 2294 y Fm(n)952 2303 y Fo(X)945 2391 y Fp(i)957 +2395 y Fm(n)977 2391 y Fn(=1)1026 2342 y Fr(A)1057 2348 +y Fp(i)1069 2352 y Fj(1)1085 2348 y Fl(\001\001\001)p +Fp(i)1127 2352 y Fm(j)q Fe(\000)p Fj(1)1179 2348 y Fp(i)1191 +2352 y Fm(j)1206 2348 y Fp(i)1218 2352 y Fm(j)q Fj(+1)1269 +2348 y Fl(\001\001\001)o Fp(i)1310 2352 y Fm(n)1332 2342 +y Fr(B)1363 2348 y Fp(i)1375 2352 y Fj(1)1392 2348 y +Fl(\001\001\001)o Fp(i)1433 2352 y Fm(j)q Fe(\000)p Fj(1)1485 +2348 y Fp(i)1497 2352 y Fm(j)q Fj(+1)1548 2348 y Fl(\001\001\001)o +Fp(i)1589 2352 y Fm(n)1612 2342 y Fr(:)267 2460 y Ft(A)13 +b Fq(de)n(c)n(omp)n(ose)n(d)i Ft(tensor)g(is)f(a)f(tensor)i(that)f(can) +g(b)q(e)h(written)f(as)722 2532 y Fr(x)d Ft(=)h Fr(x)825 +2515 y Fn(\(1\))879 2532 y Fs(\012)d Fr(x)944 2515 y +Fn(\(2\))998 2532 y Fs(\012)g(\001)e(\001)g(\001)h(\012)h +Fr(x)1162 2515 y Fn(\()p Fp(n)p Fn(\))1211 2532 y Fr(;)p +eop +%%Page: 12 12 +12 11 bop 225 125 a Fv(12)71 b Fu(\001)78 b Fv(T.)13 +b(G.)f(Kolda)g(and)h(D.)g(P)m(.)e(O'Lea)o(ry)225 233 +y Ft(where)j Fr(x)368 218 y Fn(\()p Fp(j)r Fn(\))423 +233 y Fs(2)d(<)492 218 y Fp(m)521 222 y Fm(j)552 233 +y Ft(for)h Fr(j)i Ft(=)e(1)p Fr(;)7 b(:)g(:)g(:)e(;)i(n)p +Ft(.)17 b(The)c(v)o(ectors)h Fr(x)1105 218 y Fn(\()p +Fp(j)r Fn(\))1161 233 y Ft(are)f(called)g(the)g Fq(c)n(omp)n(onents)h +Ft(of)e Fr(x)p Ft(.)225 283 y(In)i(this)g(case,)732 363 +y Fr(x)756 369 y Fp(i)768 373 y Fj(1)783 369 y Fp(i)795 +373 y Fj(2)811 369 y Fl(\001\001\001)p Fp(i)853 373 y +Fm(n)886 363 y Ft(=)e Fr(x)954 341 y Fn(\(1\))954 375 +y Fp(i)966 379 y Fj(1)999 363 y Fr(x)1023 341 y Fn(\(2\))1023 +375 y Fp(i)1035 379 y Fj(2)1074 363 y Fs(\001)7 b(\001)g(\001)e +Fr(x)1153 341 y Fn(\()p Fp(n)p Fn(\))1153 375 y Fp(i)1165 +379 y Fm(n)1201 363 y Fr(:)225 438 y Ft(Lo)o(w)o(ercase)15 +b(letters)g(denote)g(decomp)q(osed)f(tensors.)267 513 +y Fk(Lemma)21 b([K)o(old)o(a)c(1999].)k Fq(L)n(et)13 +b Fr(A)g Fq(b)n(e)g(a)g(tensor)g(of)f(or)n(der)h Fr(n)g +Fq(and)g Fr(x)g Fq(a)g(de)n(c)n(omp)n(ose)n(d)g(tensor)225 +563 y(of)i(or)n(der)f Fr(p)p Fq(.)19 b(Then)755 637 y +Fr(A)9 b Fs(\001)g Fr(x)i Ft(=)h(\()p Fr(A)d Fs(\001)g +Fr(x)996 620 y Fn(\()p Fl(\000)p Fp(j)r Fn(\))1065 637 +y Ft(\))g Fs(\001)g Fr(x)1135 620 y Fn(\()p Fp(j)r Fn(\))1178 +637 y Fr(;)225 712 y Fq(wher)n(e)14 b(the)h(notation)h +Fr(x)601 697 y Fn(\()p Fl(\000)p Fp(j)r Fn(\))685 712 +y Fq(indic)n(ates)f Fr(x)f Fq(with)g(the)h Fr(j)r Fq(th)h(c)n(omp)n +(onent)f(r)n(emove)n(d,)g(that)g(is,)539 787 y Fr(x)563 +770 y Fn(\()p Fl(\000)p Fp(j)r Fn(\))644 787 y Fs(\021)c +Fr(x)711 770 y Fn(\(1\))765 787 y Fs(\012)e(\001)e(\001)g(\001)h(\012)i +Fr(x)930 770 y Fn(\()p Fp(j)r Fl(\000)p Fn(1\))1024 787 +y Fs(\012)g Fr(x)1090 770 y Fn(\()p Fp(j)r Fn(+1\))1184 +787 y Fs(\012)g(\001)d(\001)g(\001)h(\012)h Fr(x)1349 +770 y Fn(\()p Fp(p)p Fn(\))1394 787 y Fr(:)267 862 y +Ft(The)16 b(notion)f(of)h(rank)g(for)g(tensors)h(of)e(order)i(greater)g +(than)f(t)o(w)o(o)g(is)g(a)g(non)o(trivial)e(matter)225 +912 y(\(see,)h(e.g.,)d(Kolda)h([1999]\),)e(but)j(a)f(single)g(decomp)q +(osed)h(tensor)h(is)e(alw)o(a)o(ys)g(a)g(tensor)h(of)f(rank)225 +962 y(one.)225 1045 y FA(4.2)20 b(De\014nition)15 b(of)e(the)i(T)m +(enso)o(r)f(SDD)225 1111 y Ft(Supp)q(ose)h(w)o(e)f(wish)g(to)f(appro)o +(ximate)f(an)i Fr(n)p Ft(-dimensional)d(tensor)k Fr(A)f +Ft(as)g(follo)o(ws,)800 1225 y Fr(A)d Fs(\031)h Fr(A)917 +1231 y Fp(k)949 1225 y Fs(\021)1014 1173 y Fp(k)993 1185 +y Fo(X)996 1274 y Fp(i)p Fn(=1)1060 1225 y Fr(d)1082 +1231 y Fp(i)1096 1225 y Fr(x)1120 1231 y Fp(i)1133 1225 +y Fr(;)225 1336 y Ft(where)18 b Fr(d)370 1342 y Fp(i)399 +1336 y Fr(>)f Ft(0)f(and)g Fr(x)592 1342 y Fp(i)622 1336 +y Ft(is)h(a)f(decomp)q(osed)h(tensor)g(whose)h(comp)q(onen)o(ts)e(are)h +(restricted)h(to)225 1392 y Fr(x)249 1370 y Fn(\()p Fp(j)r +Fn(\))249 1403 y Fp(i)304 1392 y Fs(2)11 b(S)371 1377 +y Fp(m)400 1381 y Fm(j)418 1392 y Ft(,)j(with)f Fs(S)i +Ft(=)d Fs(f\000)p Ft(1)p Fr(;)7 b Ft(0)p Fr(;)g Ft(1)p +Fs(g)p Ft(.)16 b(This)d(is)h(called)g(a)f Fr(k)q Ft(-term)g +Fq(tensor)i(SDD)p Ft(.)267 1442 y(The)e(SDD)g(represen)o(tation)i(is)f +(e\016cien)o(t)g(in)f(terms)g(of)g(storage.)18 b(If)13 +b(the)h(tensor)h Fr(A)e Ft(is)g(dense,)225 1491 y(the)h(total)g +(storage)g(required)h(for)e Fr(A)h Ft(is)892 1597 y Fr(\015)941 +1545 y Fp(n)925 1558 y Fo(Y)923 1646 y Fp(j)r Fn(=1)987 +1597 y Fr(m)1023 1603 y Fp(j)1041 1597 y Fr(;)225 1714 +y Ft(where)j Fr(\015)h Ft(is)d(the)h(amoun)o(t)e(of)h(storage)h +(required)g(for)f(eac)o(h)h(elemen)o(t)f(of)g Fr(A)p +Ft(.)23 b(F)m(or)15 b(example,)f(if)225 1764 y(the)f(elemen)o(ts)g(of)f +Fr(A)h Ft(are)g(in)o(teger)g(v)n(alues)f(b)q(et)o(w)o(een)i(0)f(and)f +(255,)g(then)h Fr(\015)j Ft(is)c(one)h(b)o(yte)g(\(8)g(bits\).)225 +1814 y(The)h(storage)h(required)f(for)g(the)g(appro)o(ximation)d +Fr(A)1059 1820 y Fp(k)1094 1814 y Ft(is)796 1936 y Fr(k)826 +1853 y Fo(0)826 1928 y(@)862 1936 y Fr(\013)e Ft(+)h +Fr(\014)992 1884 y Fp(n)972 1897 y Fo(X)974 1985 y Fp(j)r +Fn(=1)1039 1936 y Fr(m)1075 1942 y Fp(j)1093 1853 y Fo(1)1093 +1928 y(A)1137 1936 y Fr(;)225 2059 y Ft(where)16 b Fr(\013)e +Ft(is)h(the)g(storage)g(required)h(for)e(eac)o(h)h Fr(d)990 +2065 y Fp(k)1025 2059 y Ft(and)f(is)h(usually)e(c)o(hosen)j(to)f(b)q(e) +g(equal)f(to)h Fr(\015)225 2109 y Ft(and)g Fr(\014)i +Ft(is)d(the)i(amoun)o(t)c(of)j(storage)g(required)g(to)g(store)g(eac)o +(h)h(elemen)o(t)e(of)g Fs(S)s Ft(,)g(that)h(is,)f(log)1673 +2119 y Fn(2)1699 2109 y Ft(3)225 2158 y(bits.)27 b(Since)18 +b Fr(k)f Fs(\034)541 2127 y Fo(Q)580 2137 y Fp(n)580 +2171 y(j)r Fn(=1)646 2158 y Fr(m)682 2164 y Fp(j)700 +2158 y Ft(,)g(the)h(appro)o(ximation)c(generally)j(requires)h +(signi\014can)o(tly)e(less)225 2208 y(storage)e(than)g(the)h(original)d +(tensor.)225 2291 y FA(4.3)20 b(Computing)13 b(a)h(T)m(enso)o(r)g(SDD) +225 2358 y Ft(As)j(with)f(the)i(regular)e(and)h(w)o(eigh)o(ted)f(SDDs,) +h(a)f(tensor)i(SDD)e(can)h(b)q(e)g(constructed)i(via)d(a)225 +2408 y(greedy)c(algorithm.)j(Eac)o(h)c(iteration,)g(a)g(new)g +Fr(d)g Ft(and)g Fr(x)g Ft(are)h(computed)e(that)i(are)f(the)h(solution) +225 2457 y(to)i(the)g(follo)o(wing)d(subproblem:)321 +2532 y(min)17 b Fr(F)436 2538 y Fp(k)456 2532 y Ft(\()p +Fr(d;)7 b(x)p Ft(\))k Fs(\021)h(k)p Fr(R)661 2538 y Fp(k)690 +2532 y Fs(\000)d Fr(dx)p Fs(k)798 2515 y Fn(2)853 2532 +y Ft(s.t.)18 b Fr(d)11 b(>)h Ft(0)p Fr(;)17 b(x)1078 +2515 y Fn(\()p Fp(j)r Fn(\))1133 2532 y Fs(2)11 b(S)1200 +2515 y Fp(m)1229 2519 y Fm(j)1261 2532 y Ft(for)j Fr(j)g +Ft(=)e(1)p Fr(;)7 b(:)g(:)g(:)t(;)g(n;)96 b Ft(\(15\))p +eop +%%Page: 13 13 +13 12 bop 946 125 a Fv(Semidiscrete)12 b(Matrix)f(Decomp)q(osition)78 +b Fu(\001)70 b Fv(13)225 233 y Ft(where)21 b Fr(R)383 +239 y Fp(k)425 233 y Fs(\021)g Fr(A)14 b Fs(\000)568 +202 y Fo(P)612 212 y Fp(k)q Fl(\000)p Fn(1)612 245 y +Fp(i)p Fn(=1)682 233 y Fr(d)704 239 y Fp(i)717 233 y +Fr(x)741 239 y Fp(i)775 233 y Ft(denotes)21 b(the)g Fr(k)q +Ft(th)f(residual)f(matrix.)35 b(This)19 b(is)h(a)g(mixed)225 +283 y(in)o(teger)e(programmi)o(ng)c(problem,)j(but)g(it)g(can)g(b)q(e)h +(simpli\014ed)e(to)h(an)g(in)o(teger)h(program)d(as)225 +332 y(demonstrated)f(b)o(y)g(the)g(follo)o(wing)d(theorem,)i(a)h +(generalization)f(of)h(Theorem)f(1.)267 416 y Fk(Theorem)21 +b(9.)g Fq(Solving)14 b(the)g(mixe)n(d)g(inte)n(ger)f(pr)n(o)n(gr)n(am)g +(\(15\))h(is)f(e)n(quivalent)h(to)g(solving)f(the)225 +466 y(inte)n(ger)h(pr)n(o)n(gr)n(am)474 574 y Ft(max)579 +563 y(~)570 574 y Fr(F)5 b Ft(\()p Fr(x)p Ft(\))12 b(=)718 +545 y(\()p Fr(R)e Fs(\001)e Fr(x)p Ft(\))836 530 y Fn(2)p +718 564 137 2 v 745 602 a Fs(k)p Fr(x)p Fs(k)811 590 +y Fn(2)898 574 y Ft(s.t.)18 b Fr(x)996 556 y Fn(\()p +Fp(j)r Fn(\))1051 574 y Fs(2)11 b(S)1118 556 y Fp(m)1147 +560 y Fm(j)1180 574 y Fq(for)j Fr(j)g Ft(=)e(1)p Fr(;)7 +b(:)g(:)g(:)e(;)i(n:)174 b Ft(\(16\))267 679 y Fk(Pr)o(oof.)21 +b Ft(The)h(pro)q(of)e(follo)o(ws)f(the)i(same)f(progression)i(as)e(the) +i(pro)q(of)e(for)g(Theorem)h(1)225 729 y(except)15 b(that)871 +823 y Fr(d)893 805 y Fl(\003)923 823 y Ft(=)972 794 y +Fr(R)9 b Fs(\001)f Fr(x)p 972 813 86 2 v 973 851 a Fs(k)p +Fr(x)p Fs(k)1039 839 y Fn(2)1062 823 y Fr(:)p 265 890 +29 2 v 265 915 2 25 v 291 915 V 265 917 29 2 v 267 999 +a Ft(Solving)h(\(16\))i(is)h(an)f(in)o(teger)g(programming)d(problem)i +(that)h(has)h(3)1317 984 y Fp(m)1346 988 y Fj(1)1362 +984 y Fn(+)p Fp(m)1416 988 y Fj(2)1433 984 y Fn(+)p Fl(\001\001\001)p +Fn(+)p Fp(m)1542 988 y Fm(n)1577 999 y Ft(p)q(ossible)225 +1049 y(solutions.)27 b(T)m(o)16 b(solv)o(e)h(this)g(problem)e(appro)o +(ximately)m(,)g(an)i(alternating)f(algorithm)e(will)i(b)q(e)225 +1099 y(used.)j(The)c(idea)f(is)g(the)g(same)g(as)g(for)f(the)i(regular) +f(and)g(w)o(eighed)g(SDDs.)19 b(Fix)13 b(all)g(the)i(com-)225 +1148 y(p)q(onen)o(ts)e(of)f Fr(x)h Ft(except)g(one,)g(sa)o(y)f +Fr(x)770 1133 y Fn(\()p Fp(j)r Fn(\))814 1148 y Ft(,)g(and)g(\014nd)h +(the)g(optimal)d Fr(x)1244 1133 y Fn(\()p Fp(j)r Fn(\))1299 +1148 y Ft(under)k(those)f(conditions.)225 1198 y(Rep)q(eat)19 +b(this)f(pro)q(cess)j(for)d(another)g(v)n(alue)g(of)g +Fr(j)r Ft(,)h(con)o(tin)o(uing)f(un)o(til)f(impro)o(v)o(emen)o(t)f(in)i +(the)225 1248 y(v)n(alue)13 b(of)389 1237 y(~)380 1248 +y Fr(F)5 b Ft(\()p Fr(x)p Ft(\))14 b(stagnates.)267 1298 +y(Assume)f(that)h(all)f(comp)q(onen)o(ts)g(of)h Fr(x)f +Ft(are)i(\014xed)f(except)h Fr(x)1205 1283 y Fn(\()p +Fp(j)r Fn(\))1248 1298 y Ft(.)j(Then)d(\(16\))e(reduces)j(to)684 +1411 y(max)773 1383 y(\()p Fr(s)10 b Fs(\001)e Fr(x)862 +1368 y Fn(\()p Fp(j)r Fn(\))905 1383 y Ft(\))921 1368 +y Fn(2)p 773 1401 168 2 v 793 1440 a Fs(k)p Fr(x)838 +1428 y Fn(\()p Fp(j)r Fn(\))881 1440 y Fs(k)902 1426 +y Fn(2)902 1451 y(2)982 1411 y Ft(s.t.)18 b Fr(x)1080 +1394 y Fn(\()p Fp(j)r Fn(\))1135 1411 y Fs(2)11 b(S)1202 +1394 y Fp(m)1231 1398 y Fm(j)1249 1411 y Fr(;)225 1526 +y Ft(where)16 b Fr(s)d Fs(\021)g Ft(\()p Fr(R)471 1532 +y Fp(k)501 1526 y Fs(\001)c Fr(x)546 1511 y Fn(\()p Fl(\000)p +Fp(j)r Fn(\))615 1526 y Ft(\))p Fr(=)p Fs(k)p Fr(x)697 +1511 y Fn(\()p Fl(\000)p Fp(j)r Fn(\))766 1526 y Fs(k)787 +1511 y Fn(2)805 1526 y Ft(.)20 b(This)15 b(is)f(same)g(as)g(problem)g +(\(5\),)g(so)g(w)o(e)h(kno)o(w)f(ho)o(w)g(to)225 1575 +y(solv)o(e)g(it.)267 1626 y(The)f(tensor)g(SDD)f(algorithm)e(is)j(giv)o +(en)f(in)g(Figure)h(3.)k(In)c(Step)g(\(2a\),)f Fr(x)h +Ft(should)f(b)q(e)h(c)o(hosen)225 1675 y(so)21 b(that)f +Fr(R)411 1681 y Fp(k)445 1675 y Fs(\001)13 b Fr(x)22 +b Fs(6)p Ft(=)h(0.)37 b(Unless)21 b Fr(R)810 1681 y Fp(k)851 +1675 y Ft(is)f(zero)h(itself)f(\(in)h(whic)o(h)f(case)h +Fr(A)1422 1681 y Fp(k)q Fl(\000)p Fn(1)1508 1675 y Ft(=)i +Fr(A)p Ft(\),)e(it)f(is)225 1725 y(alw)o(a)o(ys)15 b(p)q(ossible)i(to)f +(pic)o(k)h(suc)o(h)g(an)f Fr(x)p Ft(.)26 b(The)17 b(for-lo)q(op)e(in)h +(Step)h(\(2\(b\)i\))f(do)q(es)i(not)e(need)h(to)225 1775 +y(go)g(through)h(the)g(comp)q(onen)o(ts)f(of)g Fr(x)g +Ft(in)g(order.)30 b(That)18 b(lo)q(op)f(could)g(b)q(e)h(replaced)h(b)o +(y)e(\\F)m(or)225 1825 y Fr(j)e Ft(=)e Fr(\031)q Ft(\(1\))p +Fr(;)7 b(\031)q Ft(\(2\))p Fr(;)g(:)g(:)g(:)t(;)g(\031)q +Ft(\()p Fr(n)p Ft(\))15 b(do,")e(where)j Fr(\031)f Ft(is)g(an)f +Fr(n)p Ft(-p)q(erm)o(utation.)k(Note)d(that)f(in)g(eac)o(h)h(step)225 +1875 y(of)d(\(2\(b\)i\),)h(the)h(v)n(alue)e(of)h Fr(x)f +Ft(ma)o(y)f(c)o(hange)j(and)f(that)g(the)h(ob)r(jectiv)o(e)f(function)g +(is)g(guaran)o(teed)225 1924 y(to)h(b)q(e)g(at)g(least)g(as)g(go)q(o)q +(d)g(as)f(it)h(w)o(as)g(with)f(the)i(previous)f Fr(x)p +Ft(.)225 2016 y FA(4.4)20 b(Convergence)c(of)d(the)i(T)m(enso)o(r)f +(SDD)225 2083 y Ft(Lik)o(e)j(the)g(SDD,)f(the)i(tensor)g(SDD)f +(algorithm)d(has)j(the)h(prop)q(ert)o(y)g(that)f(the)h(norm)d(of)i(the) +225 2133 y(residual)i(decreases)i(eac)o(h)e(outer)h(iteration.)32 +b(F)m(urthermore,)20 b(w)o(e)f(can)g(pro)o(v)o(e)g(con)o(v)o(ergence) +225 2183 y(results)13 b(similar)d(to)i(those)h(for)f(the)h(SDD)f(\(pro) +q(ofs)g(are)h(omitted)e(but)h(are)h(similar)d(to)i(those)h(for)225 +2233 y(the)i(SDD\))f(using)h(eac)o(h)g(of)f(the)h(follo)o(wing)d +(starting)j(strategies)g(in)g(Step)g(\(2a\))f(of)g(the)h(tensor)225 +2282 y(SDD)e(algorithm:)225 2376 y(\(1\))21 b(MAX:)14 +b(Initialize)f Fr(x)f Ft(=)h Fr(e)697 2354 y Fn(\(1\))697 +2388 y Fp(j)711 2392 y Fj(1)751 2376 y Fs(\012)d Fr(e)812 +2354 y Fn(\(2\))812 2388 y Fp(j)826 2392 y Fj(2)866 2376 +y Fs(\012)g(\001)d(\001)g(\001)h(\012)i Fr(e)1027 2354 +y Fn(\()p Fp(n)p Fn(\))1027 2388 y Fp(j)1041 2392 y Fm(n)1076 +2376 y Ft(,)k(where)h Fr(r)1241 2382 y Fp(j)1255 2386 +y Fj(1)1271 2382 y Fp(j)1285 2386 y Fj(2)1301 2382 y +Fp(:::)o(j)1344 2386 y Fm(n)1381 2376 y Ft(is)f(the)h(largest)f(mag-) +299 2426 y(nitude)g(elemen)o(t)f(of)h Fr(R)p Ft(.)225 +2503 y(\(2\))21 b(CYC:)13 b(Same)g(idea)h(as)g(for)f(the)i(SDD,)d(but)j +(no)o(w)e(the)i(cycle)f(is)1308 2463 y Fp(n)1299 2472 +y Fo(Q)1290 2539 y Fp(j)r Fn(=2)1354 2503 y Fr(m)1390 +2509 y Fp(j)1422 2503 y Ft(long.)p eop +%%Page: 14 14 +14 13 bop 225 125 a Fv(14)71 b Fu(\001)78 b Fv(T.)13 +b(G.)f(Kolda)g(and)h(D.)g(P)m(.)e(O'Lea)o(ry)300 656 +y Fz(\(1\))28 b(Let)11 b Fi(R)464 662 y Fh(k)494 656 +y Fz(denote)f(the)h(residual,)e(and)i(initialize)e Fi(R)1049 +661 y Fg(1)1075 656 y Fy( )h Fi(A)p Fz(.)374 698 y(Let)h +Fi(\032)455 704 y Fh(k)484 698 y Fz(=)f Fy(k)p Fi(R)566 +704 y Fh(k)584 698 y Fy(k)602 686 y Fg(2)631 698 y Fz(b)q(e)h(the)g +(norm)f(of)h(the)g(residual,)e(and)i(initialize)e Fi(\032)1304 +703 y Fg(1)1331 698 y Fy( )h(k)p Fi(R)1421 703 y Fg(1)1438 +698 y Fy(k)1456 686 y Fg(2)1473 698 y Fz(.)374 739 y(Let)h +Fi(A)463 745 y Fh(k)494 739 y Fz(denote)f(the)g Fi(k)q +Fz(-term)h(appro)o(ximat)o(ion)o(,)e(and)h(initialize)g +Fi(A)1267 744 y Fg(0)1294 739 y Fy( )g Fz(0.)374 781 +y(Cho)q(ose)g Fi(k)514 785 y Fg(max)573 781 y Fz(,)h(the)g(maxim)o(um)e +(n)o(um)o(b)q(er)g(of)i(terms)g(in)g(the)g(appro)o(xima)o(tion)o(.)374 +822 y(Cho)q(ose)f Fi(\032)514 827 y Fg(min)567 822 y +Fz(,)h(the)g(desired)f(accuracy)f(of)i(the)g(appro)o(ximat)o(ion.)374 +864 y(Cho)q(ose)f Fi(l)507 868 y Fg(max)565 864 y Fz(,)i(the)e(maxim)o +(um)f(allo)o(w)o(able)h(inner)g(iterations.)374 905 y(Cho)q(ose)g +Fi(\013)519 910 y Fg(min)571 905 y Fz(,)i(the)f(minim)o(um)e(relativ)o +(e)g(impro)o(v)o(emen)n(t,)g(and)h(set)h Fi(\013)f(>)g +Fz(2)p Fi(\013)1393 910 y Fh(min)1452 905 y Fz(.)300 +976 y(\(2\))28 b(F)m(or)11 b Fi(k)g Fz(=)f(1)p Fi(;)5 +b Fz(2)p Fi(;)h(:)f(:)h(:)g(;)f(k)650 980 y Fg(max)709 +976 y Fz(,)12 b(while)f Fi(\032)841 982 y Fh(k)870 976 +y Fi(>)f(\032)925 981 y Fg(min)978 976 y Fz(,)h(do)374 +1030 y(\(a\))30 b(Initialize)9 b Fi(x)g Fz(=)i Fi(x)683 +1018 y Fg(\(1\))732 1030 y Fy(\012)d Fi(x)787 1018 y +Fg(\(2\))836 1030 y Fy(\012)g(\001)e(\001)f(\001)j(\012)g +Fi(x)975 1018 y Fg(\()p Fh(n)p Fg(\))1020 1030 y Fz(.)374 +1084 y(\(b\))28 b(F)m(or)11 b Fi(l)f Fz(=)g(1)p Fi(;)5 +b Fz(2)p Fi(;)g(:)h(:)g(:)g(;)f(l)711 1088 y Fg(max)769 +1084 y Fz(,)12 b(while)f Fi(\013)e(>)h(\013)975 1089 +y Fg(min)1028 1084 y Fz(,)h(do)450 1138 y(i.)56 b(F)m(or)11 +b Fi(j)h Fz(=)e(1)p Fi(;)c Fz(2)p Fi(;)f(:)h(:)f(:)h(;)g(n)12 +b Fz(do)526 1179 y(Set)e Fi(s)h Fy( )f Fi(R)685 1185 +y Fh(k)711 1179 y Fy(\001)e Fi(x)749 1168 y Fg(\()p Ff(\000)p +Fh(j)q Fg(\))813 1179 y Fz(.)526 1255 y(Solv)o(e)i(max)704 +1232 y(\()p Fi(s)734 1221 y Fh(T)759 1232 y Fi(x)779 +1221 y Fg(\()p Fh(j)q Fg(\))819 1232 y Fz(\))833 1221 +y Fg(2)p 704 1248 146 2 v 721 1281 a Fy(k)p Fi(x)759 +1272 y Fg(\()p Fh(j)q Fg(\))798 1281 y Fy(k)816 1270 +y Fg(2)816 1293 y(2)886 1255 y Fz(s.t.)15 b Fi(x)969 +1242 y Fg(\()p Fh(j)q Fg(\))1019 1255 y Fy(2)9 b(S)1075 +1242 y Fh(m)1102 1247 y Fm(j)1121 1255 y Fi(:)526 1332 +y Fz(End)i Fi(j)r Fz(-lo)q(op.)450 1406 y(ii.)46 b Fi(\014)11 +b Fy( )607 1383 y Fz(\()p Fi(R)648 1389 y Fh(k)674 1383 +y Fy(\001)d Fi(x)p Fz(\))726 1371 y Fg(2)p 607 1399 136 +2 v 639 1431 a Fy(k)p Fi(x)p Fy(k)695 1422 y Fg(2)748 +1406 y Fz(.)450 1495 y(iii.)36 b(If)11 b Fi(l)f(>)g Fz(1:)15 +b Fi(\013)10 b Fy( )745 1471 y Fi(\014)f Fy(\000)814 +1463 y Fz(\026)809 1471 y Fi(\014)p 745 1487 87 2 v 782 +1511 a Fz(\026)777 1520 y Fi(\014)836 1495 y Fz(.)450 +1571 y(iv.)531 1562 y(\026)526 1571 y Fi(\014)i Fy( )f +Fi(\014)r Fz(.)450 1625 y(End)h Fi(l)p Fz(-lo)q(op.)374 +1679 y(\(c\))32 b Fi(x)470 1685 y Fh(k)498 1679 y Fy( )10 +b Fi(x)p Fz(.)374 1749 y(\(d\))28 b Fi(d)468 1755 y Fh(k)497 +1749 y Fy( )547 1726 y Fi(R)574 1732 y Fh(k)600 1726 +y Fy(\001)8 b Fi(x)638 1732 y Fh(k)p 547 1742 111 2 v +556 1774 a Fy(k)p Fi(x)594 1780 y Fh(k)613 1774 y Fy(k)631 +1765 y Fg(2)662 1749 y Fz(.)374 1812 y(\(e\))32 b Fi(A)476 +1818 y Fh(k)505 1812 y Fy( )10 b Fi(A)576 1818 y Fh(k)q +Ff(\000)p Fg(1)643 1812 y Fz(+)e Fi(d)696 1818 y Fh(k)715 +1812 y Fi(x)735 1818 y Fh(k)754 1812 y Fz(.)374 1866 +y(\(f)s(\))34 b Fi(R)477 1872 y Fh(k)q Fg(+1)544 1866 +y Fy( )10 b Fi(R)616 1872 y Fh(k)642 1866 y Fy(\000)e +Fi(d)695 1872 y Fh(k)715 1866 y Fi(x)735 1872 y Fh(k)754 +1866 y Fz(.)374 1920 y(\(g\))30 b Fi(\032)468 1926 y +Fh(k)q Fg(+1)535 1920 y Fy( )10 b Fi(\032)598 1926 y +Fh(k)625 1920 y Fy(\000)e Fi(\014)r Fz(.)374 1986 y(End)i +Fi(k)q Fz(-lo)q(op.)704 2136 y(Fig.)h(3.)35 b(Computing)9 +b(a)i(T)m(ensor)g(SDD)p eop +%%Page: 15 15 +15 14 bop 946 125 a Fv(Semidiscrete)12 b(Matrix)f(Decomp)q(osition)78 +b Fu(\001)70 b Fv(15)225 235 y Ft(\(3\))21 b(THR:)10 +b(Cho)q(ose)h Fr(x)578 220 y Fn(\()p Fl(\000)p Fn(1\))660 +235 y Ft(=)h Fr(e)723 213 y Fn(\(2\))723 246 y Fp(j)737 +250 y Fj(2)771 235 y Fs(\012)s(\001)7 b(\001)g(\001)s(\012)s +Fr(e)913 213 y Fn(\()p Fp(n)p Fn(\))913 246 y Fp(j)927 +250 y Fm(n)973 235 y Ft(\(i.e.,)j Fr(x)h Ft(with)g(the)g(\014rst)h +(comp)q(onen)o(t)e(remo)o(v)o(ed\))299 284 y(suc)o(h)k(that)732 +382 y Fs(k)p Ft(\()p Fr(R)9 b Fs(\001)g Fr(x)855 365 +y Fn(\()p Fl(\000)p Fn(1\))925 382 y Ft(\))p Fs(k)962 +365 y Fn(2)962 392 y(2)992 382 y Fs(\025)j(k)p Fr(R)p +Fs(k)1110 365 y Fn(2)1128 382 y Fr(=)1174 330 y Fp(n)1158 +343 y Fo(Y)1156 431 y Fp(j)r Fn(=2)1220 382 y Fr(m)1256 +388 y Fp(j)1274 382 y Fr(:)299 513 y Ft(Although)17 b(an)g(appropriate) +g(c)o(hoice)h(of)f Fr(e)971 492 y Fn(\(2\))971 525 y +Fp(j)985 529 y Fj(2)1028 513 y Fs(\012)12 b(\001)7 b(\001)g(\001)j +(\012)i Fr(e)1195 492 y Fn(\()p Fp(n)p Fn(\))1195 525 +y Fp(j)1209 529 y Fm(n)1261 513 y Ft(is)17 b(guaran)o(teed)h(to)f +(exist,)i(it)299 563 y(ma)o(y)12 b(b)q(e)i(di\016cult)f(to)g(\014nd)h +(b)q(ecause)i(of)d(the)h(large)f(searc)o(h)i(space)g(of)e(elemen)o(ts)h +(to)f(searc)o(h)299 613 y(through.)225 713 y FA(5.)20 +b(APPLICA)m(TIONS)225 779 y Ft(The)g(SDD)f(is)g(useful)g(in)g +(applications)f(in)o(v)o(olving)f(storage)j(compression,)g(data)f +(\014ltering,)225 829 y(and)13 b(feature)h(extraction.)k(As)c +(examples,)e(w)o(e)i(discuss)g(in)f(this)g(section)h(the)g(use)g(of)f +(the)h(SDD)225 879 y(in)h(image)f(compression,)i(c)o(hromosome)d +(classi\014cation,)j(and)f(laten)o(t)h(seman)o(tic)f(indexing)g(of)225 +929 y(do)q(cumen)o(ts.)225 1016 y FA(5.1)20 b(Data)14 +b(Comp)o(ression)e(via)i(the)h(SDD)225 1083 y Ft(If)f(a)h(matrix)e +(consumes)h(to)q(o)h(m)o(uc)o(h)e(storage)i(space,)h(then)f(the)h(SDD)e +(is)g(one)h(w)o(a)o(y)f(to)h(reduce)225 1133 y(the)d(storage)g(burden.) +18 b(F)m(or)11 b(example,)f(the)i(SDD)e(can)i(b)q(e)g(used)g(for)f +(image)e(compression.)17 b(The)225 1182 y(SDD)d(w)o(as)g(originally)e +(dev)o(elop)q(ed)j(b)o(y)f(O'Leary)g(and)h(P)o(eleg)f([1983])e(for)i +(this)h(application.)j(If)225 1232 y(eac)o(h)13 b(pixel)g(v)n(alue)f +(\(e.g.,)g(gra)o(y)g(lev)o(el\))h(is)g(stored)g(as)g(a)g(matrix)e(en)o +(try)m(,)i(then)g(a)g Fr(k)q Ft(-term)f(SDD)g(of)225 +1282 y(the)i(resulting)g(matrix)f(can)h(b)q(e)g(stored)h(as)f(an)g +(appro)o(ximation)c(to)k(the)h(original)d(image.)267 +1332 y(Other)k(matrix)e(appro)o(ximation)e(tec)o(hniques)17 +b(ha)o(v)o(e)e(b)q(een)i(used)f(for)g(image)d(compression.)225 +1382 y(The)h(SVD)f([Golub)f(and)h(V)m(an)g(Loan)f(1989])g(pro)o(vides)i +(a)f(set)h(of)e(basis)i(v)o(ectors)g(that)g(giv)o(es)f(the)225 +1432 y(optimal)d(lo)o(w-rank)i(appro)o(ximation)e(in)i(the)i(sense)g +(of)f(minim)o(i)o(zing)d(the)j(sum)f(squared)i(errors)225 +1481 y(\(F)m(rob)q(enius)f(norm\).)j(But)d(these)h(v)o(ectors)g(are)f +(exp)q(ensiv)o(e)g(to)f(generate)i(and)e(tak)o(e)h(quite)f(a)h(bit)225 +1531 y(of)f(storage)g(space)i(\()p Fr(n)6 b Ft(+)g Fr(m)g +Ft(+)g(1)13 b(\015oating)f(p)q(oin)o(t)g(elemen)o(ts)g(p)q(er)h(term,)f +(although)f(it)h(is)g(p)q(ossible)225 1581 y(to)j(use)g(lo)o(w)o(er)f +(precision\).)22 b(A)o(t)14 b(the)i(other)f(extreme,)g(predetermined)g +(basis)g(v)o(ectors)h(can)f(b)q(e)225 1631 y(used)j(\(e.g.,)f(Haar)g +(basis)g(or)g(other)h(w)o(a)o(v)o(elet)e(bases\).)29 +b(In)17 b(this)g(case,)i(the)e(basis)g(v)o(ectors)i(do)225 +1681 y(not)14 b(need)h(to)g(b)q(e)f(explicitly)g(stored,)h(but)f(the)h +(n)o(um)o(b)q(er)f(of)f(terms)h(is)g(generally)g(m)o(uc)o(h)f(larger) +225 1730 y(than)f(for)h(the)g(SVD.)f(Although)g(the)h(SDD)f(c)o(ho)q +(oses)h(the)g(basis)g(v)o(ectors)g(to)g(\014t)f(the)i(particular)225 +1780 y(problem)i(\(lik)o(e)g(the)h(SVD\),)g(it)f(c)o(ho)q(oses)i(them)e +(with)h(restricted)i(en)o(tries)f(\(lik)o(e)e(the)i(w)o(a)o(v)o(elet) +225 1830 y(bases\),)c(making)c(the)k(storage)f(p)q(er)h(term)f(only)f +(log)1034 1840 y Fn(2)1059 1830 y Ft(3\()p Fr(n)7 b Ft(+)h +Fr(m)p Ft(\))14 b(bits)f(plus)g(one)g(\015oating)f(p)q(oin)o(t)225 +1880 y(n)o(um)o(b)q(er.)267 1930 y(Exp)q(erimen)o(ts)i(using)g(the)h +(SDD)f(for)g(images)f(ac)o(hiev)o(ed)i(10)f(to)g(1)g(compression)g +(\(using)h(the)225 1980 y(SDD)f(with)g(run-length)h(enco)q(ding\))g +(without)f(visual)g(degradation)g(of)g(the)h(image)e([O'Leary)225 +2030 y(and)h(P)o(eleg)g(1983].)225 2117 y FA(5.2)20 b(Data)14 +b(Filtering)g(via)f(the)i(SDD)225 2184 y Ft(The)20 b +Fr(k)q Ft(-term)e(appro)o(ximations)e(pro)q(duced)21 +b(b)o(y)e(the)h(SDD)e(algorithm)f(can)i(b)q(e)h(though)o(t)f(of)225 +2233 y(as)c(\014ltered)h(appro)o(ximations,)c(\014nding)j(relations)g +(b)q(et)o(w)o(een)h(the)g(columns)e(\(or)h(ro)o(ws\))g(of)g(the)225 +2283 y(matrix)h(that)i(are)g(hidden)f(b)o(y)h(lo)q(cal)f(v)n +(ariations.)28 b(Th)o(us,)18 b(if)f(w)o(e)h(ha)o(v)o(e)f(man)o(y)f +(observ)n(ations)225 2333 y(of)h(the)g(same)g(v)o(ector-v)n(alued)g +(phenomenon,)g(then)g(an)g(SDD)g(of)f(the)i(data)f(can)g(rev)o(eal)h +(the)225 2383 y(essen)o(tial)c(unc)o(hanging)g(c)o(haracteristics.)267 +2433 y(This)k(fact)h(has)f(b)q(een)i(used)g(in)e(c)o(hromosome)e +(classi\014cation.)32 b(Giv)o(en)18 b(a)g(\\training)g(set")225 +2483 y(consisting)e(of)g(man)o(y)e(observ)n(ations)i(of)g(a)g(giv)o(en) +g(t)o(yp)q(e)g(of)g(c)o(hromosome)e(\(e.g.,)i(a)g(h)o(uman)e(X)225 +2532 y(c)o(hromosome\),)h(an)i(SDD)f(of)g(this)h(data)g(extracts)h +(common)c(c)o(haracteristics,)19 b(similar)14 b(to)j(a)p +eop +%%Page: 16 16 +16 15 bop 225 125 a Fv(16)71 b Fu(\001)78 b Fv(T.)13 +b(G.)f(Kolda)g(and)h(D.)g(P)m(.)e(O'Lea)o(ry)225 233 +y Ft(principal)j(comp)q(onen)o(t)f(analysis,)h(but)g(t)o(ypically)f +(requiring)h(less)h(storage)g(space.)21 b(Then)15 b(the)225 +283 y(idealized)f(represen)o(tation)i(of)d(this)h(c)o(hromosome)e(can)j +(b)q(e)g(used)g(to)f(iden)o(tify)f(other)i(c)o(hromo-)225 +332 y(somes)g(of)g(the)h(same)e(t)o(yp)q(e)i(\()p Fq(chr)n(omosome)h +(karyotyping)p Ft(\).)23 b(F)m(or)15 b(more)g(information)d(on)j(this) +225 382 y(tec)o(hnique,)f(see)h([Conro)o(y)e(et)i(al.)d(1999].)225 +463 y FA(5.3)20 b(F)o(eature)15 b(Extraction)f(via)g(the)h(SDD)225 +529 y Ft(The)e(lo)o(w)g(rank)g(appro)o(ximatio)o(ns)e(pro)q(duced)j(b)o +(y)f(the)h(SDD)e(extract)i(features)g(that)f(are)h(com-)225 +579 y(mon)f(among)f(the)j(columns)e(\(or)i(ro)o(ws\))f(of)g(the)h +(matrix.)j(This)c(task)h(is)f(addressed)i(b)o(y)e(laten)o(t)225 +629 y(seman)o(tic)9 b(indexing)h(\(LSI\))g(of)g(do)q(cumen)o(ts.)16 +b(A)10 b(database)h(of)e(do)q(cumen)o(ts)h(can)h(b)q(e)g(represen)o +(ted)225 679 y(b)o(y)i(a)f(term-do)q(cumen)o(t)g(matrix,)f(in)h(whic)o +(h)h(eac)o(h)g(matrix)f(en)o(try)h(represen)o(ts)j(the)d(imp)q(ortance) +225 729 y(of)i(some)g(term)g(in)g(a)g(particular)h(do)q(cumen)o(t.)22 +b(Do)q(cumen)o(ts)16 b(can)g(b)q(e)g(clustered)h(for)e(retriev)n(al)225 +778 y(based)20 b(on)f(common)d(features.)35 b(Standard)20 +b(algorithms)d(use)j(the)g(SVD)f(to)g(extract)h(these)225 +828 y(feature)15 b(v)o(ectors,)g(but)f(the)h(storage)f(in)o(v)o(olv)o +(ed)f(is)h(often)g(greater)h(than)g(that)f(for)f(the)i(original)225 +878 y(matrix.)h(In)d(con)o(trast,)h(the)g(SDD)f(has)h(b)q(een)g(used)g +(b)o(y)g(Kolda)e(and)i(O'Leary)f([1998,)f(1999])f(to)225 +928 y(ac)o(hiev)o(e)j(similar)e(retriev)n(al)h(p)q(erformance)h(at)g(a) +f(m)o(uc)o(h)g(lo)o(w)o(er)h(storage)g(cost.)225 1015 +y FA(6.)20 b(IMPLEMENT)m(A)m(TION)13 b(DET)m(AILS)225 +1081 y Ft(W)m(e)k(fo)q(cus)g(on)g(the)h(regular)f(SDD;)f(the)i(details) +f(for)g(the)h(w)o(eigh)o(ted)f(and)g(tensor)h(SDDs)f(are)225 +1131 y(similar.)24 b(The)18 b(primary)d(adv)n(an)o(tage)h(of)g(the)i +(SDD)e(o)o(v)o(er)h(matrix)e(decomp)q(ositions)h(suc)o(h)h(as)225 +1181 y(the)i(SVD)f(is)g(that)g(the)g(SDD)g(requires)h(v)o(ery)g(little) +e(memory)m(.)28 b(In)18 b(this)g(section,)h(w)o(e)g(illus-)225 +1231 y(trate)14 b(the)g(data)f(structures)i(and)e(implemen)o(tation)d +(details)j(of)f(the)i(C)f(co)q(de)h(in)f(our)g(pac)o(k)n(age,)225 +1281 y(SDDP)m(A)o(CK,)g(that)h(ac)o(hiev)o(e)g(the)g(storage)h(sa)o +(vings.)225 1361 y FA(6.1)20 b(Data)14 b(Structures)225 +1428 y Ft(An)j(en)o(try)h(from)e(the)h(discrete)i(set)f +Fs(S)s Ft(,)g(referred)h(to)e(as)g(an)g Fs(S)s Fq(-value)p +Ft(,)h(can)g(b)q(e)f(stored)i(using)225 1478 y(only)g(log)376 +1488 y Fn(2)401 1478 y Ft(3)h(bits.)36 b(W)m(e)20 b(actually)e(use)j(t) +o(w)o(o)f(bits)g(of)f(storage)h(p)q(er)h Fs(S)s Ft(-v)n(alue)e(b)q +(ecause)j(it)d(is)225 1527 y(adv)n(an)o(tageous)c(in)g(computations)f +(in)o(v)o(olving)g(the)i Fs(S)s Ft(-v)n(alues)g(\(see)h +Fs(x)p Ft(6.2\))e(and)g(requires)i(only)225 1577 y(26\045)12 +b(more)g(memory)m(.)j(The)e(\014rst)g(bit)g(is)g(the)g +Fq(value)j Ft(bit)d(and)g(is)f(on)h(if)f(the)i Fs(S)s +Ft(-v)n(alue)e(is)h(nonzero)225 1627 y(and)i(o\013)g(otherwise;)g(the)h +(second)g(bit)e(is)h(the)h Fq(sign)i Ft(bit)c(and)h(is)g(on)f(for)h(an) +g Fs(S)s Ft(-v)n(alue)f(of)g(-1,)g(o\013)225 1677 y(for)g(1,)f(and)h +(unde\014ned)h(for)f(0)g(\(T)m(able)f(1\).)18 b(The)d(unde\014ned)g +(bits)f(w)o(ould)f(not)h(b)q(e)h(stored)g(if)e(w)o(e)225 +1727 y(w)o(ere)i(storing)f(using)f(only)g(log)713 1737 +y Fn(2)738 1727 y Ft(3)h(bits)g(p)q(er)h Fs(S)s Ft(-v)n(alue.)657 +1860 y Fz(T)m(able)c(1.)35 b(Bit)11 b(represen)o(tation)d(of)j +Fy(S)r Fz(-v)n(alues.)p 661 1872 611 2 v 660 1913 2 42 +v 686 1901 a Fy(S)r Fx(-V)m(alue)p 847 1913 V 855 1913 +V 57 w(V)m(alue)h(Bit)p 1074 1913 V 50 w(Sign)h(Bit)p +1271 1913 V 661 1915 611 2 v 660 1956 2 42 v 752 1944 +a Fz(0)p 847 1956 V 855 1956 V 187 w(0)p 1074 1956 V +151 w(undef.)p 1271 1956 V 661 1958 611 2 v 660 2000 +2 42 v 752 1987 a(1)p 847 2000 V 855 2000 V 187 w(1)p +1074 2000 V 189 w(0)p 1271 2000 V 661 2001 611 2 v 660 +2043 2 42 v 740 2030 a(-1)p 847 2043 V 855 2043 V 187 +w(1)p 1074 2043 V 189 w(1)p 1271 2043 V 661 2044 611 +2 v 267 2134 a Ft(Eac)o(h)f(iteration,)g(a)h(new)g(\()p +Fr(d;)7 b(x;)g(y)q Ft(\))12 b(triplet)g(is)h(computed.)k(The)c +Fr(x)f Ft(and)g Fr(y)j Ft(v)o(ectors)e(of)f(length)225 +2184 y Fr(m)k Ft(and)g Fr(n)p Ft(,)g(resp)q(ectiv)o(ely)m(,)h(are)f +(referred)i(to)e(as)g Fs(S)s Ft(-v)o(ectors.)25 b(In)16 +b(SDDP)m(A)o(CK,)f(w)o(e)h(store)h(eac)o(h)225 2234 y +Fs(S)s Ft(-v)o(ector's)e(v)n(alue)e(and)h(sign)f(arra)o(ys)h(pac)o(k)o +(ed)g(in)o(to)g(unsigned)g(long)f(in)o(teger)h(arra)o(ys.)267 +2283 y(Supp)q(ose)h(that)g(w)o(e)h(are)f(w)o(orking)f(on)h(a)f +Fr(p)p Ft(-bit)h(arc)o(hitecture)h(\(i.e.,)e(the)i(length)f(of)f(a)h +(single)225 2333 y(w)o(ord)f(of)g(memory)e(is)j Fr(p)f +Ft(bits\).)20 b(Then)15 b(the)g(memory)d(allo)q(cated)i(to)g(the)i(v)n +(alue)d(arra)o(y)i(to)f(hold)225 2383 y Fr(m)h Ft(bits)h(is)e +Fs(d)q Fr(m=p)p Fs(e)h Ft(w)o(ords.)22 b(Storage)15 b(for)g(the)h(sign) +e(arra)o(y)h(is)g(the)h(same.)k(An)15 b(example)f(of)h(an)225 +2433 y Fs(S)s Ft(-v)o(ector)e(and)f(its)g(represen)o(tation)h(on)f(an)g +(8-bit)f(arc)o(hitecture)j(is)e(giv)o(en)f(in)h(Figure)g(4.)17 +b(Notice)225 2483 y(that)e(extra)h(bits)f(in)f(the)i(last)f(w)o(ord)g +(of)f(the)i(arra)o(y)e(and)h(sign)g(bits)g(asso)q(ciated)h(with)e(zero) +i Fs(S)s Ft(-)225 2532 y(v)n(alues)d(are)h(unde\014ned.)20 +b(Extra)13 b(bits)h(are)g(ignored)f(\(i.e.,)g(mask)o(ed)f(to)i(an)f +(appropriate)h(v)n(alue\))p eop +%%Page: 17 17 +17 16 bop 946 125 a Fv(Semidiscrete)12 b(Matrix)f(Decomp)q(osition)78 +b Fu(\001)70 b Fv(17)297 560 y Fi(x)10 b Fz(=)364 242 +y Fo(2)364 315 y(6)364 340 y(6)364 365 y(6)364 389 y(6)364 +414 y(6)364 439 y(6)364 464 y(6)364 489 y(6)364 514 y(6)364 +539 y(6)364 564 y(6)364 589 y(6)364 614 y(6)364 638 y(6)364 +663 y(6)364 688 y(6)364 713 y(6)364 738 y(6)364 763 y(6)364 +790 y(4)402 269 y Fy(\000)p Fz(1)430 311 y(0)430 352 +y(1)430 394 y(1)402 435 y Fy(\000)p Fz(1)430 477 y(0)430 +518 y(0)430 560 y(0)430 601 y(1)430 643 y(1)402 684 y +Fy(\000)p Fz(1)430 726 y(0)402 767 y Fy(\000)p Fz(1)430 +809 y(0)430 850 y(0)458 242 y Fo(3)458 315 y(7)458 340 +y(7)458 365 y(7)458 389 y(7)458 414 y(7)458 439 y(7)458 +464 y(7)458 489 y(7)458 514 y(7)458 539 y(7)458 564 y(7)458 +589 y(7)458 614 y(7)458 638 y(7)458 663 y(7)458 688 y(7)458 +713 y(7)458 738 y(7)458 763 y(7)458 790 y(5)569 264 y +Fz(The)e Fy(S)r Fz(-v)o(ector)f Fi(x)h Fz(sho)o(wn)f(at)h(left)f(has)g +(15)h(en)o(tries.)k(Let)c Fw(x)g Fz(b)q(e)f(a)h(p)q(oin)o(ter)569 +306 y(to)15 b(its)h(represen)o(tatio)o(n)d(on)i(an)h(8-bit)e(arc)o +(hitecture.)25 b(In)16 b(order)e(to)569 347 y(store)g(15)i(bits,)f(the) +g(v)n(alue)f(and)h(sign)g(arra)o(ys)f(are)h(eac)o(h)g(allo)q(cated)569 +389 y(t)o(w)o(o)c(w)o(ords)g(of)f(memory)m(.)j(The)e(v)n(alues)f(of)g +(all)h(elemen)o(ts)d(of)j(the)f(data)569 430 y(structure)k(are)h(giv)o +(en)g(b)q(elo)o(w.)29 b(The)16 b(binary)f(v)n(alues)g(of)h(the)f(8-bit) +569 472 y(w)o(ords)d(are)g(sho)o(wn)g(for)g(the)g(v)n(alue)f(and)g +(sign)h(arra)o(ys;)f(the)h(question)569 513 y(marks)g(\()p +Fw(?)p Fz(\))20 b(represen)o(t)11 b(bits)h(that)g(are)h(unde\014ned.)18 +b(Note)13 b(that)f(the)569 555 y Fd(low)e(or)n(der)g +Fz(bits)e(are)g(used)f(\014rst,)h(so)h(the)f(represen)o(tat)o(ion)d(at) +j(the)g(w)o(ord)569 596 y(lev)o(el)i(is)i(righ)o(t-to-lef)o(t.)594 +711 y Fw(x->length)i(=)k(15)594 770 y(x->value[1)o(])d(=)p +841 737 170 2 v 841 782 2 46 v 31 w(00011101)p 1009 782 +V 841 784 170 2 v 58 w(x->value[2])f(=)p 1304 737 V 1304 +782 2 46 v 31 w(?0010111)p 1472 782 V 1304 784 170 2 +v 594 831 a(x->sign[1])32 b(=)p 841 798 V 841 843 2 46 +v 31 w(???100?1)p 1009 843 V 841 845 170 2 v 58 w(x->sign[2])g(=)p +1304 798 V 1304 843 2 46 v 31 w(???1?100)p 1472 843 V +1304 845 170 2 v 611 988 a Fz(Fig.)11 b(4.)34 b(Illustration)9 +b(of)i Fw(svector)e Fz(data)i(structure.)225 1093 y Ft(in)i(an)o(y)h +(calculations.)j(W)m(e)c(used)i(an)e(8-bit)g(example)g(for)g(simplicit) +o(y;)e(curren)o(t)k(arc)o(hitectures)225 1143 y(are)f(generally)g(32-)f +(or)h(64-bit)f(\(T)m(able)g(2\).)723 1315 y Fz(T)m(able)e(2.)34 +b(Curren)o(t)11 b(arc)o(hitectur)o(es.)p 720 1320 494 +2 v 799 1349 a Fx(32-bit)142 b(64-bit)772 1391 y Fz(Sun)11 +b(Sparc)76 b(SGI)10 b(Octane)745 1432 y(In)o(tel)g(P)o(en)o(tium)57 +b(Dec)11 b(Alpha)752 1474 y(IBM)g(RS6000)p 720 1488 V +225 1668 a FA(6.2)20 b(Computations)13 b(with)h(Objects)h(Using)e(P)o +(ack)o(ed)i(Sto)o(rage)225 1735 y Ft(Giv)o(en)c(an)h +Fs(S)s Ft(-v)o(ector)h(in)f(pac)o(k)o(ed)g(storage,)h(w)o(e)f(can)h(lo) +q(ok)e(up)h(the)h(v)n(alue)e(in)h(a)g(particular)g(en)o(try)225 +1785 y(as)i(follo)o(ws.)i(If)e Fr(i)g Ft(is)f(the)i(desired)g(en)o(try) +m(,)e(then)i(the)f(index)g(in)o(to)f(the)h(pac)o(k)o(ed)g(arra)o(y)g +(is)g Fr(i)g Ft(div)f Fr(p)p Ft(,)225 1835 y(and)f(the)g(bit)g(w)o(e)g +(w)o(an)o(t)g(inside)g(that)g(w)o(ord)g(is)g Fr(i)i Ft(mo)q(d)e +Fr(p)p Ft(,)g(and)g(the)h(desired)g(bit)f(can)g(b)q(e)g(mask)o(ed)225 +1885 y(o\013.)18 b(W)m(e)c(\014rst)h(do)e(a)h(mask)e(on)i(the)h +(appropriate)f(w)o(ord)g(in)f(the)i(v)n(alue)e(arra)o(y)m(.)18 +b(If)13 b(the)i(result)f(is)225 1934 y(zero,)g(then)g(en)o(try)h +Fr(i)e Ft(is)h(zero,)g(and)f(w)o(e)h(need)h(do)e(no)g(further)i(w)o +(ork.)i(Otherwise,)e(the)f(en)o(try)g(is)225 1984 y(either)i(+1)f(or)g +(-1,)g(and)g(w)o(e)h(need)g(to)f(determine)g(the)h(sign.)22 +b(W)m(e)15 b(mask)e(o\013)i(the)h(appropriate)225 2034 +y(w)o(ord)e(in)f(the)i(sign)e(arra)o(y)m(.)18 b(If)13 +b(that)h(is)g(zero,)g(the)g(en)o(try)h(is)f(+1;)f(otherwise,)i(it)e(is) +h(-1.)267 2084 y(F)m(or)d(example,)g(Figure)i(5)f(sho)o(ws)g(ho)o(w)g +(to)g(lo)q(ok)f(up)i(en)o(try)g(10)e(in)h(the)h(example)e(in)h(Figure)g +(4.)225 2134 y(Here)18 b Fc(i)e Ft(is)g(the)h(desired)h(en)o(try)m(.)26 +b(T)m(o)16 b(compute)g Fc(index)p Ft(,)f(the)i(index)g(in)o(to)f(the)h +(pac)o(k)o(ed)g(arra)o(y)m(,)225 2184 y(divide)12 b(b)o(y)g +Fr(p)p Ft(,)f(the)i(n)o(um)o(b)q(er)f(of)f(bits)h(p)q(er)h(w)o(ord.)18 +b(Since)12 b Fr(p)g Ft(is)g(alw)o(a)o(ys)f(a)h(p)q(o)o(w)o(er)h(of)e(t) +o(w)o(o,)h(this)g(can)225 2234 y(b)q(e)i(accomplished)f(b)o(y)g(a)g +(righ)o(t)g(shift.)18 b(In)c(this)f(example,)f(w)o(e)i(righ)o(t)f +(shift)g(3)g(since)i(log)1585 2244 y Fn(2)1611 2234 y +Ft(8)c(=)h(3.)225 2283 y(Giv)o(en)j(the)i(correct)g(index)f(in)o(to)f +(the)i(pac)o(k)o(ed)f(arra)o(ys,)g(the)g(correct)i(bit)d(inside)h(the)h +(w)o(ord)e(is)225 2333 y(determined)g(b)o(y)f(a)h(mo)q(d)e(b)o(y)h +Fr(p)p Ft(.)21 b(Again,)13 b(since)j Fr(p)e Ft(is)h(alw)o(a)o(ys)f(a)g +(p)q(o)o(w)o(er)h(of)f(t)o(w)o(o,)g(w)o(e)h(can)g(use)h(a)225 +2383 y(shortcut)i(b)o(y)e(doing)g(a)g(logical)f(AND)h(with)h +Fr(p)11 b Fs(\000)g Ft(1,)16 b(in)h(this)f(example,)g(7.)25 +b(Then)18 b(mask)d(the)225 2433 y(appropriate)f(w)o(ord)g(in)g(the)h(v) +n(alue)e(arra)o(y)m(.)18 b(In)c(this)g(example,)f(it)g(is)h(nonzero,)h +(so)f(the)h(en)o(try)f(is)225 2483 y(either)h(+1)f(or)g(-1.)19 +b(Then)c(mask)e(the)h(appropriate)h(w)o(ord)f(in)g(the)g(sign)g(arra)o +(y)g(and)g(determine)225 2532 y(that)g(the)g(en)o(try)h(is)f(+1.)p +eop +%%Page: 18 18 +18 17 bop 225 125 a Fv(18)71 b Fu(\001)78 b Fv(T.)13 +b(G.)f(Kolda)g(and)h(D.)g(P)m(.)e(O'Lea)o(ry)597 212 +y Fw(i)17 b(=)h(10)597 253 y(index)e(=)h(i)h(>>)f(3)597 +295 y(mask)f(=)i(1)f(<<)g(\(i)g(AND)f(7\))597 336 y(x->value[in)o(dex)o +(])e(AND)j(mask)f(=)p 1074 303 170 2 v 1074 349 2 46 +v 32 w(00000010)p 1241 349 V 1074 351 170 2 v 597 389 +a(x->sign[ind)o(ex])31 b(AND)17 b(mask)f(=)p 1074 356 +V 1074 401 2 46 v 32 w(00000000)p 1241 401 V 1074 403 +170 2 v 614 480 a Fz(Fig.)11 b(5.)35 b(Lo)q(oking)9 b(up)i(a)h(v)n +(alue)e(in)h(a)h(pac)o(k)o(ed)d(arra)o(y)m(.)267 579 +y Ft(Note)g(that)h(the)g(alignmen)o(t)d(of)i(the)h(v)n(alue)f(and)g +(sign)h(arra)o(ys)f(mak)o(es)g(it)g(easy)h(to)f(do)g(individual)225 +629 y(lo)q(okups)14 b(of)g(v)n(alues.)20 b(If)14 b(w)o(e)h(did)f(not)g +(store)i(the)f(`\014ller')e(bits)i(in)f(the)h(sign)f(arra)o(y)g(for)g +(the)h(zero)225 679 y(en)o(tries,)h(the)g(sign)f(arra)o(y)h(w)o(ould)e +(b)q(e)i(m)o(uc)o(h)e(shorter,)j(but)e(w)o(e)h(w)o(ould)f(ha)o(v)o(e)g +(a)g(di\016cult)g(time)225 728 y(kno)o(wing)e(where)i(in)e(the)i(sign)e +(arra)o(y)h(to)g(lo)q(ok)f(for)g(the)i(appropriate)f(bit.)267 +778 y(In)j(the)i(previous)f(example,)f(w)o(e)h(sa)o(w)g(ho)o(w)f(to)h +(lo)q(ok)f(up)h(a)f(random)g(en)o(try)h(in)f(a)h(pac)o(k)o(ed)225 +828 y(arra)o(y)m(.)f(Often)d(w)o(e)g(w)o(alk)e(through)i(an)f +Fs(S)s Ft(-v)o(ector)h(in)f(sequence.)20 b(In)13 b(that)h(case,)g +(computations)225 878 y(can)h(b)q(e)h(p)q(erformed)f(ev)o(en)h(more)e +(quic)o(kly)h(b)o(y)g(cop)o(ying)f(the)i(curren)o(t)h(v)n(alue)d(and)h +(sign)g(w)o(ords)225 928 y(in)o(to)j(the)h(register)g(to)f(b)q(e)h +(used)g Fr(p)g Ft(times)e(and)h(quic)o(kly)f(up)q(dating)h(the)h(mask)e +(with)h(just)h(a)225 978 y(single)13 b(left)g(shift.)k(Ev)o(ery)d +Fr(p)f Ft(en)o(tries,)h(w)o(e)f(reset)i(the)f(mask)e(to)h(one)g(and)g +(sw)o(ap)g(the)h(next)g(v)n(alue)225 1027 y(and)g(sign)f(w)o(ords)h(in) +o(to)g(the)g(register.)267 1077 y(The)k(inner)h(pro)q(duct)h(b)q(et)o +(w)o(een)f(t)o(w)o(o)f Fs(S)s Ft(-v)o(ectors,)j(something)c(that)h(w)o +(e)h(require,)h(can)f(b)q(e)225 1127 y(computed)12 b(as)h(follo)o(ws.)j +(The)e(result)f(is)g(the)g(n)o(um)o(b)q(er)f(of)h(nonzeros)g(in)g +(common)d(min)o(us)h(t)o(wice)225 1177 y(the)21 b(n)o(um)o(b)q(er)f(of) +g(common)d(nonzeros)22 b(with)e(opp)q(osite)h(signs.)37 +b(Pseudo-co)q(de)23 b(is)d(giv)o(en)g(in)225 1227 y(Figure)d(6)f(for)g +(the)i(inner)f(pro)q(duct)g(of)f(t)o(w)o(o)g Fs(S)s Ft(-v)o(ectors)i +Fc(a)f Ft(and)f Fc(b)p Ft(.)26 b(In)17 b(practice,)h(the)f(logical)225 +1276 y(ANDs)k(and)f(ORs)h(are)g(done)g(on)f(a)h(w)o(ord-b)o(y-w)o(ord)e +(basis)i(and)f(the)i(p)q(op)q(coun)o(t)f(\(sum\))e(is)225 +1326 y(determined)e(using)g(a)g(lo)q(okup)f(table)h(on)g(a)g(b)o(yte-b) +o(y-b)o(yte)g(basis.)28 b(So,)17 b(for)g(computing)f(the)225 +1376 y(inner)e(pro)q(duct)g(of)f(t)o(w)o(o)f Fr(m)p Ft(-long)h +Fs(S)s Ft(-v)o(ectors,)h(the)g(w)o(ork)f(required)h(is)f(3)p +Fs(d)p Fr(m=p)p Fs(e)c Ft(+)g(4)p Fs(d)p Fr(m=)p Ft(8)p +Fs(e)14 b Ft(and)225 1426 y(requires)h(no)f(m)o(ultiplicati)o(on.)567 +1512 y Fw(common)i(=)h(a->value)e(AND)h(b->value)567 +1553 y(oppsign)f(=)j(\(a->)e(sign)g(XOR)h(b->sign\))d(AND)j(common)567 +1595 y(ip)g(=)g(popcount\(co)o(mmo)o(n\))d(-)k(2)f(popcount\(o)o(pps)o +(ign)o(\))662 1679 y Fz(Fig.)11 b(6.)35 b(Inner)10 b(pro)q(duct)f(of)i +(t)o(w)o(o)h Fy(S)r Fz(-v)o(ectors.)267 1785 y Ft(Eac)o(h)18 +b(iteration)g(of)g(the)h(SDD)f(calculation,)g(the)h(most)f(exp)q(ensiv) +o(e)h(op)q(erations)g(are)g(the)225 1835 y(computations)14 +b(of)g Fr(R)565 1841 y Fp(k)585 1835 y Fr(y)j Ft(or)e +Fr(R)706 1820 y Fp(T)706 1847 y(k)732 1835 y Fr(x)g Ft(\(Steps)h +(\(2\(b\)i\))f(and)g(\(2\(b\)ii\))f(of)h(the)h(SDD)e(Algorithm)f(of)225 +1885 y(Figure)18 b(1\).)31 b(W)m(e)18 b(fo)q(cus)g(on)g(the)h +(computation)e(of)g Fr(R)1094 1891 y Fp(k)1114 1885 y +Fr(y)j Ft(and)e(explain)f(the)i(di\013erences)i(for)225 +1935 y(the)c(transp)q(ose)g(at)f(the)h(conclusion.)25 +b(The)16 b(residual)g(breaks)h(in)o(to)f(t)o(w)o(o)f(parts:)23 +b(the)17 b(original)225 1984 y(matrix,)12 b Fr(A)p Ft(,)h(and)h(the)g +(\()p Fr(k)d Fs(\000)e Ft(1\)-term)k(SDD)g(appro)o(ximation)e(that)j(w) +o(e)g(denote)h(b)o(y)f Fr(X)s(D)q(Y)1646 1969 y Fp(T)1672 +1984 y Ft(.)267 2034 y(The)c(computation)f Fr(v)k Ft(=)f +Fr(Ay)h Ft(is)d(a)g(sparse)i(matrix)d(times)g(an)i Fs(S)s +Ft(-v)o(ector.)17 b(The)11 b(sparse)h(matrix)225 2084 +y(is)h(stored)i(in)e(compressed)i(sparse)f(column)e(\(CSC\))i(format.)i +(W)m(e)e(lo)q(op)e(through)i(the)g(matrix)225 2134 y(column)o(wise,)k +(whic)o(h)g(means)f(that)i(w)o(e)f(w)o(alk)g(through)g(the)h +Fr(y)q Ft(-v)o(ector)h(in)e(sequence.)34 b(If)18 b Fr(y)1702 +2140 y Fp(j)225 2184 y Ft(is)f(zero,)i(then)e(nothing)g(is)g(done)h +(with)e(column)g Fr(j)r Ft(.)28 b(Otherwise,)20 b(w)o(e)d(either)h(add) +f(\()p Fr(y)1598 2190 y Fp(j)1633 2184 y Ft(=)g(1\))225 +2234 y(or)e(subtract)i(\()p Fr(y)479 2240 y Fp(j)511 +2234 y Ft(=)d Fs(\000)p Ft(1\))h(the)h(en)o(tries)g(in)f(column)f +Fr(j)k Ft(from)13 b(the)j(appropriate)g(en)o(tries)g(in)f(the)225 +2283 y(solution)e(v)o(ector)i Fr(v)q Ft(.)267 2333 y(The)f(computation) +e(of)i Fr(w)f Ft(=)f Fr(X)s(D)q(Y)835 2318 y Fp(T)861 +2333 y Fr(y)k Ft(breaks)f(do)o(wn)f(in)o(to)f(three)j(parts:)j +Fr(Y)1485 2318 y Fp(T)1511 2333 y Fr(y)q Ft(,)c Fr(D)q +Ft(\()p Fr(Y)1644 2318 y Fp(T)1670 2333 y Fr(y)q Ft(\),)225 +2383 y(and)f Fr(X)s Ft(\()p Fr(D)q(Y)429 2368 y Fp(T)455 +2383 y Fr(y)q Ft(\).)21 b(The)15 b(\014rst)g(part)g(is)f(an)g +Fs(S)s Ft(-matrix)f(times)g(an)i Fs(S)s Ft(-v)o(ector,)g(whic)o(h)f +(reduces)i(to)225 2433 y(an)e(inner)h(pro)q(duct)g(b)q(et)o(w)o(een)h +(t)o(w)o(o)e Fs(S)s Ft(-v)o(ectors)h(for)f(eac)o(h)h(en)o(try)g(in)f +(the)h(solution.)k(The)c(result)225 2483 y(of)h Fr(Y)308 +2468 y Fp(T)334 2483 y Fr(y)i Ft(is)e(an)g(in)o(teger)h(v)o(ector.)26 +b(The)16 b Fr(D)q Ft(\()p Fr(Y)936 2468 y Fp(T)962 2483 +y Fr(y)q Ft(\))i(is)e(just)g(a)g(simple)f(scaling)g(op)q(eration,)i +(and)225 2532 y(the)c(result)g(is)g(a)f(real)h(v)o(ector.)18 +b(The)13 b(\014nal)f(pro)q(duct)h(is)g Fr(X)s Ft(\()p +Fr(D)q(Y)1195 2517 y Fp(T)1222 2532 y Fr(y)q Ft(\),)g(and)f(in)g(this)h +(case)h(w)o(e)e(w)o(alk)p eop +%%Page: 19 19 +19 18 bop 946 125 a Fv(Semidiscrete)12 b(Matrix)f(Decomp)q(osition)78 +b Fu(\001)70 b Fv(19)225 233 y Ft(through)15 b(eac)o(h)g(bit)f(in)g +(the)h Fr(X)j Ft(matrix)13 b(column)g(b)o(y)h(column)f(and)h(tak)o(e)h +(appropriate)f(action.)225 283 y(Again,)f(only)g(additions)g(and)h +(subtractions)g(are)h(required,)f(no)g(m)o(ultipli)o(cations.)267 +333 y(In)h(the)i(case)g(of)e(the)i(transp)q(ose)g(computation,)d(the)i +(main)e(di\013erence)k(is)e(in)f(the)i(compu-)225 382 +y(tation)e(of)g Fr(A)429 367 y Fp(T)455 382 y Fr(x)p +Ft(.)23 b(Here,)17 b(w)o(e)f(are)g(forced)g(to)g(use)g(random)e(access) +k(in)o(to)c Fr(x)i Ft(since)g Fr(A)g Ft(is)f(stored)225 +432 y(in)f(CSC)g(format.)i(The)f(metho)q(d)e(for)h(computing)e(\()p +Fr(X)s(D)q(Y)1151 417 y Fp(T)1177 432 y Ft(\))1193 417 +y Fp(T)1219 432 y Fr(x)i Ft(is)g(nearly)g(iden)o(tical)f(to)h(that)225 +482 y(describ)q(ed)i(previously)d(for)h Fr(X)s(D)q(Y)777 +467 y Fp(T)804 482 y Fr(y)q Ft(,)g(except)h(that)f(the)g(roles)h(of)e +Fr(X)k Ft(and)d Fr(Y)23 b Ft(are)15 b(sw)o(app)q(ed.)267 +532 y(So,)e(the)j(only)d(m)o(ultiplications)f(required)j(in)f(our)h +(computations)e(are)i(the)g(diagonal)d(scal-)225 582 +y(ings;)h(ev)o(erything)h(else)h(is)f(additions)f(and)h(subtractions.) +19 b(F)m(urther,)14 b(the)h(pieces)g(of)e(the)i(SDD)225 +632 y(are)f(small)e(and)i(\014t)g(w)o(ell)f(in)o(to)g(cac)o(he.)225 +729 y FA(7.)20 b(NUMERICAL)13 b(RESUL)m(TS)225 796 y +Ft(The)d(computational)e(exp)q(erimen)o(ts)i(presen)o(ted)i(here)f(are) +g(done)f(in)f(Matlab,)h(with)g(the)g(Matlab)225 846 y(co)q(de)21 +b(and)f(examples)f(pro)o(vided)h(in)g(SDDP)m(A)o(CK.)f(In)h(general,)h +(the)g(C)f(SDDP)m(A)o(CK)g(co)q(de)225 895 y(should)f(b)q(e)h(used)h +(when)f(sp)q(eed)h(and)e(storage)h(e\016ciency)g(are)g(concerns.)37 +b(No)19 b(results)i(are)225 945 y(presen)o(ted)16 b(here)f(for)e(the)h +(w)o(eigh)o(ted)g(or)g(tensor)g(SDDs)g(although)e(MA)m(TLAB)i(co)q(de)h +(for)e(these)225 995 y(decomp)q(ositions)g(are)h(included.)k(No)c(C)g +(co)q(de)h(is)e(pro)o(vided)h(for)g(these)h(in)e(SDDP)m(A)o(CK.)267 +1045 y(W)m(e)i(discuss)i(previous)f(researc)o(h)i(and)d(presen)o(t)j +(new)e(results)h(on)e(the)i(SDD)e(and)g(starting)225 +1095 y(criteria)f(as)g(w)o(ell)f(as)h(comparisons)f(b)q(et)o(w)o(een)i +(the)g(SDD)e(and)h(the)g(SVD.)267 1145 y(In)9 b([Kolda)f(1997],)h +(comparisons)f(of)h(the)h(v)n(arious)f(starting)g(criteria)h(on)f +(small,)e(dense)k(matri-)225 1195 y(ces)j(are)g(presen)o(ted.)20 +b(T)m(o)12 b(summarize,)f(the)i(MAX,)g(CYC,)g(and)g(THR)g(tec)o +(hniques)h(are)f(nearly)225 1244 y(iden)o(tical)k(in)g(p)q(erformance.) +30 b(The)18 b(SVD)g(initialization)d(t)o(ypically)h(results)j(in)f(few) +o(er)g(inner)225 1294 y(iterations)f(p)q(er)g(outer)g(iteration,)g(but) +g(the)g(gain)f(is)g(o\013set)i(b)o(y)e(the)h(exp)q(ense)i(of)d +(computing)225 1344 y(the)e(starting)g(v)o(ector.)267 +1394 y(In)c([Kolda)f(and)h(O'Leary)h(1998],)e(the)i(SDD)e(and)h(SVD)h +(are)f(compared)g(for)g(laten)o(t)g(seman)o(tic)225 1444 +y(indexing)f(for)h(information)d(retriev)n(al.)17 b(A)o(t)10 +b(equal)g(lev)o(els)g(of)g(retriev)n(al)g(p)q(erformance,)g(the)h(SDD) +225 1494 y(mo)q(del)k(required)i(appro)o(ximately)d(20)i(times)f(less)i +(storage)g(and)f(p)q(erformed)g(queries)h(ab)q(out)225 +1543 y(t)o(wice)g(as)g(fast.)25 b(On)17 b(the)g(negativ)o(e)g(side,)g +(the)g(SVD)g(can)f(b)q(e)i(computed)e(ab)q(out)g(four)g(times)225 +1593 y(faster)i(than)g(the)g(SDD)f(for)g(equal)g(p)q(erformance)h(lev)o +(els.)29 b(The)18 b(SDD)f(computations)f(used)225 1643 +y(option)g(PER,)h(as)g(describ)q(ed)i(subsequen)o(tly)f(|)e(w)o(e)i(ma) +o(y)d(b)q(e)i(able)g(to)g(impro)o(v)o(e)e(the)j(sp)q(eed)225 +1693 y(and)c(p)q(erformance)f(b)o(y)h(using)g(option)f(THR)g(instead.) +267 1743 y(W)m(e)e(compare)g(v)n(arious)g(initialization)f(strategies)j +(for)e(the)i(SDD)e(on)h(sev)o(eral)g(sparse)h(matri-)225 +1793 y(ces)i(from)e(MatrixMark)o(et;)g(the)i(test)g(set)g(is)f(describ) +q(ed)i(in)e(T)m(able)f(3.)19 b(W)m(e)13 b(test)j(four)d(di\013eren)o(t) +225 1842 y(initialization)e(strategies)k(as)f(listed)g(b)q(elo)o(w.)225 +1922 y(THR:)20 b(Cycle)f(through)g(the)h(unit)f(v)o(ectors)h +(\(starting)f(where)h(it)f(left)g(o\013)g(at)f(the)i(previous)267 +1972 y(iteration\))13 b(un)o(til)g Fs(k)p Fr(R)602 1978 +y Fp(k)622 1972 y Fr(e)641 1978 y Fp(j)659 1972 y Fs(k)680 +1957 y Fn(2)680 1982 y(2)710 1972 y Fs(\025)e(k)p Fr(R)806 +1978 y Fp(k)826 1972 y Fs(k)847 1957 y Fn(2)847 1983 +y Fp(F)874 1972 y Fr(=n)p Ft(,)i(and)h(set)h Fr(y)e Ft(=)f +Fr(e)1187 1978 y Fp(j)1205 1972 y Ft(.)18 b(\(Threshold\))225 +2033 y(CYC:)i(Initialize)13 b Fr(y)h Ft(=)d Fr(e)616 +2039 y Fp(i)631 2033 y Ft(,)i(where)i Fr(i)d Ft(=)g(\(\()p +Fr(k)e Fs(\000)g Ft(1\))j(mo)q(d)g Fr(n)p Ft(\))c(+)g(1.)18 +b(\(Cycling\))225 2094 y(ONE:)j(Initialize)13 b Fr(y)i +Ft(to)f(the)h(all)d(ones)j(v)o(ector.)k(\(Ones\))225 +2155 y(PER:)h(Initialize)e Fr(y)i Ft(to)f(a)f(v)o(ector)i(suc)o(h)f +(that)g(elemen)o(ts)g(1)p Fr(;)7 b Ft(101)p Fr(;)g Ft(201)p +Fr(;)f(:)h(:)f(:)15 b Ft(are)k(one)g(and)g(the)267 2205 +y(remaining)11 b(elemen)o(ts)j(are)g(zero.)19 b(\(P)o(erio)q(dic)c +(ones\))225 2283 y(W)m(e)c(do)h(not)f(test)i(the)f(MAX)g(strategy)g(b)q +(ecause)i(these)f(matrices)e(are)h(sparse,)g(so)g(the)g(residual)225 +2333 y(is)k(stored)h(implicitly)l(.)22 b(The)16 b(other)h(parameters)f +(of)g(the)g(SDD)g(are)h(set)g(as)f(follo)o(ws:)21 b Fr(k)1613 +2339 y Fn(max)1691 2333 y Ft(is)225 2383 y(set)15 b(to)f(the)g(rank)g +(of)f(the)i(matrix,)c Fr(\013)800 2389 y Fn(min)868 2383 +y Ft(=)h(0)p Fr(:)p Ft(01,)g Fr(l)1023 2389 y Fn(max)1099 +2383 y Ft(=)f(100,)i(and)h Fr(\032)1332 2389 y Fn(min)1401 +2383 y Ft(=)e(0.)267 2433 y(The)17 b(p)q(erformance)f(of)g(these)j +(four)d(strategies)i(on)e(our)h(four)f(test)i(matrices)e(is)h(sho)o(wn) +g(in)225 2483 y(T)m(able)e(4.)24 b(The)16 b(table)g(compares)f(the)i +(relativ)o(e)f(reduction)g(in)g(the)g(residual)g(\(as)g(a)g(p)q(ercen)o +(t-)225 2532 y(age\),)j(the)h(a)o(v)o(erage)e(n)o(um)o(b)q(er)g(of)g +(inner)h(iterations)g(\(whic)o(h)g(includes)g(the)g(extra)g(w)o(ork)g +(for)p eop +%%Page: 20 20 +20 19 bop 225 125 a Fv(20)71 b Fu(\001)78 b Fv(T.)13 +b(G.)f(Kolda)g(and)h(D.)g(P)m(.)e(O'Lea)o(ry)225 233 +y Ft(initialization)h(in)j(THR\),)f(and)h(the)g(densit)o(y)g(of)g(the)g +(\014nal)g(factors)g(\(as)g(a)g(p)q(ercen)o(tage\).)23 +b(The)225 283 y(initialization)18 b(can)i(ha)o(v)o(e)h(a)f(dramatic)f +(a\013ect)i(on)f(the)h(residual)g(after)g Fr(k)g Ft(terms.)37 +b(In)21 b(the)225 332 y Fc(impcol)p 360 332 14 2 v 14 +w(c)15 b Ft(and)g Fc(watson2)f Ft(matrices,)g(THR)h(and)f(CYC)h(are)h +(drastically)e(b)q(etter)j(than)e(ONE)225 382 y(and)j(PER.)h(The)g(n)o +(um)o(b)q(er)e(of)h(inner)h(iterations)g(is)f(lo)o(w)o(est)h(o)o(v)o +(erall)e(for)h(CYC,)g(with)h(THR)225 432 y(b)q(eing)c(a)f(close)h +(second.)21 b(In)15 b(terms)f(of)g(densit)o(y)m(,)g(THR)h(and)f(CYC)h +(are)g(drastically)f(b)q(etter)i(in)225 482 y(ev)o(ery)d(case,)g(p)q +(erhaps)g(b)q(ecause)h(the)e(initial)e(v)o(ector)j(is)f(sparse.)19 +b(It)12 b(seems)g(that)g(the)h(densit)o(y)f(of)225 532 +y(the)h(factors)g(ma)o(y)d(b)q(e)j(somewhat)e(related)i(to)f(the)h +(densit)o(y)g(of)e(the)i(original)e(matrix.)k(Ov)o(erall,)225 +581 y(THR)f(is)f(b)q(est,)i(with)e(CYC)h(a)g(close)g(second.)784 +717 y Fz(T)m(able)d(3.)35 b(T)m(est)11 b(matrices.)p +508 723 917 2 v 507 764 2 42 v 533 752 a(Matrix)81 b(Ro)o(ws)50 +b(Cols)g(NNZ)g(Rank)f(Densit)o(y\(\045\))p 1424 764 V +508 766 917 2 v 507 808 2 42 v 533 795 a(bfw62a)102 b(62)88 +b(62)75 b(450)83 b(62)128 b(11.7)p 1424 808 V 507 849 +V 533 837 a(imp)q(col)p 640 837 11 2 v 11 w(c)71 b(137)f(137)c(411)74 +b(137)128 b(2.2)p 1424 849 2 42 v 507 891 V 533 878 a(w)o(est0132)63 +b(132)70 b(132)c(414)74 b(132)128 b(2.4)p 1424 891 V +507 932 V 533 920 a(w)o(atson2)86 b(66)i(67)75 b(409)83 +b(66)137 b(9.2)p 1424 932 V 508 934 917 2 v 586 1116 +a(T)m(able)11 b(4.)35 b(Comparison)9 b(of)i(initializatio)o(n)e(tec)o +(hniques.)572 1156 y(bfw62a)p 287 1170 680 2 v 286 1211 +2 42 v 318 1199 a(Init.)54 b(\045)13 b(Resid.)48 b(In.)15 +b(Its.)49 b(\045)12 b(Densit)o(y)p 965 1211 V 287 1213 +680 2 v 286 1255 2 42 v 312 1242 a(THR)78 b(28.19)94 +b Fx(3.69)112 b(9.33)p 965 1255 V 286 1296 V 312 1284 +a Fz(CYC)79 b(25.54)99 b(3.73)119 b(9.55)p 965 1296 V +286 1338 V 312 1325 a(ONE)72 b Fx(22.86)96 b Fz(6.81)110 +b(41.13)p 965 1338 V 286 1379 V 314 1367 a(PER)79 b(25.48)99 +b(6.79)110 b(21.48)p 965 1379 V 287 1381 680 2 v 1252 +1156 a(imp)q(col)p 1359 1156 11 2 v 11 w(c)p 978 1170 +680 2 v 977 1211 2 42 v 1009 1199 a(Init.)55 b(\045)12 +b(Resid.)48 b(In.)15 b(Its.)49 b(\045)12 b(Densit)o(y)p +1657 1211 V 978 1213 680 2 v 977 1255 2 42 v 1003 1242 +a(THR)82 b Fx(3.53)101 b(2.58)112 b(1.79)p 1657 1255 +V 977 1296 V 1003 1284 a Fz(CYC)88 b(7.86)108 b(3.47)119 +b(6.47)p 1657 1296 V 977 1338 V 1003 1325 a(ONE)78 b(36.93)99 +b(5.95)110 b(24.32)p 1657 1338 V 977 1379 V 1005 1367 +a(PER)79 b(31.09)99 b(6.39)110 b(21.24)p 1657 1379 V +978 1381 680 2 v 552 1414 a(w)o(est0132)p 281 1428 V +280 1470 2 42 v 312 1457 a(Init.)55 b(\045)12 b(Resid.)48 +b(In.)15 b(Its.)49 b(\045)12 b(Densit)o(y)p 960 1470 +V 281 1471 680 2 v 280 1513 2 42 v 306 1500 a(THR)82 +b Fx(0.00)106 b Fz(5.62)119 b(1.95)p 960 1513 V 280 1554 +V 306 1542 a(CYC)88 b(0.01)103 b Fx(3.25)112 b(1.68)p +960 1554 V 280 1596 V 306 1583 a Fz(ONE)87 b(0.01)108 +b(5.64)i(11.97)p 960 1596 V 280 1637 V 308 1625 a(PER)88 +b(0.30)108 b(8.46)119 b(3.54)p 960 1637 V 281 1639 680 +2 v 1250 1414 a(w)o(atson2)p 972 1428 V 971 1470 2 42 +v 1003 1457 a(Init.)55 b(\045)12 b(Resid.)49 b(In.)14 +b(Its.)49 b(\045)12 b(Densit)o(y)p 1651 1470 V 972 1471 +680 2 v 971 1513 2 42 v 997 1500 a(THR)72 b Fx(16.99)96 +b Fz(3.02)114 b Fx(3.87)p 1651 1513 V 971 1554 V 997 +1542 a Fz(CYC)80 b(20.51)93 b Fx(2.76)117 b Fz(4.17)p +1651 1554 V 971 1596 V 997 1583 a(ONE)79 b(78.74)98 b(5.42)110 +b(18.94)p 1651 1596 V 971 1637 V 999 1625 a(PER)80 b(75.99)98 +b(4.82)110 b(10.69)p 1651 1637 V 972 1639 680 2 v 267 +1735 a Ft(In)12 b(Figures)g(7{10,)f(the)i(SVD,)e(SDD-THR,)f(and)i +(SDD-CYC)g(are)g(compared.)17 b(The)12 b(results)225 +1785 y(on)k Fc(bfw62a)f Ft(are)i(giv)o(en)f(in)g(Figure)h(7.)25 +b(The)17 b(upp)q(er)h(left)e(plot)g(sho)o(ws)h(a)f(comparison)f(of)h +(the)225 1835 y(relativ)o(e)c(residual)f(\()p Fs(k)p +Fr(R)592 1841 y Fp(k)612 1835 y Fs(k)p Fr(=)p Fs(k)p +Fr(R)707 1841 y Fn(0)725 1835 y Fs(k)p Ft(\))g(v)o(ersus)i(the)g(n)o +(um)o(b)q(er)e(of)g(terms.)17 b(The)12 b(SVD)g(is)g(the)g(optimal)225 +1885 y(decomp)q(osition)k(for)i(a)f(\014xed)i(n)o(um)o(b)q(er)e(of)g +(terms,)h(so)g(the)h(SDD)e(curv)o(es)i(will)d(lie)i(ab)q(o)o(v)o(e)f +(it.)225 1935 y(Ho)o(w)o(ev)o(er,)e(the)h(SDD)f(still)f(giv)o(es)h(go)q +(o)q(d)g(reduction)h(in)e(the)i(residual,)f(requiring)g(only)f(ab)q +(out)225 1984 y(t)o(wice)f(as)f(man)o(y)e(terms)i(as)g(the)h(SVD)f(for) +g(the)h(same)e(lev)o(el)h(of)f(reduction.)19 b(SDD-THR)11 +b(giv)o(es)h(a)225 2034 y(b)q(etter)j(residual)f(than)f(SDD-CYC)g(un)o +(til)g(the)h(last)f(few)h(terms,)f(where)h(SDD-CYC)f(`catc)o(hes)225 +2084 y(up'.)33 b(In)19 b(the)g(upp)q(er)h(righ)o(t,)g(a)e(plot)h(of)f +(the)i(residual)f(v)o(ersus)h(the)f(storage)h(is)f(sho)o(wn;)i(for)225 +2134 y(the)14 b(same)f(lev)o(el)g(of)h(reduction)g(in)f(the)h +(residual,)g(the)g(storage)g(requiremen)o(t)g(for)f(the)h(SDD)f(is)225 +2184 y(ab)q(out)i(one)h(to)f(t)o(w)o(o)f(orders)j(of)d(magnitude)g +(less)i(than)f(for)g(the)h(SVD.)e(In)i(the)g(b)q(ottom)d(plot,)225 +2234 y(the)h(singular)f(v)n(alues)g(and)g(SDD)g(v)n(alues)g(are)h(sho)o +(wn,)f(where)i(the)f Fr(i)p Ft(th)f(SDD)g(v)n(alue)g(is)g(de\014ned)225 +2283 y(as)282 2272 y(^)275 2283 y Fr(d)297 2289 y Fp(i)322 +2283 y Ft(=)e Fr(d)387 2289 y Fp(i)401 2283 y Fs(k)p +Fr(x)446 2289 y Fp(i)459 2283 y Fs(k)480 2289 y Fn(2)499 +2283 y Fs(k)p Fr(y)540 2289 y Fp(i)553 2283 y Fs(k)574 +2289 y Fn(2)593 2283 y Ft(.)17 b(Initially)m(,)10 b(the)k(SDD)e(v)n +(alues)g(are)h(smaller)e(than)i(the)g(singular)f(v)n(alues)225 +2333 y(b)q(ecause)19 b(they)e(cannot)g(capture)h(as)f(m)o(uc)o(h)e +(information;)g(later,)i(they)h(are)f(larger)g(b)q(ecause)225 +2383 y(they)d(are)h(capturing)f(the)g(information)d(missed)i(initially) +m(.)267 2433 y(The)k Fc(impcol)p 490 2433 14 2 v 15 w(c)g +Ft(matrix)f(has)h(an)h(in)o(teresting)g(singular)e(v)n(alue)h(pattern)i +(\(see)f(Figure)g(8\):)225 2483 y(there)i(is)f(one)g(isolated)f +(singular)g(v)n(alue)g(at)h(11,)g(a)f(cluster)i(of)e(singular)g(v)n +(alues)h(at)f(3,)i(and)225 2532 y(another)c(cluster)i(at)d(2.)24 +b(SDD-THR)15 b(mimi)o(cs)f(the)j(SVD)f(closely)f(b)q(ecause)j(SDD-THR)d +(also)p eop +%%Page: 21 21 +21 20 bop 946 125 a Fv(Semidiscrete)12 b(Matrix)f(Decomp)q(osition)78 +b Fu(\001)70 b Fv(21)225 233 y Ft(\014nds)18 b(one)g(isolated)f +(singular)g(SDD)g(v)n(alue,)g(as)h(man)o(y)e(SDD)h(v)n(alues)g(at)g(3,) +h(and)g(almost)d(as)225 283 y(man)o(y)j(SDD)h(v)n(alues)g(at)h(2.)35 +b(SDD-CYC,)18 b(on)i(the)g(other)g(hand,)h(has)f(trouble)g(mim)o(ic)o +(king)225 332 y(singular)15 b(v)n(alues)g(b)q(ecause)i(it)d(do)q(es)i +(not)g(pic)o(k)f(out)g(the)h(isolated)f(v)n(alue)f(at)h(\014rst.)23 +b(Still,)14 b(b)q(oth)225 382 y(SDD)f(v)n(arian)o(ts)g(are)i(sup)q +(erior)g(to)e(the)i(SVD)e(in)h(terms)g(of)f(storage)h(vs.)k(residual)c +(norm.)267 432 y(On)k Fc(west0132)e Ft(\(see)k(Figure)e(9\),)g(w)o(e)h +(see)g(phenomena)e(similar)f(to)i(that)g(for)g Fc(impcol)p +1675 432 14 2 v 14 w(c)p Ft(.)225 482 y(SDD-THR)12 b(\014nds)h +(isolated)g(SDD)f(v)n(alues)h(and)f(quic)o(kly)g(reduces)j(the)f +(residual)f(|)f(almost)f(as)225 532 y(quic)o(kly)g(as)h(the)h(SVD)f +(itself)f(in)h(terms)f(of)h(n)o(um)o(b)q(er)f(of)h(terms.)17 +b(SDD-CYC)11 b(has)h(more)f(trouble)225 581 y(isolating)g(SDD)g(v)n +(alues)i(but)f(ev)o(en)o(tually)g(gets)h(them)e(as)i(w)o(ell.)k(Here,)c +(SDD-THR)e(is)h(sup)q(erior)225 631 y(to)i(the)g(SVD)g(in)f(terms)h(of) +f(storage,)h(but)g(SDD-CYC)g(is)f(not.)267 681 y(The)h(last)h(matrix,)d +Fc(watson2)h Ft(\(see)j(Figure)e(10\),)g(most)f(closely)i(resem)o(bles) +g Fc(bfw62a)e Ft(in)h(the)225 731 y(structure)20 b(of)c(its)i(singular) +e(v)n(alues,)i(although)e Fc(watson2)g Ft(has)i(three)g(eigen)o(v)n +(alues)g(that)f(are)225 781 y(sligh)o(tly)c(isolated,)g(and)h(w)o(e)h +(can)f(see)i(that)e(b)q(oth)g(SDD)g(metho)q(ds)g(ev)o(en)o(tually)f +(pic)o(k)h(out)h(suc)o(h)225 831 y(v)n(alues)f(whic)o(h)g(results)h(in) +e(the)i(steep)q(er)h(drops)f(in)e(the)i(residual)f(curv)o(es.)20 +b(Again,)12 b(SDD-THR)225 880 y(do)q(es)i(b)q(etter)i(than)d(the)i +(SDD-CYC)e(in)g(all)f(resp)q(ects.)21 b(SDD-THR)13 b(requires)i(ab)q +(out)e(t)o(wice)h(as)225 930 y(man)o(y)d(terms)i(to)h(get)f(the)h(same) +e(reduction)i(in)f(storage)h(as)f(the)h(SVD,)f(while)g(using)g(an)g +(order)225 980 y(of)g(magnitude)g(less)h(storage.)225 +1071 y FA(8.)20 b(CONCLUSIONS)225 1138 y Ft(By)c(presen)o(ting)h(the)f +(co)q(de)h(for)f(computing)e(a)i(SDD,)e(w)o(e)j(hop)q(e)f(to)g(stim)o +(ulate)e(more)h(uses)i(of)225 1187 y(this)d(storage-e\016cien)o(t)h +(matrix)d(appro)o(ximation)f(metho)q(d.)267 1237 y(SDDP)m(A)o(CK,)h +(con)o(taining)h(Matlab)g(and)h(C)f(co)q(de)i(for)e(the)i(SDD,)e(as)h +(w)o(ell)f(as)g(Matlab)h(co)q(de)225 1287 y(for)g(the)g(w)o(eigh)o(ted) +g(and)g(tensor)h(SDDs)e(is)h(a)o(v)n(ailable)e(at)585 +1362 y Fc(http://www.cs.umd.)o(edu/u)o(sers)o(/olea)o(ry/)p +Ft(.)225 1470 y Fb(A)o(CKNO)o(WLEDGMENTS)225 1528 y Ft(W)m(e)k(are)h +(grateful)g(to)f(Professor)i(W)m(alter)e(Gander)h(and)f(Professor)i +(Martin)f(Gutknec)o(h)o(t)g(for)225 1578 y(their)d(hospitalit)o(y)f(at) +g(ETH.)225 1669 y Fb(REFERENCES)265 1727 y Fa(Conr)o(o)o(y,)20 +b(J.,)e(K)o(old)o(a,)h(T.)e(G.,)h(and)g(O'Lear)n(y,)f(D.)g(P.)34 +b Fz(1999.)51 b(Chromosome)14 b(iden)o(ti\014cati)o(on.)f(In)328 +1769 y(preparatio)o(n.)265 1814 y Fa(Gabriel,)g(K.)g(R.)e(and)j(Zamir,) +e(S.)35 b Fz(No)o(v)o(em)o(b)q(er)10 b(1979.)46 b(Lo)o(w)o(er)11 +b(rank)g(appro)o(ximat)o(ion)d(of)k(matrices)d(b)o(y)328 +1856 y(least)h(squares)g(with)h(an)o(y)g(c)o(hoice)f(of)h(w)o(eigh)o +(ts.)g Fd(T)m(e)n(chnometrics)16 b(21)p Fz(,)c(489{498.)265 +1901 y Fa(Golub,)g(G.)g(H.)e(and)i(V)l(an)g(Lo)o(an,)g(C.)f(F.)35 +b Fz(1989.)44 b Fd(Matrix)12 b(Computations)g Fz(\(2nd)d(ed.\).)g +(Johns)h(Hopkins)328 1943 y(Press.)265 1989 y Fa(K)o(old)o(a,)19 +b(T.)d(G.)36 b Fz(1997.)50 b Fd(Limite)n(d-Memory)18 +b(Matrix)g(Metho)n(ds)f(with)g(Applic)n(ations)p Fz(.)g(Ph.)f(D.)g +(thesis,)328 2030 y(Univ)o(ersit)o(y)c(of)i(Maryland)f(Applied)g +(Mathematics)f(Program.)h(Also)h(a)o(v)n(ailable)e(as)i(Departmen)o(t)e +(of)328 2072 y(Computer)d(Science)h(T)m(ec)o(hnical)g(Rep)q(ort)g +(CS-TR-3806.)265 2117 y Fa(K)o(old)o(a,)j(T.)f(G.)35 +b Fz(1999.)46 b(Orthogonal)9 b(rank)i(decomp)q(osi)o(tion)o(s)e(for)i +(tensors.)f(In)h(preparation)o(.)265 2163 y Fa(K)o(old)o(a,)j(T.)g(G.)f +(and)h(O'Lear)n(y,)f(D.)g(P.)35 b Fz(1998.)46 b(A)13 +b(semidiscrete)d(matrix)h(decomp)q(osit)o(ion)e(for)j(laten)o(t)328 +2205 y(seman)o(tic)d(indexing)g(in)i(information)d(retriev)n(al.)h +Fd(A)o(CM)k(T)m(r)n(ans.)g(Inf.)f(Syst.)f(16)p Fz(,)h(322{346.)265 +2250 y Fa(K)o(old)o(a,)18 b(T.)f(G.)g(and)g(O'Lear)n(y,)g(D.)f(P.)34 +b Fz(1999.)50 b(Laten)o(t)14 b(seman)o(tic)g(indexing)f(via)i(a)h +(semi-discrete)328 2292 y(matrix)c(decomp)q(ositio)o(n.)f(In)j +Fd(The)h(Mathematics)h(of)g(Information)f(Co)n(ding,)i(Extr)n(action)f +(and)g(Dis-)328 2333 y(tribution)s Fz(,)e(V)m(olume)f(107)g(of)h(IMA)g +(V)m(olumes)f(in)h(Mathematics)d(and)i(Its)g(Applications,)f(pp.)h +(73{80.)328 2375 y(Springer-V)m(erla)o(g.)265 2420 y +Fa(O'Lear)n(y,)g(D.)f(P.)h(and)h(Peleg,)e(S.)35 b Fz(1983.)46 +b(Digital)11 b(image)g(compression)e(b)o(y)i(outer)g(pro)q(duct)f +(expan-)328 2462 y(sion.)g Fd(IEEE)j(T)m(r)n(ansactions)g(on)g +(Communic)n(ations)i(31)p Fz(,)d(441{444.)p eop +%%Page: 22 22 +22 21 bop 225 125 a Fv(22)71 b Fu(\001)78 b Fv(T.)13 +b(G.)f(Kolda)g(and)h(D.)g(P)m(.)e(O'Lea)o(ry)297 1966 +y @beginspecial 71 @llx 210 @lly 546 @urx 600 @ury 3240 +@rwi 3240 @rhi @setspecial +%%BeginDocument: bfw62a.eps + + +% MathWorks dictionary +/MathWorks 160 dict begin + +% definition operators +/bdef {bind def} bind def +/ldef {load def} bind def +/xdef {exch def} bdef +/xstore {exch store} bdef + +% operator abbreviations +/c /clip ldef +/cc /concat ldef +/cp /closepath ldef +/gr /grestore ldef +/gs /gsave ldef +/mt /moveto ldef +/np /newpath ldef +/cm /currentmatrix ldef +/sm /setmatrix ldef +/rc {rectclip} bdef +/rf {rectfill} bdef +/rm /rmoveto ldef +/rl /rlineto ldef +/s /show ldef +/sc {setcmykcolor} bdef +/sr /setrgbcolor ldef +/sg /setgray ldef +/w /setlinewidth ldef +/j /setlinejoin ldef +/cap /setlinecap ldef + +% page state control +/pgsv () def +/bpage {/pgsv save def} bdef +/epage {pgsv restore} bdef +/bplot /gsave ldef +/eplot {stroke grestore} bdef + +% orientation switch +/portraitMode 0 def +/landscapeMode 1 def + +% coordinate system mappings +/dpi2point 0 def + +% font control +/FontSize 0 def +/FMS { + /FontSize xstore %save size off stack + findfont + [FontSize 0 0 FontSize neg 0 0] + makefont + setfont + }bdef + +/reencode { +exch dup where +{pop load} {pop StandardEncoding} ifelse +exch +dup 3 1 roll +findfont dup length dict begin + { 1 index /FID ne {def}{pop pop} ifelse } forall + /Encoding exch def + currentdict +end +definefont pop +} bdef + +/isroman { +findfont /CharStrings get +/Agrave known +} bdef + +/FMSR { +3 1 roll 1 index +dup isroman +{reencode} {pop pop} ifelse +exch FMS +} bdef + +/csm { + 1 dpi2point div -1 dpi2point div scale + neg translate + landscapeMode eq {90 rotate} if + } bdef + +% line types: solid, dotted, dashed, dotdash +/SO { [] 0 setdash } bdef +/DO { [.5 dpi2point mul 4 dpi2point mul] 0 setdash } bdef +/DA { [6 dpi2point mul] 0 setdash } bdef +/DD { [.5 dpi2point mul 4 dpi2point mul 6 dpi2point mul 4 dpi2point mul] 0 setdash } bdef + +% macros for lines and objects +/L { + lineto + stroke + } bdef +/MP { + 3 1 roll moveto + 1 sub {rlineto} repeat + } bdef +/AP { + {rlineto} repeat + } bdef +/PP { + closepath eofill + } bdef +/DP { + closepath stroke + } bdef +/MR { + 4 -2 roll moveto + dup 0 exch rlineto + exch 0 rlineto + neg 0 exch rlineto + closepath + } bdef +/FR { + MR stroke + } bdef +/PR { + MR fill + } bdef +/L1i { + { currentfile picstr readhexstring pop } image + } bdef + +/tMatrix matrix def +/MakeOval { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 0 360 arc + tMatrix setmatrix + } bdef +/FO { + MakeOval + stroke + } bdef +/PO { + MakeOval + fill + } bdef + +/PD { + currentlinecap 1 setlinecap 3 1 roll 2 copy moveto lineto stroke setlinecap + } bdef + +/FA { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 5 -2 roll arc + tMatrix setmatrix + stroke + } bdef +/PA { + newpath + tMatrix currentmatrix pop + translate 0 0 moveto scale + 0 0 1 5 -2 roll arc + closepath + tMatrix setmatrix + fill + } bdef + +/FAn { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 5 -2 roll arcn + tMatrix setmatrix + stroke + } bdef +/PAn { + newpath + tMatrix currentmatrix pop + translate 0 0 moveto scale + 0 0 1 5 -2 roll arcn + closepath + tMatrix setmatrix + fill + } bdef + +/MRR { + /vradius xdef + /hradius xdef + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + newpath + tMatrix currentmatrix pop + ulx hradius add uly vradius add translate + hradius vradius scale + 0 0 1 180 270 arc + tMatrix setmatrix + lrx hradius sub uly vradius add translate + hradius vradius scale + 0 0 1 270 360 arc + tMatrix setmatrix + lrx hradius sub lry vradius sub translate + hradius vradius scale + 0 0 1 0 90 arc + tMatrix setmatrix + ulx hradius add lry vradius sub translate + hradius vradius scale + 0 0 1 90 180 arc + tMatrix setmatrix + closepath + } bdef +/FRR { + MRR stroke } bdef +/PRR { + MRR fill } bdef + +/MlrRR { + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + /rad lry uly sub 2 div def + newpath + tMatrix currentmatrix pop + ulx rad add uly rad add translate + rad rad scale + 0 0 1 90 270 arc + tMatrix setmatrix + lrx rad sub lry rad sub translate + rad rad scale + 0 0 1 270 90 arc + tMatrix setmatrix + closepath + } bdef +/FlrRR { + MlrRR stroke } bdef +/PlrRR { + MlrRR fill } bdef + +/MtbRR { + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + /rad lrx ulx sub 2 div def + newpath + tMatrix currentmatrix pop + ulx rad add uly rad add translate + rad rad scale + 0 0 1 180 360 arc + tMatrix setmatrix + lrx rad sub lry rad sub translate + rad rad scale + 0 0 1 0 180 arc + tMatrix setmatrix + closepath + } bdef +/FtbRR { + MtbRR stroke } bdef +/PtbRR { + MtbRR fill } bdef + +currentdict end def + +MathWorks begin + +0 cap + +end + +MathWorks begin +bpage + +bplot + +/dpi2point 12 def +portraitMode 0216 7344 csm + + 641 134 5702 4679 MR c np +88 dict begin %Colortable dictionary +/c0 { 0 0 0 sr} bdef +/c1 { 1 1 1 sr} bdef +/c2 { 1 0 0 sr} bdef +/c3 { 0 1 0 sr} bdef +/c4 { 0 0 1 sr} bdef +/c5 { 1 1 0 sr} bdef +/c6 { 1 0 1 sr} bdef +/c7 { 0 1 1 sr} bdef +1 j +1 sg + 0 0 6918 5185 PR +6 w +0 1782 2261 0 0 -1782 899 2170 4 MP +PP +-2261 0 0 1782 2261 0 0 -1782 899 2170 5 MP stroke +4 w +DO +SO +6 w +0 sg + 899 2170 mt 3160 2170 L + 899 388 mt 3160 388 L + 899 2170 mt 899 388 L +3160 2170 mt 3160 388 L + 899 2170 mt 3160 2170 L + 899 2170 mt 899 388 L + 899 2170 mt 899 2147 L + 899 388 mt 899 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + + 866 2316 mt +(0) s +1628 2170 mt 1628 2147 L +1628 388 mt 1628 411 L +1562 2316 mt +(20) s +2358 2170 mt 2358 2147 L +2358 388 mt 2358 411 L +2292 2316 mt +(40) s +3087 2170 mt 3087 2147 L +3087 388 mt 3087 411 L +3021 2316 mt +(60) s + 899 2170 mt 922 2170 L +3160 2170 mt 3137 2170 L + 798 2214 mt +(0) s + 899 1814 mt 922 1814 L +3160 1814 mt 3137 1814 L + 698 1858 mt +(0.2) s + 899 1457 mt 922 1457 L +3160 1457 mt 3137 1457 L + 698 1501 mt +(0.4) s + 899 1101 mt 922 1101 L +3160 1101 mt 3137 1101 L + 698 1145 mt +(0.6) s + 899 744 mt 922 744 L +3160 744 mt 3137 744 L + 698 788 mt +(0.8) s + 899 388 mt 922 388 L +3160 388 mt 3137 388 L + 798 432 mt +(1) s + 899 2170 mt 3160 2170 L + 899 388 mt 3160 388 L + 899 2170 mt 899 388 L +3160 2170 mt 3160 388 L +gs 899 388 2262 1783 MR c np +36 1 37 2 36 4 37 6 36 5 37 9 36 7 37 9 +36 8 37 9 36 10 37 11 36 16 37 15 36 14 36 13 +37 15 36 18 37 16 36 16 37 16 36 20 37 20 36 19 +37 19 36 18 37 18 36 20 37 18 36 23 36 22 37 24 +36 24 37 24 36 24 37 24 36 26 37 26 36 26 37 28 +36 29 37 28 36 32 37 30 36 33 37 34 36 37 36 38 +37 38 36 44 37 45 36 53 37 51 36 53 37 68 36 68 +37 70 36 69 37 72 36 80 37 84 36 83 899 388 63 MP stroke +DA +36 10 37 6 36 11 37 4 36 9 37 7 36 12 37 9 +36 5 37 15 36 12 37 10 36 8 37 10 36 13 36 16 +37 14 36 14 37 11 36 16 37 9 36 9 37 9 36 14 +37 8 36 6 37 9 36 13 37 9 36 5 36 8 37 8 +36 19 37 22 36 11 37 17 36 23 37 8 36 22 37 20 +36 19 37 27 36 24 37 40 36 19 37 22 36 37 36 33 +37 29 36 30 37 43 36 55 37 52 36 28 37 41 36 19 +37 56 36 38 37 53 36 50 37 69 36 35 899 388 63 MP stroke +DO +36 9 37 11 36 13 37 10 36 15 37 11 36 10 37 25 +36 7 37 6 36 22 37 10 36 17 37 25 36 15 36 26 +37 17 36 42 37 19 36 40 37 20 36 18 37 11 36 37 +37 27 36 7 37 10 36 62 37 9 36 51 36 14 37 53 +36 16 37 23 36 10 37 5 36 14 37 27 36 7 37 4 +36 7 37 9 36 4 37 12 36 2 37 4 36 7 36 6 +37 27 36 44 37 84 36 36 37 35 36 46 37 32 36 29 +37 9 36 59 37 11 36 30 37 55 36 4 899 388 63 MP stroke + +gr +DO +1283 293 mt +(Residual Norm vs. No. of Terms) s +SO +1 sg +0 1782 2261 0 0 -1782 3997 2170 4 MP +PP +-2261 0 0 1782 2261 0 0 -1782 3997 2170 5 MP stroke +4 w +DO +SO +6 w +0 sg +3997 2170 mt 6258 2170 L +3997 388 mt 6258 388 L +3997 2170 mt 3997 388 L +6258 2170 mt 6258 388 L +3997 2170 mt 6258 2170 L +3997 2170 mt 3997 388 L +4347 2170 mt 4347 2147 L +4347 388 mt 4347 411 L +4259 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +4392 2279 mt +(2) s +5114 2170 mt 5114 2147 L +5114 388 mt 5114 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +5026 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +5159 2279 mt +(3) s +5881 2170 mt 5881 2147 L +5881 388 mt 5881 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +5793 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +5926 2279 mt +(4) s +3997 2170 mt 4020 2170 L +6258 2170 mt 6235 2170 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +3896 2214 mt +(0) s +3997 1814 mt 4020 1814 L +6258 1814 mt 6235 1814 L +3796 1858 mt +(0.2) s +3997 1457 mt 4020 1457 L +6258 1457 mt 6235 1457 L +3796 1501 mt +(0.4) s +3997 1101 mt 4020 1101 L +6258 1101 mt 6235 1101 L +3796 1145 mt +(0.6) s +3997 744 mt 4020 744 L +6258 744 mt 6235 744 L +3796 788 mt +(0.8) s +3997 388 mt 4020 388 L +6258 388 mt 6235 388 L +3896 432 mt +(1) s +3997 2170 mt 6258 2170 L +3997 388 mt 6258 388 L +3997 2170 mt 3997 388 L +6258 2170 mt 6258 388 L +gs 3997 388 2262 1783 MR c np +5 1 6 2 6 4 5 6 6 5 6 9 6 7 6 9 +6 8 7 9 6 10 7 11 6 16 7 15 7 14 7 13 +8 15 7 18 8 16 8 16 8 16 8 20 8 20 9 19 +9 19 9 18 10 18 9 20 10 18 10 23 11 22 11 24 +11 24 12 24 12 24 13 24 13 26 13 26 14 26 15 28 +16 29 16 28 17 32 18 30 19 33 20 34 22 37 23 38 +24 38 27 44 29 45 32 53 35 51 39 53 45 68 51 68 +61 70 74 69 96 72 135 80 231 84 4883 471 62 MP stroke +DA +5 10 6 6 6 11 5 4 6 9 6 7 6 12 6 9 +6 5 7 15 6 12 7 10 6 8 7 10 7 13 7 16 +8 14 7 14 8 11 8 16 8 9 8 9 8 9 9 14 +9 8 9 6 9 9 10 13 10 9 10 5 11 8 11 8 +11 19 12 22 12 11 13 17 13 23 13 8 14 22 15 20 +16 19 16 27 17 24 18 40 19 19 20 22 22 37 23 33 +24 29 27 30 29 43 32 55 35 52 39 28 45 41 51 19 +61 56 74 38 96 53 135 50 231 69 3997 423 62 MP stroke +DO +5 9 6 11 6 13 5 10 6 15 6 11 6 10 6 25 +6 7 7 6 6 22 7 10 6 17 7 25 7 15 7 26 +8 17 7 42 8 19 8 40 8 20 8 18 8 11 9 37 +9 27 9 7 9 10 10 62 10 9 10 51 11 14 11 53 +11 16 12 23 12 10 13 5 13 14 13 27 14 7 15 4 +16 7 16 9 17 4 18 12 19 2 20 4 22 7 23 6 +24 27 27 44 29 84 32 36 35 35 39 46 45 32 51 29 +61 9 74 59 96 11 135 30 231 55 3997 392 62 MP stroke + +gr +DO +4387 293 mt +(Residual Norms vs. Storage) s +SO +1 sg +0 1782 5394 0 0 -1782 899 4612 4 MP +PP +-5394 0 0 1782 5394 0 0 -1782 899 4612 5 MP stroke +4 w +DO +SO +6 w +0 sg + 899 4612 mt 6293 4612 L + 899 2830 mt 6293 2830 L + 899 4612 mt 899 2830 L +6293 4612 mt 6293 2830 L + 899 4612 mt 6293 4612 L + 899 4612 mt 899 2830 L + 899 4612 mt 899 4558 L + 899 2830 mt 899 2884 L + 866 4758 mt +(0) s +1755 4612 mt 1755 4558 L +1755 2830 mt 1755 2884 L +1689 4758 mt +(10) s +2611 4612 mt 2611 4558 L +2611 2830 mt 2611 2884 L +2545 4758 mt +(20) s +3468 4612 mt 3468 4558 L +3468 2830 mt 3468 2884 L +3402 4758 mt +(30) s +4324 4612 mt 4324 4558 L +4324 2830 mt 4324 2884 L +4258 4758 mt +(40) s +5180 4612 mt 5180 4558 L +5180 2830 mt 5180 2884 L +5114 4758 mt +(50) s +6036 4612 mt 6036 4558 L +6036 2830 mt 6036 2884 L +5970 4758 mt +(60) s + 899 4612 mt 953 4612 L +6293 4612 mt 6239 4612 L + 798 4656 mt +(0) s + 899 4167 mt 953 4167 L +6293 4167 mt 6239 4167 L + 798 4211 mt +(1) s + 899 3721 mt 953 3721 L +6293 3721 mt 6239 3721 L + 798 3765 mt +(2) s + 899 3276 mt 953 3276 L +6293 3276 mt 6239 3276 L + 798 3320 mt +(3) s + 899 2830 mt 953 2830 L +6293 2830 mt 6239 2830 L + 798 2874 mt +(4) s + 899 4612 mt 6293 4612 L + 899 2830 mt 6293 2830 L + 899 4612 mt 899 2830 L +6293 4612 mt 6293 2830 L +gs 899 2830 5395 1783 MR c np + +gr + 960 3231 mt 1010 3281 L +1010 3231 mt 960 3281 L +1045 3245 mt 1095 3295 L +1095 3245 mt 1045 3295 L +1131 3282 mt 1181 3332 L +1181 3282 mt 1131 3332 L +1216 3325 mt 1266 3375 L +1266 3325 mt 1216 3375 L +1302 3358 mt 1352 3408 L +1352 3358 mt 1302 3408 L +1388 3364 mt 1438 3414 L +1438 3364 mt 1388 3414 L +1473 3392 mt 1523 3442 L +1523 3392 mt 1473 3442 L +1559 3407 mt 1609 3457 L +1609 3407 mt 1559 3457 L +1645 3494 mt 1695 3544 L +1695 3494 mt 1645 3544 L +1730 3515 mt 1780 3565 L +1780 3515 mt 1730 3565 L +1816 3519 mt 1866 3569 L +1866 3519 mt 1816 3569 L +1901 3572 mt 1951 3622 L +1951 3572 mt 1901 3622 L +1987 3591 mt 2037 3641 L +2037 3591 mt 1987 3641 L +2073 3634 mt 2123 3684 L +2123 3634 mt 2073 3684 L +2158 3651 mt 2208 3701 L +2208 3651 mt 2158 3701 L +2244 3659 mt 2294 3709 L +2294 3659 mt 2244 3709 L +2330 3692 mt 2380 3742 L +2380 3692 mt 2330 3742 L +2415 3711 mt 2465 3761 L +2465 3711 mt 2415 3761 L +2501 3731 mt 2551 3781 L +2551 3731 mt 2501 3781 L +2586 3737 mt 2636 3787 L +2636 3737 mt 2586 3787 L +2672 3765 mt 2722 3815 L +2722 3765 mt 2672 3815 L +2758 3774 mt 2808 3824 L +2808 3774 mt 2758 3824 L +2843 3786 mt 2893 3836 L +2893 3786 mt 2843 3836 L +2929 3811 mt 2979 3861 L +2979 3811 mt 2929 3861 L +3014 3814 mt 3064 3864 L +3064 3814 mt 3014 3864 L +3100 3830 mt 3150 3880 L +3150 3830 mt 3100 3880 L +3186 3853 mt 3236 3903 L +3236 3853 mt 3186 3903 L +3271 3858 mt 3321 3908 L +3321 3858 mt 3271 3908 L +3357 3868 mt 3407 3918 L +3407 3868 mt 3357 3918 L +3443 3874 mt 3493 3924 L +3493 3874 mt 3443 3924 L +3528 3887 mt 3578 3937 L +3578 3887 mt 3528 3937 L +3614 3913 mt 3664 3963 L +3664 3913 mt 3614 3963 L +3699 3917 mt 3749 3967 L +3749 3917 mt 3699 3967 L +3785 3958 mt 3835 4008 L +3835 3958 mt 3785 4008 L +3871 3961 mt 3921 4011 L +3921 3961 mt 3871 4011 L +3956 3972 mt 4006 4022 L +4006 3972 mt 3956 4022 L +4042 3992 mt 4092 4042 L +4092 3992 mt 4042 4042 L +4128 3993 mt 4178 4043 L +4178 3993 mt 4128 4043 L +4213 3998 mt 4263 4048 L +4263 3998 mt 4213 4048 L +4299 4001 mt 4349 4051 L +4349 4001 mt 4299 4051 L +4384 4016 mt 4434 4066 L +4434 4016 mt 4384 4066 L +4470 4056 mt 4520 4106 L +4520 4056 mt 4470 4106 L +4556 4069 mt 4606 4119 L +4606 4069 mt 4556 4119 L +4641 4074 mt 4691 4124 L +4691 4074 mt 4641 4124 L +4727 4076 mt 4777 4126 L +4777 4076 mt 4727 4126 L +4812 4112 mt 4862 4162 L +4862 4112 mt 4812 4162 L +4898 4142 mt 4948 4192 L +4948 4142 mt 4898 4192 L +4984 4144 mt 5034 4194 L +5034 4144 mt 4984 4194 L +5069 4148 mt 5119 4198 L +5119 4148 mt 5069 4198 L +5155 4158 mt 5205 4208 L +5205 4158 mt 5155 4208 L +5241 4219 mt 5291 4269 L +5291 4219 mt 5241 4269 L +5326 4235 mt 5376 4285 L +5376 4235 mt 5326 4285 L +5412 4254 mt 5462 4304 L +5462 4254 mt 5412 4304 L +5497 4280 mt 5547 4330 L +5547 4280 mt 5497 4330 L +5583 4292 mt 5633 4342 L +5633 4292 mt 5583 4342 L +5669 4318 mt 5719 4368 L +5719 4318 mt 5669 4368 L +5754 4326 mt 5804 4376 L +5804 4326 mt 5754 4376 L +5840 4385 mt 5890 4435 L +5890 4385 mt 5840 4435 L +5926 4387 mt 5976 4437 L +5976 4387 mt 5926 4437 L +6011 4447 mt 6061 4497 L +6061 4447 mt 6011 4497 L +6097 4489 mt 6147 4539 L +6147 4489 mt 6097 4539 L +6182 4529 mt 6232 4579 L +6232 4529 mt 6182 4579 L +gs 899 2830 5395 1783 MR c np + +gr + 36 36 985 3514 FO + 36 36 1070 3327 FO + 36 36 1156 3433 FO + 36 36 1241 3427 FO + 36 36 1327 3531 FO + 36 36 1413 3427 FO + 36 36 1498 3711 FO + 36 36 1584 3531 FO + 36 36 1670 3628 FO + 36 36 1755 3478 FO + 36 36 1841 3476 FO + 36 36 1926 3551 FO + 36 36 2012 3645 FO + 36 36 2098 3667 FO + 36 36 2183 3636 FO + 36 36 2269 3618 FO + 36 36 2355 3748 FO + 36 36 2440 3778 FO + 36 36 2526 3620 FO + 36 36 2611 3743 FO + 36 36 2697 3720 FO + 36 36 2783 3801 FO + 36 36 2868 3798 FO + 36 36 2954 3781 FO + 36 36 3039 3966 FO + 36 36 3125 3779 FO + 36 36 3211 3839 FO + 36 36 3296 3936 FO + 36 36 3382 3798 FO + 36 36 3468 3830 FO + 36 36 3553 3982 FO + 36 36 3639 3996 FO + 36 36 3724 4051 FO + 36 36 3810 3986 FO + 36 36 3896 3904 FO + 36 36 3981 3986 FO + 36 36 4067 4051 FO + 36 36 4153 3986 FO + 36 36 4238 3913 FO + 36 36 4324 3986 FO + 36 36 4409 3986 FO + 36 36 4495 3986 FO + 36 36 4581 3894 FO + 36 36 4666 3966 FO + 36 36 4752 3929 FO + 36 36 4837 3927 FO + 36 36 4923 3911 FO + 36 36 5009 3957 FO + 36 36 5094 3990 FO + 36 36 5180 4024 FO + 36 36 5266 4010 FO + 36 36 5351 3963 FO + 36 36 5437 3948 FO + 36 36 5522 4092 FO + 36 36 5608 4022 FO + 36 36 5694 3994 FO + 36 36 5779 4067 FO + 36 36 5865 4028 FO + 36 36 5951 4132 FO + 36 36 6036 4012 FO + 36 36 6122 4097 FO + 36 36 6207 4025 FO +gs 899 2830 5395 1783 MR c np + +gr +0 j +-41 71 -41 -71 82 0 944 4010 4 MP +DP +-41 71 -41 -71 82 0 1029 3413 4 MP +DP +-41 71 -41 -71 82 0 1115 3587 4 MP +DP +-41 71 -41 -71 82 0 1200 3820 4 MP +DP +-41 71 -41 -71 82 0 1286 3413 4 MP +DP +-41 71 -41 -71 82 0 1372 3860 4 MP +DP +-41 71 -41 -71 82 0 1457 3615 4 MP +DP +-41 71 -41 -71 82 0 1543 3600 4 MP +DP +-41 71 -41 -71 82 0 1629 3505 4 MP +DP +-41 71 -41 -71 82 0 1714 3586 4 MP +DP +-41 71 -41 -71 82 0 1800 3587 4 MP +DP +-41 71 -41 -71 82 0 1885 3348 4 MP +DP +-41 71 -41 -71 82 0 1971 3559 4 MP +DP +-41 71 -41 -71 82 0 2057 3684 4 MP +DP +-41 71 -41 -71 82 0 2142 4002 4 MP +DP +-41 71 -41 -71 82 0 2228 3945 4 MP +DP +-41 71 -41 -71 82 0 2314 4072 4 MP +DP +-41 71 -41 -71 82 0 2399 4155 4 MP +DP +-41 71 -41 -71 82 0 2485 3854 4 MP +DP +-41 71 -41 -71 82 0 2570 4072 4 MP +DP +-41 71 -41 -71 82 0 2656 3914 4 MP +DP +-41 71 -41 -71 82 0 2742 3981 4 MP +DP +-41 71 -41 -71 82 0 2827 4045 4 MP +DP +-41 71 -41 -71 82 0 2913 3971 4 MP +DP +-41 71 -41 -71 82 0 2998 3698 4 MP +DP +-41 71 -41 -71 82 0 3084 3852 4 MP +DP +-41 71 -41 -71 82 0 3170 4034 4 MP +DP +-41 71 -41 -71 82 0 3255 3909 4 MP +DP +-41 71 -41 -71 82 0 3341 3755 4 MP +DP +-41 71 -41 -71 82 0 3427 3829 4 MP +DP +-41 71 -41 -71 82 0 3512 3555 4 MP +DP +-41 71 -41 -71 82 0 3598 3865 4 MP +DP +-41 71 -41 -71 82 0 3683 3585 4 MP +DP +-41 71 -41 -71 82 0 3769 3965 4 MP +DP +-41 71 -41 -71 82 0 3855 3549 4 MP +DP +-41 71 -41 -71 82 0 3940 3948 4 MP +DP +-41 71 -41 -71 82 0 4026 4016 4 MP +DP +-41 71 -41 -71 82 0 4112 3768 4 MP +DP +-41 71 -41 -71 82 0 4197 3708 4 MP +DP +-41 71 -41 -71 82 0 4283 3942 4 MP +DP +-41 71 -41 -71 82 0 4368 3871 4 MP +DP +-41 71 -41 -71 82 0 4454 3855 4 MP +DP +-41 71 -41 -71 82 0 4540 3710 4 MP +DP +-41 71 -41 -71 82 0 4625 3876 4 MP +DP +-41 71 -41 -71 82 0 4711 3717 4 MP +DP +-41 71 -41 -71 82 0 4796 3908 4 MP +DP +-41 71 -41 -71 82 0 4882 3839 4 MP +DP +-41 71 -41 -71 82 0 4968 3945 4 MP +DP +-41 71 -41 -71 82 0 5053 3859 4 MP +DP +-41 71 -41 -71 82 0 5139 3934 4 MP +DP +-41 71 -41 -71 82 0 5225 4016 4 MP +DP +-41 71 -41 -71 82 0 5310 3898 4 MP +DP +-41 71 -41 -71 82 0 5396 4104 4 MP +DP +-41 71 -41 -71 82 0 5481 4101 4 MP +DP +-41 71 -41 -71 82 0 5567 3882 4 MP +DP +-41 71 -41 -71 82 0 5653 4049 4 MP +DP +-41 71 -41 -71 82 0 5738 4029 4 MP +DP +-41 71 -41 -71 82 0 5824 3987 4 MP +DP +-41 71 -41 -71 82 0 5910 4054 4 MP +DP +-41 71 -41 -71 82 0 5995 4020 4 MP +DP +-41 71 -41 -71 82 0 6081 4038 4 MP +DP +-41 71 -41 -71 82 0 6166 4085 4 MP +DP +gs 899 2830 5395 1783 MR c np + +gr +2953 2735 mt +(Singular vs. SDD values) s + +end + +eplot + +epage +end + +showpage + +%%EndDocument + @endspecial 225 2058 a Fz(Fig.)j(7.)35 b(Comparison)13 +b(of)h(the)g(SVD)h(\(solid)f(line,)g Fw(x)h Fz(marks\),)f(SDD-THR)h +(\(dashed)e(line,)h Fw(o)h Fz(marks\),)f(and)225 2099 +y(SDD-CYC)e(\(dotted)e(line,)g(triangle)g(marks\))g(on)h +Fw(bfw62a)p Fz(.)p eop +%%Page: 23 23 +23 22 bop 946 125 a Fv(Semidiscrete)12 b(Matrix)f(Decomp)q(osition)78 +b Fu(\001)70 b Fv(23)297 1966 y @beginspecial 71 @llx +210 @lly 550 @urx 600 @ury 3240 @rwi 3240 @rhi @setspecial +%%BeginDocument: impcol_c.eps + + +% MathWorks dictionary +/MathWorks 160 dict begin + +% definition operators +/bdef {bind def} bind def +/ldef {load def} bind def +/xdef {exch def} bdef +/xstore {exch store} bdef + +% operator abbreviations +/c /clip ldef +/cc /concat ldef +/cp /closepath ldef +/gr /grestore ldef +/gs /gsave ldef +/mt /moveto ldef +/np /newpath ldef +/cm /currentmatrix ldef +/sm /setmatrix ldef +/rc {rectclip} bdef +/rf {rectfill} bdef +/rm /rmoveto ldef +/rl /rlineto ldef +/s /show ldef +/sc {setcmykcolor} bdef +/sr /setrgbcolor ldef +/sg /setgray ldef +/w /setlinewidth ldef +/j /setlinejoin ldef +/cap /setlinecap ldef + +% page state control +/pgsv () def +/bpage {/pgsv save def} bdef +/epage {pgsv restore} bdef +/bplot /gsave ldef +/eplot {stroke grestore} bdef + +% orientation switch +/portraitMode 0 def +/landscapeMode 1 def + +% coordinate system mappings +/dpi2point 0 def + +% font control +/FontSize 0 def +/FMS { + /FontSize xstore %save size off stack + findfont + [FontSize 0 0 FontSize neg 0 0] + makefont + setfont + }bdef + +/reencode { +exch dup where +{pop load} {pop StandardEncoding} ifelse +exch +dup 3 1 roll +findfont dup length dict begin + { 1 index /FID ne {def}{pop pop} ifelse } forall + /Encoding exch def + currentdict +end +definefont pop +} bdef + +/isroman { +findfont /CharStrings get +/Agrave known +} bdef + +/FMSR { +3 1 roll 1 index +dup isroman +{reencode} {pop pop} ifelse +exch FMS +} bdef + +/csm { + 1 dpi2point div -1 dpi2point div scale + neg translate + landscapeMode eq {90 rotate} if + } bdef + +% line types: solid, dotted, dashed, dotdash +/SO { [] 0 setdash } bdef +/DO { [.5 dpi2point mul 4 dpi2point mul] 0 setdash } bdef +/DA { [6 dpi2point mul] 0 setdash } bdef +/DD { [.5 dpi2point mul 4 dpi2point mul 6 dpi2point mul 4 dpi2point mul] 0 setdash } bdef + +% macros for lines and objects +/L { + lineto + stroke + } bdef +/MP { + 3 1 roll moveto + 1 sub {rlineto} repeat + } bdef +/AP { + {rlineto} repeat + } bdef +/PP { + closepath eofill + } bdef +/DP { + closepath stroke + } bdef +/MR { + 4 -2 roll moveto + dup 0 exch rlineto + exch 0 rlineto + neg 0 exch rlineto + closepath + } bdef +/FR { + MR stroke + } bdef +/PR { + MR fill + } bdef +/L1i { + { currentfile picstr readhexstring pop } image + } bdef + +/tMatrix matrix def +/MakeOval { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 0 360 arc + tMatrix setmatrix + } bdef +/FO { + MakeOval + stroke + } bdef +/PO { + MakeOval + fill + } bdef + +/PD { + currentlinecap 1 setlinecap 3 1 roll 2 copy moveto lineto stroke setlinecap + } bdef + +/FA { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 5 -2 roll arc + tMatrix setmatrix + stroke + } bdef +/PA { + newpath + tMatrix currentmatrix pop + translate 0 0 moveto scale + 0 0 1 5 -2 roll arc + closepath + tMatrix setmatrix + fill + } bdef + +/FAn { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 5 -2 roll arcn + tMatrix setmatrix + stroke + } bdef +/PAn { + newpath + tMatrix currentmatrix pop + translate 0 0 moveto scale + 0 0 1 5 -2 roll arcn + closepath + tMatrix setmatrix + fill + } bdef + +/MRR { + /vradius xdef + /hradius xdef + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + newpath + tMatrix currentmatrix pop + ulx hradius add uly vradius add translate + hradius vradius scale + 0 0 1 180 270 arc + tMatrix setmatrix + lrx hradius sub uly vradius add translate + hradius vradius scale + 0 0 1 270 360 arc + tMatrix setmatrix + lrx hradius sub lry vradius sub translate + hradius vradius scale + 0 0 1 0 90 arc + tMatrix setmatrix + ulx hradius add lry vradius sub translate + hradius vradius scale + 0 0 1 90 180 arc + tMatrix setmatrix + closepath + } bdef +/FRR { + MRR stroke } bdef +/PRR { + MRR fill } bdef + +/MlrRR { + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + /rad lry uly sub 2 div def + newpath + tMatrix currentmatrix pop + ulx rad add uly rad add translate + rad rad scale + 0 0 1 90 270 arc + tMatrix setmatrix + lrx rad sub lry rad sub translate + rad rad scale + 0 0 1 270 90 arc + tMatrix setmatrix + closepath + } bdef +/FlrRR { + MlrRR stroke } bdef +/PlrRR { + MlrRR fill } bdef + +/MtbRR { + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + /rad lrx ulx sub 2 div def + newpath + tMatrix currentmatrix pop + ulx rad add uly rad add translate + rad rad scale + 0 0 1 180 360 arc + tMatrix setmatrix + lrx rad sub lry rad sub translate + rad rad scale + 0 0 1 0 180 arc + tMatrix setmatrix + closepath + } bdef +/FtbRR { + MtbRR stroke } bdef +/PtbRR { + MtbRR fill } bdef + +currentdict end def + +MathWorks begin + +0 cap + +end + +MathWorks begin +bpage + +bplot + +/dpi2point 12 def +portraitMode 0216 7344 csm + + 641 134 5748 4679 MR c np +88 dict begin %Colortable dictionary +/c0 { 0 0 0 sr} bdef +/c1 { 1 1 1 sr} bdef +/c2 { 1 0 0 sr} bdef +/c3 { 0 1 0 sr} bdef +/c4 { 0 0 1 sr} bdef +/c5 { 1 1 0 sr} bdef +/c6 { 1 0 1 sr} bdef +/c7 { 0 1 1 sr} bdef +1 j +1 sg + 0 0 6918 5185 PR +6 w +0 1782 2261 0 0 -1782 899 2170 4 MP +PP +-2261 0 0 1782 2261 0 0 -1782 899 2170 5 MP stroke +4 w +DO +SO +6 w +0 sg + 899 2170 mt 3160 2170 L + 899 388 mt 3160 388 L + 899 2170 mt 899 388 L +3160 2170 mt 3160 388 L + 899 2170 mt 3160 2170 L + 899 2170 mt 899 388 L + 899 2170 mt 899 2147 L + 899 388 mt 899 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + + 866 2316 mt +(0) s +1351 2170 mt 1351 2147 L +1351 388 mt 1351 411 L +1285 2316 mt +(20) s +1803 2170 mt 1803 2147 L +1803 388 mt 1803 411 L +1737 2316 mt +(40) s +2256 2170 mt 2256 2147 L +2256 388 mt 2256 411 L +2190 2316 mt +(60) s +2708 2170 mt 2708 2147 L +2708 388 mt 2708 411 L +2642 2316 mt +(80) s +3160 2170 mt 3160 2147 L +3160 388 mt 3160 411 L +3060 2316 mt +(100) s + 899 2170 mt 922 2170 L +3160 2170 mt 3137 2170 L + 798 2214 mt +(0) s + 899 1814 mt 922 1814 L +3160 1814 mt 3137 1814 L + 698 1858 mt +(0.2) s + 899 1457 mt 922 1457 L +3160 1457 mt 3137 1457 L + 698 1501 mt +(0.4) s + 899 1101 mt 922 1101 L +3160 1101 mt 3137 1101 L + 698 1145 mt +(0.6) s + 899 744 mt 922 744 L +3160 744 mt 3137 744 L + 698 788 mt +(0.8) s + 899 388 mt 922 388 L +3160 388 mt 3137 388 L + 798 432 mt +(1) s + 899 2170 mt 3160 2170 L + 899 388 mt 3160 388 L + 899 2170 mt 899 388 L +3160 2170 mt 3160 388 L +gs 899 388 2262 1783 MR c np +23 14 22 6 23 7 22 7 23 5 23 4 22 5 23 4 +22 4 23 4 23 4 22 3 23 4 23 4 22 4 23 5 +22 4 23 4 23 4 22 4 23 3 22 4 23 4 23 4 +22 4 23 4 22 5 23 5 23 4 22 5 23 4 23 6 +22 5 23 6 22 6 23 40 23 33 22 30 23 27 22 24 +23 23 23 21 22 20 23 19 22 19 23 17 23 17 22 16 +23 16 22 15 23 15 23 15 22 14 23 13 23 14 22 13 +23 12 22 13 23 12 23 12 22 12 23 12 22 11 23 11 +23 11 22 11 23 11 22 10 23 11 23 10 22 10 23 10 +23 10 22 9 23 10 22 9 23 10 23 9 22 9 23 9 +22 9 23 9 23 9 22 9 23 8 22 9 23 8 23 9 +22 8 23 8 23 8 22 9 23 8 22 8 23 8 23 8 +22 8 23 8 22 7 922 1168 100 MP stroke +23 780 899 388 2 MP stroke +DA +23 1 22 1 23 1 22 4 23 1 23 2 22 2 23 3 +22 2 23 2 23 3 22 0 23 2 23 2 22 2 23 2 +22 3 23 1 23 2 22 1 23 2 22 1 23 1 23 2 +22 1 23 2 22 2 23 1 23 1 22 2 23 1 23 1 +22 2 23 3 22 3 23 33 23 30 22 26 23 25 22 22 +23 21 23 20 22 20 23 18 22 17 23 17 23 16 22 16 +23 15 22 15 23 14 23 14 22 14 23 13 23 13 22 13 +23 12 22 12 23 12 23 12 22 11 23 12 22 11 23 11 +23 11 22 10 23 11 22 10 23 10 23 10 22 10 23 10 +23 9 22 10 23 9 22 10 23 9 23 9 22 9 23 9 +22 9 23 9 23 8 22 9 23 8 22 9 23 8 23 8 +22 8 23 9 23 8 22 8 23 7 22 8 23 8 23 8 +22 7 23 8 22 7 922 1167 100 MP stroke +23 779 899 388 2 MP stroke +DO +23 8 22 5 23 1 22 17 23 1 23 1 22 17 23 16 +22 15 23 15 23 14 22 14 23 14 23 13 22 12 23 13 +22 12 23 0 23 12 22 12 23 0 22 1 23 0 23 1 +22 1 23 0 22 1 23 4 23 0 22 1 23 5 23 5 +22 11 23 11 22 11 23 11 23 10 22 11 23 10 22 10 +23 9 23 10 22 9 23 1 22 9 23 9 23 11 22 5 +23 1 22 0 23 0 23 1 22 0 23 0 23 1 22 7 +23 7 22 7 23 7 23 9 22 7 23 7 22 0 23 1 +23 5 22 1 23 3 22 1 23 6 23 3 22 8 23 8 +23 7 22 8 23 8 22 7 23 8 23 7 22 8 23 7 +22 8 23 7 23 7 22 7 23 7 22 1 23 1 23 6 +22 1 23 7 23 1 22 8 23 802 22 4 23 5 23 4 +22 4 23 5 22 4 922 392 100 MP stroke +23 4 899 388 2 MP stroke + +gr +DO +1283 293 mt +(Residual Norm vs. No. of Terms) s +SO +1 sg +0 1782 2261 0 0 -1782 3997 2170 4 MP +PP +-2261 0 0 1782 2261 0 0 -1782 3997 2170 5 MP stroke +4 w +DO +SO +6 w +0 sg +3997 2170 mt 6258 2170 L +3997 388 mt 6258 388 L +3997 2170 mt 3997 388 L +6258 2170 mt 6258 388 L +3997 2170 mt 6258 2170 L +3997 2170 mt 3997 388 L +4096 2170 mt 4096 2147 L +4096 388 mt 4096 411 L +4008 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +4141 2279 mt +(2) s +4807 2170 mt 4807 2147 L +4807 388 mt 4807 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +4719 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +4852 2279 mt +(3) s +5518 2170 mt 5518 2147 L +5518 388 mt 5518 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +5430 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +5563 2279 mt +(4) s +6229 2170 mt 6229 2147 L +6229 388 mt 6229 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +6141 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +6274 2279 mt +(5) s +3997 2170 mt 4020 2170 L +6258 2170 mt 6235 2170 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +3896 2214 mt +(0) s +3997 1814 mt 4020 1814 L +6258 1814 mt 6235 1814 L +3796 1858 mt +(0.2) s +3997 1457 mt 4020 1457 L +6258 1457 mt 6235 1457 L +3796 1501 mt +(0.4) s +3997 1101 mt 4020 1101 L +6258 1101 mt 6235 1101 L +3796 1145 mt +(0.6) s +3997 744 mt 4020 744 L +6258 744 mt 6235 744 L +3796 788 mt +(0.8) s +3997 388 mt 4020 388 L +6258 388 mt 6235 388 L +3896 432 mt +(1) s +3997 2170 mt 6258 2170 L +3997 388 mt 6258 388 L +3997 2170 mt 3997 388 L +6258 2170 mt 6258 388 L +gs 3997 388 2262 1783 MR c np +3 14 3 6 3 7 4 7 3 5 3 4 3 5 4 4 +3 4 4 4 3 4 3 3 4 4 4 4 3 4 4 5 +4 4 3 4 4 4 4 4 4 3 4 4 4 4 4 4 +4 4 4 4 4 5 4 5 5 4 4 5 5 4 4 6 +5 5 4 6 5 6 5 40 5 33 5 30 5 27 5 24 +5 23 5 21 6 20 5 19 6 19 5 17 6 17 6 16 +6 16 6 15 6 15 7 15 6 14 7 13 6 14 7 13 +8 12 7 13 7 12 8 12 8 12 8 12 8 11 8 11 +9 11 9 11 9 11 10 10 10 11 10 10 10 10 11 10 +11 10 12 9 12 10 13 9 13 10 13 9 15 9 15 9 +16 9 16 9 18 9 19 9 20 8 21 9 23 8 24 9 +27 8 30 8 32 8 37 9 41 8 47 8 57 8 69 8 +88 8 126 8 214 7 4836 1168 100 MP stroke +DA +4 1 3 1 3 1 3 4 3 1 4 2 3 2 3 3 +4 2 3 2 3 3 4 0 3 2 4 2 4 2 3 2 +4 3 4 1 4 2 3 1 4 2 4 1 4 1 4 2 +4 1 4 2 5 2 4 1 4 1 5 2 4 1 5 1 +4 2 5 3 4 3 5 33 5 30 5 26 5 25 5 22 +5 21 6 20 5 20 5 18 6 17 6 17 5 16 6 16 +6 15 6 15 7 14 6 14 7 14 6 13 7 13 7 13 +7 12 7 12 8 12 7 12 8 11 8 12 8 11 9 11 +9 11 8 10 10 11 9 10 10 10 10 10 11 10 10 10 +12 9 11 10 12 9 13 10 13 9 14 9 14 9 15 9 +16 9 17 9 17 8 19 9 20 8 21 9 23 8 25 8 +27 8 29 9 33 8 36 8 41 7 48 8 56 8 69 8 +89 7 125 8 214 7 3997 1167 100 MP stroke +DO +4 8 3 5 3 1 3 17 3 1 4 1 3 17 3 16 +4 15 3 15 3 14 4 14 3 14 4 13 4 12 3 13 +4 12 4 0 4 12 3 12 4 0 4 1 4 0 4 1 +4 1 4 0 5 1 4 4 4 0 5 1 4 5 5 5 +4 11 5 11 4 11 5 11 5 10 5 11 5 10 5 10 +5 9 6 10 5 9 5 1 6 9 6 9 5 11 6 5 +6 1 6 0 7 0 6 1 7 0 6 0 7 1 7 7 +7 7 7 7 8 7 7 9 8 7 8 7 8 0 9 1 +9 5 8 1 10 3 9 1 10 6 10 3 11 8 10 8 +12 7 11 8 12 8 13 7 13 8 14 7 14 8 15 7 +16 8 17 7 17 7 19 7 20 7 21 1 23 1 25 6 +27 1 29 7 33 1 36 8 41 802 48 4 56 5 69 4 +89 4 125 5 214 4 3997 392 100 MP stroke + +gr +DO +4387 293 mt +(Residual Norms vs. Storage) s +SO +1 sg +0 1782 5394 0 0 -1782 899 4612 4 MP +PP +-5394 0 0 1782 5394 0 0 -1782 899 4612 5 MP stroke +4 w +DO +SO +6 w +0 sg + 899 4612 mt 6293 4612 L + 899 2830 mt 6293 2830 L + 899 4612 mt 899 2830 L +6293 4612 mt 6293 2830 L + 899 4612 mt 6293 4612 L + 899 4612 mt 899 2830 L + 899 4612 mt 899 4558 L + 899 2830 mt 899 2884 L + 866 4758 mt +(0) s +1433 4612 mt 1433 4558 L +1433 2830 mt 1433 2884 L +1367 4758 mt +(10) s +1967 4612 mt 1967 4558 L +1967 2830 mt 1967 2884 L +1901 4758 mt +(20) s +2501 4612 mt 2501 4558 L +2501 2830 mt 2501 2884 L +2435 4758 mt +(30) s +3035 4612 mt 3035 4558 L +3035 2830 mt 3035 2884 L +2969 4758 mt +(40) s +3569 4612 mt 3569 4558 L +3569 2830 mt 3569 2884 L +3503 4758 mt +(50) s +4103 4612 mt 4103 4558 L +4103 2830 mt 4103 2884 L +4037 4758 mt +(60) s +4637 4612 mt 4637 4558 L +4637 2830 mt 4637 2884 L +4571 4758 mt +(70) s +5171 4612 mt 5171 4558 L +5171 2830 mt 5171 2884 L +5105 4758 mt +(80) s +5706 4612 mt 5706 4558 L +5706 2830 mt 5706 2884 L +5640 4758 mt +(90) s +6240 4612 mt 6240 4558 L +6240 2830 mt 6240 2884 L +6140 4758 mt +(100) s + 899 4612 mt 953 4612 L +6293 4612 mt 6239 4612 L + 798 4656 mt +(0) s + 899 4018 mt 953 4018 L +6293 4018 mt 6239 4018 L + 798 4062 mt +(5) s + 899 3424 mt 953 3424 L +6293 3424 mt 6239 3424 L + 731 3468 mt +(10) s + 899 2830 mt 953 2830 L +6293 2830 mt 6239 2830 L + 731 2874 mt +(15) s + 899 4612 mt 6293 4612 L + 899 2830 mt 6293 2830 L + 899 4612 mt 899 2830 L +6293 4612 mt 6293 2830 L +gs 899 2830 5395 1783 MR c np + +gr + 927 3286 mt 977 3336 L + 977 3286 mt 927 3336 L + 981 4208 mt 1031 4258 L +1031 4208 mt 981 4258 L +1034 4209 mt 1084 4259 L +1084 4209 mt 1034 4259 L +1088 4209 mt 1138 4259 L +1138 4209 mt 1088 4259 L +1141 4209 mt 1191 4259 L +1191 4209 mt 1141 4259 L +1194 4209 mt 1244 4259 L +1244 4209 mt 1194 4259 L +1248 4209 mt 1298 4259 L +1298 4209 mt 1248 4259 L +1301 4209 mt 1351 4259 L +1351 4209 mt 1301 4259 L +1355 4209 mt 1405 4259 L +1405 4209 mt 1355 4259 L +1408 4209 mt 1458 4259 L +1458 4209 mt 1408 4259 L +1461 4210 mt 1511 4260 L +1511 4210 mt 1461 4260 L +1515 4210 mt 1565 4260 L +1565 4210 mt 1515 4260 L +1568 4210 mt 1618 4260 L +1618 4210 mt 1568 4260 L +1622 4210 mt 1672 4260 L +1672 4210 mt 1622 4260 L +1675 4210 mt 1725 4260 L +1725 4210 mt 1675 4260 L +1728 4210 mt 1778 4260 L +1778 4210 mt 1728 4260 L +1782 4210 mt 1832 4260 L +1832 4210 mt 1782 4260 L +1835 4210 mt 1885 4260 L +1885 4210 mt 1835 4260 L +1889 4210 mt 1939 4260 L +1939 4210 mt 1889 4260 L +1942 4210 mt 1992 4260 L +1992 4210 mt 1942 4260 L +1996 4210 mt 2046 4260 L +2046 4210 mt 1996 4260 L +2049 4210 mt 2099 4260 L +2099 4210 mt 2049 4260 L +2102 4210 mt 2152 4260 L +2152 4210 mt 2102 4260 L +2156 4210 mt 2206 4260 L +2206 4210 mt 2156 4260 L +2209 4210 mt 2259 4260 L +2259 4210 mt 2209 4260 L +2263 4210 mt 2313 4260 L +2313 4210 mt 2263 4260 L +2316 4210 mt 2366 4260 L +2366 4210 mt 2316 4260 L +2369 4210 mt 2419 4260 L +2419 4210 mt 2369 4260 L +2423 4210 mt 2473 4260 L +2473 4210 mt 2423 4260 L +2476 4210 mt 2526 4260 L +2526 4210 mt 2476 4260 L +2530 4210 mt 2580 4260 L +2580 4210 mt 2530 4260 L +2583 4210 mt 2633 4260 L +2633 4210 mt 2583 4260 L +2636 4210 mt 2686 4260 L +2686 4210 mt 2636 4260 L +2690 4210 mt 2740 4260 L +2740 4210 mt 2690 4260 L +2743 4210 mt 2793 4260 L +2793 4210 mt 2743 4260 L +2797 4210 mt 2847 4260 L +2847 4210 mt 2797 4260 L +2850 4210 mt 2900 4260 L +2900 4210 mt 2850 4260 L +2903 4210 mt 2953 4260 L +2953 4210 mt 2903 4260 L +2957 4210 mt 3007 4260 L +3007 4210 mt 2957 4260 L +3010 4210 mt 3060 4260 L +3060 4210 mt 3010 4260 L +3064 4210 mt 3114 4260 L +3114 4210 mt 3064 4260 L +3117 4210 mt 3167 4260 L +3167 4210 mt 3117 4260 L +3170 4210 mt 3220 4260 L +3220 4210 mt 3170 4260 L +3224 4210 mt 3274 4260 L +3274 4210 mt 3224 4260 L +3277 4210 mt 3327 4260 L +3327 4210 mt 3277 4260 L +3331 4210 mt 3381 4260 L +3381 4210 mt 3331 4260 L +3384 4210 mt 3434 4260 L +3434 4210 mt 3384 4260 L +3437 4210 mt 3487 4260 L +3487 4210 mt 3437 4260 L +3491 4210 mt 3541 4260 L +3541 4210 mt 3491 4260 L +3544 4210 mt 3594 4260 L +3594 4210 mt 3544 4260 L +3598 4210 mt 3648 4260 L +3648 4210 mt 3598 4260 L +3651 4210 mt 3701 4260 L +3701 4210 mt 3651 4260 L +3705 4210 mt 3755 4260 L +3755 4210 mt 3705 4260 L +3758 4210 mt 3808 4260 L +3808 4210 mt 3758 4260 L +3811 4210 mt 3861 4260 L +3861 4210 mt 3811 4260 L +3865 4210 mt 3915 4260 L +3915 4210 mt 3865 4260 L +3918 4210 mt 3968 4260 L +3968 4210 mt 3918 4260 L +3972 4210 mt 4022 4260 L +4022 4210 mt 3972 4260 L +4025 4210 mt 4075 4260 L +4075 4210 mt 4025 4260 L +4078 4210 mt 4128 4260 L +4128 4210 mt 4078 4260 L +4132 4210 mt 4182 4260 L +4182 4210 mt 4132 4260 L +4185 4210 mt 4235 4260 L +4235 4210 mt 4185 4260 L +4239 4210 mt 4289 4260 L +4289 4210 mt 4239 4260 L +4292 4210 mt 4342 4260 L +4342 4210 mt 4292 4260 L +4345 4211 mt 4395 4261 L +4395 4211 mt 4345 4261 L +4399 4361 mt 4449 4411 L +4449 4361 mt 4399 4411 L +4452 4364 mt 4502 4414 L +4502 4364 mt 4452 4414 L +4506 4372 mt 4556 4422 L +4556 4372 mt 4506 4422 L +4559 4375 mt 4609 4425 L +4609 4375 mt 4559 4425 L +4612 4381 mt 4662 4431 L +4662 4381 mt 4612 4431 L +4666 4385 mt 4716 4435 L +4716 4385 mt 4666 4435 L +4719 4386 mt 4769 4436 L +4769 4386 mt 4719 4436 L +4773 4386 mt 4823 4436 L +4823 4386 mt 4773 4436 L +4826 4387 mt 4876 4437 L +4876 4387 mt 4826 4437 L +4879 4398 mt 4929 4448 L +4929 4398 mt 4879 4448 L +4933 4399 mt 4983 4449 L +4983 4399 mt 4933 4449 L +4986 4402 mt 5036 4452 L +5036 4402 mt 4986 4452 L +5040 4404 mt 5090 4454 L +5090 4404 mt 5040 4454 L +5093 4405 mt 5143 4455 L +5143 4405 mt 5093 4455 L +5146 4408 mt 5196 4458 L +5196 4408 mt 5146 4458 L +5200 4410 mt 5250 4460 L +5250 4410 mt 5200 4460 L +5253 4411 mt 5303 4461 L +5303 4411 mt 5253 4461 L +5307 4411 mt 5357 4461 L +5357 4411 mt 5307 4461 L +5360 4412 mt 5410 4462 L +5410 4412 mt 5360 4462 L +5414 4412 mt 5464 4462 L +5464 4412 mt 5414 4462 L +5467 4412 mt 5517 4462 L +5517 4412 mt 5467 4462 L +5520 4423 mt 5570 4473 L +5570 4423 mt 5520 4473 L +5574 4424 mt 5624 4474 L +5624 4424 mt 5574 4474 L +5627 4428 mt 5677 4478 L +5677 4428 mt 5627 4478 L +5681 4431 mt 5731 4481 L +5731 4431 mt 5681 4481 L +5734 4432 mt 5784 4482 L +5784 4432 mt 5734 4482 L +5787 4432 mt 5837 4482 L +5837 4432 mt 5787 4482 L +5841 4434 mt 5891 4484 L +5891 4434 mt 5841 4484 L +5894 4435 mt 5944 4485 L +5944 4435 mt 5894 4485 L +5948 4437 mt 5998 4487 L +5998 4437 mt 5948 4487 L +6001 4437 mt 6051 4487 L +6051 4437 mt 6001 4487 L +6054 4438 mt 6104 4488 L +6104 4438 mt 6054 4488 L +6108 4438 mt 6158 4488 L +6158 4438 mt 6108 4488 L +6161 4461 mt 6211 4511 L +6211 4461 mt 6161 4511 L +6215 4461 mt 6265 4511 L +6265 4461 mt 6215 4511 L +gs 899 2830 5395 1783 MR c np + +gr + 36 36 952 3311 FO + 36 36 1006 4236 FO + 36 36 1059 4236 FO + 36 36 1113 4236 FO + 36 36 1166 4236 FO + 36 36 1219 4236 FO + 36 36 1273 4236 FO + 36 36 1326 4236 FO + 36 36 1380 4236 FO + 36 36 1433 4236 FO + 36 36 1486 4236 FO + 36 36 1540 4236 FO + 36 36 1593 4236 FO + 36 36 1647 4236 FO + 36 36 1700 4236 FO + 36 36 1753 4236 FO + 36 36 1807 4236 FO + 36 36 1860 4236 FO + 36 36 1914 4236 FO + 36 36 1967 4236 FO + 36 36 2021 4236 FO + 36 36 2074 4236 FO + 36 36 2127 4236 FO + 36 36 2181 4236 FO + 36 36 2234 4236 FO + 36 36 2288 4236 FO + 36 36 2341 4236 FO + 36 36 2394 4236 FO + 36 36 2448 4236 FO + 36 36 2501 4236 FO + 36 36 2555 4236 FO + 36 36 2608 4236 FO + 36 36 2661 4236 FO + 36 36 2715 4236 FO + 36 36 2768 4236 FO + 36 36 2822 4236 FO + 36 36 2875 4236 FO + 36 36 2928 4236 FO + 36 36 2982 4236 FO + 36 36 3035 4236 FO + 36 36 3089 4236 FO + 36 36 3142 4236 FO + 36 36 3195 4236 FO + 36 36 3249 4236 FO + 36 36 3302 4236 FO + 36 36 3356 4236 FO + 36 36 3409 4236 FO + 36 36 3462 4236 FO + 36 36 3516 4236 FO + 36 36 3569 4236 FO + 36 36 3623 4236 FO + 36 36 3676 4236 FO + 36 36 3730 4236 FO + 36 36 3783 4236 FO + 36 36 3836 4236 FO + 36 36 3890 4236 FO + 36 36 3943 4236 FO + 36 36 3997 4236 FO + 36 36 4050 4236 FO + 36 36 4103 4236 FO + 36 36 4157 4236 FO + 36 36 4210 4236 FO + 36 36 4264 4236 FO + 36 36 4317 4236 FO + 36 36 4370 4236 FO + 36 36 4424 4412 FO + 36 36 4477 4410 FO + 36 36 4531 4449 FO + 36 36 4584 4449 FO + 36 36 4637 4449 FO + 36 36 4691 4449 FO + 36 36 4744 4449 FO + 36 36 4798 4449 FO + 36 36 4851 4440 FO + 36 36 4904 4440 FO + 36 36 4958 4449 FO + 36 36 5011 4449 FO + 36 36 5065 4449 FO + 36 36 5118 4449 FO + 36 36 5171 4449 FO + 36 36 5225 4470 FO + 36 36 5278 4440 FO + 36 36 5332 4440 FO + 36 36 5385 4431 FO + 36 36 5439 4439 FO + 36 36 5492 4439 FO + 36 36 5545 4440 FO + 36 36 5599 4439 FO + 36 36 5652 4470 FO + 36 36 5706 4438 FO + 36 36 5759 4438 FO + 36 36 5812 4438 FO + 36 36 5866 4416 FO + 36 36 5919 4455 FO + 36 36 5973 4445 FO + 36 36 6026 4455 FO + 36 36 6079 4418 FO + 36 36 6133 4471 FO + 36 36 6186 4471 FO + 36 36 6240 4478 FO +gs 899 2830 5395 1783 MR c np + +gr +0 j +-41 71 -41 -71 82 0 911 4260 4 MP +DP +-41 71 -41 -71 82 0 965 4260 4 MP +DP +-41 71 -41 -71 82 0 1018 4260 4 MP +DP +-41 71 -41 -71 82 0 1072 4260 4 MP +DP +-41 71 -41 -71 82 0 1125 4260 4 MP +DP +-41 71 -41 -71 82 0 1178 4260 4 MP +DP +-41 71 -41 -71 82 0 1232 4260 4 MP +DP +-41 71 -41 -71 82 0 1285 3335 4 MP +DP +-41 71 -41 -71 82 0 1339 4260 4 MP +DP +-41 71 -41 -71 82 0 1392 4436 4 MP +DP +-41 71 -41 -71 82 0 1445 4274 4 MP +DP +-41 71 -41 -71 82 0 1499 4431 4 MP +DP +-41 71 -41 -71 82 0 1552 4277 4 MP +DP +-41 71 -41 -71 82 0 1606 4424 4 MP +DP +-41 71 -41 -71 82 0 1659 4448 4 MP +DP +-41 71 -41 -71 82 0 1712 4276 4 MP +DP +-41 71 -41 -71 82 0 1766 4273 4 MP +DP +-41 71 -41 -71 82 0 1819 4273 4 MP +DP +-41 71 -41 -71 82 0 1873 4273 4 MP +DP +-41 71 -41 -71 82 0 1926 4273 4 MP +DP +-41 71 -41 -71 82 0 1980 4273 4 MP +DP +-41 71 -41 -71 82 0 2033 4273 4 MP +DP +-41 71 -41 -71 82 0 2086 4273 4 MP +DP +-41 71 -41 -71 82 0 2140 4274 4 MP +DP +-41 71 -41 -71 82 0 2193 4274 4 MP +DP +-41 71 -41 -71 82 0 2247 4274 4 MP +DP +-41 71 -41 -71 82 0 2300 4274 4 MP +DP +-41 71 -41 -71 82 0 2353 4274 4 MP +DP +-41 71 -41 -71 82 0 2407 4274 4 MP +DP +-41 71 -41 -71 82 0 2460 4274 4 MP +DP +-41 71 -41 -71 82 0 2514 4354 4 MP +DP +-41 71 -41 -71 82 0 2567 4308 4 MP +DP +-41 71 -41 -71 82 0 2620 4394 4 MP +DP +-41 71 -41 -71 82 0 2674 4350 4 MP +DP +-41 71 -41 -71 82 0 2727 4434 4 MP +DP +-41 71 -41 -71 82 0 2781 4316 4 MP +DP +-41 71 -41 -71 82 0 2834 4418 4 MP +DP +-41 71 -41 -71 82 0 2887 4495 4 MP +DP +-41 71 -41 -71 82 0 2941 4290 4 MP +DP +-41 71 -41 -71 82 0 2994 4290 4 MP +DP +-41 71 -41 -71 82 0 3048 4273 4 MP +DP +-41 71 -41 -71 82 0 3101 4290 4 MP +DP +-41 71 -41 -71 82 0 3154 4290 4 MP +DP +-41 71 -41 -71 82 0 3208 4290 4 MP +DP +-41 71 -41 -71 82 0 3261 4290 4 MP +DP +-41 71 -41 -71 82 0 3315 4477 4 MP +DP +-41 71 -41 -71 82 0 3368 4477 4 MP +DP +-41 71 -41 -71 82 0 3421 4477 4 MP +DP +-41 71 -41 -71 82 0 3475 4477 4 MP +DP +-41 71 -41 -71 82 0 3528 4477 4 MP +DP +-41 71 -41 -71 82 0 3582 4477 4 MP +DP +-41 71 -41 -71 82 0 3635 4477 4 MP +DP +-41 71 -41 -71 82 0 3689 4308 4 MP +DP +-41 71 -41 -71 82 0 3742 4260 4 MP +DP +-41 71 -41 -71 82 0 3795 4273 4 MP +DP +-41 71 -41 -71 82 0 3849 4273 4 MP +DP +-41 71 -41 -71 82 0 3902 4462 4 MP +DP +-41 71 -41 -71 82 0 3956 4273 4 MP +DP +-41 71 -41 -71 82 0 4009 4273 4 MP +DP +-41 71 -41 -71 82 0 4062 4273 4 MP +DP +-41 71 -41 -71 82 0 4116 4273 4 MP +DP +-41 71 -41 -71 82 0 4169 4271 4 MP +DP +-41 71 -41 -71 82 0 4223 4271 4 MP +DP +-41 71 -41 -71 82 0 4276 4271 4 MP +DP +-41 71 -41 -71 82 0 4329 4271 4 MP +DP +-41 71 -41 -71 82 0 4383 4271 4 MP +DP +-41 71 -41 -71 82 0 4436 4271 4 MP +DP +-41 71 -41 -71 82 0 4490 4271 4 MP +DP +-41 71 -41 -71 82 0 4543 4343 4 MP +DP +-41 71 -41 -71 82 0 4596 4337 4 MP +DP +-41 71 -41 -71 82 0 4650 4452 4 MP +DP +-41 71 -41 -71 82 0 4703 4452 4 MP +DP +-41 71 -41 -71 82 0 4757 4361 4 MP +DP +-41 71 -41 -71 82 0 4810 4465 4 MP +DP +-41 71 -41 -71 82 0 4863 4465 4 MP +DP +-41 71 -41 -71 82 0 4917 4452 4 MP +DP +-41 71 -41 -71 82 0 4970 4465 4 MP +DP +-41 71 -41 -71 82 0 5024 4456 4 MP +DP +-41 71 -41 -71 82 0 5077 4498 4 MP +DP +-41 71 -41 -71 82 0 5130 4482 4 MP +DP +-41 71 -41 -71 82 0 5184 4272 4 MP +DP +-41 71 -41 -71 82 0 5237 4272 4 MP +DP +-41 71 -41 -71 82 0 5291 4498 4 MP +DP +-41 71 -41 -71 82 0 5344 4272 4 MP +DP +-41 71 -41 -71 82 0 5398 4273 4 MP +DP +-41 71 -41 -71 82 0 5451 4273 4 MP +DP +-41 71 -41 -71 82 0 5504 4273 4 MP +DP +-41 71 -41 -71 82 0 5558 4272 4 MP +DP +-41 71 -41 -71 82 0 5611 4272 4 MP +DP +-41 71 -41 -71 82 0 5665 4273 4 MP +DP +-41 71 -41 -71 82 0 5718 4272 4 MP +DP +-41 71 -41 -71 82 0 5771 4271 4 MP +DP +-41 71 -41 -71 82 0 5825 4271 4 MP +DP +-41 71 -41 -71 82 0 5878 4271 4 MP +DP +-41 71 -41 -71 82 0 5932 4474 4 MP +DP +-41 71 -41 -71 82 0 5985 4474 4 MP +DP +-41 71 -41 -71 82 0 6038 4271 4 MP +DP +-41 71 -41 -71 82 0 6092 4474 4 MP +DP +-41 71 -41 -71 82 0 6145 4369 4 MP +DP +-41 71 -41 -71 82 0 6199 4343 4 MP +DP +gs 899 2830 5395 1783 MR c np + +gr +2953 2735 mt +(Singular vs. SDD values) s + +end + +eplot + +epage +end + +showpage + +%%EndDocument + @endspecial 225 2058 a Fz(Fig.)14 b(8.)35 b(Comparison)13 +b(of)h(the)g(SVD)h(\(solid)f(line,)g Fw(x)h Fz(marks\),)f(SDD-THR)h +(\(dashed)e(line,)h Fw(o)h Fz(marks\),)f(and)225 2099 +y(SDD-CYC)e(\(dotted)e(line,)g(triangle)g(marks\))g(on)h +Fw(impcol)p 1009 2099 11 2 v 10 w(c)p Fz(.)p eop +%%Page: 24 24 +24 23 bop 225 125 a Fv(24)71 b Fu(\001)78 b Fv(T.)13 +b(G.)f(Kolda)g(and)h(D.)g(P)m(.)e(O'Lea)o(ry)297 1966 +y @beginspecial 68 @llx 210 @lly 550 @urx 600 @ury 3240 +@rwi 3240 @rhi @setspecial +%%BeginDocument: west0132.eps + + +% MathWorks dictionary +/MathWorks 160 dict begin + +% definition operators +/bdef {bind def} bind def +/ldef {load def} bind def +/xdef {exch def} bdef +/xstore {exch store} bdef + +% operator abbreviations +/c /clip ldef +/cc /concat ldef +/cp /closepath ldef +/gr /grestore ldef +/gs /gsave ldef +/mt /moveto ldef +/np /newpath ldef +/cm /currentmatrix ldef +/sm /setmatrix ldef +/rc {rectclip} bdef +/rf {rectfill} bdef +/rm /rmoveto ldef +/rl /rlineto ldef +/s /show ldef +/sc {setcmykcolor} bdef +/sr /setrgbcolor ldef +/sg /setgray ldef +/w /setlinewidth ldef +/j /setlinejoin ldef +/cap /setlinecap ldef + +% page state control +/pgsv () def +/bpage {/pgsv save def} bdef +/epage {pgsv restore} bdef +/bplot /gsave ldef +/eplot {stroke grestore} bdef + +% orientation switch +/portraitMode 0 def +/landscapeMode 1 def + +% coordinate system mappings +/dpi2point 0 def + +% font control +/FontSize 0 def +/FMS { + /FontSize xstore %save size off stack + findfont + [FontSize 0 0 FontSize neg 0 0] + makefont + setfont + }bdef + +/reencode { +exch dup where +{pop load} {pop StandardEncoding} ifelse +exch +dup 3 1 roll +findfont dup length dict begin + { 1 index /FID ne {def}{pop pop} ifelse } forall + /Encoding exch def + currentdict +end +definefont pop +} bdef + +/isroman { +findfont /CharStrings get +/Agrave known +} bdef + +/FMSR { +3 1 roll 1 index +dup isroman +{reencode} {pop pop} ifelse +exch FMS +} bdef + +/csm { + 1 dpi2point div -1 dpi2point div scale + neg translate + landscapeMode eq {90 rotate} if + } bdef + +% line types: solid, dotted, dashed, dotdash +/SO { [] 0 setdash } bdef +/DO { [.5 dpi2point mul 4 dpi2point mul] 0 setdash } bdef +/DA { [6 dpi2point mul] 0 setdash } bdef +/DD { [.5 dpi2point mul 4 dpi2point mul 6 dpi2point mul 4 dpi2point mul] 0 setdash } bdef + +% macros for lines and objects +/L { + lineto + stroke + } bdef +/MP { + 3 1 roll moveto + 1 sub {rlineto} repeat + } bdef +/AP { + {rlineto} repeat + } bdef +/PP { + closepath eofill + } bdef +/DP { + closepath stroke + } bdef +/MR { + 4 -2 roll moveto + dup 0 exch rlineto + exch 0 rlineto + neg 0 exch rlineto + closepath + } bdef +/FR { + MR stroke + } bdef +/PR { + MR fill + } bdef +/L1i { + { currentfile picstr readhexstring pop } image + } bdef + +/tMatrix matrix def +/MakeOval { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 0 360 arc + tMatrix setmatrix + } bdef +/FO { + MakeOval + stroke + } bdef +/PO { + MakeOval + fill + } bdef + +/PD { + currentlinecap 1 setlinecap 3 1 roll 2 copy moveto lineto stroke setlinecap + } bdef + +/FA { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 5 -2 roll arc + tMatrix setmatrix + stroke + } bdef +/PA { + newpath + tMatrix currentmatrix pop + translate 0 0 moveto scale + 0 0 1 5 -2 roll arc + closepath + tMatrix setmatrix + fill + } bdef + +/FAn { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 5 -2 roll arcn + tMatrix setmatrix + stroke + } bdef +/PAn { + newpath + tMatrix currentmatrix pop + translate 0 0 moveto scale + 0 0 1 5 -2 roll arcn + closepath + tMatrix setmatrix + fill + } bdef + +/MRR { + /vradius xdef + /hradius xdef + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + newpath + tMatrix currentmatrix pop + ulx hradius add uly vradius add translate + hradius vradius scale + 0 0 1 180 270 arc + tMatrix setmatrix + lrx hradius sub uly vradius add translate + hradius vradius scale + 0 0 1 270 360 arc + tMatrix setmatrix + lrx hradius sub lry vradius sub translate + hradius vradius scale + 0 0 1 0 90 arc + tMatrix setmatrix + ulx hradius add lry vradius sub translate + hradius vradius scale + 0 0 1 90 180 arc + tMatrix setmatrix + closepath + } bdef +/FRR { + MRR stroke } bdef +/PRR { + MRR fill } bdef + +/MlrRR { + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + /rad lry uly sub 2 div def + newpath + tMatrix currentmatrix pop + ulx rad add uly rad add translate + rad rad scale + 0 0 1 90 270 arc + tMatrix setmatrix + lrx rad sub lry rad sub translate + rad rad scale + 0 0 1 270 90 arc + tMatrix setmatrix + closepath + } bdef +/FlrRR { + MlrRR stroke } bdef +/PlrRR { + MlrRR fill } bdef + +/MtbRR { + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + /rad lrx ulx sub 2 div def + newpath + tMatrix currentmatrix pop + ulx rad add uly rad add translate + rad rad scale + 0 0 1 180 360 arc + tMatrix setmatrix + lrx rad sub lry rad sub translate + rad rad scale + 0 0 1 0 180 arc + tMatrix setmatrix + closepath + } bdef +/FtbRR { + MtbRR stroke } bdef +/PtbRR { + MtbRR fill } bdef + +currentdict end def + +MathWorks begin + +0 cap + +end + +MathWorks begin +bpage + +bplot + +/dpi2point 12 def +portraitMode 0216 7344 csm + + 607 134 5782 4679 MR c np +88 dict begin %Colortable dictionary +/c0 { 0 0 0 sr} bdef +/c1 { 1 1 1 sr} bdef +/c2 { 1 0 0 sr} bdef +/c3 { 0 1 0 sr} bdef +/c4 { 0 0 1 sr} bdef +/c5 { 1 1 0 sr} bdef +/c6 { 1 0 1 sr} bdef +/c7 { 0 1 1 sr} bdef +1 j +1 sg + 0 0 6918 5185 PR +6 w +0 1782 2261 0 0 -1782 899 2170 4 MP +PP +-2261 0 0 1782 2261 0 0 -1782 899 2170 5 MP stroke +4 w +DO +SO +6 w +0 sg + 899 2170 mt 3160 2170 L + 899 388 mt 3160 388 L + 899 2170 mt 899 388 L +3160 2170 mt 3160 388 L + 899 2170 mt 3160 2170 L + 899 2170 mt 899 388 L + 899 2170 mt 899 2147 L + 899 388 mt 899 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + + 866 2316 mt +(0) s +1351 2170 mt 1351 2147 L +1351 388 mt 1351 411 L +1285 2316 mt +(20) s +1803 2170 mt 1803 2147 L +1803 388 mt 1803 411 L +1737 2316 mt +(40) s +2256 2170 mt 2256 2147 L +2256 388 mt 2256 411 L +2190 2316 mt +(60) s +2708 2170 mt 2708 2147 L +2708 388 mt 2708 411 L +2642 2316 mt +(80) s +3160 2170 mt 3160 2147 L +3160 388 mt 3160 411 L +3060 2316 mt +(100) s + 899 2170 mt 922 2170 L +3160 2170 mt 3137 2170 L + 798 2214 mt +(0) s + 899 1814 mt 922 1814 L +3160 1814 mt 3137 1814 L + 698 1858 mt +(0.2) s + 899 1457 mt 922 1457 L +3160 1457 mt 3137 1457 L + 698 1501 mt +(0.4) s + 899 1101 mt 922 1101 L +3160 1101 mt 3137 1101 L + 698 1145 mt +(0.6) s + 899 744 mt 922 744 L +3160 744 mt 3137 744 L + 698 788 mt +(0.8) s + 899 388 mt 922 388 L +3160 388 mt 3137 388 L + 798 432 mt +(1) s + 899 2170 mt 3160 2170 L + 899 388 mt 3160 388 L + 899 2170 mt 899 388 L +3160 2170 mt 3160 388 L +gs 899 388 2262 1783 MR c np +23 0 22 0 23 0 22 0 23 0 23 0 22 0 23 0 +22 0 23 0 23 0 22 0 23 0 23 0 22 0 23 0 +22 0 23 0 23 0 22 0 23 0 22 0 23 0 23 0 +22 0 23 0 22 0 23 0 23 0 22 0 23 0 23 0 +22 0 23 0 22 0 23 0 23 0 22 0 23 0 22 0 +23 0 23 0 22 0 23 0 22 0 23 0 23 0 22 0 +23 0 22 0 23 0 23 0 22 0 23 0 23 0 22 0 +23 0 22 0 23 0 23 0 22 0 23 0 22 0 23 0 +23 0 22 0 23 0 22 0 23 0 23 0 22 0 23 0 +23 1 22 0 23 0 22 0 23 0 23 0 22 0 23 0 +22 0 23 0 23 1 22 0 23 0 22 0 23 0 23 0 +22 0 23 1 23 0 22 0 23 1 22 10 23 8 23 155 +22 74 23 311 22 229 922 1379 100 MP stroke +23 991 899 388 2 MP stroke +DA +23 0 22 0 23 0 22 0 23 0 23 0 22 0 23 0 +22 0 23 0 23 0 22 0 23 0 23 0 22 0 23 0 +22 0 23 0 23 0 22 0 23 0 22 0 23 0 23 0 +22 0 23 0 22 0 23 0 23 0 22 0 23 0 23 0 +22 0 23 0 22 0 23 0 23 0 22 0 23 0 22 1 +23 0 23 0 22 0 23 0 22 0 23 0 23 0 22 0 +23 1 22 0 23 0 23 0 22 0 23 0 23 0 22 0 +23 0 22 0 23 0 23 0 22 1 23 0 22 1 23 0 +23 0 22 0 23 0 22 1 23 0 23 0 22 0 23 1 +23 0 22 1 23 2 22 1 23 0 23 1 22 1 23 2 +22 0 23 1 23 4 22 2 23 4 22 12 23 2 23 1 +22 65 23 1 23 3 22 14 23 13 22 130 23 85 23 259 +22 25 23 175 22 19 922 1341 100 MP stroke +23 953 899 388 2 MP stroke +DO +23 0 22 0 23 0 22 0 23 1 23 0 22 0 23 0 +22 0 23 0 23 0 22 0 23 0 23 0 22 0 23 0 +22 0 23 0 23 0 22 0 23 0 22 0 23 0 23 3 +22 0 23 1 22 0 23 0 23 1 22 0 23 0 23 0 +22 0 23 0 22 1 23 1 23 1 22 5 23 5 22 1 +23 1 23 0 22 10 23 0 22 6 23 0 23 0 22 8 +23 28 22 24 23 8 23 0 22 141 23 0 23 0 22 58 +23 0 22 283 23 0 23 0 22 0 23 183 22 0 23 0 +23 0 22 0 23 0 22 0 23 0 23 0 22 0 23 0 +23 0 22 0 23 0 22 0 23 0 23 0 22 0 23 0 +22 0 23 0 23 0 22 0 23 0 22 0 23 2 23 1 +22 14 23 0 23 9 22 0 23 0 22 0 23 0 23 32 +22 953 23 0 22 0 922 388 100 MP stroke +23 0 899 388 2 MP stroke + +gr +DO +1283 293 mt +(Residual Norm vs. No. of Terms) s +SO +1 sg +0 1782 2261 0 0 -1782 3997 2170 4 MP +PP +-2261 0 0 1782 2261 0 0 -1782 3997 2170 5 MP stroke +4 w +DO +SO +6 w +0 sg +3997 2170 mt 6258 2170 L +3997 388 mt 6258 388 L +3997 2170 mt 3997 388 L +6258 2170 mt 6258 388 L +3997 2170 mt 6258 2170 L +3997 2170 mt 3997 388 L +4107 2170 mt 4107 2147 L +4107 388 mt 4107 411 L +4019 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +4152 2279 mt +(2) s +4818 2170 mt 4818 2147 L +4818 388 mt 4818 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +4730 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +4863 2279 mt +(3) s +5529 2170 mt 5529 2147 L +5529 388 mt 5529 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +5441 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +5574 2279 mt +(4) s +6240 2170 mt 6240 2147 L +6240 388 mt 6240 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +6152 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +6285 2279 mt +(5) s +3997 2170 mt 4020 2170 L +6258 2170 mt 6235 2170 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +3896 2214 mt +(0) s +3997 1814 mt 4020 1814 L +6258 1814 mt 6235 1814 L +3796 1858 mt +(0.2) s +3997 1457 mt 4020 1457 L +6258 1457 mt 6235 1457 L +3796 1501 mt +(0.4) s +3997 1101 mt 4020 1101 L +6258 1101 mt 6235 1101 L +3796 1145 mt +(0.6) s +3997 744 mt 4020 744 L +6258 744 mt 6235 744 L +3796 788 mt +(0.8) s +3997 388 mt 4020 388 L +6258 388 mt 6235 388 L +3896 432 mt +(1) s +3997 2170 mt 6258 2170 L +3997 388 mt 6258 388 L +3997 2170 mt 3997 388 L +6258 2170 mt 6258 388 L +gs 3997 388 2262 1783 MR c np +3 0 3 0 3 0 4 0 3 0 3 0 3 0 4 0 +3 0 4 0 3 0 3 0 4 0 4 0 3 0 4 0 +4 0 3 0 4 0 4 0 4 0 4 0 4 0 4 0 +4 0 4 0 4 0 4 0 5 0 4 0 5 0 4 0 +5 0 4 0 5 0 5 0 5 0 5 0 5 0 5 0 +5 0 5 0 6 0 5 0 6 0 5 0 6 0 6 0 +6 0 6 0 6 0 7 0 6 0 7 0 7 0 6 0 +8 0 7 0 7 0 8 0 8 0 8 0 8 0 8 0 +9 0 9 0 9 0 10 0 10 0 10 0 10 0 11 0 +11 1 12 0 12 0 13 0 13 0 14 0 14 0 15 0 +16 0 16 0 18 1 19 0 20 0 21 0 23 0 25 0 +27 0 29 1 32 0 37 0 41 1 48 10 56 8 69 155 +89 74 125 311 214 229 4836 1379 100 MP stroke +DA +3 0 3 0 3 0 4 0 3 0 3 0 3 0 4 0 +3 0 4 0 3 0 4 0 3 0 4 0 3 0 4 0 +4 0 3 0 4 0 4 0 4 0 4 0 4 0 4 0 +4 0 4 0 4 0 5 0 4 0 4 0 5 0 4 0 +5 0 4 0 5 0 5 0 5 0 5 0 5 0 5 1 +5 0 5 0 6 0 5 0 6 0 5 0 6 0 6 0 +6 1 6 0 6 0 7 0 6 0 7 0 7 0 7 0 +7 0 7 0 7 0 8 0 8 1 8 0 8 1 9 0 +8 0 9 0 9 0 10 1 10 0 10 0 10 0 11 1 +11 0 12 1 12 2 13 1 13 0 14 1 14 1 15 2 +16 0 17 1 17 4 19 2 20 4 21 12 23 2 25 1 +27 65 29 1 33 3 36 14 41 13 48 130 56 85 69 259 +89 25 125 175 214 19 3997 1341 100 MP stroke +DO +3 0 3 0 3 0 4 0 3 1 3 0 3 0 4 0 +3 0 4 0 3 0 4 0 3 0 4 0 3 0 4 0 +4 0 3 0 4 0 4 0 4 0 4 0 4 0 4 3 +4 0 4 1 4 0 5 0 4 1 4 0 5 0 4 0 +5 0 4 0 5 1 5 1 5 1 5 5 5 5 5 1 +5 1 5 0 6 10 5 0 6 6 5 0 6 0 6 8 +6 28 6 24 6 8 7 0 6 141 7 0 7 0 7 58 +7 0 7 283 7 0 8 0 8 0 8 183 8 0 9 0 +8 0 9 0 9 0 10 0 10 0 10 0 10 0 11 0 +11 0 12 0 12 0 13 0 13 0 14 0 14 0 15 0 +16 0 17 0 17 0 19 0 20 0 21 0 23 2 25 1 +27 14 29 0 33 9 36 0 41 0 48 0 56 0 69 32 +89 953 125 0 214 0 3997 388 100 MP stroke + +gr +DO +4387 293 mt +(Residual Norms vs. Storage) s +SO +1 sg +0 1782 5394 0 0 -1782 899 4612 4 MP +PP +-5394 0 0 1782 5394 0 0 -1782 899 4612 5 MP stroke +4 w +DO +SO +6 w +0 sg + 899 4612 mt 6293 4612 L + 899 2830 mt 6293 2830 L + 899 4612 mt 899 2830 L +6293 4612 mt 6293 2830 L + 899 4612 mt 6293 4612 L + 899 4612 mt 899 2830 L + 899 4612 mt 899 4558 L + 899 2830 mt 899 2884 L + 866 4758 mt +(0) s +1433 4612 mt 1433 4558 L +1433 2830 mt 1433 2884 L +1367 4758 mt +(10) s +1967 4612 mt 1967 4558 L +1967 2830 mt 1967 2884 L +1901 4758 mt +(20) s +2501 4612 mt 2501 4558 L +2501 2830 mt 2501 2884 L +2435 4758 mt +(30) s +3035 4612 mt 3035 4558 L +3035 2830 mt 3035 2884 L +2969 4758 mt +(40) s +3569 4612 mt 3569 4558 L +3569 2830 mt 3569 2884 L +3503 4758 mt +(50) s +4103 4612 mt 4103 4558 L +4103 2830 mt 4103 2884 L +4037 4758 mt +(60) s +4637 4612 mt 4637 4558 L +4637 2830 mt 4637 2884 L +4571 4758 mt +(70) s +5171 4612 mt 5171 4558 L +5171 2830 mt 5171 2884 L +5105 4758 mt +(80) s +5706 4612 mt 5706 4558 L +5706 2830 mt 5706 2884 L +5640 4758 mt +(90) s +6240 4612 mt 6240 4558 L +6240 2830 mt 6240 2884 L +6140 4758 mt +(100) s + 899 4612 mt 953 4612 L +6293 4612 mt 6239 4612 L + 798 4656 mt +(0) s + 899 4315 mt 953 4315 L +6293 4315 mt 6239 4315 L + 664 4359 mt +(100) s + 899 4018 mt 953 4018 L +6293 4018 mt 6239 4018 L + 664 4062 mt +(200) s + 899 3721 mt 953 3721 L +6293 3721 mt 6239 3721 L + 664 3765 mt +(300) s + 899 3424 mt 953 3424 L +6293 3424 mt 6239 3424 L + 664 3468 mt +(400) s + 899 3127 mt 953 3127 L +6293 3127 mt 6239 3127 L + 664 3171 mt +(500) s + 899 2830 mt 953 2830 L +6293 2830 mt 6239 2830 L + 664 2874 mt +(600) s + 899 4612 mt 6293 4612 L + 899 2830 mt 6293 2830 L + 899 4612 mt 899 2830 L +6293 4612 mt 6293 2830 L +gs 899 2830 5395 1783 MR c np + +gr + 927 2907 mt 977 2957 L + 977 2907 mt 927 2957 L + 981 3595 mt 1031 3645 L +1031 3595 mt 981 3645 L +1034 3644 mt 1084 3694 L +1084 3644 mt 1034 3694 L +1088 4026 mt 1138 4076 L +1138 4026 mt 1088 4076 L +1141 4029 mt 1191 4079 L +1191 4029 mt 1141 4079 L +1194 4415 mt 1244 4465 L +1244 4415 mt 1194 4465 L +1248 4432 mt 1298 4482 L +1298 4432 mt 1248 4482 L +1301 4524 mt 1351 4574 L +1351 4524 mt 1301 4574 L +1355 4541 mt 1405 4591 L +1405 4541 mt 1355 4591 L +1408 4548 mt 1458 4598 L +1458 4548 mt 1408 4598 L +1461 4548 mt 1511 4598 L +1511 4548 mt 1461 4598 L +1515 4549 mt 1565 4599 L +1565 4549 mt 1515 4599 L +1568 4549 mt 1618 4599 L +1618 4549 mt 1568 4599 L +1622 4549 mt 1672 4599 L +1672 4549 mt 1622 4599 L +1675 4552 mt 1725 4602 L +1725 4552 mt 1675 4602 L +1728 4553 mt 1778 4603 L +1778 4553 mt 1728 4603 L +1782 4553 mt 1832 4603 L +1832 4553 mt 1782 4603 L +1835 4554 mt 1885 4604 L +1885 4554 mt 1835 4604 L +1889 4555 mt 1939 4605 L +1939 4555 mt 1889 4605 L +1942 4555 mt 1992 4605 L +1992 4555 mt 1942 4605 L +1996 4558 mt 2046 4608 L +2046 4558 mt 1996 4608 L +2049 4558 mt 2099 4608 L +2099 4558 mt 2049 4608 L +2102 4558 mt 2152 4608 L +2152 4558 mt 2102 4608 L +2156 4560 mt 2206 4610 L +2206 4560 mt 2156 4610 L +2209 4560 mt 2259 4610 L +2259 4560 mt 2209 4610 L +2263 4560 mt 2313 4610 L +2313 4560 mt 2263 4610 L +2316 4564 mt 2366 4614 L +2366 4564 mt 2316 4614 L +2369 4566 mt 2419 4616 L +2419 4566 mt 2369 4616 L +2423 4567 mt 2473 4617 L +2473 4567 mt 2423 4617 L +2476 4567 mt 2526 4617 L +2526 4567 mt 2476 4617 L +2530 4568 mt 2580 4618 L +2580 4568 mt 2530 4618 L +2583 4570 mt 2633 4620 L +2633 4570 mt 2583 4620 L +2636 4574 mt 2686 4624 L +2686 4574 mt 2636 4624 L +2690 4579 mt 2740 4629 L +2740 4579 mt 2690 4629 L +2743 4579 mt 2793 4629 L +2793 4579 mt 2743 4629 L +2797 4579 mt 2847 4629 L +2847 4579 mt 2797 4629 L +2850 4580 mt 2900 4630 L +2900 4580 mt 2850 4630 L +2903 4580 mt 2953 4630 L +2953 4580 mt 2903 4630 L +2957 4581 mt 3007 4631 L +3007 4581 mt 2957 4631 L +3010 4581 mt 3060 4631 L +3060 4581 mt 3010 4631 L +3064 4581 mt 3114 4631 L +3114 4581 mt 3064 4631 L +3117 4581 mt 3167 4631 L +3167 4581 mt 3117 4631 L +3170 4582 mt 3220 4632 L +3220 4582 mt 3170 4632 L +3224 4583 mt 3274 4633 L +3274 4583 mt 3224 4633 L +3277 4583 mt 3327 4633 L +3327 4583 mt 3277 4633 L +3331 4583 mt 3381 4633 L +3381 4583 mt 3331 4633 L +3384 4583 mt 3434 4633 L +3434 4583 mt 3384 4633 L +3437 4583 mt 3487 4633 L +3487 4583 mt 3437 4633 L +3491 4583 mt 3541 4633 L +3541 4583 mt 3491 4633 L +3544 4583 mt 3594 4633 L +3594 4583 mt 3544 4633 L +3598 4583 mt 3648 4633 L +3648 4583 mt 3598 4633 L +3651 4583 mt 3701 4633 L +3701 4583 mt 3651 4633 L +3705 4583 mt 3755 4633 L +3755 4583 mt 3705 4633 L +3758 4583 mt 3808 4633 L +3808 4583 mt 3758 4633 L +3811 4583 mt 3861 4633 L +3861 4583 mt 3811 4633 L +3865 4584 mt 3915 4634 L +3915 4584 mt 3865 4634 L +3918 4584 mt 3968 4634 L +3968 4584 mt 3918 4634 L +3972 4584 mt 4022 4634 L +4022 4584 mt 3972 4634 L +4025 4584 mt 4075 4634 L +4075 4584 mt 4025 4634 L +4078 4584 mt 4128 4634 L +4128 4584 mt 4078 4634 L +4132 4584 mt 4182 4634 L +4182 4584 mt 4132 4634 L +4185 4584 mt 4235 4634 L +4235 4584 mt 4185 4634 L +4239 4584 mt 4289 4634 L +4289 4584 mt 4239 4634 L +4292 4584 mt 4342 4634 L +4342 4584 mt 4292 4634 L +4345 4584 mt 4395 4634 L +4395 4584 mt 4345 4634 L +4399 4584 mt 4449 4634 L +4449 4584 mt 4399 4634 L +4452 4584 mt 4502 4634 L +4502 4584 mt 4452 4634 L +4506 4584 mt 4556 4634 L +4556 4584 mt 4506 4634 L +4559 4584 mt 4609 4634 L +4609 4584 mt 4559 4634 L +4612 4584 mt 4662 4634 L +4662 4584 mt 4612 4634 L +4666 4584 mt 4716 4634 L +4716 4584 mt 4666 4634 L +4719 4584 mt 4769 4634 L +4769 4584 mt 4719 4634 L +4773 4584 mt 4823 4634 L +4823 4584 mt 4773 4634 L +4826 4584 mt 4876 4634 L +4876 4584 mt 4826 4634 L +4879 4584 mt 4929 4634 L +4929 4584 mt 4879 4634 L +4933 4584 mt 4983 4634 L +4983 4584 mt 4933 4634 L +4986 4584 mt 5036 4634 L +5036 4584 mt 4986 4634 L +5040 4584 mt 5090 4634 L +5090 4584 mt 5040 4634 L +5093 4584 mt 5143 4634 L +5143 4584 mt 5093 4634 L +5146 4584 mt 5196 4634 L +5196 4584 mt 5146 4634 L +5200 4584 mt 5250 4634 L +5250 4584 mt 5200 4634 L +5253 4584 mt 5303 4634 L +5303 4584 mt 5253 4634 L +5307 4584 mt 5357 4634 L +5357 4584 mt 5307 4634 L +5360 4584 mt 5410 4634 L +5410 4584 mt 5360 4634 L +5414 4584 mt 5464 4634 L +5464 4584 mt 5414 4634 L +5467 4584 mt 5517 4634 L +5517 4584 mt 5467 4634 L +5520 4584 mt 5570 4634 L +5570 4584 mt 5520 4634 L +5574 4584 mt 5624 4634 L +5624 4584 mt 5574 4634 L +5627 4584 mt 5677 4634 L +5677 4584 mt 5627 4634 L +5681 4584 mt 5731 4634 L +5731 4584 mt 5681 4634 L +5734 4584 mt 5784 4634 L +5784 4584 mt 5734 4634 L +5787 4584 mt 5837 4634 L +5837 4584 mt 5787 4634 L +5841 4584 mt 5891 4634 L +5891 4584 mt 5841 4634 L +5894 4584 mt 5944 4634 L +5944 4584 mt 5894 4634 L +5948 4584 mt 5998 4634 L +5998 4584 mt 5948 4634 L +6001 4584 mt 6051 4634 L +6051 4584 mt 6001 4634 L +6054 4584 mt 6104 4634 L +6104 4584 mt 6054 4634 L +6108 4585 mt 6158 4635 L +6158 4585 mt 6108 4635 L +6161 4585 mt 6211 4635 L +6211 4585 mt 6161 4635 L +6215 4585 mt 6265 4635 L +6265 4585 mt 6215 4635 L +gs 899 2830 5395 1783 MR c np + +gr + 36 36 952 2942 FO + 36 36 1006 4055 FO + 36 36 1059 3669 FO + 36 36 1113 4050 FO + 36 36 1166 3673 FO + 36 36 1219 3977 FO + 36 36 1273 3976 FO + 36 36 1326 4292 FO + 36 36 1380 4292 FO + 36 36 1433 4399 FO + 36 36 1486 4460 FO + 36 36 1540 4197 FO + 36 36 1593 4514 FO + 36 36 1647 4449 FO + 36 36 1700 4395 FO + 36 36 1753 4455 FO + 36 36 1807 4490 FO + 36 36 1860 4468 FO + 36 36 1914 4527 FO + 36 36 1967 4518 FO + 36 36 2021 4516 FO + 36 36 2074 4508 FO + 36 36 2127 4524 FO + 36 36 2181 4568 FO + 36 36 2234 4535 FO + 36 36 2288 4505 FO + 36 36 2341 4532 FO + 36 36 2394 4567 FO + 36 36 2448 4539 FO + 36 36 2501 4583 FO + 36 36 2555 4574 FO + 36 36 2608 4569 FO + 36 36 2661 4577 FO + 36 36 2715 4578 FO + 36 36 2768 4585 FO + 36 36 2822 4583 FO + 36 36 2875 4573 FO + 36 36 2928 4535 FO + 36 36 2982 4586 FO + 36 36 3035 4565 FO + 36 36 3089 4577 FO + 36 36 3142 4593 FO + 36 36 3195 4588 FO + 36 36 3249 4584 FO + 36 36 3302 4588 FO + 36 36 3356 4579 FO + 36 36 3409 4579 FO + 36 36 3462 4592 FO + 36 36 3516 4585 FO + 36 36 3569 4583 FO + 36 36 3623 4574 FO + 36 36 3676 4565 FO + 36 36 3730 4599 FO + 36 36 3783 4592 FO + 36 36 3836 4585 FO + 36 36 3890 4583 FO + 36 36 3943 4595 FO + 36 36 3997 4594 FO + 36 36 4050 4595 FO + 36 36 4103 4591 FO + 36 36 4157 4582 FO + 36 36 4210 4604 FO + 36 36 4264 4597 FO + 36 36 4317 4595 FO + 36 36 4370 4605 FO + 36 36 4424 4595 FO + 36 36 4477 4597 FO + 36 36 4531 4601 FO + 36 36 4584 4598 FO + 36 36 4637 4604 FO + 36 36 4691 4605 FO + 36 36 4744 4602 FO + 36 36 4798 4602 FO + 36 36 4851 4605 FO + 36 36 4904 4605 FO + 36 36 4958 4595 FO + 36 36 5011 4602 FO + 36 36 5065 4606 FO + 36 36 5118 4606 FO + 36 36 5171 4606 FO + 36 36 5225 4608 FO + 36 36 5278 4603 FO + 36 36 5332 4605 FO + 36 36 5385 4606 FO + 36 36 5439 4606 FO + 36 36 5492 4608 FO + 36 36 5545 4605 FO + 36 36 5599 4606 FO + 36 36 5652 4607 FO + 36 36 5706 4606 FO + 36 36 5759 4607 FO + 36 36 5812 4607 FO + 36 36 5866 4607 FO + 36 36 5919 4608 FO + 36 36 5973 4607 FO + 36 36 6026 4607 FO + 36 36 6079 4607 FO + 36 36 6133 4608 FO + 36 36 6186 4607 FO + 36 36 6240 4607 FO +gs 899 2830 5395 1783 MR c np + +gr +0 j +-41 71 -41 -71 82 0 911 4633 4 MP +DP +-41 71 -41 -71 82 0 965 4633 4 MP +DP +-41 71 -41 -71 82 0 1018 4602 4 MP +DP +-41 71 -41 -71 82 0 1072 2966 4 MP +DP +-41 71 -41 -71 82 0 1125 4001 4 MP +DP +-41 71 -41 -71 82 0 1178 4633 4 MP +DP +-41 71 -41 -71 82 0 1232 4634 4 MP +DP +-41 71 -41 -71 82 0 1285 4630 4 MP +DP +-41 71 -41 -71 82 0 1339 4633 4 MP +DP +-41 71 -41 -71 82 0 1392 4181 4 MP +DP +-41 71 -41 -71 82 0 1445 4633 4 MP +DP +-41 71 -41 -71 82 0 1499 4122 4 MP +DP +-41 71 -41 -71 82 0 1552 4351 4 MP +DP +-41 71 -41 -71 82 0 1606 4357 4 MP +DP +-41 71 -41 -71 82 0 1659 4615 4 MP +DP +-41 71 -41 -71 82 0 1712 4609 4 MP +DP +-41 71 -41 -71 82 0 1766 4607 4 MP +DP +-41 71 -41 -71 82 0 1819 4597 4 MP +DP +-41 71 -41 -71 82 0 1873 4631 4 MP +DP +-41 71 -41 -71 82 0 1926 4632 4 MP +DP +-41 71 -41 -71 82 0 1980 4633 4 MP +DP +-41 71 -41 -71 82 0 2033 4447 4 MP +DP +-41 71 -41 -71 82 0 2086 4633 4 MP +DP +-41 71 -41 -71 82 0 2140 4507 4 MP +DP +-41 71 -41 -71 82 0 2193 4541 4 MP +DP +-41 71 -41 -71 82 0 2247 4628 4 MP +DP +-41 71 -41 -71 82 0 2300 4538 4 MP +DP +-41 71 -41 -71 82 0 2353 4579 4 MP +DP +-41 71 -41 -71 82 0 2407 4583 4 MP +DP +-41 71 -41 -71 82 0 2460 4601 4 MP +DP +-41 71 -41 -71 82 0 2514 4613 4 MP +DP +-41 71 -41 -71 82 0 2567 4615 4 MP +DP +-41 71 -41 -71 82 0 2620 4621 4 MP +DP +-41 71 -41 -71 82 0 2674 4632 4 MP +DP +-41 71 -41 -71 82 0 2727 4632 4 MP +DP +-41 71 -41 -71 82 0 2781 4603 4 MP +DP +-41 71 -41 -71 82 0 2834 4629 4 MP +DP +-41 71 -41 -71 82 0 2887 4630 4 MP +DP +-41 71 -41 -71 82 0 2941 3697 4 MP +DP +-41 71 -41 -71 82 0 2994 4632 4 MP +DP +-41 71 -41 -71 82 0 3048 4630 4 MP +DP +-41 71 -41 -71 82 0 3101 4592 4 MP +DP +-41 71 -41 -71 82 0 3154 3693 4 MP +DP +-41 71 -41 -71 82 0 3208 4630 4 MP +DP +-41 71 -41 -71 82 0 3261 4074 4 MP +DP +-41 71 -41 -71 82 0 3315 4632 4 MP +DP +-41 71 -41 -71 82 0 3368 4632 4 MP +DP +-41 71 -41 -71 82 0 3421 4008 4 MP +DP +-41 71 -41 -71 82 0 3475 4617 4 MP +DP +-41 71 -41 -71 82 0 3528 4364 4 MP +DP +-41 71 -41 -71 82 0 3582 4300 4 MP +DP +-41 71 -41 -71 82 0 3635 4316 4 MP +DP +-41 71 -41 -71 82 0 3689 4423 4 MP +DP +-41 71 -41 -71 82 0 3742 4601 4 MP +DP +-41 71 -41 -71 82 0 3795 4612 4 MP +DP +-41 71 -41 -71 82 0 3849 4446 4 MP +DP +-41 71 -41 -71 82 0 3902 4632 4 MP +DP +-41 71 -41 -71 82 0 3956 4434 4 MP +DP +-41 71 -41 -71 82 0 4009 4633 4 MP +DP +-41 71 -41 -71 82 0 4062 4513 4 MP +DP +-41 71 -41 -71 82 0 4116 4540 4 MP +DP +-41 71 -41 -71 82 0 4169 4484 4 MP +DP +-41 71 -41 -71 82 0 4223 4492 4 MP +DP +-41 71 -41 -71 82 0 4276 4542 4 MP +DP +-41 71 -41 -71 82 0 4329 4551 4 MP +DP +-41 71 -41 -71 82 0 4383 4559 4 MP +DP +-41 71 -41 -71 82 0 4436 4593 4 MP +DP +-41 71 -41 -71 82 0 4490 4607 4 MP +DP +-41 71 -41 -71 82 0 4543 4603 4 MP +DP +-41 71 -41 -71 82 0 4596 4628 4 MP +DP +-41 71 -41 -71 82 0 4650 4619 4 MP +DP +-41 71 -41 -71 82 0 4703 4564 4 MP +DP +-41 71 -41 -71 82 0 4757 4583 4 MP +DP +-41 71 -41 -71 82 0 4810 4590 4 MP +DP +-41 71 -41 -71 82 0 4863 4600 4 MP +DP +-41 71 -41 -71 82 0 4917 4621 4 MP +DP +-41 71 -41 -71 82 0 4970 4540 4 MP +DP +-41 71 -41 -71 82 0 5024 4631 4 MP +DP +-41 71 -41 -71 82 0 5077 4633 4 MP +DP +-41 71 -41 -71 82 0 5130 4608 4 MP +DP +-41 71 -41 -71 82 0 5184 4613 4 MP +DP +-41 71 -41 -71 82 0 5237 4623 4 MP +DP +-41 71 -41 -71 82 0 5291 4634 4 MP +DP +-41 71 -41 -71 82 0 5344 4633 4 MP +DP +-41 71 -41 -71 82 0 5398 4622 4 MP +DP +-41 71 -41 -71 82 0 5451 4627 4 MP +DP +-41 71 -41 -71 82 0 5504 4622 4 MP +DP +-41 71 -41 -71 82 0 5558 4623 4 MP +DP +-41 71 -41 -71 82 0 5611 4627 4 MP +DP +-41 71 -41 -71 82 0 5665 4633 4 MP +DP +-41 71 -41 -71 82 0 5718 4632 4 MP +DP +-41 71 -41 -71 82 0 5771 4635 4 MP +DP +-41 71 -41 -71 82 0 5825 4633 4 MP +DP +-41 71 -41 -71 82 0 5878 4633 4 MP +DP +-41 71 -41 -71 82 0 5932 4604 4 MP +DP +-41 71 -41 -71 82 0 5985 4600 4 MP +DP +-41 71 -41 -71 82 0 6038 4613 4 MP +DP +-41 71 -41 -71 82 0 6092 4615 4 MP +DP +-41 71 -41 -71 82 0 6145 4616 4 MP +DP +-41 71 -41 -71 82 0 6199 4609 4 MP +DP +gs 899 2830 5395 1783 MR c np + +gr +2953 2735 mt +(Singular vs. SDD values) s + +end + +eplot + +epage +end + +showpage + +%%EndDocument + @endspecial 225 2058 a Fz(Fig.)j(9.)35 b(Comparison)13 +b(of)h(the)g(SVD)h(\(solid)f(line,)g Fw(x)h Fz(marks\),)f(SDD-THR)h +(\(dashed)e(line,)h Fw(o)h Fz(marks\),)f(and)225 2099 +y(SDD-CYC)e(\(dotted)e(line,)g(triangle)g(marks\))g(on)h +Fw(west0132)p Fz(.)p eop +%%Page: 25 25 +25 24 bop 946 125 a Fv(Semidiscrete)12 b(Matrix)f(Decomp)q(osition)78 +b Fu(\001)70 b Fv(25)297 1966 y @beginspecial 71 @llx +210 @lly 546 @urx 600 @ury 3240 @rwi 3240 @rhi @setspecial +%%BeginDocument: watson2.eps + + +% MathWorks dictionary +/MathWorks 160 dict begin + +% definition operators +/bdef {bind def} bind def +/ldef {load def} bind def +/xdef {exch def} bdef +/xstore {exch store} bdef + +% operator abbreviations +/c /clip ldef +/cc /concat ldef +/cp /closepath ldef +/gr /grestore ldef +/gs /gsave ldef +/mt /moveto ldef +/np /newpath ldef +/cm /currentmatrix ldef +/sm /setmatrix ldef +/rc {rectclip} bdef +/rf {rectfill} bdef +/rm /rmoveto ldef +/rl /rlineto ldef +/s /show ldef +/sc {setcmykcolor} bdef +/sr /setrgbcolor ldef +/sg /setgray ldef +/w /setlinewidth ldef +/j /setlinejoin ldef +/cap /setlinecap ldef + +% page state control +/pgsv () def +/bpage {/pgsv save def} bdef +/epage {pgsv restore} bdef +/bplot /gsave ldef +/eplot {stroke grestore} bdef + +% orientation switch +/portraitMode 0 def +/landscapeMode 1 def + +% coordinate system mappings +/dpi2point 0 def + +% font control +/FontSize 0 def +/FMS { + /FontSize xstore %save size off stack + findfont + [FontSize 0 0 FontSize neg 0 0] + makefont + setfont + }bdef + +/reencode { +exch dup where +{pop load} {pop StandardEncoding} ifelse +exch +dup 3 1 roll +findfont dup length dict begin + { 1 index /FID ne {def}{pop pop} ifelse } forall + /Encoding exch def + currentdict +end +definefont pop +} bdef + +/isroman { +findfont /CharStrings get +/Agrave known +} bdef + +/FMSR { +3 1 roll 1 index +dup isroman +{reencode} {pop pop} ifelse +exch FMS +} bdef + +/csm { + 1 dpi2point div -1 dpi2point div scale + neg translate + landscapeMode eq {90 rotate} if + } bdef + +% line types: solid, dotted, dashed, dotdash +/SO { [] 0 setdash } bdef +/DO { [.5 dpi2point mul 4 dpi2point mul] 0 setdash } bdef +/DA { [6 dpi2point mul] 0 setdash } bdef +/DD { [.5 dpi2point mul 4 dpi2point mul 6 dpi2point mul 4 dpi2point mul] 0 setdash } bdef + +% macros for lines and objects +/L { + lineto + stroke + } bdef +/MP { + 3 1 roll moveto + 1 sub {rlineto} repeat + } bdef +/AP { + {rlineto} repeat + } bdef +/PP { + closepath eofill + } bdef +/DP { + closepath stroke + } bdef +/MR { + 4 -2 roll moveto + dup 0 exch rlineto + exch 0 rlineto + neg 0 exch rlineto + closepath + } bdef +/FR { + MR stroke + } bdef +/PR { + MR fill + } bdef +/L1i { + { currentfile picstr readhexstring pop } image + } bdef + +/tMatrix matrix def +/MakeOval { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 0 360 arc + tMatrix setmatrix + } bdef +/FO { + MakeOval + stroke + } bdef +/PO { + MakeOval + fill + } bdef + +/PD { + currentlinecap 1 setlinecap 3 1 roll 2 copy moveto lineto stroke setlinecap + } bdef + +/FA { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 5 -2 roll arc + tMatrix setmatrix + stroke + } bdef +/PA { + newpath + tMatrix currentmatrix pop + translate 0 0 moveto scale + 0 0 1 5 -2 roll arc + closepath + tMatrix setmatrix + fill + } bdef + +/FAn { + newpath + tMatrix currentmatrix pop + translate scale + 0 0 1 5 -2 roll arcn + tMatrix setmatrix + stroke + } bdef +/PAn { + newpath + tMatrix currentmatrix pop + translate 0 0 moveto scale + 0 0 1 5 -2 roll arcn + closepath + tMatrix setmatrix + fill + } bdef + +/MRR { + /vradius xdef + /hradius xdef + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + newpath + tMatrix currentmatrix pop + ulx hradius add uly vradius add translate + hradius vradius scale + 0 0 1 180 270 arc + tMatrix setmatrix + lrx hradius sub uly vradius add translate + hradius vradius scale + 0 0 1 270 360 arc + tMatrix setmatrix + lrx hradius sub lry vradius sub translate + hradius vradius scale + 0 0 1 0 90 arc + tMatrix setmatrix + ulx hradius add lry vradius sub translate + hradius vradius scale + 0 0 1 90 180 arc + tMatrix setmatrix + closepath + } bdef +/FRR { + MRR stroke } bdef +/PRR { + MRR fill } bdef + +/MlrRR { + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + /rad lry uly sub 2 div def + newpath + tMatrix currentmatrix pop + ulx rad add uly rad add translate + rad rad scale + 0 0 1 90 270 arc + tMatrix setmatrix + lrx rad sub lry rad sub translate + rad rad scale + 0 0 1 270 90 arc + tMatrix setmatrix + closepath + } bdef +/FlrRR { + MlrRR stroke } bdef +/PlrRR { + MlrRR fill } bdef + +/MtbRR { + /lry xdef + /lrx xdef + /uly xdef + /ulx xdef + /rad lrx ulx sub 2 div def + newpath + tMatrix currentmatrix pop + ulx rad add uly rad add translate + rad rad scale + 0 0 1 180 360 arc + tMatrix setmatrix + lrx rad sub lry rad sub translate + rad rad scale + 0 0 1 0 180 arc + tMatrix setmatrix + closepath + } bdef +/FtbRR { + MtbRR stroke } bdef +/PtbRR { + MtbRR fill } bdef + +currentdict end def + +MathWorks begin + +0 cap + +end + +MathWorks begin +bpage + +bplot + +/dpi2point 12 def +portraitMode 0216 7344 csm + + 641 134 5702 4679 MR c np +88 dict begin %Colortable dictionary +/c0 { 0 0 0 sr} bdef +/c1 { 1 1 1 sr} bdef +/c2 { 1 0 0 sr} bdef +/c3 { 0 1 0 sr} bdef +/c4 { 0 0 1 sr} bdef +/c5 { 1 1 0 sr} bdef +/c6 { 1 0 1 sr} bdef +/c7 { 0 1 1 sr} bdef +1 j +1 sg + 0 0 6918 5185 PR +6 w +0 1782 2261 0 0 -1782 899 2170 4 MP +PP +-2261 0 0 1782 2261 0 0 -1782 899 2170 5 MP stroke +4 w +DO +SO +6 w +0 sg + 899 2170 mt 3160 2170 L + 899 388 mt 3160 388 L + 899 2170 mt 899 388 L +3160 2170 mt 3160 388 L + 899 2170 mt 3160 2170 L + 899 2170 mt 899 388 L + 899 2170 mt 899 2147 L + 899 388 mt 899 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + + 866 2316 mt +(0) s +1584 2170 mt 1584 2147 L +1584 388 mt 1584 411 L +1518 2316 mt +(20) s +2269 2170 mt 2269 2147 L +2269 388 mt 2269 411 L +2203 2316 mt +(40) s +2954 2170 mt 2954 2147 L +2954 388 mt 2954 411 L +2888 2316 mt +(60) s + 899 2170 mt 922 2170 L +3160 2170 mt 3137 2170 L + 798 2214 mt +(0) s + 899 1814 mt 922 1814 L +3160 1814 mt 3137 1814 L + 698 1858 mt +(0.2) s + 899 1457 mt 922 1457 L +3160 1457 mt 3137 1457 L + 698 1501 mt +(0.4) s + 899 1101 mt 922 1101 L +3160 1101 mt 3137 1101 L + 698 1145 mt +(0.6) s + 899 744 mt 922 744 L +3160 744 mt 3137 744 L + 698 788 mt +(0.8) s + 899 388 mt 922 388 L +3160 388 mt 3137 388 L + 798 432 mt +(1) s + 899 2170 mt 3160 2170 L + 899 388 mt 3160 388 L + 899 2170 mt 899 388 L +3160 2170 mt 3160 388 L +gs 899 388 2262 1783 MR c np +34 0 35 0 34 0 34 0 34 0 35 1 34 0 34 0 +34 1 35 3 34 7 34 7 34 6 35 6 34 6 34 6 +34 6 35 6 34 7 34 6 34 6 35 7 34 6 34 14 +34 15 35 13 34 14 34 20 34 20 35 18 34 17 34 15 +34 14 35 14 34 13 34 12 35 14 34 31 34 31 34 29 +35 33 34 31 34 29 34 28 35 29 34 38 34 40 34 37 +35 46 34 43 34 40 34 40 35 40 34 43 34 51 34 49 +35 56 34 56 34 58 34 63 35 63 34 61 34 63 34 89 +35 91 34 174 899 388 67 MP stroke +DA +34 5 35 13 34 11 34 8 34 10 35 3 34 12 34 9 +34 7 35 5 34 5 34 5 34 9 35 7 34 13 34 16 +34 11 35 5 34 6 34 4 34 19 35 27 34 6 34 20 +34 11 35 28 34 19 34 5 34 6 35 16 34 5 34 25 +34 9 35 28 34 20 34 18 35 14 34 27 34 8 34 18 +35 17 34 17 34 29 34 23 35 58 34 64 34 91 34 16 +35 19 34 27 34 21 34 93 35 100 34 140 34 17 34 14 +35 16 34 14 34 16 34 19 35 38 34 26 34 25 34 30 +35 32 34 24 899 388 67 MP stroke +DO +34 12 35 18 34 4 34 116 34 109 35 137 34 4 34 4 +34 3 35 4 34 10 34 4 34 2 35 5 34 10 34 3 +34 10 35 3 34 31 34 8 34 8 35 122 34 124 34 169 +34 2 35 2 34 15 34 2 34 18 35 3 34 1 34 8 +34 12 35 12 34 12 34 22 35 3 34 19 34 7 34 4 +35 15 34 8 34 1 34 2 35 4 34 2 34 5 34 7 +35 21 34 2 34 16 34 11 35 16 34 20 34 3 34 39 +35 26 34 26 34 31 34 1 35 8 34 33 34 8 34 14 +35 11 34 24 899 388 67 MP stroke + +gr +DO +1283 293 mt +(Residual Norm vs. No. of Terms) s +SO +1 sg +0 1782 2261 0 0 -1782 3997 2170 4 MP +PP +-2261 0 0 1782 2261 0 0 -1782 3997 2170 5 MP stroke +4 w +DO +SO +6 w +0 sg +3997 2170 mt 6258 2170 L +3997 388 mt 6258 388 L +3997 2170 mt 3997 388 L +6258 2170 mt 6258 388 L +3997 2170 mt 6258 2170 L +3997 2170 mt 3997 388 L +4323 2170 mt 4323 2147 L +4323 388 mt 4323 411 L +4235 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +4368 2279 mt +(2) s +5082 2170 mt 5082 2147 L +5082 388 mt 5082 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +4994 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +5127 2279 mt +(3) s +5841 2170 mt 5841 2147 L +5841 388 mt 5841 411 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +5753 2353 mt +(10) s +/Helvetica /ISOLatin1Encoding 80 FMSR + +5886 2279 mt +(4) s +3997 2170 mt 4020 2170 L +6258 2170 mt 6235 2170 L +/Helvetica /ISOLatin1Encoding 120 FMSR + +3896 2214 mt +(0) s +3997 1814 mt 4020 1814 L +6258 1814 mt 6235 1814 L +3796 1858 mt +(0.2) s +3997 1457 mt 4020 1457 L +6258 1457 mt 6235 1457 L +3796 1501 mt +(0.4) s +3997 1101 mt 4020 1101 L +6258 1101 mt 6235 1101 L +3796 1145 mt +(0.6) s +3997 744 mt 4020 744 L +6258 744 mt 6235 744 L +3796 788 mt +(0.8) s +3997 388 mt 4020 388 L +6258 388 mt 6235 388 L +3896 432 mt +(1) s +3997 2170 mt 6258 2170 L +3997 388 mt 6258 388 L +3997 2170 mt 3997 388 L +6258 2170 mt 6258 388 L +gs 3997 388 2262 1783 MR c np +5 0 5 0 5 0 6 0 5 0 5 1 6 0 6 0 +5 1 6 3 6 7 6 7 6 6 7 6 6 6 7 6 +6 6 7 6 7 7 7 6 7 6 8 7 7 6 8 14 +8 15 8 13 8 14 9 20 9 20 9 18 9 17 10 15 +10 14 10 14 10 13 11 12 11 14 12 31 12 31 12 29 +13 33 14 31 14 29 14 28 16 29 16 38 17 40 17 37 +19 46 20 43 22 40 22 40 25 40 26 43 29 51 31 49 +35 56 39 56 44 58 51 63 60 63 73 61 95 63 134 89 +229 91 4876 562 66 MP stroke +DA +5 5 5 13 6 11 5 8 5 10 6 3 5 12 6 9 +6 7 6 5 5 5 7 5 6 9 6 7 6 13 7 16 +7 11 6 5 7 6 7 4 8 19 7 27 8 6 7 20 +8 11 8 28 9 19 8 5 9 6 9 16 10 5 9 25 +10 9 10 28 11 20 10 18 12 14 11 27 12 8 13 18 +12 17 14 17 14 29 15 23 15 58 16 64 17 91 18 16 +19 19 20 27 21 21 23 93 24 100 27 140 28 17 32 14 +34 16 39 14 44 16 51 19 60 38 74 26 95 25 133 30 +229 32 3997 412 66 MP stroke +DO +5 12 5 18 6 4 5 116 5 109 6 137 5 4 6 4 +6 3 6 4 5 10 7 4 6 2 6 5 6 10 7 3 +7 10 6 3 7 31 7 8 8 8 7 122 8 124 7 169 +8 2 8 2 9 15 8 2 9 18 9 3 10 1 9 8 +10 12 10 12 11 12 10 22 12 3 11 19 12 7 13 4 +12 15 14 8 14 1 15 2 15 4 16 2 17 5 18 7 +19 21 20 2 21 16 23 11 24 16 27 20 28 3 32 39 +34 26 39 26 44 31 51 1 60 8 74 33 95 8 133 14 +229 11 3997 412 66 MP stroke + +gr +DO +4387 293 mt +(Residual Norms vs. Storage) s +SO +1 sg +0 1782 5394 0 0 -1782 899 4612 4 MP +PP +-5394 0 0 1782 5394 0 0 -1782 899 4612 5 MP stroke +4 w +DO +SO +6 w +0 sg + 899 4612 mt 6293 4612 L + 899 2830 mt 6293 2830 L + 899 4612 mt 899 2830 L +6293 4612 mt 6293 2830 L + 899 4612 mt 6293 4612 L + 899 4612 mt 899 2830 L + 899 4612 mt 899 4558 L + 899 2830 mt 899 2884 L + 866 4758 mt +(0) s +1704 4612 mt 1704 4558 L +1704 2830 mt 1704 2884 L +1638 4758 mt +(10) s +2509 4612 mt 2509 4558 L +2509 2830 mt 2509 2884 L +2443 4758 mt +(20) s +3314 4612 mt 3314 4558 L +3314 2830 mt 3314 2884 L +3248 4758 mt +(30) s +4119 4612 mt 4119 4558 L +4119 2830 mt 4119 2884 L +4053 4758 mt +(40) s +4924 4612 mt 4924 4558 L +4924 2830 mt 4924 2884 L +4858 4758 mt +(50) s +5729 4612 mt 5729 4558 L +5729 2830 mt 5729 2884 L +5663 4758 mt +(60) s + 899 4612 mt 953 4612 L +6293 4612 mt 6239 4612 L + 798 4656 mt +(0) s + 899 4167 mt 953 4167 L +6293 4167 mt 6239 4167 L + 798 4211 mt +(1) s + 899 3721 mt 953 3721 L +6293 3721 mt 6239 3721 L + 798 3765 mt +(2) s + 899 3276 mt 953 3276 L +6293 3276 mt 6239 3276 L + 798 3320 mt +(3) s + 899 2830 mt 953 2830 L +6293 2830 mt 6239 2830 L + 798 2874 mt +(4) s + 899 4612 mt 6293 4612 L + 899 2830 mt 6293 2830 L + 899 4612 mt 899 2830 L +6293 4612 mt 6293 2830 L +gs 899 2830 5395 1783 MR c np + +gr + 955 3233 mt 1005 3283 L +1005 3233 mt 955 3283 L +1035 3457 mt 1085 3507 L +1085 3457 mt 1035 3507 L +1116 3478 mt 1166 3528 L +1166 3478 mt 1116 3528 L +1196 3587 mt 1246 3637 L +1246 3587 mt 1196 3637 L +1277 3604 mt 1327 3654 L +1327 3604 mt 1277 3654 L +1357 3609 mt 1407 3659 L +1407 3609 mt 1357 3659 L +1438 3622 mt 1488 3672 L +1488 3622 mt 1438 3672 L +1518 3654 mt 1568 3704 L +1568 3654 mt 1518 3704 L +1599 3672 mt 1649 3722 L +1649 3672 mt 1599 3722 L +1679 3684 mt 1729 3734 L +1729 3684 mt 1679 3734 L +1760 3726 mt 1810 3776 L +1810 3726 mt 1760 3776 L +1840 3726 mt 1890 3776 L +1890 3726 mt 1840 3776 L +1921 3774 mt 1971 3824 L +1971 3774 mt 1921 3824 L +2001 3803 mt 2051 3853 L +2051 3803 mt 2001 3853 L +2082 3808 mt 2132 3858 L +2132 3808 mt 2082 3858 L +2162 3815 mt 2212 3865 L +2212 3815 mt 2162 3865 L +2243 3815 mt 2293 3865 L +2293 3815 mt 2243 3865 L +2323 3815 mt 2373 3865 L +2373 3815 mt 2323 3865 L +2404 3865 mt 2454 3915 L +2454 3865 mt 2404 3915 L +2484 3866 mt 2534 3916 L +2534 3866 mt 2484 3916 L +2565 3881 mt 2615 3931 L +2615 3881 mt 2565 3931 L +2645 3944 mt 2695 3994 L +2695 3944 mt 2645 3994 L +2726 3956 mt 2776 4006 L +2776 3956 mt 2726 4006 L +2806 3957 mt 2856 4007 L +2856 3957 mt 2806 4007 L +2887 3957 mt 2937 4007 L +2937 3957 mt 2887 4007 L +2967 3964 mt 3017 4014 L +3017 3964 mt 2967 4014 L +3048 3991 mt 3098 4041 L +3098 3991 mt 3048 4041 L +3128 3993 mt 3178 4043 L +3178 3993 mt 3128 4043 L +3209 4010 mt 3259 4060 L +3259 4010 mt 3209 4060 L +3289 4125 mt 3339 4175 L +3339 4125 mt 3289 4175 L +3370 4141 mt 3420 4191 L +3420 4141 mt 3370 4191 L +3450 4141 mt 3500 4191 L +3500 4141 mt 3450 4191 L +3531 4141 mt 3581 4191 L +3581 4141 mt 3531 4191 L +3611 4141 mt 3661 4191 L +3661 4141 mt 3611 4191 L +3692 4141 mt 3742 4191 L +3742 4141 mt 3692 4191 L +3772 4141 mt 3822 4191 L +3822 4141 mt 3772 4191 L +3853 4141 mt 3903 4191 L +3903 4141 mt 3853 4191 L +3933 4142 mt 3983 4192 L +3983 4142 mt 3933 4192 L +4014 4153 mt 4064 4203 L +4064 4153 mt 4014 4203 L +4094 4201 mt 4144 4251 L +4144 4201 mt 4094 4251 L +4175 4220 mt 4225 4270 L +4225 4220 mt 4175 4270 L +4255 4222 mt 4305 4272 L +4305 4222 mt 4255 4272 L +4336 4234 mt 4386 4284 L +4386 4234 mt 4336 4284 L +4416 4305 mt 4466 4355 L +4466 4305 mt 4416 4355 L +4497 4312 mt 4547 4362 L +4547 4312 mt 4497 4362 L +4577 4325 mt 4627 4375 L +4627 4325 mt 4577 4375 L +4658 4325 mt 4708 4375 L +4708 4325 mt 4658 4375 L +4738 4329 mt 4788 4379 L +4788 4329 mt 4738 4379 L +4819 4337 mt 4869 4387 L +4869 4337 mt 4819 4387 L +4899 4356 mt 4949 4406 L +4949 4356 mt 4899 4406 L +4980 4357 mt 5030 4407 L +5030 4357 mt 4980 4407 L +5060 4362 mt 5110 4412 L +5110 4362 mt 5060 4412 L +5141 4376 mt 5191 4426 L +5191 4376 mt 5141 4426 L +5221 4392 mt 5271 4442 L +5271 4392 mt 5221 4442 L +5302 4399 mt 5352 4449 L +5352 4399 mt 5302 4449 L +5382 4430 mt 5432 4480 L +5432 4430 mt 5382 4480 L +5463 4482 mt 5513 4532 L +5513 4482 mt 5463 4532 L +5543 4521 mt 5593 4571 L +5593 4521 mt 5543 4571 L +5624 4531 mt 5674 4581 L +5674 4531 mt 5624 4581 L +5704 4554 mt 5754 4604 L +5754 4554 mt 5704 4604 L +5785 4557 mt 5835 4607 L +5835 4557 mt 5785 4607 L +5865 4560 mt 5915 4610 L +5915 4560 mt 5865 4610 L +5946 4563 mt 5996 4613 L +5996 4563 mt 5946 4613 L +6026 4574 mt 6076 4624 L +6076 4574 mt 6026 4624 L +6107 4578 mt 6157 4628 L +6157 4578 mt 6107 4628 L +6187 4581 mt 6237 4631 L +6237 4581 mt 6187 4631 L +gs 899 2830 5395 1783 MR c np + +gr + 36 36 980 3779 FO + 36 36 1060 3721 FO + 36 36 1141 3733 FO + 36 36 1221 3779 FO + 36 36 1302 3779 FO + 36 36 1382 3694 FO + 36 36 1463 3840 FO + 36 36 1543 3882 FO + 36 36 1624 3908 FO + 36 36 1704 3878 FO + 36 36 1785 3908 FO + 36 36 1865 3878 FO + 36 36 1946 3378 FO + 36 36 2026 3506 FO + 36 36 2107 3544 FO + 36 36 2187 3884 FO + 36 36 2268 3840 FO + 36 36 2348 3908 FO + 36 36 2429 3941 FO + 36 36 2509 3591 FO + 36 36 2590 3694 FO + 36 36 2670 3728 FO + 36 36 2751 3922 FO + 36 36 2831 3884 FO + 36 36 2912 3982 FO + 36 36 2992 3982 FO + 36 36 3073 3981 FO + 36 36 3153 4090 FO + 36 36 3234 3921 FO + 36 36 3314 4023 FO + 36 36 3395 3992 FO + 36 36 3475 3979 FO + 36 36 3556 3931 FO + 36 36 3636 4097 FO + 36 36 3717 3959 FO + 36 36 3797 4167 FO + 36 36 3878 4037 FO + 36 36 3958 4167 FO + 36 36 4039 4166 FO + 36 36 4119 4022 FO + 36 36 4200 3960 FO + 36 36 4280 4100 FO + 36 36 4361 4023 FO + 36 36 4441 4167 FO + 36 36 4522 3987 FO + 36 36 4602 4043 FO + 36 36 4683 4226 FO + 36 36 4763 4205 FO + 36 36 4844 4205 FO + 36 36 4924 4127 FO + 36 36 5005 4078 FO + 36 36 5085 4115 FO + 36 36 5166 4183 FO + 36 36 5246 4166 FO + 36 36 5327 4224 FO + 36 36 5407 4224 FO + 36 36 5488 4226 FO + 36 36 5568 4192 FO + 36 36 5649 4183 FO + 36 36 5729 4135 FO + 36 36 5810 4278 FO + 36 36 5890 4166 FO + 36 36 5971 4199 FO + 36 36 6051 4164 FO + 36 36 6132 4143 FO + 36 36 6212 4247 FO +gs 899 2830 5395 1783 MR c np + +gr +0 j +-41 71 -41 -71 82 0 939 3803 4 MP +DP +-41 71 -41 -71 82 0 1019 3946 4 MP +DP +-41 71 -41 -71 82 0 1100 3908 4 MP +DP +-41 71 -41 -71 82 0 1180 4006 4 MP +DP +-41 71 -41 -71 82 0 1261 3745 4 MP +DP +-41 71 -41 -71 82 0 1341 4005 4 MP +DP +-41 71 -41 -71 82 0 1422 4271 4 MP +DP +-41 71 -41 -71 82 0 1502 3757 4 MP +DP +-41 71 -41 -71 82 0 1583 3803 4 MP +DP +-41 71 -41 -71 82 0 1663 3803 4 MP +DP +-41 71 -41 -71 82 0 1744 3718 4 MP +DP +-41 71 -41 -71 82 0 1824 4190 4 MP +DP +-41 71 -41 -71 82 0 1905 3864 4 MP +DP +-41 71 -41 -71 82 0 1985 3909 4 MP +DP +-41 71 -41 -71 82 0 2066 3968 4 MP +DP +-41 71 -41 -71 82 0 2146 3915 4 MP +DP +-41 71 -41 -71 82 0 2227 4216 4 MP +DP +-41 71 -41 -71 82 0 2307 3864 4 MP +DP +-41 71 -41 -71 82 0 2388 4035 4 MP +DP +-41 71 -41 -71 82 0 2468 4104 4 MP +DP +-41 71 -41 -71 82 0 2549 4231 4 MP +DP +-41 71 -41 -71 82 0 2629 4131 4 MP +DP +-41 71 -41 -71 82 0 2710 4190 4 MP +DP +-41 71 -41 -71 82 0 2790 4249 4 MP +DP +-41 71 -41 -71 82 0 2871 4046 4 MP +DP +-41 71 -41 -71 82 0 2951 3934 4 MP +DP +-41 71 -41 -71 82 0 3032 4124 4 MP +DP +-41 71 -41 -71 82 0 3112 4044 4 MP +DP +-41 71 -41 -71 82 0 3193 3896 4 MP +DP +-41 71 -41 -71 82 0 3273 4191 4 MP +DP +-41 71 -41 -71 82 0 3354 3864 4 MP +DP +-41 71 -41 -71 82 0 3434 3982 4 MP +DP +-41 71 -41 -71 82 0 3515 3975 4 MP +DP +-41 71 -41 -71 82 0 3595 3982 4 MP +DP +-41 71 -41 -71 82 0 3676 4041 4 MP +DP +-41 71 -41 -71 82 0 3756 4285 4 MP +DP +-41 71 -41 -71 82 0 3837 4190 4 MP +DP +-41 71 -41 -71 82 0 3917 3908 4 MP +DP +-41 71 -41 -71 82 0 3998 4261 4 MP +DP +-41 71 -41 -71 82 0 4078 3950 4 MP +DP +-41 71 -41 -71 82 0 4159 4189 4 MP +DP +-41 71 -41 -71 82 0 4239 4227 4 MP +DP +-41 71 -41 -71 82 0 4320 3402 4 MP +DP +-41 71 -41 -71 82 0 4400 3530 4 MP +DP +-41 71 -41 -71 82 0 4481 3568 4 MP +DP +-41 71 -41 -71 82 0 4561 4114 4 MP +DP +-41 71 -41 -71 82 0 4642 4102 4 MP +DP +-41 71 -41 -71 82 0 4722 3897 4 MP +DP +-41 71 -41 -71 82 0 4803 4240 4 MP +DP +-41 71 -41 -71 82 0 4883 4076 4 MP +DP +-41 71 -41 -71 82 0 4964 4240 4 MP +DP +-41 71 -41 -71 82 0 5044 4095 4 MP +DP +-41 71 -41 -71 82 0 5125 4168 4 MP +DP +-41 71 -41 -71 82 0 5205 4271 4 MP +DP +-41 71 -41 -71 82 0 5286 4190 4 MP +DP +-41 71 -41 -71 82 0 5366 4096 4 MP +DP +-41 71 -41 -71 82 0 5447 4190 4 MP +DP +-41 71 -41 -71 82 0 5527 4225 4 MP +DP +-41 71 -41 -71 82 0 5608 4216 4 MP +DP +-41 71 -41 -71 82 0 5688 4210 4 MP +DP +-41 71 -41 -71 82 0 5769 3615 4 MP +DP +-41 71 -41 -71 82 0 5849 3718 4 MP +DP +-41 71 -41 -71 82 0 5930 3752 4 MP +DP +-41 71 -41 -71 82 0 6010 4286 4 MP +DP +-41 71 -41 -71 82 0 6091 4102 4 MP +DP +-41 71 -41 -71 82 0 6171 4157 4 MP +DP +gs 899 2830 5395 1783 MR c np + +gr +2953 2735 mt +(Singular vs. SDD values) s + +end + +eplot + +epage +end + +showpage + +%%EndDocument + @endspecial 225 2058 a Fz(Fig.)13 b(10.)35 b(Comparison)11 +b(of)i(the)g(SVD)h(\(solid)e(line,)h Fw(x)h Fz(marks\),)e(SDD-THR)i +(\(dashed)e(line,)h Fw(o)g Fz(marks\),)g(and)225 2099 +y(SDD-CYC)f(\(dotted)e(line,)g(triangle)g(marks\))g(on)h +Fw(watson2)p Fz(.)p eop +%%Trailer +end +userdict /end-hook known{end-hook}if +%%EOF + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/gpl.txt b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/gpl.txt new file mode 100644 index 0000000000000000000000000000000000000000..60549be514af76c5db0c17ce6bbe01b2f81e2d9e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/gpl.txt @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/include/qsortopt.h b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/include/qsortopt.h new file mode 100644 index 0000000000000000000000000000000000000000..9e85268e0363e0578c3b19ed689163470775f0ff --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/include/qsortopt.h @@ -0,0 +1,274 @@ +/*---------------------------------------------------------------------- + + SDDPACK: Software for the Semidiscrete Decomposition. + Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + This next piece of code is a customized version of the GNU qsort for + the data type we are sorting here. It will be used if the -DQSORTOPT + flag is used in compliation. It should generally make the code + faster, but may be incompatible with some machine types. To + determine if this qsort will work for you, first compile without the + flag, time and test the code. Then try the same thing again with the + flag on. If you do not get the same answers or the code is slower, + than you should not use this option. + + ----------------------------------------------------------------------*/ + +#ifdef QSORTOPT +#include <alloca.h> /* used by our optimized qsort */ + +/* Slightly Modified so the compare operation is in-lined. -T. Kolda */ + +/* Plug-compatible replacement for UNIX qsort. + Copyright (C) 1989 Free Software Foundation, Inc. + Written by Douglas C. Schmidt (schmidt@ics.uci.edu) + +This file is part of GNU CC. + +GNU QSORT is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU QSORT is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU QSORT; see the file COPYING. If not, write to +the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifdef sparc +#include <alloca.h> +#endif + +/* Invoke the comparison function, returns either 0, < 0, or > 0. */ +#define CMP(A,B) (((sdddouble_plus*)(B))->val - ((sdddouble_plus*)(A))->val) +#define size (sizeof(sdddouble_plus)) + +/* Byte-wise swap two items of size SIZE. */ +#define SWAP(A,B,SIZE) do {int sz = (SIZE); char *a = (A); char *b = (B); \ + do { char _temp = *a;*a++ = *b;*b++ = _temp;} while (--sz);} while (0) + +/* Copy SIZE bytes from item B to item A. */ +#define COPY(A,B,SIZE) {int sz = (SIZE); do { *(A)++ = *(B)++; } while (--sz); } + +/* This should be replaced by a standard ANSI macro. */ +#ifndef BYTES_PER_WORD +#define BYTES_PER_WORD (sizeof(ulong)) +#endif + +/* The next 4 #defines implement a very fast in-line stack abstraction. */ +#define STACK_SIZE (BYTES_PER_WORD * sizeof (long)) +#define PUSH(LOW,HIGH) do {top->lo = LOW;top++->hi = HIGH;} while (0) +#define POP(LOW,HIGH) do {LOW = (--top)->lo;HIGH = top->hi;} while (0) +#define STACK_NOT_EMPTY (stack < top) + +/* Discontinue quicksort algorithm when partition gets below this size. + This particular magic number was chosen to work best on a Sun 4/260. */ +#define MAX_THRESH 4 + +/* Stack node declarations used to store unfulfilled partition obligations. */ +typedef struct +{ + char *lo; + char *hi; +} stack_node; + +/* Order size using quicksort. This implementation incorporates + four optimizations discussed in Sedgewick: + + 1. Non-recursive, using an explicit stack of pointer that store the + next array partition to sort. To save time, this maximum amount + of space required to store an array of MAX_INT is allocated on the + stack. Assuming a 32-bit integer, this needs only 32 * + sizeof (stack_node) == 136 bits. Pretty cheap, actually. + + 2. Chose the pivot element using a median-of-three decision tree. + This reduces the probability of selecting a bad pivot value and + eliminates certain extraneous comparisons. + + 3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving + insertion sort to order the MAX_THRESH items within each partition. + This is a big win, since insertion sort is faster for small, mostly + sorted array segments. + + 4. The larger of the two sub-partitions is always pushed onto the + stack first, with the algorithm then concentrating on the + smaller partition. This *guarantees* no more than log (n) + stack size is needed (actually O(1) in this case)! */ + +int qsortopt (char *base_ptr, int total_elems) +{ + /* Allocating SIZE bytes for a pivot buffer facilitates a better + algorithm below since we can do comparisons directly on the pivot. */ + char *pivot_buffer = (char *) alloca (size); + int max_thresh = MAX_THRESH * size; + + if (total_elems > MAX_THRESH) + { + char *lo = base_ptr; + char *hi = lo + size * (total_elems - 1); + stack_node stack[STACK_SIZE]; /* Largest size needed for 32-bit int!!! */ + stack_node *top = stack + 1; + + while (STACK_NOT_EMPTY) + { + char *left_ptr; + char *right_ptr; + { + char *pivot = pivot_buffer; + { + /* Select median value from among LO, MID, and HI. Rearrange + LO and HI so the three values are sorted. This lowers the + probability of picking a pathological pivot value and + skips a comparison for both the LEFT_PTR and RIGHT_PTR. */ + + char *mid = lo + size * ((hi - lo) / size >> 1); + + if (CMP (mid, lo) < 0) + SWAP (mid, lo, size); + if (CMP (hi, mid) < 0) + SWAP (mid, hi, size); + else + goto jump_over; + if (CMP (mid, lo) < 0) + SWAP (mid, lo, size); + jump_over: + COPY (pivot, mid, size); + pivot = pivot_buffer; + } + left_ptr = lo + size; + right_ptr = hi - size; + + /* Here's the famous ``collapse the walls'' section of quicksort. + Gotta like those tight inner loops! They are the main reason + that this algorithm runs much faster than others. */ + do + { + while (CMP (left_ptr, pivot) < 0) + left_ptr += size; + + while (CMP (pivot, right_ptr) < 0) + right_ptr -= size; + + if (left_ptr < right_ptr) + { + SWAP (left_ptr, right_ptr, size); + left_ptr += size; + right_ptr -= size; + } + else if (left_ptr == right_ptr) + { + left_ptr += size; + right_ptr -= size; + break; + } + } + while (left_ptr <= right_ptr); + + } + + /* Set up pointers for next iteration. First determine whether + left and right partitions are below the threshold size. If so, + ignore one or both. Otherwise, push the larger partition's + bounds on the stack and continue sorting the smaller one. */ + + if ((right_ptr - lo) <= max_thresh) + { + if ((hi - left_ptr) <= max_thresh) /* Ignore both small + partitions. */ + POP (lo, hi); + else /* Ignore small left partition. */ + lo = left_ptr; + } + else if ((hi - left_ptr) <= max_thresh) /* Ignore small + right partition. */ + hi = right_ptr; + else if ((right_ptr - lo) > (hi - left_ptr)) /* Push larger + left + partition + indices. */ + { + PUSH (lo, right_ptr); + lo = left_ptr; + } + else /* Push larger right partition indices. */ + { + PUSH (left_ptr, hi); + hi = right_ptr; + } + } + } + + /* Once the BASE_PTR array is partially sorted by quicksort the rest + is completely sorted using insertion sort, since this is efficient + for partitions below MAX_THRESH size. BASE_PTR points to the beginning + of the array to sort, and END_PTR points at the very last element in + the array (*not* one beyond it!). */ + +#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) + + { + char *end_ptr = base_ptr + size * (total_elems - 1); + char *run_ptr; + char *tmp_ptr = base_ptr; + char *thresh = MIN (end_ptr, base_ptr + max_thresh); + + /* Find smallest element in first threshold and place it at the + array's beginning. This is the smallest array element, + and the operation speeds up insertion sort's inner loop. */ + + for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) + if (CMP (run_ptr, tmp_ptr) < 0) + tmp_ptr = run_ptr; + + if (tmp_ptr != base_ptr) + SWAP (tmp_ptr, base_ptr, size); + + /* Insertion sort, running from left-hand-side up to `right-hand-side.' + Pretty much straight out of the original GNU qsort routine. */ + + for (run_ptr = base_ptr + size; (tmp_ptr = run_ptr += size) <= end_ptr; ) + { + + while (CMP (run_ptr, tmp_ptr -= size) < 0) + ; + + if ((tmp_ptr += size) != run_ptr) + { + char *trav; + + for (trav = run_ptr + size; --trav >= run_ptr;) + { + char c = *trav; + char *hi, *lo; + + for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) + *hi = *lo; + *hi = c; + } + } + + } + } + return 1; +} + +#endif diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/include/sdd.h b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/include/sdd.h new file mode 100644 index 0000000000000000000000000000000000000000..c05dd66cbb6f19c62151b3c61f769f718dad6f9d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/include/sdd.h @@ -0,0 +1,163 @@ +/*---------------------------------------------------------------------- + + SDDPACK: Software for the Semidiscrete Decomposition. + Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + MODULE: sdd.o + + DESCRIPTION: Header file for sdd.c, routines for creating and + updating the SDD decomposition and sparse matrices. + + MODULE DEPENDENCIES: sdd.c sdd.h + + BUG REPORTS: Email Tamara.Kolda@na-net.ornl.gov. + + ----------------------------------------------------------------------*/ + +#ifndef _SDD_H +#define _SDD_H + +/*---------------------------------------------------------------------- + Includes + ----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <math.h> +#include <string.h> + +/*---------------------------------------------------------------------- + Definitions + ----------------------------------------------------------------------*/ + +#define MAXLINE 1000 /* Max length of comment line in data file. */ + +/* WARNING: The IDXSHIFT definition only works on 32 or 64 bit + architectures. If you have a different architecture (e.g., 128 + bit), you should replace the next line with the appropriate value + (e.g., #define IDXSHIFT 7). */ + +#ifndef IDXSHIFT +#define IDXSHIFT ((sizeof(ulong) == 4) ? 5 : 6) /* log2(bits_per_word) */ +#endif + +#define IDXMASK ((sizeof(ulong) * 8) - 1) /* bits_per_word - 1 */ + +#define ONE ((ulong)(1)) /* one */ + +#define MAXMASK (ONE << IDXMASK) /* one in leftmost position */ + +/*---------------------------------------------------------------------- + Type Definitions + ----------------------------------------------------------------------*/ + +/* Stores a sparse m x n matrix in compressed sparse column format. + jc is an (n+1)-long array. jc[j] gives the starting index in val + and ir for the j-th column, and jc[j+1] gives the ending index + + 1. */ +typedef struct matrix_struct { + int m; /* number of rows */ + int n; /* number of columns */ + int nnz; /* number of nonzero entries */ + int *jc; /* array of length (n+1), col starts */ + int *ir; /* array of length nnz, row indices */ + float *val; /* array of length nnz, values */ +} matrix; + +/* Used for packed bit vectors */ +typedef unsigned long ulong; + +/* The type sddfloat is used as the final precision that the diagonal + values of the matrix D are stored in. The type sdddouble is used for + all calculations. Experience has shown us that float is sufficient + for our calculations and requires less computation time. */ +typedef float sddfloat; /* used for low-precision reals */ +typedef float sdddouble; /* used for high-precision reals */ + +/* The following structure is used for sorting. The function qsortopt + in sdd.c is specially modified for this datatype and is used if + QSORTOPT is defined. */ +typedef struct sdddouble_plus_struct { + sdddouble val; + int idx; +} sdddouble_plus; + +/* An s-vector is used to store an m-long array of s-values. Each + s-value is represented by a val bit and a sgn bit. + 0: val = 0, sgn = undefined + 1: val = 1, sgn = 0 + -1: val = 1, val = 1 + These bits are packed into ulong's to form the val and sgn + arrays. */ +typedef struct svector_struct { + int m; /* number of entries stored */ + ulong *val; /* zero (0) or non-zero (1) */ + ulong *sgn; /* plus (0) or minus (1) */ +} svector; + +/* An s-matrix is used to store up to an m by kmax matrix of s-values. + The dimension of the stored matrix is m by k. The col array stores + kmax pointers to s-vectors which are the columns of the matrix. + Specifically, col[i] is a pointer to the (i+1)st column of the + matrix (0 <= i < k). */ +typedef struct smatrix_struct { + int k, kmax; + int m; + svector **col; +} smatrix; + +/* A dmatrix is used to store the diagonal entries of up to a kmax by + kmax diagonal matrix. The dimension of the stored matrix is given + by k. d is an array of length kmax such that d[i] is the (i+1)st + diagonal value (0 <= i < k). */ +typedef struct dmatrix_struct { + int k, kmax; + sddfloat *d; +} dmatrix; + +/* An sdd stores a semi-discrete decomposition (SDD) to an m by n + matrix up to kmax terms. The current number of terms is given by + k. X and Y are pointers to the left and right smatrices + respectively, and D is a pointer to the diagonal matrix. */ +typedef struct sdd_struct { + int m, n, k, kmax; + smatrix *X, *Y; + dmatrix *D; +} sdd; + +/*---------------------------------------------------------------------- + Function Declarations + ----------------------------------------------------------------------*/ + +void free_sdd(sdd*); +sdd* read_sdd(char*, int); +void write_sdd(sdd*, char*, int, char*); + +void free_matrix(matrix*); +matrix* read_matrix(char*, int); +void write_matrix(matrix*, char*, int); + +sdd* compute_sdd (matrix*, sdd*, int, int, float, int, float, int); +sdd* update_sdd(matrix*, sdd*, int, int); + +#endif + + + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/mtxread.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/mtxread.m new file mode 100644 index 0000000000000000000000000000000000000000..8d16ace7ed79a2082cc324fe33afdaa2bb7d9572 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/mtxread.m @@ -0,0 +1,50 @@ +function [A, m, n] = mtxread(infile); + +%MTXREAD Read matrix A from a file in matrix market format. +% +% A = mtxread(FILENAME) reads a MatrixMarket formatted matrix from the +% file FILENAME. +% +%SDDPACK: Software for the Semidiscrete Decomposition. +%Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + +% This program is free software; you can redistribute it and/or modify it +% under the terms of the GNU General Public License as published by the Free +% Software Foundation; either version 2 of the License, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +% for more details. +% +% You should have received a copy of the GNU General Public License along +% with this program; if not, write to the Free Software Foundation, Inc., 59 +% Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +fid = fopen(infile, 'rt'); + +if (fid == -1) + error('Error opening file.'); +end + +line = fgets(fid); +while line(1) == '%' + line = fgets(fid); +end + +[data, cnt] = sscanf(line,'%d'); +m = data(1); +n = data(2); +nnzs = data(3); + +[data, cnt] = fscanf(fid, '%d %d %e', [3, inf]); + +I = data(1,:); +J = data(2,:); +S = data(3,:); +A = sparse(I, J, S, m, n); + +fclose(fid); + +return; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/mtxwrite.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/mtxwrite.m new file mode 100644 index 0000000000000000000000000000000000000000..eea081b82cb3d0f46117001b26582d4702ca1cf8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/mtxwrite.m @@ -0,0 +1,45 @@ +function mtxwrite(filename, A) + +%MTXWRITE Write a matrix in MatrixMarket format. +% +% MTXWRITE(FILENAME, A) writes the matrix A to the file FILENAME in +% MatrixMarket format. +% +%SDDPACK: Software for the Semidiscrete Decomposition. +%Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + +% This program is free software; you can redistribute it and/or modify it +% under the terms of the GNU General Public License as published by the Free +% Software Foundation; either version 2 of the License, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +% for more details. +% +% You should have received a copy of the GNU General Public License along +% with this program; if not, write to the Free Software Foundation, Inc., 59 +% Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +[m, n] = size(A); +nnza = nnz(A); + +fid = fopen(filename, 'wt'); + +fprintf(fid, '%%%% MatrixMarket matrix coordinate real general\n'); +fprintf(fid, '%% File generated by mtxwrite from SDDPACK.\n'); +fprintf(fid, '%d %d %d\n', m, n, nnz(A)); + +[I, J, V] = find(A); + +for k = 1 : nnza + fprintf(fid, '%4d %4d %15.6e\n', I(k), J(k), V(k)); +end + +fclose(fid); + +return + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sdd.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sdd.m new file mode 100644 index 0000000000000000000000000000000000000000..d9effcb3570c4e61294138c8bed7d1c414cdd2d7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sdd.m @@ -0,0 +1,240 @@ +function [dsav, xsav, ysav, itssav, rhosav, iitssav] = ... + sdd(A, kmax, alphamin, lmax, rhomin, yinit) + +%SDD Semidiscrete Decomposition. +% +% [D, X, Y] = SDD(A) produces discrete matrices X and Y and a vector D +% such that X * diag(D) * Y' is the 100-term SDD that approximates A. +% +% [D, X, Y, ITS] = SDD(...) also returns the number of inner iterations +% for each outer iteration. +% +% [D, X, Y, ITS, RHO] = SDD(...) also returns a vector RHO containing the +% norm-squared of the residual after each outer iteration. +% +% [D, X, Y, ITS, RHO, IITS] = SDD(...) also returns a vector IITS +% containing the number of extra matrix-vector multiplies used in the +% initialization of each inner iteration when using C=1 (see below). +% +% [...] = SDD(A, K) produces a K-term SDD. The default is 100. +% +% [...] = SDD(A, K, TOL) stops the inner iterations after the +% improvement is less than TOL. The default is 0.01. +% +% [...] = SDD(A, K, TOL, L) specifies that the maximum number of inner +% iterations is L. The default is 100. +% +% [...] = SDD(A, K, TOL, L, R) produces an SDD approximation that +% either has K terms or such that norm(A - X * diag(D) * Y', 'fro') < R. +% The default is zero. +% +% [...] = SDD(A, K, TOL, L, R, C) sets the choice for initializing y in +% the inner iterations as follows: +% +% C = 1 Threshold +% C = 2 Cycling +% C = 3, All elements of y are set to 1. +% C = 4, Every 100th element of y is set to 1 starting with 1. +% +% Default is C = 1. +% +% +%SDDPACK: Software for the Semidiscrete Decomposition. +%Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + +% This program is free software; you can redistribute it and/or modify it +% under the terms of the GNU General Public License as published by the Free +% Software Foundation; either version 2 of the License, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +% for more details. +% +% You should have received a copy of the GNU General Public License along +% with this program; if not, write to the Free Software Foundation, Inc., 59 +% Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +%%% Check Input Arguments + +if ~exist('A') + error('Incorrent number of inputs.'); +end + +if ~exist('kmax') + kmax = 100; +end + +if ~exist('alphamin') + alphamin = 0.01; +end + +if ~exist('lmax') + lmax = 100; +end + +if ~exist('rhomin') + rhomin = 0; +else + rhomin = rhomin^2; +end + +if ~exist('yinit') + yinit = 1; +end +idx = 1; % only used for yinit = 1 + +%%% Initialization + +[m, n] = size(A); % size of A +rho = norm(A, 'fro')^2; % squared residual norm +iitssav = []; + +%%% Outer Loop + +for k = 1 : kmax + + %%% Initialize y for Inner Loop + + switch yinit, + case 1, % Threshold + s = zeros(m, 1); + iits = 0; + while (norm(s)^2) < (rho / n) + y = zeros(n, 1); + y(idx) = 1; + s = A * y; + if k > 1 + s = s - (xsav * (dsav .* (ysav' * y))); + end + idx = mod(idx, n) + 1; + iits = iits + 1; + end + iitssav(k) = iits; + case 2, % Cycling Periodic Ones + y = zeros(n, 1); + y(mod(k-1,n)+1) = 1; + case 3, % All Ones + y = ones(n, 1); + case 4, % Periodic Ones + y = zeros(n, 1); + for i = 1 : 100 : n + y(i) = 1; + end + otherwise, + error('Invalid choice for C.'); + end % switch on yinit + + %%% Inner Loop + + for l = 1 : lmax + + %%% Fix y and Solve for x + + s = A * y; + if k > 1 + s = s - (xsav * (dsav .* (ysav' * y))); + end + + [x, xcnt] = sddsolve(s, m); + + %%% Fix x and Solve for y + + s = A' * x; + if (k > 1) + s = s - (ysav * (dsav .* (xsav' * x))); + end + + [y, ycnt, fmax] = sddsolve(s, n); + + %%% Check Progress + + d = sqrt(fmax * ycnt) / (ycnt * xcnt); + + beta = d^2 * ycnt * xcnt; + + if (l > 1) + alpha = (beta - betabar) / betabar; + if (alpha <= alphamin) + break + end + end + + betabar = beta; + + end % l-loop + + %%% Save + + xsav(:, k) = x; + ysav(:, k) = y; + dsav(k, 1) = d; + rho = max([rho - beta, 0]); + rhosav(k) = rho; + itssav(k) = l; + + %%% Threshold Test + + if (rho <= rhomin) + break; + end + +end % k-loop + +return + +%----------------------------------------------------------------------% + +function [x, imax, fmax] = sddsolve(s, m) + +%SDDSOLVE Solve SDD subproblem +% +% [X] = SDDSOLVE(S, M) computes max (X' * S) / (X' * X) where M is the +% size of S. +% +% [X, I] = SDDSOLVE(S, M) additionally returns number of nonzeros in X. +% +% [X, I, F] = SDDSOLVE(S, M) additionally returns value of function at the +% optimum. +% +%For use with SDD. +%Tamara G. Kolda, Oak Ridge National Laboratory, 1999. +%Dianne P. O'Leary, University of Maryland and ETH, 1999. + +for i = 1 : m + if s(i) < 0 + x(i, 1) = -1; + s(i) = -s(i); + else + x(i, 1) = 1; + end +end + +[sorts, indexsort] = sort(-s); +sorts = -sorts; + +clear f +f(1) = sorts(1); +for i = 2 : m + f(i) = sorts(i) + f(i - 1); +end + +f = (f.^2) ./ [1:m]; + +imax = 1; +fmax = f(1); +for i = 2 : m + if f(i) >= fmax + imax = i; + fmax = f(i); + end +end + +for i = (imax + 1) : m + x(indexsort(i)) = 0; +end + +return + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddfun.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddfun.m new file mode 100644 index 0000000000000000000000000000000000000000..3ab226866b8ea1030eb84719a51c73ecf0fbc2b9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddfun.m @@ -0,0 +1,179 @@ +function sddfun(A) + +% This is a test to compare the SDD with the SVD and to compare different +% SDD starting strategies. It computes the rank of the matrix A and its +% SVD. It then computes a k-term SDD with each of four different starting +% strategies where k is the rank of the matrix. +% +% A table and four plots provide comparisons. The table compares the +% different starting strategies with respect to final relative residual, +% average number of inner iterations, and sparsity of factors. The plots +% compare residual norm vs. iteration and residual norm vs. storage for the +% SVD and the 4 SDDs. We also compare the singular values with the (scaled) +% diagonal value from the SDDs. Lastly, we compare work vs. the residual +% norm for each SDD method. +% +% +%SDDPACK: Software for the Semidiscrete Decomposition. +%Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + +% This program is free software; you can redistribute it and/or modify it +% under the terms of the GNU General Public License as published by the Free +% Software Foundation; either version 2 of the License, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +% for more details. +% +% You should have received a copy of the GNU General Public License along +% with this program; if not, write to the Free Software Foundation, Inc., 59 +% Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%---------------------------------------------------------------------- +% Initialization +%---------------------------------------------------------------------- +[m, n] = size(A); % size of A +rho0 = sum(sum(A .* A)); % 2-norm of A + +%---------------------------------------------------------------------- +% SVD Stuff +%---------------------------------------------------------------------- +fprintf(1, '\n'); +disp('Computing SVD'); +[U, S, V] = svd(full(A)); % svd of A +S = diag(S); % diagonalize S +k = size(S,1); % rank of A + +fprintf(1, '\n'); +fprintf(1, 'Rank of matrix: %d\n', k); + +clear svdrho % residual or SVD +svdrho(k) = 0; % final residual +for i = k-1 : -1 : 1 % working backwards... + svdrho(i) = svdrho(i+1) + S(i+1)^2; +end + +svdstor = 4 * (m + n + 1) * [1 : k]; % storage for SVD + +%---------------------------------------------------------------------- +% SDD Stuff +%---------------------------------------------------------------------- + +fprintf(1, '\n'); +disp('Computing SDD with option 1'); +[D1, X1, Y1, its1, rho1, iits1] = sdd(A, k, 0.01, 100, 0.0, 1); +disp('Computing SDD with option 2'); +[D2, X2, Y2, its2, rho2] = sdd(A, k, 0.01, 100, 0.0, 2); +disp('Computing SDD with option 3'); +[D3, X3, Y3, its3, rho3] = sdd(A, k, 0.01, 100, 0.0, 3); +disp('Computing SDD with option 4'); +[D4, X4, Y4, its4, rho4] = sdd(A, k, 0.01, 100, 0.0, 4); + +its1 = its1 + (iits1 - 1) / 2.0; + +clear Dplus1 +for i = 1 : k + Dplus1(i) = D1(i) * norm(X1(:,i)) * norm(Y1(:,i)); +end +clear Dplus2 +for i = 1 : k + Dplus2(i) = D2(i) * norm(X2(:,i)) * norm(Y2(:,i)); +end +clear Dplus3 +for i = 1 : k + Dplus3(i) = D3(i) * norm(X3(:,i)) * norm(Y3(:,i)); +end +clear Dplus4 +for i = 1 : k + Dplus4(i) = D4(i) * norm(X4(:,i)) * norm(Y4(:,i)); +end + +sddstor = (4 + .25 * (m + n)) * [1 : k]; % storage for SDD + +density1 = 100 * (sum(sum(abs(X1))) + sum(sum(abs(Y1)))) / (2 * m * n); +density2 = 100 * (sum(sum(abs(X2))) + sum(sum(abs(Y2)))) / (2 * m * n); +density3 = 100 * (sum(sum(abs(X3))) + sum(sum(abs(Y3)))) / (2 * m * n); +density4 = 100 * (sum(sum(abs(X4))) + sum(sum(abs(Y4)))) / (2 * m * n); + +clear sits1 sits2 sits3 sits4 +sits1(1) = its1(1); +sits2(1) = its2(1); +sits3(1) = its3(1); +sits4(1) = its4(1); + +for i = 2 : k + sits1(i) = sits1(i-1) + its1(i); + sits2(i) = sits2(i-1) + its2(i); + sits3(i) = sits3(i-1) + its3(i); + sits4(i) = sits4(i-1) + its4(i); +end + +%---------------------------------------------------------------------- +% Plotting +%---------------------------------------------------------------------- + +c = ['b' 'm' 'r' 'c' 'g']; % colors +l = ['- '; ': '; '-.'; '--'; '- ']; % line pattern +d = ['o'; '^'; '+'; '*'; 'x']; % dot pattern + +fprintf(1,'\n'); +fprintf(1, 'Method Color Line Dot\n'); +fprintf(1, '------ ----- ---- ---\n'); +fprintf(1, 'SVD %1s %2s %1s\n', c(5), l(5,:), d(5)); +for i = 1:4 + fprintf(1, 'SDD-%d %1s %2s %1s\n', i, c(i), l(i,:), d(i)); +end +fprintf(1,'\n'); + +%%% Residual Norms vs. No. of Terms +subplot(2,2,1); +plot([0:k], sqrt([rho0 svdrho]/rho0), [c(5) l(5,:)]); +hold on; +plot([0:k], sqrt([rho0 rho1]/rho0), [c(1) l(1,:)]); +plot([0:k], sqrt([rho0 rho2]/rho0), [c(2) l(2,:)]); +plot([0:k], sqrt([rho0 rho3]/rho0), [c(3) l(3,:)]); +plot([0:k], sqrt([rho0 rho4]/rho0), [c(4) l(4,:)]); +hold off; +title('Residual Norms vs. No. of Terms'); + +%%% Singular vs. SDD values +subplot(2,2,2); +plot([1:k], sqrt(S), [c(5) d(5)]); +hold on; +plot([1:k], sqrt(Dplus1), [c(1) d(1)]); +plot([1:k], sqrt(Dplus2), [c(2) d(2)]); +plot([1:k], sqrt(Dplus3), [c(3) d(3)]); +plot([1:k], sqrt(Dplus4), [c(4) d(4)]); +hold off; +title('Singular vs. SDD values'); + +%%% Residual Norm vs. Storage +subplot(2, 2, 3); +semilogx(svdstor, sqrt(svdrho/rho0), [c(5) l(5,:)]); +hold on; +semilogx(sddstor, sqrt(rho1/rho0), [c(1) l(1,:)]); +semilogx(sddstor, sqrt(rho2/rho0), [c(2) l(2,:)]); +semilogx(sddstor, sqrt(rho3/rho0), [c(3) l(3,:)]); +semilogx(sddstor, sqrt(rho4/rho0), [c(4) l(4,:)]); +hold off; +title('Residual Norms vs. Storage'); + +%%% SDD Inner Iterations +subplot(2, 2, 4); +plot(sits1, sqrt([rho1]/rho0), [c(1) l(1,:)]); +hold on; +plot(sits2, sqrt([rho2]/rho0), [c(2) l(2,:)]); +plot(sits3, sqrt([rho3]/rho0), [c(3) l(3,:)]); +plot(sits4, sqrt([rho4]/rho0), [c(4) l(4,:)]); +hold off; +title('Residual Norms vs. No. Inner Iterations'); + +fprintf(1, 'Method Rel Resid Inn Its Density\n'); +fprintf(1, '------ --------- ------- -------\n'); +fprintf(1, 'SDD-1 %5.2f %5.2f %5.2f\n', 100 * sqrt(rho1(k)/rho0), mean(its1), density1); +fprintf(1, 'SDD-2 %5.2f %5.2f %5.2f\n', 100 * sqrt(rho2(k)/rho0), mean(its2), density2); +fprintf(1, 'SDD-3 %5.2f %5.2f %5.2f\n', 100 * sqrt(rho3(k)/rho0), mean(its3), density3); +fprintf(1, 'SDD-4 %5.2f %5.2f %5.2f\n', 100 * sqrt(rho4(k)/rho0), mean(its4), density4); diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddtensor.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddtensor.m new file mode 100644 index 0000000000000000000000000000000000000000..d12f7a945c066cc1212d0b69c7bb1e06fb5dac75 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddtensor.m @@ -0,0 +1,295 @@ +function [dsav, xsav, itssav, rhosav] = ... + sddtensor(A, kmax, alphamin, lmax, rhomin) + +%SDDTENSOR Semidiscrete Tensor Decomposition. +% [D, X] = SDDTENSOR(A) produces discrete matrices stored in the cell +% array X and a vector D that can be used to generate the 10-term tensor +% SDD that approximates A. The X cell array is formatted as follows: the +% first cell holds the component of each decomposed vectors from the first +% dimension, the second cell goes with the second dimension, and so +% on. The kth term of the SDD would be given by D(k) times the outer +% product of X{1}(:,K) x X{2}(:,k) x ... x X{n}(:,k) where n is the order +% of A. If A were a simple matrix, then X{1} and X{2} would be equivalent, +% respectively, to the X and Y generated by the regular SDD routine. +% +% [D, X, ITS] = SDDTENSOR(...) also returns the number of inner +% iterations for each outer iteration. +% +% [D, X, ITS, RHO] = SDDTENSOR(...) also returns a vector RHO containing +% the norm-squared of the residual after each outer iteration. +% +% [...] = SDDTENSOR(A, K) produces a K-term tensor SDD. The default is 10. +% +% [...] = SDDTENSOR(A, K, TOL) stops the inner iterations after the +% improvement is less than TOL. The default is 0.01. +% +% [...] = SDDTENSOR(A, K, TOL, L) specifies that the maximum number of +% inner iterations is L. The default is 10. +% +% [...] = SDDTENSOR(A, K, TOL, L, R) produces an SDD approximation that +% either has K terms or such that norm(A - B, 'fro') < R where B is the +% tensor SDD approximation. The default is zero. +% +% +%SDDPACK: Software for the Semidiscrete Decomposition. +%Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + +% This program is free software; you can redistribute it and/or modify it +% under the terms of the GNU General Public License as published by the Free +% Software Foundation; either version 2 of the License, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +% for more details. +% +% You should have received a copy of the GNU General Public License along +% with this program; if not, write to the Free Software Foundation, Inc., 59 +% Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +%%% Check Input Arguments + +if ~exist('A') + error('Incorrect number of inputs.'); +end + +if ~exist('kmax') + kmax = 10; +end + +if ~exist('alphamin') + alphamin = 0.01; +end + +if ~exist('lmax') + lmax = 10; +end + +if ~exist('rhomin') + rhomin = 0; +else + rhomin = rhomin^2; +end + +%%% Initialization + +n = ndims(A); % order of A +m = size(A); % vector of dimensions of A + +tmp = A .* A; % compute residual norm squared +for j = 1 : n + tmp = sum(tmp); +end +rho = tmp; +clear tmp; + +iitssav = []; + +%%% Outer Loop + +for k = 1 : kmax + + %%% Initialize y for Inner Loop + + x = cell(n,1); + for j = 1 : n + x{j} = ones(m(j),1); + end + + %%% Inner Loop + + for l = 1 : lmax + + for j = 1 : n + + s = product(A, x, j); + [x{j}, xcnt(j), tmp] = sddtsolve(s, m(j)); + + end + + %%% Check Progress + + Axsqr = tmp * xcnt(n); + beta = Axsqr / prod(xcnt); + + if (l > 1) + alpha = (beta - betabar) / betabar; + if (alpha <= alphamin) + break + end + end + + betabar = beta; + + end % l-loop + + %%% Save + + d = sqrt(Axsqr) / prod(xcnt); + A = A - d * expand(x); + for j = 1 : n + xsav{j}(:,k) = x{j}; + end + dsav(k, 1) = d; + rho = max([rho - beta, 0]); + rhosav(k) = rho; + itssav(k) = l; + + %%% Threshold Test + + if (rho < rhomin) + break; + end + +end % k-loop + +return + +%----------------------------------------------------------------------% + +function B = expand(x) + +%EXPAND Expand a decomposed tensor to a full tensor. +% +% B = EXPAND(X) returns B, a full tensor, that is the result of the outer +% product of all the elements of X. +% +%For use with SDDTENSOR. +%Tamara G. Kolda, Oak Ridge National Laboratory, 1999. +%Dianne P. O'Leary, University of Maryland and ETH, 1999. + +n = size(x, 1); +for j = 1 : n + m(j) = size(x{j}, 1); +end + +tmp = x{1}; +for j = 2 : n + tmp = tmp * x{j}'; + tmp = reshape(tmp, prod(m(1:j)), 1); +end + +B = reshape(tmp, m); + + +%----------------------------------------------------------------------% + +function s = product(A,x,idx) + +%PRODUCT Product (contracted) of a tensor and decomposed tensor. +% +% S = PRODUCT(A,X) computes the inner product of a tesnor A with a +% decomposed tensor X. S is a scalar. +% +% S = PRODUCT(A,X,I) computes the contracted inner product of a tensor A +% with a decomposed tensor X without its Ith component. +% +%For use with SDDTENSOR. +%Tamara G. Kolda, Oak Ridge National Laboratory, 1999. +%Dianne P. O'Leary, University of Maryland and ETH, 1999. + +if exist('idx') + + str = 'tmp = squeeze(A('; + for i = 1 : ndims(A) + if i == idx + str = [str 'i']; + else + str = [str ':']; + end + if i == ndims(A) + str = [str '));']; + else + str = [str ',']; + end + end + + jj = [1 : idx-1, idx+1 : ndims(A)]; + + for i = 1 : size(A, idx) + + eval(str); + if ndims(A) == 2 + n = 1; + m = length(tmp); + else + n = ndims(tmp); + m = size(tmp); + end + + for j = n : -1 : 1 + tmp = reshape (tmp, prod(m(1 : j-1)), m(j)); + tmp = tmp * x{jj(j)}; + end + + s(i) = tmp; + + end + +else + + tmp = A; + n = ndims(tmp); + m = size(tmp); + + for j = n : -1 : 1 + tmp = reshape (tmp, prod(m(1 : j-1)), m(j)); + tmp = tmp * x{j}; + end + + s = tmp; + +end + +%----------------------------------------------------------------------% + +function [x, imax, fmax] = sddtsolve(s, m) + +%SDDTSOLVE Solve SDD subproblem +% [X] = SDDTSOLVE(S, M) computes max(X'S)/(X'X) where M is the size of S. +% +% [X, I] = SDDTSOLVE(S, M) additionally returns number of nonzeros in X. +% +% [X, I, F] = SDDTSOLVE(S, M) additionally returns value of function at +% the optimum. +% +%For use with SDDTENSOR. +%Tamara G. Kolda, Oak Ridge National Laboratory, 1999. +%Dianne P. O'Leary, University of Maryland and ETH, 1999. + +for i = 1 : m + if s(i) < 0 + x(i, 1) = -1; + s(i) = -s(i); + else + x(i, 1) = 1; + end +end + +[sorts, indexsort] = sort(-s); +sorts = -sorts; + +clear f +f(1) = sorts(1); +for i = 2 : m + f(i) = sorts(i) + f(i - 1); +end + +f = (f.^2) ./ [1:m]; + +imax = 1; +fmax = f(1); +for i = 2 : m + if f(i) >= fmax + imax = i; + fmax = f(i); + end +end + +for i = (imax + 1) : m + x(indexsort(i)) = 0; +end + +return + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddweight.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddweight.m new file mode 100644 index 0000000000000000000000000000000000000000..68396ca79a521302f42ab90166362163a2a3cef9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddweight.m @@ -0,0 +1,241 @@ +function [dsav, xsav, ysav, itssav, rhosav, iitssav] = ... + sddweight(A, W, kmax, alphamin, lmax, rhomin, yinit) + +%SDDWEIGHT Weighted Semidiscrete Decomposition. +% +% [D, X, Y] = SDDWEIGHT(A, W) produces discrete matrices X and Y and a +% vector D such that X *diag(D) * Y' is the weighted SDD of rank 100 that +% approximates A in the norm ||Z||^2 = sum(sum(A .* A .* W)). +% +% [D, X, Y, ITS] = SDDWEIGHT(...) also returns the number of inner +% iterations for each outer iteration. +% +% [D, X, Y, ITS, RHO] = SDDWEIGHT(...) also returns the norm-squared of +% the residual after each outer iteration. +% +% [D, X, Y, ITS, RHO, IITS] = SDDWEIGHT(...) also returns the number of +% extra matrix-vector multiplies used in the initialization of each inner +% iteration when using C=3 (see below). +% +% [...] = SDDWEIGHT(A, W, K) produces a rank-k SDDWEIGHT. The default +% rank is 100. +% +% [...] = SDDWEIGHT(A, W, K, TOL) stops the inner iterations after the +% improvement is less than TOL. The default value is 0.01. +% +% [...] = SDDWEIGHT(A, W, K, TOL, L) specifies that the maximum number of +% inner iterations is L. The default is 100. +% +% [...] = SDDWEIGHT(A, W, K, TOL, L, R) produces an SDDWEIGHT +% approximation that is either of rank K or such that +% || A - X * diag(D) * Y' ||_W < R. The default is zero. +% +% [...] = SDDWEIGHT(A, W, K, TOL, L, R, C) sets the choice for +% initializing y in the inner iterations as follows: +% +% C = 1 Threshold +% C = 2 Cycling +% C = 3, All elements of y are set to 1. +% C = 4, Every 100th element of y is set to 1 starting with 1. +% +% Default is C = 1. +% +% +%SDDPACK: Software for the Semidiscrete Decomposition. +%Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + +% This program is free software; you can redistribute it and/or modify it +% under the terms of the GNU General Public License as published by the Free +% Software Foundation; either version 2 of the License, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +% for more details. +% +% You should have received a copy of the GNU General Public License along +% with this program; if not, write to the Free Software Foundation, Inc., 59 +% Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +%%% Check Input Arguments + +if ~exist('A') + error('Incorrect number of inputs.'); +end + +if ~exist('kmax') + kmax = 100; +end + +if ~exist('alphamin') + alphamin = 0.01; +end + +if ~exist('lmax') + lmax = 100; +end + +if ~exist('rhomin') + rhomin = 0; +else + rhomin = rhomin^2; +end + +if ~exist('yinit') + yinit = 1; +end +idx = 1; % only used for yinit = 2 + +%%% Initialization + +[m, n] = size(A); % size of A +rho = sum(sum(A .* A .* W)); % squared residual norm +iitssav = []; + +%%% Outer Loop + +for k = 1 : kmax + + %%% Initialize y for Inner Loop + + switch yinit(1), % All Ones + case 1, % Threshold + snorm = 0; + iits = 0; + while snorm < (rho / n) + y = zeros(n, 1); + y(idx) = 1; + snorm = sum((A(:,idx) .* A(:,idx) .* W(:,idx))); + idx = mod(idx, n) + 1; + iits = iits + 1; + end + iitssav(k) = iits; + case 2, % Cycling Periodic Ones + y = zeros(n, 1); + y(mod(k-1,n)+1) = 1; + case 3, + y = ones(n, 1); + case 4, % Periodic Ones + y = zeros(n, 1); + for i = 1 : 100 : n + y(i) = 1; + end + otherwise, + error('Invalid choice for C.'); + end % switch on yinit + + %%% Inner Loop + + for l = 1 : lmax + + %%% Fix y and Solve for x + + s = (A .* W) * y; + v = W *(y .* y); + + [x, xcnt] = solveweight(s, v, m); + + %%% Fix x and Solve for y + + s = (A .* W)' * x; + v = W' * (x .* x); + + [y, ycnt] = solveweight(s, v, n); + + %%% Check Progress + + beta = (s' * y)^2 / (v' * (y .* y)); + + if (l > 1) + alpha = (beta - betabar) / betabar; + if (alpha <= alphamin) + break + end + end + + betabar = beta; + + + end % l-loop + + %%% Save + + d = (s' * y) / (v' * (y .* y)); + xsav(:, k) = x; + ysav(:, k) = y; + dsav(k, 1) = d; + A = A - x * d * y'; + rho = rho - beta; + rhosav(k) = rho; + itssav(k) = l; + + %%% Threshold Test + + if (rho < rhomin) + break; + end + +end % k-loop + +return + +%----------------------------------------------------------------------% + +function [x, imax] = solveweight(s, v, m) + +%SOLVEWEIGHT Solve SDDWEIGHT subproblem +% [X] = SOLVE(S, V, M) computes max(X'S)/(X.*X)'*V where M is the size of +% S. +% +% [X, I] = SOLVE(S, V, M) additionally returns number of nonzeros in X. +% +%For use with SDDWEIGHT. +%Tamara G. Kolda, Oak Ridge National Laboratory, 1999. +%Dianne P. O'Leary, University of Maryland and ETH, 1999. + +if s == 0, error('s is zero'), end; + +for i = 1 : m + if s(i) < 0 + x(i, 1) = -1; + s(i) = -s(i); + ratio(i) = -s(i)/v(i); + elseif s(i) > 0 + x(i, 1) = 1; + ratio(i) = -s(i)/v(i); + else + x(i, 1) = 0; + ratio(i) = 0; + end +end + +[sorts, indexsort] = sort(ratio); +clear f +num = s(indexsort(1)); +den = v(indexsort(1)); +f(1) = num^2/den; +for i = 2 : m + num = num + s(indexsort(i)); + den = den + v(indexsort(i)); + f(i) = num^2/den; +end + +imax = 1; +fmax = f(1); +for i = 2 : m + if f(i) >= fmax + imax = i; + fmax = f(i); + end +end + +for i = (imax + 1) : m + x(indexsort(i)) = 0; +end + +return + + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddweightfun.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddweightfun.m new file mode 100644 index 0000000000000000000000000000000000000000..7f0ca39f2e6d2e687e921a767d124ae1fea5c936 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/matlab/sddweightfun.m @@ -0,0 +1,163 @@ +function sddweightfun(A, W) + +% This is a test to compare the SDDWEIGHT with different starting strategies. It +% computes a k-term SDD with each of four different starting strategies +% where k is the rank of the matrix. +% +% A table and four plots provide comparisons. The table compares the +% different starting strategies with respect to final relative residual, +% average number of inner iterations, and sparsity of factors. The plots +% compare residual norm vs. iteration and residual norm vs. storage for the +% SVD and the 4 SDDs. We also compare the (scaled) diagonal value from the +% SDDs. Lastly, we compare work vs. the residual norm for each SDD method. +% +%SDDPACK: Software for the Semidiscrete Decomposition. +%Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + +% This program is free software; you can redistribute it and/or modify it +% under the terms of the GNU General Public License as published by the Free +% Software Foundation; either version 2 of the License, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +% for more details. +% +% You should have received a copy of the GNU General Public License along +% with this program; if not, write to the Free Software Foundation, Inc., 59 +% Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + +%---------------------------------------------------------------------- +% Initialization +%---------------------------------------------------------------------- +A = full(A); +W = full(W); +[m, n] = size(A); % size of A +rho0 = sum(sum(A .* A .* W)); % 2-norm of A + +%---------------------------------------------------------------------- +% Rank Stuff +%---------------------------------------------------------------------- +fprintf(1, '\n'); +k = rank(A .* W); % rank of A .* W + +fprintf(1, '\n'); +fprintf(1, 'Rank of matrix: %d\n', k); + +%---------------------------------------------------------------------- +% SDD Stuff +%---------------------------------------------------------------------- + +fprintf(1, '\n'); +disp('Computing SDDWEIGHT with option 1'); +[D1, X1, Y1, its1, rho1, iits1] = sddweight(A, W, k, 0.01, 100, 0.0, 1); +disp('Computing SDDWEIGHT with option 2'); +[D2, X2, Y2, its2, rho2] = sddweight(A, W, k, 0.01, 100, 0.0, 2); +disp('Computing SDDWEIGHT with option 3'); +[D3, X3, Y3, its3, rho3] = sddweight(A, W, k, 0.01, 100, 0.0, 3); +disp('Computing SDDWEIGHT with option 4'); +[D4, X4, Y4, its4, rho4] = sddweight(A, W, k, 0.01, 100, 0.0, 4); + +its1 = its1 + (iits1 - 1) / 2.0; + +clear Dplus1 +for i = 1 : k + Dplus1(i) = D1(i) * norm(X1(:,i)) * norm(Y1(:,i)); +end +clear Dplus2 +for i = 1 : k + Dplus2(i) = D2(i) * norm(X2(:,i)) * norm(Y2(:,i)); +end +clear Dplus3 +for i = 1 : k + Dplus3(i) = D3(i) * norm(X3(:,i)) * norm(Y3(:,i)); +end +clear Dplus4 +for i = 1 : k + Dplus4(i) = D4(i) * norm(X4(:,i)) * norm(Y4(:,i)); +end + +sddstor = (4 + .25 * (m + n)) * [1 : k]; % storage for SDD + +density1 = 100 * (sum(sum(abs(X1))) + sum(sum(abs(Y1)))) / (2 * m * n); +density2 = 100 * (sum(sum(abs(X2))) + sum(sum(abs(Y2)))) / (2 * m * n); +density3 = 100 * (sum(sum(abs(X3))) + sum(sum(abs(Y3)))) / (2 * m * n); +density4 = 100 * (sum(sum(abs(X4))) + sum(sum(abs(Y4)))) / (2 * m * n); + +clear sits1 sits2 sits3 sits4 +sits1(1) = its1(1); +sits2(1) = its2(1); +sits3(1) = its3(1); +sits4(1) = its4(1); + +for i = 2 : k + sits1(i) = sits1(i-1) + its1(i); + sits2(i) = sits2(i-1) + its2(i); + sits3(i) = sits3(i-1) + its3(i); + sits4(i) = sits4(i-1) + its4(i); +end + +%---------------------------------------------------------------------- +% Plotting +%---------------------------------------------------------------------- + +c = ['b' 'm' 'r' 'c']; % colors +l = ['- '; ': '; '-.'; '--']; % line pattern +d = ['o'; '^'; '+'; '*']; % dot pattern + +fprintf(1,'\n'); +fprintf(1, ' Method Color Line Dot\n'); +fprintf(1, '----------- ----- ---- ---\n'); +for i = 1:4 + fprintf(1, 'SDDWEIGHT-%d %1s %2s %1s\n', i, c(i), l(i,:), d(i)); +end +fprintf(1,'\n'); + +%%% Residual Norms vs. Iteration +subplot(2,2,1); +plot([0:k], sqrt([rho0 rho1]/rho0), [c(1) l(1,:)]); +hold on; +plot([0:k], sqrt([rho0 rho2]/rho0), [c(2) l(2,:)]); +plot([0:k], sqrt([rho0 rho3]/rho0), [c(3) l(3,:)]); +plot([0:k], sqrt([rho0 rho4]/rho0), [c(4) l(4,:)]); +hold off; +title('Residual Norms vs. No. of Terms'); + +%%% SDD values +subplot(2,2,2); +plot([1:k], sqrt(Dplus1), [c(1) d(1)]); +hold on; +plot([1:k], sqrt(Dplus2), [c(2) d(2)]); +plot([1:k], sqrt(Dplus3), [c(3) d(3)]); +plot([1:k], sqrt(Dplus4), [c(4) d(4)]); +hold off; +title('SDD values'); + +%%% Residual Norm vs. Storage +subplot(2, 2, 3); +semilogx(sddstor, sqrt(rho1/rho0), [c(1) l(1,:)]); +hold on; +semilogx(sddstor, sqrt(rho2/rho0), [c(2) l(2,:)]); +semilogx(sddstor, sqrt(rho3/rho0), [c(3) l(3,:)]); +semilogx(sddstor, sqrt(rho4/rho0), [c(4) l(4,:)]); +hold off; +title('Residual Norms vs. Storage'); + +%%% SDD Inner Iterations +subplot(2, 2, 4); +plot(sits1, sqrt([rho1]/rho0), [c(1) l(1,:)]); +hold on; +plot(sits2, sqrt([rho2]/rho0), [c(2) l(2,:)]); +plot(sits3, sqrt([rho3]/rho0), [c(3) l(3,:)]); +plot(sits4, sqrt([rho4]/rho0), [c(4) l(4,:)]); +hold off; +title('Residual Norms vs. No. Inner Iterations'); + +fprintf(1, ' Method Rel Resid Inn Its Density\n'); +fprintf(1, '----------- --------- ------- -------\n'); +fprintf(1, 'SDDWEIGHT-1 %5.2f %5.2f %5.2f\n', 100 * sqrt(rho1(k)/rho0), mean(its1), density1); +fprintf(1, 'SDDWEIGHT-2 %5.2f %5.2f %5.2f\n', 100 * sqrt(rho2(k)/rho0), mean(its2), density2); +fprintf(1, 'SDDWEIGHT-3 %5.2f %5.2f %5.2f\n', 100 * sqrt(rho3(k)/rho0), mean(its3), density3); +fprintf(1, 'SDDWEIGHT-4 %5.2f %5.2f %5.2f\n', 100 * sqrt(rho4(k)/rho0), mean(its4), density4); diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/convertmtx.c b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/convertmtx.c new file mode 100644 index 0000000000000000000000000000000000000000..b9697215db1227f5d7fc3081a04808114282232b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/convertmtx.c @@ -0,0 +1,136 @@ +/*---------------------------------------------------------------------- + + SDDPACK: Software for the Semidiscrete Decomposition. + Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + PROGRAM: convertmtx + + DESCRIPTION: Converts a text matrix (in MatrixMarket coordinate, + real, general format) to SDDPACK binary format and vice versa. + + USAGE: convertmtx [options] infile outfile + + OPTIONS: -b Convert from binary to text. + -t Convert from text to binary. (DEFAULT) + + FILE FORMATS: Text files should be in MatrixMarket coordinate, + real, general format. The header lines (beginning with '%') are NOT + checked and need not be present. The output files will be in binary + format. + + EXTERNAL SUBROUTINES: read_matrix, write_matrix (from sdd.c) + + PROGRAM DEPENDENCIES: convertmtx.c sdd.o sdd.h + + BUG REPORTS: Email Tamara.Kolda@na-net.ornl.gov. + + ----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "sdd.h" /* sparse matrix */ + +#define INDATA 't' /* default input data type ('t' = text) */ + +void usage(char*); + +int main (int argc, char *argv[]) +{ + int i; /* counter */ + char *infile; /* input file name */ + char *outfile; /* output file name */ + char indata = INDATA; /* input file type: [t]ext or [b]inary */ + matrix *A = NULL; /* pointer to sparse matrix */ + + /* Parse command line */ + if (argc < 3) { + usage(argv[0]); + exit(-1); + } + infile = argv[argc - 2]; + outfile = argv[argc - 1]; + i = 1; + while (i < argc - 2) { + if (argv[i][0] != '-') { + usage(argv[0]); + exit(-1); + } + switch (argv[i][1]) { + case 'b': + indata = 'b'; + break; + case 't': + indata = 't'; + break; + default: + usage(argv[0]); + exit(-1); + break; + } /* switch */ + i++; + } /* while */ + + /* Echo selections to standard output */ + fprintf(stdout, "*** output from %s ***\n", argv[0]); + fprintf(stdout, "Input File : %s\n", infile); + fprintf(stdout, "Output File : %s\n", outfile); + + /* Call appropriate conversion routines */ + switch(indata) { + + case 'b': /* Convert binary matrix to text */ + + if ((A = read_matrix(infile, 1)) == NULL) { + fprintf(stderr, "Error reading matrix.\n"); + exit(-1); + } + write_matrix(A, outfile, 0); + break; + + case 't': default: /* Convert text matrix to binary */ + + if ((A = read_matrix(infile, 0)) == NULL) { + fprintf(stderr, "Error reading matrix.\n"); + exit(-1); + } + write_matrix(A, outfile, 1); + break; + + } /* switch */ + + /* Free memory and exit */ + free_matrix(A); + return(0); + +} /* main */ + +/*----------------------------------------------------------------------*/ + +void usage(char *name) +{ + fprintf(stderr, "\n"); + fprintf(stderr, "Usage: %s [options] infile outfile\n", name); + fprintf(stderr, "Converts a matrix text file to binary or vice versa.\n"); + fprintf(stderr, "Options: -b Convert from binary to text\n"); + fprintf(stderr, " -t Convert from text to binary (DEFAULT)\n"); + fprintf(stderr, "\n"); + return; + +} /* usage */ + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/convertsdd.c b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/convertsdd.c new file mode 100644 index 0000000000000000000000000000000000000000..dc8b5f29d6143875f42d63bc266fda3df97cff28 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/convertsdd.c @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------- + + SDDPACK: Software for the Semidiscrete Decomposition. + Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + PROGRAM: convertsdd + + DESCRIPTION: Converts a text sdd to SDDPACK binary format and vice + versa. + + USAGE: convertsdd [options] infile outfile + + OPTIONS: -b Convert from binary to text. + -t Convert from text to binary. (DEFAULT) + + EXTERNAL SUBROUTINES: read_sdd, write_sdd (from sdd.c) + + PROGRAM DEPENDENCIES: convertmtx.c sdd.o sdd.h + + BUG REPORTS: Email Tamara.Kolda@na-net.ornl.gov. + + ----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "sdd.h" /* sdd header file */ + +#define INDATA 't' /* default input data type ('t' = text) */ + +void usage(char*); + +int main (int argc, char *argv[]) +{ + int i; /* counter */ + char *infile; /* input file name */ + char *outfile; /* output file name */ + char indata = INDATA; /* input file type: [t]ext or [b]inary */ + sdd *A = NULL; /* pointer to sparse matrix */ + + /* Parse command line */ + if (argc < 3) { + usage(argv[0]); + exit(-1); + } + infile = argv[argc - 2]; + outfile = argv[argc - 1]; + i = 1; + while (i < argc - 2) { + if (argv[i][0] != '-') { + usage(argv[0]); + exit(-1); + } + switch (argv[i][1]) { + case 'b': + indata = 'b'; + break; + case 't': + indata = 't'; + break; + default: + usage(argv[0]); + exit(-1); + break; + } /* switch */ + i++; + } /* while */ + + /* Echo selections to standard output */ + fprintf(stdout, "*** output from %s ***\n", argv[0]); + fprintf(stdout, "Input File : %s\n", infile); + fprintf(stdout, "Output File : %s\n", outfile); + + /* Call appropriate conversion routines */ + switch(indata) { + + case 'b': /* Convert binary matrix to text */ + + if ((A = read_sdd(infile, 1)) == NULL) { + fprintf(stderr, "Error reading SDD.\n"); + exit(-1); + } + write_sdd(A, outfile, 0, NULL); + break; + + case 't': default: /* Convert text matrix to binary */ + + if ((A = read_sdd(infile, 0)) == NULL) { + fprintf(stderr, "Error reading SDD.\n"); + exit(-1); + } + write_sdd(A, outfile, 1, NULL); + break; + + } /* switch */ + + /* Free memory and exit */ + free_sdd(A); + return(0); + +} /* main */ + +/*----------------------------------------------------------------------*/ + +void usage(char *name) +{ + fprintf(stderr, "\n"); + fprintf(stderr, "Usage: %s [options] infile outfile\n", name); + fprintf(stderr, "Converts an SDD text file to binary or vice versa.\n"); + fprintf(stderr, "Options: -b Convert from binary to text\n"); + fprintf(stderr, " -t Convert from text to binary (DEFAULT)\n"); + fprintf(stderr, "\n"); + return; + +} /* usage */ + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/decomp.c b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/decomp.c new file mode 100644 index 0000000000000000000000000000000000000000..0177e5f981240e325b32539e37fb55ffd096f53e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/decomp.c @@ -0,0 +1,212 @@ +/*---------------------------------------------------------------------- + + SDDPACK: Software for the Semidiscrete Decomposition. + Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + PROGRAM: decomp + + DESCRIPTION: Computes (or expands) the Semidiscrete Decomposition + (SDD) of a sparse matrix. + + USAGE: decomp [options] infile outfile + + OPTIONS: -k terms Desired number of terms in SDD (Default: 100) + -a accuarcy Desired SDD accuracy (Default: 0) + -t tolerance Tolerance for inner iterations (Default: 0.01) + -i its Max inner iterations (Default: 100) + -y choice Initialization for inner loop... + 1 = Threshold (Default) + 2 = Cycling + 3 = Ones + 4 = Periodic Ones + -e filename Expand existing SDD + -b I/O in binary format + + + FILE FORMATS: + + EXTERNAL SUBROUTINES: + read_sparse, free_sparse, read_sdd, compute_sdd, write_sdd, free_sdd - sdd.c + + PROGRAM DEPENDENCIES: decomp.c, sdd.h, sdd.o + + BUG REPORTS: Email Tamara.Kolda@na-net.ornl.gov. + + ----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "sdd.h" /* semidiscrete decomposition */ + +#define TERMS 100 /* default number of terms */ +#define ACCR 0.0 /* default desired accuarcy */ +#define TOL 0.01 /* default tolerance */ +#define ITS 100 /* default max inner its */ +#define YINIT 1 /* default initialization choice */ +#define BFLAG 0 /* default I/O in binary format? */ + +void usage(char *); + +int main(int argc, char* argv[]) +{ + int i; /* counter */ + int terms = TERMS; /* number of terms in SDD */ + float accr = ACCR; /* desired accuary of SDD */ + float tol = TOL; /* tolerance */ + int its = ITS; /* max its for inner iteration */ + int yinit = YINIT; /* choice for initialization */ + int bflag = BFLAG; /* I/O in binary format? */ + char *matrixf; /* matrix file name */ + matrix *A; /* matrix */ + char *decompf; /* sdd file name */ + sdd *S; /* sdd */ + char *edecompf = NULL; /* existing sdd file name */ + int eterms = 0; /* no. of terms in existing sdd */ + sdd *E = NULL; /* existing sdd */ + char note[MAXLINE]; /* note for sdd file */ + + /* Parse command line */ + if (argc < 3) { + usage(argv[0]); + return(-1); + } + matrixf = argv[argc-2]; + decompf = argv[argc-1]; + + i = 1; + while (i < argc - 2) { + if (argv[i][0] != '-') { + usage(argv[0]); + return(-1); + } + switch (argv[i][1]) { + case 'e': + edecompf = argv[++i]; + break; + case 'k': + terms = atoi(argv[++i]); + break; + case 'a': + accr = atof(argv[++i]); + break; + case 't': + tol = atof(argv[++i]); + break; + case 'i': + its = atoi(argv[++i]); + break; + case 'y': + yinit = atoi(argv[++i]); + break; + case 'b': + bflag = 1; + break; + default: + usage(argv[0]); + return(-1); + } + i++; + } + + /* Output values being used */ + fprintf(stdout, "*** output from %s ***\n", argv[0]); + fprintf(stdout, "matrix file : %s\n", matrixf); + fprintf(stdout, "SDD file : %s\n", decompf); + fprintf(stdout, "existing SDD file : "); + if (edecompf) fprintf(stdout, "%s\n", edecompf); + else fprintf(stdout, "<none>\n"); + fprintf(stdout, "terms : %d\n", terms); + fprintf(stdout, "accuracy : %f\n", accr); + fprintf(stdout, "tolerance : %f\n", tol); + fprintf(stdout, "max inner its : %d\n", its); + fprintf(stdout, "y init choice : %d\n", yinit); + fprintf(stdout, "input type : "); + if (bflag) fprintf(stdout, "binary\n"); + else fprintf(stdout, "text\n"); + + /* Create note for SDD file */ + if (!bflag) { + if (edecompf) + sprintf(note, "Matrix: %s Old SDD: %s Terms: %d Accr: %.2e Tol: %.2e InnIts: %d Init: %d", + matrixf, edecompf, terms, accr, tol, its, yinit); + else + sprintf(note, "Matrix: %s Terms: %d Accr: %.2e Tol: %.2e InnIts: %d Init: %d", + matrixf, terms, accr, tol, its, yinit); + } + + /* Read matrix matrix */ + if ((A = read_matrix(matrixf, bflag)) == NULL) { + fprintf(stderr, "Error reading sparse matrix.\n"); + return (-1); + } + + /* Read exisiting SDD if one exists */ + if (edecompf) { + if ((E = read_sdd(edecompf, bflag)) == NULL) { + fprintf(stderr, "Error reading existing SDD from file.\n"); + return (-1); + } + eterms = E->k; + } + + /* Compute SDD */ + S = compute_sdd(A, E, eterms, terms, accr, its, tol, yinit); + + /* Save SDD */ + write_sdd(S, decompf, bflag, note); + + /* Free memory and exit */ + free_matrix(A); + free_sdd(S); + return (0); + +} /* main */ + +/*----------------------------------------------------------------------*/ + +void usage(char *name) { + + fprintf(stderr, "\n"); + fprintf(stderr, "USAGE: decomp [options] infile outfile\n"); + fprintf(stderr, "Computes Semidiscrete Decomposition (SDD).\n"); + fprintf(stderr, "OPTIONS: -k terms Terms in SDD (Default: 100)\n"); + fprintf(stderr, " -a accuarcy Desired residual norm (Default: 0)\n"); + fprintf(stderr, " -t tol Tolerance (Default: 0.01)\n"); + fprintf(stderr, " -i its Max inner iterations (Default: 100)\n"); + fprintf(stderr, " -y (1|2|3|4) Initialization Choice\n"); + fprintf(stderr, " 1 = Threshold (Default)\n"); + fprintf(stderr, " 2 = Cycling\n"); + fprintf(stderr, " 3 = All Ones\n"); + fprintf(stderr, " 4 = Periodic Ones\n"); + fprintf(stderr, " -e filename Expand exisiting SDD\n"); + fprintf(stderr, " -b I/O in binary format\n"); + fprintf(stderr, "\n"); + return; + +} /* usage */ + + + + + + + + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/sdd.c b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/sdd.c new file mode 100644 index 0000000000000000000000000000000000000000..252e3bbf854dc17ccf422552e65775711d969843 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/src/sdd.c @@ -0,0 +1,2070 @@ +/*---------------------------------------------------------------------- + + SDDPACK: Software for the Semidiscrete Decomposition. + Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + + MODULE: sdd.o + + DESCRIPTION: Routines for creating and updating SDD's and sparse + matrices. + + EXTERNAL SUBROUTINES: No external subroutines + + MODULE DEPENDENCIES: sdd.c sdd.h + + BUG REPORTS: Email Tamara.Kolda@na-net.ornl.gov. + + ----------------------------------------------------------------------*/ + +#include "sdd.h" /* header file */ + +/*---------------------------------------------------------------------- + Internal Definitions, Macros, and Structures + ----------------------------------------------------------------------*/ + +/* Max length of comment line in data file. */ +#define MAXLINE 1000 + +/* Information level. Higher numbers yield more info. */ +#ifndef INFO +#define INFO 10 +#endif + +/* Sets every bit in the first y bytes pointed to by x to zero or one + respectively. */ +#define bzero(x, y) memset(x, 0, y) +#define bone(x, y) memset(x, 0xff, y) + +/* Structure for reading in and sorting matrix entries from + MatrixMarket formatted file. */ +typedef struct entry_struct { + int i, j; /* indicies */ + float val; /* entry */ +} entry; + +/*---------------------------------------------------------------------- + Internal Function Declarations + ----------------------------------------------------------------------*/ + +/* Internal svector functions */ +int numwords(int); +void free_svector(svector*); +svector* create_svector(svector*, int); +void write_svector(svector*, FILE*, int); +svector* read_svector(int, FILE*, int); +int svcount(svector*); + +/* Initialization functions */ +sdddouble *init_threshold(svector*, matrix*, sdd*, sddfloat, int*); +void init_cycle(svector*, int); +void init_ones(svector*); +void init_pones(svector*); + +/* Internal smatrix functions */ +void free_smatrix(smatrix*); +smatrix* create_smatrix(smatrix*, int, int, int); +void write_smatrix(smatrix*, FILE*, int); +smatrix* read_smatrix(int, int, FILE*, int); +void expand_smatrix(smatrix*, svector*); +void smxv(smatrix*, int, sdddouble*, int, sdddouble*); + +/* Internal dmatrix functions */ +void free_dmatrix(dmatrix*); +dmatrix* create_dmatrix(dmatrix*, int, int); +void write_dmatrix(dmatrix*, FILE*, int); +dmatrix* read_dmatrix(int, FILE*, int); +void expand_dmatrix(dmatrix*, sddfloat); + +/* Internal SDD functions */ +sdd* create_sdd(sdd*, int, int, int, int); +void expand_sdd(sdd*, sddfloat, svector*, svector*); +void sddxsv(sdddouble*, sdd*, svector*, int); + +/* Internal sparse matrix (matrix) functions */ +double fnormsq(matrix*); + +/* Internal functions the combine objects */ +void matrixxsv(sdddouble*, matrix*, svector*, int); +sdddouble_plus subproblem(matrix*, sdd*, svector*, svector*, int, sdddouble*); + +/* Internal utility functions */ +int comparentry(const entry *a, const entry *b) { + if (a->j == b->j) return (a->i > b->i ? 1 : -1); + else return (a->j > b->j ? 1 : -1); +} + +#ifdef QSORTOPT /* use optimized GNU qsort */ +#include "qsortopt.h" +#else /* use system-provided qsort */ +int compar(const sdddouble_plus *a, const sdddouble_plus *b) { + return(a->val > b->val ? -1 : 1); +} +#endif + +/*------------------------------------------------------------------------ + Functions for S-Vectors + ------------------------------------------------------------------------*/ + +int numwords(int x) +{ + /* Returns the number of words needed to store x bits. On error, + returns 0. */ + + int i; + if (x < 0) return (0); /* error */ + i = x >> IDXSHIFT; /* whole words */ + if (x & IDXMASK) i ++; /* partial word */ + return (i); + +} /* numwords */ + +/*------------------------------------------------------------------------*/ + +void free_svector(svector *x) +{ + /* Frees the memory used by x. Does nothing if x is NULL. */ + + if (x == NULL) { + fprintf(stderr, "Warning: Trying to free null svector.\n"); + return; + } + free(x->val); + free(x->sgn); + free(x); + return; + +} /* free_svector */ + +/*------------------------------------------------------------------------*/ + +svector* create_svector(svector *x, int m) +{ + /* Creates an svector that holds m svalues. If x is non-null, the + first min(x->m, m) entries are preserved. On error, returns + NULL. */ + + int nwrds = numwords(m); + + if (x == NULL) { /* create new svector */ + + if ((x = (svector*) calloc(1, sizeof(svector))) == NULL) { + fprintf(stderr, "Error allocating space for svector.\n"); + return (NULL); + } + x->m = m; + if (((x->val = (ulong*) calloc(nwrds, sizeof(ulong))) == NULL) || + ((x->sgn = (ulong*) calloc(nwrds, sizeof(ulong))) == NULL)) { + fprintf(stderr, "Error allocating space for svector components.\n"); + return (NULL); + } + + } /* if - create new svector */ + + else { /* enlarge or shrink previous svector */ + + x->m = m; + if (((x->val = (ulong*) realloc(x->val, nwrds * sizeof(ulong))) == NULL) || + ((x->sgn = (ulong*) realloc(x->sgn, nwrds * sizeof(ulong))) == NULL)) { + fprintf(stderr, "Error shrinking/enlarging svector.\n"); + return (NULL); + } + + } /* else - enlarge or shrink previous svector */ + + return(x); + +} /* create_svector */ + +/*------------------------------------------------------------------------*/ + +void write_svector(svector *x, FILE *fptr, int bflag) +{ + /* Writes x to the file pointed to by fptr in text (bflag=0) or + binary (bflag=1) format. On error, does nothing. */ + + int i; /* counter */ + ulong *valptr, *sgnptr; /* local pointers */ + ulong mask; /* bit mask */ + ulong val, sgn; /* current val and sgn words */ + + if (x == NULL) { + fprintf(stderr, "Warning: Trying to write NULL svector to file.\n"); + return; + } + + if (bflag) { /* binary */ + + i = numwords(x->m); + if (((fwrite(x->val, sizeof(ulong), i, fptr)) < i) || + ((fwrite(x->sgn, sizeof(ulong), i, fptr)) < i)) { + fprintf(stderr, "Error writing svector to binary file.\n"); + return; + } + + } /* if - binary */ + + else { /* text */ + + valptr = x->val; + sgnptr = x->sgn; + val = *valptr; + sgn = *sgnptr; + mask = ONE; + + /* Loop through each s-value in x. */ + for (i = 0; i < x->m; i ++) { + + /* Print out the appropriate value. */ + if (val & mask) { + if (sgn & mask) + fprintf(fptr, " -1"); + else + fprintf(fptr, " 1"); + } + else + fprintf(fptr, " 0"); + + /* Update mask, val, and sgn. */ + if (mask == MAXMASK) { + mask = ONE; + val = *(++valptr); + sgn = *(++sgnptr); + fprintf(fptr, "\n"); + } + else + mask <<= 1; + + } /* i-loop */ + + if (mask != (ONE)) fprintf(fptr, "\n"); + + } /* else - text */ + + return; + +} /* write_svector */ + +/*------------------------------------------------------------------------*/ + +svector* read_svector(int m, FILE *fptr, int bflag) +{ + /* Reads an svector from the file pointed to by fptr in text + (bflag=0) or binary (bflag=1) format. Returns a pointer to the + svector. On error, returns NULL. */ + + int i; /* counter */ + svector *x; /* new svector */ + int tmp; /* svalue read from file */ + int idx; /* index */ + ulong mask; /* bit mask */ + + i = numwords(m); + + if ((x = create_svector(NULL, m)) == NULL) + return (NULL); + + if (bflag) { /* binary */ + + if (((fread(x->val, sizeof(ulong), i, fptr)) < i) || + ((fread(x->sgn, sizeof(ulong), i, fptr)) < i)) { + fprintf(stderr, "Error reading svector from binary file.\n"); + return (NULL); + } + + } /* if - binary */ + + else { /* text */ + + bzero(x->val, numwords(m) * sizeof(ulong)); /* set val to all zeros */ + bzero(x->sgn, numwords(m) * sizeof(ulong)); /* set sgn to all zeros */ + + for (i = 0; i < m; i ++) { + + if ((fscanf(fptr, "%d", &tmp)) < 1) { + fprintf(stderr, "Error reading svector from text file.\n"); + return (NULL); + } + + if (tmp != 0) { + idx = i >> IDXSHIFT; /* word index */ + mask = ONE << (i & IDXMASK); /* bit mask */ + x->val[idx] |= mask; /* turn correct val bit to 1 */ + if (tmp == -1) + x->sgn[idx] |= mask; /* turn correct sgn bit to 1 */ + } + + } /* i-loop */ + + } /* else - text */ + + return (x); + +} /* read_svector */ + +/*------------------------------------------------------------------------*/ + +sdddouble *init_threshold(svector *y, matrix *A, sdd *B, sddfloat rho, int *idx) +{ + int i; /* counter */ + int m, n; /* size of A */ + int localidx; /* initialization index */ + sdddouble *s; /* return vector */ + sdddouble sqnorms = 0; /* squared norm of s */ + + if ((y == NULL) || (A == NULL) || (B == NULL)) { /* error */ + fprintf(stderr, "Error in initialization of y.\n"); + return (NULL); + } + + /* Allocate space for s and init to zero. */ + m = (A->m > A->n) ? A->m : A->n; + if ((s = (sdddouble*) calloc(m, sizeof(sdddouble))) == NULL) { + fprintf(stderr, "Error allocating space for s.\n"); + return (NULL); + } + + /* Set sizes. */ + m = A->m; + n = A->n; + + while (sqnorms < (rho / n)) { + + /* Set y */ + bzero(y->val, numwords(n) * sizeof(ulong)); + bzero(y->sgn, numwords(n) * sizeof(ulong)); + localidx = (*idx) % n; + y->val[localidx >> IDXSHIFT] |= ONE << (localidx & IDXMASK); + + /* Update iidx */ + (*idx) ++; + + /* Compute s */ + matrixxsv(s, A, y, 0); /* s = A * y */ + sddxsv(s, B, y, 0); /* s = s - B * y */ + + /* Compute squared norm of s */ + sqnorms = 0; + for (i = 0; i < m; i ++) + sqnorms += s[i] * s[i]; + + } /* while loop */ + + return (s); +} + +/*------------------------------------------------------------------------*/ + +void init_cycle(svector *y, int idx) +{ + int n; /* size of A */ + int localidx; /* initialization index */ + + if (y == NULL) { + fprintf(stderr, "Error trying to initialize NULL y-vector.\n"); + return; + } + + n = y->m; + + /* Set y */ + bzero(y->val, numwords(n) * sizeof(ulong)); + bzero(y->sgn, numwords(n) * sizeof(ulong)); + localidx = idx % n; + y->val[localidx >> IDXSHIFT] |= ONE << (localidx & IDXMASK); + + return; +} + +/*------------------------------------------------------------------------*/ + +void init_ones(svector *x) +{ + /* Initializes x so that every 100th s-value is 1, and all other + values are set to 0. Does nothing on error. */ + + int m; /* size of x */ + + if (x == NULL) { + fprintf(stderr, "Error trying to initialize NULL y-vector.\n"); + return; + } + + m = x->m; + + bone(x->val, numwords(m) * sizeof(ulong)); /* set x to all ones */ + bzero(x->sgn, numwords(m) * sizeof(ulong)); /* set x to all oness */ + + return; + +} /* init_pones */ + +/*------------------------------------------------------------------------*/ + +void init_pones(svector *x) +{ + /* Initializes x so that every 100th s-value is 1, and all other + values are set to 0. Does nothing on error. */ + + int i; /* counter */ + int m; /* size of x */ + + if (x == NULL) { + fprintf(stderr, "Error trying to initialize NULL y-vector.\n"); + return; + } + + m = x->m; + + bzero(x->val, numwords(m) * sizeof(ulong)); /* set x to all zeros */ + bzero(x->sgn, numwords(m) * sizeof(ulong)); /* set x to all zeros */ + + /* set every 100th element in x to 1 */ + for (i = 0 ; i < m ; i += 100) { + x->val[i >> IDXSHIFT] |= ONE << (i & IDXMASK); + } + + return; + +} /* init_pones */ + +/*------------------------------------------------------------------------*/ + +int svcount(svector *x) +{ + /* Returns the number of non-zero values in x. On error, returns + zero. */ + + int i, j; /* counters */ + int cnt; /* counter */ + int nwrds; /* number of whole words used in x */ + ulong val; /* temporary variable */ + ulong mask; /* mask for final word */ + static int *cntlookup = NULL; /* static look-up table */ + + if (x == NULL) return(0); /* error */ + + /* The array cntlookup is a lookup table of length 2^8 that, for + each byte used as an index, returns the number of 1-bits in that + byte. Allocate space for and compute the static look-up table + cntlookup. Note that since this variable is static, we only + compute the look-up table the first time this function is + called. We use this table for speed. For a given byte x, + cntlookup[x] = number of one bits in x. */ + + if (cntlookup == NULL) { + if ((cntlookup = (int*) calloc(256, sizeof(int))) == NULL) { + fprintf(stderr, "Error allocating space for look-up table.\n"); + return(0); + } + for (i = 0; i < 256; i ++) { + mask = i; + cnt = 0; + for (j = 0; j < 8; j ++) { + if (mask & 1) cnt ++; + mask >>= 1; + } + cntlookup[i] = cnt; + } + } + + nwrds = numwords(x->m); /* number of words in x */ + + /* compute mask for final partial word with (x->m & idxmask) 1-bits */ + mask = (ONE << (x->m & IDXMASK)) - 1; + if (mask) x->val[nwrds - 1] &= mask; + + /* Count the number of 1 bits in the whole words of val. For + efficiency, we look at the val array one byte at a time (rather + than one bit at a time) using the cntlookup array. The means we + trade 8 right shifts, 8 AND's, and 8 adds for one right shift, + one and, one add, and one array look-up. Generally, the cntlookup + array should easily fit into cache memory. */ + + cnt = 0; + for (i = 0 ; i < nwrds; i ++) { + val = x->val[i]; + for (j = 0 ; j < sizeof(ulong) ; j ++) { + cnt += cntlookup[val & 0xff]; + val >>= 8; + } + } + + return(cnt); + +} /* svcount */ + +/*------------------------------------------------------------------------ + Functions for S-Matrices + ------------------------------------------------------------------------*/ + +smatrix* create_smatrix(smatrix *A, int kmin, int kmax, int m) +{ + /* Returns a ptr to an smatrix of maximum dimension m by kmax, and + of current dimension m by kmin. If A is non-null, then the first + min(A->m, m) s-values of the first kmin columns of A are + preserved. On error, returns NULL. */ + + int k; /* counter */ + + if ((kmax <= 0) || (m <= 0) || (kmin < 0)) { /* error checking */ + fprintf(stderr, "Error in requested size of smatrix.\n"); + return (NULL); + } + + if (kmin > kmax) { /* error checking */ + fprintf(stderr, "Max k-dimension less than min dimension.\n"); + return (NULL); + } + + if (A == NULL) { /* starting from scratch */ + + if (kmin != 0) { /* error checking */ + fprintf(stderr, "Invalid kmin dimension.\n"); + return (NULL); + } + + if ((A = (smatrix*) calloc(1, sizeof(smatrix))) == NULL) { + fprintf(stderr, "Error allocating memory for smatrix.\n"); + return (NULL); + } + + A->k = 0; /* current columns in A */ + A->kmax = kmax; /* max size columns in A */ + A->m = m; /* number of rows in A */ + + /* allocate column pointers */ + if ((A->col = (svector**) calloc(kmax, sizeof(svector*))) == NULL) { + fprintf(stderr, "Error allocating space for smatrix columns.\n"); + return (NULL); + } + + } /* if - starting from scratch */ + + else { /* enlarging or shrinking A */ + + /* If nothing needs to be changed, just return A. */ + if ((A->k == kmin) && (A->kmax == kmax) && (A->m == m)) + return (A); + + /* If the current A has too many columns defined, delete some. */ + if (kmin < A->k) { + for (k = kmin; k < A->k; k ++) + free_svector(A->col[k]); + A->k = kmin; + } + + /* If the current A does not have the right number of rows, + re-create each column vector, adjusting to the new size. */ + if (m != A->m) { + for (k = 0; k < A->k; k ++) + if ((A->col[k] = create_svector(A->col[k], m)) == NULL) { + fprintf(stderr, "Error recreating svectors.\n"); + return (NULL); + } + A->m = m; + } + + /* If A does not have the right maximum number of columns, adjust + that. */ + if (kmax != A->kmax) { + if ((A->col = (svector**) realloc(A->col, kmax * sizeof(svector*))) + == NULL) { + fprintf(stderr, "Error enlarging number of columns in A matrix,\n"); + return (NULL); + } + A->kmax = kmax; + } + + } /* else - enlarging / shrinking A */ + + return (A); + +} /* create_smatrix */ + +/*------------------------------------------------------------------------*/ + +void write_smatrix(smatrix *A, FILE *fptr, int bflag) +{ + /* Writes the smatrix A to the file pointed to by fptr in text + (flag=0) or binary (bflag=1) format. */ + + int k; /* counter */ + + /* Simply write each svector to the file in sequence. */ + for (k = 0; k < A->k; k ++) + write_svector(A->col[k], fptr, bflag); + + return; + +} /* write_smatrix */ + +/*------------------------------------------------------------------------*/ + +smatrix* read_smatrix(int m, int k, FILE *fptr, int bflag) +{ + /* Read in an smatrix of size m by k from the file pointed to by + fptr in text (bflag=0) or binary (bflag=1) format. Return a + pointer to the new smatrix. On error, returns NULL. */ + + smatrix *A; /* smatrix to be read in */ + + /* Create the matrix */ + if ((A = (smatrix*) calloc(1, sizeof(smatrix))) == NULL) { + fprintf(stderr, "Error allocating memory for smatrix.\n"); + return (NULL); + } + + A->m = m; + A->k = k; + A->kmax = k; + + if ((A->col = (svector**) calloc(k, sizeof(svector*))) == NULL) { + fprintf(stderr, "Error allocating memory for smatrix columns.\n"); + return (NULL); + } + + /* Read in the columns in sequence */ + for (k = 0; k < A->k; k ++) + if ((A->col[k] = read_svector(m, fptr, bflag)) == NULL) { + fprintf(stderr, "Error reading smatrix from file.\n"); + return (NULL); + } + + return (A); + +} /* read_smatrix */ + +/*------------------------------------------------------------------------*/ + +void expand_smatrix(smatrix *A, svector *x) +{ + /* Add x as the next column in A. On error, prints message. */ + + if (x->m != A->m) { + fprintf(stderr, "Error: Size mismatch.\n"); + return; + } + + if (A->k == A->kmax) { + fprintf(stderr, "Error: Smatrix is full.\n"); + return; + } + + A->col[A->k] = x; + A->k ++; + return; + +} /* expand_smatrix */ + +/*------------------------------------------------------------------------*/ + +void free_smatrix(smatrix *A) +{ + /* Frees the memory used by A. */ + + int k; /* counter */ + + if (A == NULL) { + fprintf(stderr, "Warning: Trying to free NULL smatrix.\n"); + return; + } + + if (A->col != NULL) { + for (k = 0; k < A->k; k ++) + free_svector(A->col[k]); + free(A->col); + } + free(A); + return; + +} /* free_smatrix */ + + +/*------------------------------------------------------------------------ + Functions for D-Matrices + ------------------------------------------------------------------------*/ + +dmatrix* create_dmatrix(dmatrix *D, int kmin, int kmax) +{ + /* Returns a ptr to a dmatrix of maximum size kmax. If D is + non-null then the first kmin elements of D are preserved. On + error, returns NULL. */ + + if ((kmin < 0) || (kmax <= 0) || (kmin > kmax)) { /* error checking */ + fprintf(stderr, "Error in parameters for dmatrix.\n"); + return (NULL); + } + + if (D == NULL) { /* start from scratch */ + + if ((D = (dmatrix*) calloc(1, sizeof(dmatrix))) == NULL) { + fprintf(stderr, "Error allocating space for dmatrix.\n"); + return (NULL); + } + + D->k = 0; + D->kmax = kmax; + + if ((D->d = (sddfloat*) calloc(kmax, sizeof(sddfloat))) == NULL) { + fprintf(stderr, "Error allocating space for dmatrix values,\n"); + return (NULL); + } + + } /* if - start from scratch */ + + else { /* enlarging or shrinking D */ + + /* Delete extra elements, if necessary. */ + + if (kmin > D->k) { + fprintf(stderr, "Error: kmin too big for dmatrix.\n"); + return (NULL); + } + + D->k = kmin; + + /* Expand or shrink maximum number of elements, if necessary. */ + + if (D->kmax != kmax) { + D->kmax = kmax; + if ((D->d = (sddfloat*) realloc(D->d, kmax * sizeof(sddfloat))) == NULL) { + fprintf(stderr, "Error in reallocating memory for dmatrix.\n"); + return (NULL); + } + } + + } /* else - enlarge/shrink */ + + return (D); + +} /* create_dmatrix */ + +/*------------------------------------------------------------------------*/ + +void write_dmatrix(dmatrix *D, FILE *fptr, int bflag) +{ + /* Writes D to the file pointed to by fptr in text (bflag=0) or + binary (bflag=1) format. On error, prints message.*/ + + int k; /* counter */ + + if (bflag) { /* binary */ + + if ((fwrite(D->d, sizeof(sddfloat), D->k, fptr)) < D->k) { + fprintf(stderr, "Error writing dmatrix to binary file.\n"); + return; + } + + } /* if - binary */ + + else { /* text */ + + for (k = 0; k < D->k; k ++) + fprintf(fptr, "%30.25e\n", D->d[k]); + + } /* else - text */ + + return; + +} /* write_dmatrix */ + +/*------------------------------------------------------------------------*/ + +dmatrix* read_dmatrix(int k, FILE *fptr, int bflag) +{ + /* Read a dmatrix of size k from the file pointed to by fptr in text + format (bflag=0) or binary format (bflag=1). Return a ptr to the + dmatrix. On error, returns NULL. */ + + int i; /* counter */ + dmatrix *D; /* matrix to be read in */ + + if ((D = (dmatrix*) calloc(1, sizeof(dmatrix))) == NULL) { + fprintf(stderr, "Error allocating space for dmatrix.\n"); + return (NULL); + } + + D->k = k; /* set current size */ + D->kmax = k; /* set max size */ + + if ((D->d = (sddfloat*) calloc(k, sizeof(sddfloat))) == NULL) { + fprintf(stderr, "Error allocating space for dmatrix entries.\n"); + return (NULL); + } + + if (bflag) { /* binary */ + + if ((fread(D->d, sizeof(sddfloat), k, fptr)) < k) { + fprintf(stderr, "Error reading D from file.\n"); + return (NULL); + } + + } /* if - binary */ + + else { /* text */ + + for (i = 0; i < k; i ++) + if ((fscanf(fptr, "%e", D->d + i)) < 1) { + fprintf(stderr, "Error reading D from file.\n"); + return (NULL); + } + + } /* else - text */ + + return (D); + +} /* read_dmatrix */ + +/*------------------------------------------------------------------------*/ + +void expand_dmatrix(dmatrix *D, sddfloat d) +{ + /* Add d to the next open spot in D. On error, prints message. */ + + if (D == NULL) { + fprintf(stderr, "Cannot expand NULL Dmatrix.\n"); + return; + } + + if (D->k == D->kmax) { + fprintf(stderr, "Error: Dmatrix is full.\n"); + return; + } + + D->d[D->k] = d; + D->k ++; + + return; + +} /* expand_dmatrix */ + +/*------------------------------------------------------------------------*/ + +void free_dmatrix(dmatrix *D) +{ + /* Free the memory used by D. Does nothing if D is null. */ + + if (D == NULL) { + fprintf(stderr, "Warning: Trying to free NULL D-Matrix.\n"); + return; + } + + free(D->d); + free(D); + return; + +} /* free_dmatrix */ + +/*------------------------------------------------------------------------ + Functions for SDD's + ------------------------------------------------------------------------*/ + +sdd* create_sdd(sdd *A, int m, int n, int kmin, int kmax) +{ + /* Returns a pointer to an SDD for an m by n matrix. The maximum + allowable number of terms is kmax. If A is non-null, then the + first kmin terms are preserved. On error, returns NULL. */ + + /* Error checking */ + if ((m <= 0) || (n <= 0) || (kmin < 0) || (kmax <= 0) || (kmin > kmax)) { + fprintf(stderr, "Error in size parameters for SDD.\n"); + return (NULL); + } + + if (A == NULL) { /* start from scratch */ + + if (kmin != 0) { + fprintf(stderr, "Warning: Specified nonzero existing kmax for new SDD.\n"); + kmin = 0; + } + + /* Allocate space for A, and initialize pointers to NULL. */ + if ((A = (sdd*) calloc(1, sizeof(sdd))) == NULL) { + fprintf(stderr, "Error allocating space for SDD.\n"); + return (NULL); + } + + } /* if start from scratch */ + + else { /* appending A */ + + if (kmin > A->k) { + fprintf(stderr, "Error in kmin parameter for SDD.\n"); + return (NULL); + } + + } /* appending A */ + + /* Fill in A */ + A->m = m; + A->n = n; + A->k = kmin; + A->kmax = kmax; + if (((A->X = create_smatrix(A->X, kmin, kmax, m)) == NULL) || + ((A->Y = create_smatrix(A->Y, kmin, kmax, n)) == NULL) || + ((A->D = create_dmatrix(A->D, kmin, kmax)) == NULL)) { + fprintf(stderr, "Error allocating memory for SDD components.\n"); + return (NULL); + } + + return (A); + +} /* create_sdd */ + +/*------------------------------------------------------------------------*/ + +void write_sdd(sdd *A, char *fname, int bflag, char *note) +{ + /* Write A to the file named fname in text (bflag=0) or binary + (bflag=1) format. The extra stuff (matrixf, edecompf, kmin, tol) + is written in the comments for a text file. On error, print + message. */ + + FILE *fptr; + + if (A == NULL) { + fprintf(stderr, "Error trying to write NULL SDD to file,\n"); + return; + } + + /* Write Header Information */ + if (bflag) { /* binary */ + + if ((fptr = fopen(fname, "wb")) == NULL) { + fprintf(stderr, "Error opening output file.\n"); + return; + } + + fwrite(&A->k, sizeof(int), 1, fptr); + fwrite(&A->m, sizeof(int), 1, fptr); + fwrite(&A->n, sizeof(int), 1, fptr); + + } /* if - binary */ + + else { /* text */ + + if ((fptr = fopen(fname, "w")) == NULL) { + fprintf(stderr, "Error opening output file.\n"); + return; + } + + fprintf(fptr, "%%%% Semidiscrete Decomposition (SDD)\n"); + if (note != NULL) + fprintf(fptr, "%%%% %s\n", note); + fprintf(fptr, "%d %d %d\n", A->k, A->m, A->n); + + } /* else - text */ + + /* Write out components of SDD */ + write_dmatrix(A->D, fptr, bflag); + write_smatrix(A->X, fptr, bflag); + write_smatrix(A->Y, fptr, bflag); + + fclose(fptr); + return; + +} /* write_sdd */ + +/*------------------------------------------------------------------------*/ + +sdd* read_sdd(char *fname, int bflag) +{ + /* Read an sdd from the file named fname in text (bflag=0) or binary + (bflag=1) format. On error, return NULL. */ + + sdd *A; /* sdd to be read in */ + char s[MAXLINE]; /* line of input file */ + FILE *fptr; /* input file pointer */ + + if ((A = (sdd*) calloc(1, sizeof(sdd))) == NULL) { + fprintf(stderr, "Error allocating memory for SDD.\n"); + return (NULL); + } + + /* Get header information */ + if (bflag) { /* binary */ + + if ((fptr = fopen(fname, "rb")) == NULL) { + fprintf(stderr, "Error in opening input file.\n"); + free(A); + return (NULL); + } + + if (((fread(&A->k, sizeof(int), 1, fptr)) < 1) || + ((fread(&A->m, sizeof(int), 1, fptr)) < 1) || + ((fread(&A->n, sizeof(int), 1, fptr)) < 1)) { + fprintf(stderr, "Error reading input file.\n"); + return (NULL); + } + + } /* if - binary */ + + else { /* text */ + + if ((fptr = fopen(fname, "r")) == NULL) { + fprintf(stderr, "Error in opening input file.\n"); + return (NULL); + } + + /* Scan through comment lines */ + do + if (fgets(s, MAXLINE, fptr) == NULL) { + fprintf(stderr, "Error reading header of text SDD input file\n"); + return (NULL); + } + while(s[0] == '%'); + + if ((sscanf(s, "%d %d %d", &A->k, &A->m, &A->n)) < 3) { + fprintf(stderr, "Error reading dimensions from SDD file.\n"); + return (NULL); + } + + } /* else - text */ + + + /* Fill in remainder of SDD */ + + A->kmax = A->k; + + if (((A->D = read_dmatrix(A->k, fptr, bflag)) == NULL) || + ((A->X = read_smatrix(A->m, A->k, fptr, bflag)) == NULL) || + ((A->Y = read_smatrix(A->n, A->k, fptr, bflag)) == NULL)) { + fprintf(stderr, "Error reading SDD.\n"); + return (NULL); + } + + fclose(fptr); + return (A); + +} /* read_sdd */ + +/*------------------------------------------------------------------------*/ + +void expand_sdd(sdd *A, sddfloat d, svector *x, svector *y) +{ + /* Adds d and the svectors x and y to the next spot in A, and + updates the number of terms in A. On error, prints warning. */ + + if (A->k == A->kmax) { + fprintf(stderr, "Error: SDD is full.\n"); + return; + } + + expand_dmatrix(A->D, d); + expand_smatrix(A->X, x); + expand_smatrix(A->Y, y); + A->k ++; + return; + +} /* expand_sdd */ + +void free_sdd(sdd *A){ + + /* Frees the memory used by A. Does nothing if A is NULL. */ + + if (A == NULL) { + fprintf(stderr, "Warning: Trying to free NULL matrix.\n"); + return; + } + + free_smatrix(A->X); + free_smatrix(A->Y); + free_dmatrix(A->D); + free(A); + return; + +} /* free_sdd */ + +/*------------------------------------------------------------------------ + Subroutines which use a variety of data types. + ------------------------------------------------------------------------*/ + +void sddxsv(sdddouble *s, sdd *A, svector *y, int tflag) +{ + /* SDD times Svector. Computes s = s - A y where s is a A->m long + real vector (of type sdddouble), A is an SDD, and y is an A->n long + svector. A is transposed if tflag=1, and then we assume s is + A->n long and y is A->m long. The vector s is modified. All the + other vectors are unchanged. On error, prints message. */ + + int i, j, k; /* counters */ + int kmax; /* number of terms in SDD A */ + int nwrds; /* number of words in y */ + int cnt; /* counter */ + sdddouble tmp; /* tmp value */ + smatrix *X, *Y; /* local pointers */ + sddfloat *D; /* local pointer */ + ulong val, sgn; /* used in inner product calculation */ + ulong mask; /* used for last partial word */ + ulong *xvalptr, *xsgnptr; /* pointers to walk through arrays */ + ulong *yvalptr, *ysgnptr; /* pointers to walk through arrays */ + sdddouble *tmpvec = NULL; /* temporary workspace holds A y */ + static int *cntlookup = NULL; /* static look-up table */ + + if (A->k == 0) return; /* A is empty, do nothing */ + + /* Allocate space for tmpvec. */ + + if ((tmpvec = (sdddouble*) calloc(A->kmax, sizeof(sdddouble))) == NULL) { + fprintf(stderr, "Error allocating work space for sdd times vec.\n"); + return; + } + + /* Allocate space for and compute the static look-up table + cntlookup. Note that since this variable is static, we only + compute the look-up table the first time this function is + called. We use this table for speed. For a given byte x, + cntlookup[x] = number of one bits in x. */ + + if (cntlookup == NULL) { + if ((cntlookup = (int*) calloc(256, sizeof(int))) == NULL) { + fprintf(stderr, "Error allocating space for look-up table.\n"); + return; + } + for (i = 0; i < 256; i ++) { + mask = i; + cnt = 0; + for (j = 0; j < 8; j ++) { + if (mask & 1) cnt ++; + mask >>= 1; + } + cntlookup[i] = cnt; + } + } + + /* Assign X, Y, and D to local variables. Note that transposing the + SDD A only has the effect of swapping the X and Y matrices, so + that is the only thing we need to do if tflag=1. */ + + kmax = A->k; + + if (tflag) { /* Transpose => Swap X and Y */ + X = A->Y; + Y = A->X; + } + else { + X = A->X; + Y = A->Y; + } + + D = (A->D)->d; + + /* COMPUTE tmpvec = Y'y */ + + if (y->m != Y->m) { /* error checking */ + fprintf(stderr, "Size mismatch.\n"); + return; + } + + yvalptr = y->val; + ysgnptr = y->sgn; + + nwrds = numwords(y->m); + mask = (ONE << (Y->m & IDXMASK)) - 1; + if (mask) ysgnptr[nwrds - 1] &= mask; + + /* Loop through each column of Y, computing its inner product with y + which will be added to s[k]. */ + + for (k = 0; k < kmax; k ++) { + + /* Set xvalptr and xsgnptr to the beginnings of the (k+1)st column + of Y's val and sgn arrays. */ + + xvalptr = (Y->col[k])->val; + xsgnptr = (Y->col[k])->sgn; + + /* Mask final partial word, if it exists */ + if (mask) { + xvalptr[nwrds-1] &= mask; + xsgnptr[nwrds-1] &= mask; + } + + cnt = 0; /* This will be the value of the innner product when + we are done. */ + + /* Do whole words first. */ + + for (i = 0; i < nwrds; i ++) { + + /* Rather than going through comparing y and the (k+1)st column + of Y s-value by s-value, we will handle BITS_PER_WORD + s-values at once. Assuming there are 32 bits_per_word, we + are trading a _MINIMUM_ of 32 shifts, 32 AND's, and 32 + compares for 2 AND's, 1 XOR, 8 adds, 8 array look-ups, 4 + multiplies, and 8 right shifts. Generally, the cntlookup + array should easily fit into cache memory. + + Here is a brief mathematical explanation of what we are + doing: suppose we have two s-values a and b. If we AND the + val bits, we get 1 if a*b = +1 or -1, and 0 if a*b = 0; call + this bit c. If a*b = -1, the XOR of the sgn bits is 1, and + if a*b = 1, the XOR of the sgn bits is 0. If a*b = 0, the + XOR of the sgn bits could be anything. In order to make sure + it is zero if a*b = 0, we AND c with the result of the XOR of + the sgn bits; Call this d. Finally, a * b = c - 2 * d. We + are doing the same thing below, but rather than dealing with + one pair of s-values at a time, we are dealing with 32! */ + + val = xvalptr[i] & yvalptr[i]; + sgn = xsgnptr[i] ^ ysgnptr[i]; + sgn &= val; + + for (j = 0; j < sizeof(ulong); j ++) { + cnt += cntlookup[val & 0xff]; + cnt -= 2 * cntlookup[sgn & 0xff]; + val >>= 8; + sgn >>= 8; + } + } + + tmpvec[k] = cnt; + + } /* k-loop */ + + + /*------------------------------ + Compute tmpvec = D * tmpvec + ------------------------------*/ + + for (k = 0; k < kmax; k ++) + tmpvec[k] *= D[k]; + + /*------------------------------ + Compute s -= X * tmpvec + ------------------------------*/ + + /* Cycle through the columns of X. */ + + for (k = 0; k < kmax; k ++) { + + tmp = tmpvec[k]; /* Copy tmpvec[k] to a local variable */ + xvalptr = (X->col[k])->val; /* Set xvalptr to the beginning to val */ + xsgnptr = (X->col[k])->sgn; /* Set xsgnptr to the beginning to sgn */ + val = *xvalptr; /* Dereference the xvalptr */ + sgn = *xsgnptr; /* Dereference the xsgnptr */ + mask = ONE; /* Initialize the mask */ + + + /* This loop will go through each s-value in X->m. */ + + for (i = 0; i < X->m; i ++) { + + /* Mask picks off the current s-value. */ + + if (val & mask) { /* i-th s-value is nonzero */ + if (sgn & mask) /* X[i,k] = -1 */ + s[i] += tmp; + else /* X[i,k] = 1 */ + s[i] -= tmp; + } + + /* Update mask and, if necessary, val and sgn. */ + + if (mask == MAXMASK) { + mask = ONE; /* Reinitialize the mask. */ + val = *(++xvalptr); /* Increment the pointer and dereference. */ + sgn = *(++xsgnptr); /* Increment the pointer and dereference. */ + } + else + mask <<= 1; /* Update the mask. */ + + } /* i-loop */ + + } /* k-loop */ + + free(tmpvec); + return; + +} /* smxsv */ + +/*------------------------------------------------------------------------*/ + +void smxv(smatrix *X, int kmax, sdddouble *y, int tflag, sdddouble *r) +{ + /* Smatrix times vector. Computes r = X * y using only the + first kmax columns of X where X is an smatrix, y is an kmax-long + real vector (of type sdddouble), and r is an X->m long real vector + (of type double-type). If tflag is TRUE, then the transpose of X + is used, y should be of length X->m and s should be of length + kmax. On error, prints message. */ + + int j, k, m; /* counters */ + ulong *valptr, *sgnptr; /* tmp pointers */ + ulong mask; /* mask out certain bits */ + ulong val, sgn; /* tmp values */ + sdddouble tmp; /* tmp value */ + + m = X->m; /* copy to a local variable */ + + if (tflag) { /* tranpose */ + + /* Cycle through each column of X. */ + + for (k = 0; k < kmax; k ++) { + + tmp = 0; /* This will be r[k]. */ + valptr = (X->col[k])->val; /* Set to beginning of the val array + * for the (k+1)st column of X. */ + sgnptr = (X->col[k])->sgn; /* Set to the beginning of the sgn + * array for the (k+1)st column of X. */ + val = *valptr; /* Dereference into local variable. */ + sgn = *sgnptr; /* Dereference into local variable. */ + mask = ONE; /* Initialize the mask. */ + + /* Cycle through each value in y. */ + + for (j = 0; j < m; j ++) { + + /* Compute y(j) * X(j,k) and update tmp. Mask picks off the + correct s-value. */ + + if (val & mask) { /* X(j,k) is nonzero */ + if (sgn & mask) /* X(j,k) is -1 */ + tmp -= y[j]; + else /* X(j,k) is 1 */ + tmp += y[j]; + } + + /* Update the mask and, if necessary, val and sgn. */ + + if (mask == MAXMASK) { + mask = ONE; /* Reinitialize the mask. */ + val = *(++valptr); /* Increment the pointer and dereference. */ + sgn = *(++sgnptr); /* Increment the pointer and dereference. */ + } + else + mask <<= 1; /* Update the mask. */ + + } /* j-loop */ + + r[k] = tmp; /* Copy tmp to r[k]. */ + + } /* k-loop */ + + } /* if - transpose */ + + else { /* transpose */ + + bzero(r, m * sizeof(sdddouble)); /* Set all elements of r to zero. */ + + /* Cycle through each value in y. */ + + for (k = 0; k < kmax; k ++) { + + tmp = y[k]; /* Copy to a local variable. */ + valptr = (X->col[k])->val; /* Set to beginning of the val array + for the (k+1)st column of X. */ + sgnptr = (X->col[k])->sgn; /* Set to the beginning of the sgn + array for the (k+1)st column of X. */ + val = *valptr; /* Dereference into local variable. */ + sgn = *sgnptr; /* Dereference into local variable. */ + mask = ONE; /* Initialize the mask. */ + + for (j = 0; j < m; j ++) { + + if (val & mask) { /* X(j,k) is nonzero */ + if (sgn & mask) /* X(j,k) is -1 */ + r[j] -= tmp; + else /* X(j,k) is 1 */ + r[j] += tmp; + } + + /* Update the mask and, if necessary, val and sgn. */ + + if (mask == MAXMASK) { + mask = ONE; /* Reinitialize the mask. */ + val = *(++valptr); /* Increment the pointer and dereference. */ + sgn = *(++sgnptr); /* Increment the pointer and dereference. */ + } + else + mask <<=1; /* Update the mask. */ + + } /* j-loop */ + + } /* k-loop */ + + } /* else - no transpose*/ + + return; + +} /* smxv */ + +/*------------------------------------------------------------------------*/ + +void free_matrix(matrix *A) +{ + + /* Free memory used by A. Does nothing if A is NULL. */ + + if (A == NULL) { + fprintf(stderr, "Warning: Trying to free NULL matrix.\n"); + return; + } + free(A->jc); + free(A->ir); + free(A->val); + free(A); + return; + +} /* free_matrix */ + +void write_matrix(matrix *A, char *fname, int bflag) +{ + /* Writes A to file named fname in text (bflag=0) or binary + (bflag=1) format. Text output is compatible with MatrixMarket + format. Does nothing if A is null. On error, prints message. */ + + int i, j; /* counters */ + FILE *out; /* pointer to output file */ + + if (A == NULL) return; + + if (bflag) { /* binary */ + + if ((out = fopen(fname, "wb")) == NULL) { + fprintf(stderr, "Error opening binary sparse matrix output file.\n"); + return; + } + + fwrite(&A->m, sizeof(int), 1, out); + fwrite(&A->n, sizeof(int), 1, out); + fwrite(&A->nnz, sizeof(int), 1, out); + fwrite(A->jc, sizeof(int), A->n + 1, out); + fwrite(A->ir, sizeof(int), A->nnz, out); + fwrite(A->val, sizeof(float), A->nnz, out); + + fclose(out); + + } /* binary */ + + else { /* text */ + + if ((out = fopen(fname, "w")) == NULL) { + fprintf(stderr, "Error opening text sparse matrix output file.\n"); + return; + } + + fprintf(out, "%%%%MatrixMarket matrix coordinate real general\n"); + fprintf(out, "%% File generated by SDDPACK.\n"); + fprintf(out, "%d ", A->m); + fprintf(out, "%d ", A->n); + fprintf(out, "%d\n", A->nnz); + + for (j = 0; j < A->n; j++) + for (i = A->jc[j]; i < A->jc[j+1]; i ++) + fprintf(out, "%4d %4d %15.6e\n", A->ir[i] + 1, j + 1, A->val[i]); + + fclose(out); + + } /* text */ + + return; + +} /* write_matrix */ + +/*------------------------------------------------------------------------*/ + +matrix *read_matrix(char *fname, int bflag) +{ + + /* Reads a sparse matrix in text (bflag=0) or binary (bflag=1) + format from file named fname. (The text matrix should be in + general real coordinate MatrixMarket format. If you prefer to use + binary format, the convertmtx utility will convert a general real + coordinate MatrixMarket file to binary format.) Creates and + allocates memory for a new matrix structure to contain the sparse + matrix. Returns a pointer to the matrix. On error, returns + NULL. */ + + int i, j, curj, cnt; /* counters */ + float val; /* matrix entry */ + char s[MAXLINE]; /* line of input file */ + FILE *in; /* pointer to input file */ + entry *a; /* entries of the sparse matrix */ + matrix *A; /* pointer to sparse matrix */ + + if (bflag) { /* binary */ + + if ((in = fopen(fname, "rb")) == NULL) { + fprintf(stderr, "Error opening binary sparse matrix input file.\n"); + return (NULL); + } + + if ((A = (matrix *) malloc(sizeof(matrix))) == NULL) { + fprintf(stderr, "Memory allocation error.\n"); + return (NULL); + } + + if (((fread(&A->m, sizeof(int), 1, in)) < 1) || + ((fread(&A->n, sizeof(int), 1, in)) < 1) || + ((fread(&A->nnz, sizeof(int), 1, in)) < 1)) { + fprintf(stderr, "Error reading sparse matrix input file.\n"); + return (NULL); + } + + if (((A->jc = (int *) calloc(A->n + 1, sizeof(int))) == NULL) || + ((A->ir = (int *) calloc(A->nnz, sizeof(int))) == NULL) || + ((A->val = (float *) calloc(A->nnz, sizeof(float))) == NULL)) { + fprintf(stderr, "Memory allocation error.\n"); + return (NULL); + } + + if (((fread(A->jc, sizeof(int), A->n + 1, in)) < A->n + 1) || + ((fread(A->ir, sizeof(int), A->nnz, in)) < A->nnz) || + ((fread(A->val, sizeof(float), A->nnz, in)) < A->nnz)) { + fprintf(stderr, "Error reading sparse matrix input file.\n"); + return (NULL); + } + + fclose(in); + + return (A); + + } /* if - binary */ + + else { /* text */ + + if ((in = fopen(fname, "r")) == NULL) { + fprintf(stderr, "Error opening text sparse matrix input file.\n"); + return (NULL); + } + + /* Scan past comment lines. */ + do + if (fgets(s, MAXLINE, in) == NULL) { + fprintf(stderr, "Error reading header of sparse matrix input file\n"); + return (NULL); + } + while(s[0] == '%'); + + if ((A = (matrix*) malloc(sizeof(matrix))) == NULL) { + fprintf(stderr, "Memory allocation error.\n"); + return (NULL); + } + + if (sscanf(s, "%d %d %d", &A->m, &A->n, &A->nnz) != 3) { + fprintf(stderr, "Error reading sparse matrix input file.\n"); + return (NULL); + } + + if ((a = (entry*) calloc(A->nnz, sizeof(entry))) == NULL) { + fprintf(stderr, "Memory allocation error.\n"); + return (NULL); + } + + cnt = 0; + while ((fscanf(in, "%d %d %f", &i, &j, &val)) == 3) { + + if ((i <= 0) || (i > A->m)) { + fprintf(stderr, "Invalid row index i=%d, not in range 1 to %d\n", i, A->m); + exit(1); + } + if ((j <= 0) || (j > A->n)) { + fprintf(stderr, "Invalid row index j=%d, not in range 1 to %d\n", j, A->n); + exit(1); + } + + a[cnt].i = i - 1; + a[cnt].j = j - 1; + a[cnt ++].val = val; + } + + fclose(in); + + if (cnt < A->nnz) { + fprintf(stderr, "WARNING: Reported number of nonzeros (%d) ", A->nnz); + fprintf(stderr, "is less than number read in (%d). Adjusting. \n", cnt); + A->nnz = cnt; + } + + qsort(a, cnt, sizeof(entry), (int(*)(const void*, const void*))comparentry); + + if (((A->jc = (int *) calloc(A->n + 1, sizeof(int))) == NULL) || + ((A->ir = (int *) calloc(A->nnz, sizeof(int))) == NULL) || + ((A->val = (float *) calloc(A->nnz, sizeof(float))) == NULL)) + { + fprintf(stderr, "Memory allocating error.\n"); + return (NULL); + } + + cnt = 0; + curj = 0; + A->jc[0] = 0; + for (i = 0; i < A->nnz; i ++) { + while (curj < a[i].j) A->jc[++ curj] = cnt; + A->ir[cnt] = a[i].i; + A->val[cnt ++] = a[i].val; + } + + while (curj < A->n) A->jc[++ curj] = cnt; + + free(a); + + return (A); + + } /* else - text */ + +} /* read_matrix */ + +/*------------------------------------------------------------------------*/ + +void matrixxv(float *y, matrix *A, float *x, int tflag) +{ + /* Computes y = A * x (tflag = 0) or y = A' * x (tflag = 1). Vectors + x and y are assumed to be the appropriate sizes. The vector y is + initialized to zero. On error, prints message. */ + + int i, j; /* counters */ + + if ((y == NULL) || (A == NULL) || (x == NULL)) { + fprintf(stderr, "Null input argument for matrix-vector multiply.\n"); + return; + } + + if (tflag) { /* tranpose */ + for (j = 0; j < A->n; j ++) y[j] = 0; + for (j = 0; j < A->n; j ++) + for (i = A->jc[j]; i < A->jc[j+1]; i ++) + y[j] += A->val[i] * x[A->ir[i]]; + } + else { /* no transpose */ + for (i = 0; i < A->m; i ++) y[i] = 0; + for (j = 0; j < A->n; j ++) + for (i = A->jc[j]; i < A->jc[j+1]; i ++) + y[A->ir[i]] += A->val[i] * x[j]; + } + + return; + +} /* matrixxv */ + +/*------------------------------------------------------------------------*/ + +double fnormsq(matrix *A) +{ + /* Returns the sum of all the squares of the elements of + sparse matrix A. On error, returns zero. */ + + int i; /* counter */ + double f = 0; /* sum */ + + if (A == NULL) return (f); + + for (i = 0; i < A->nnz; i ++) + f += A->val[i] * A->val[i]; + + return (f); + +} /* fnormsq */ + +/*------------------------------------------------------------------------*/ + +void matrixxsv(sdddouble *s, matrix *A, svector *y, int tflag) +{ + /* Sparse matrix times svector. Computes s = A * y where A + is transposed if tflag is TRUE. On error, prints message. */ + + int i, j; /* couters */ + int m, n; /* size of A */ + int *ir, *jc; /* tmp pointers */ + sddfloat *val; /* tmp pointer */ + int row; /* row number */ + int idx; /* word index of y to get svalue */ + ulong mask; /* mask to extract svalue */ + ulong *valptr, *sgnptr; /* tmp pointers */ + + m = A->m; + n = A->n; + ir = A->ir; + jc = A->jc; + val = A->val; + valptr = y->val; + sgnptr = y->sgn; + + if (tflag) { /* tranpose A */ + + bzero(s, n * sizeof(sdddouble)); /* set s to zero */ + + for (j = 0; j < n; j ++) + + for (i = jc[j]; i < jc[j+1]; i ++) { + + row = ir[i]; + idx = row >> IDXSHIFT; /* element of y to look in */ + mask = ONE << (row & IDXMASK); /* bit in y[idx] to pick off */ + + if (valptr[idx] & mask) { /* nonzero */ + if (sgnptr[idx] & mask) /* y[row] = -1 */ + s[j] -= val[i]; + else /* y[row] = 1 */ + s[j] += val[i]; + } + + } /* i-loop */ + + } /* if - transpose */ + + else { /* no transpose */ + + bzero(s, m * sizeof(sdddouble)); /* set s to zero */ + + idx = 0; + mask = 1; + for (j = 0; j < n ; j ++) { + + if (valptr[idx] & mask) { /* nonzero */ + if (sgnptr[idx] & mask) /* y[j] = -1 */ + for (i = jc[j]; i < jc[j+1]; i ++) { + s[ir[i]] -= val[i]; + } + else /* y[j] = 1 */ + for (i = jc[j]; i < jc[j+1]; i ++) { + s[ir[i]] += val[i]; + } + } + + if (mask == MAXMASK) { + mask = 1; + idx ++; + } + else + mask <<= 1; + + } /* j-loop */ + + } /* else - no transpose*/ + +} /* matrixxsv */ + +/*------------------------------------------------------------------------*/ + +sdddouble_plus subproblem(matrix *A, sdd *B, svector *y, svector *x, + int tflag, sdddouble *s) +{ + /* Solve the SDD subproblem. + + Returns the maximum value of + + max (x' * s) / |x|_2^2 + + in 'val' and the number of nonzeros in x in 'idx'. Here x is + constrained to be an (A->m)-long svector and s equals (A - B)y. + A is a sparse matrix, B is an SDD of the same size, and y is an + (A->n)-long svector. If tflag is TRUE, we use the transpose of A + and B, x should be (A->n)-long, and y should be (A->m)-long. + Only x is modified. On error, returns f with 0,0. */ + + sdddouble_plus f; /* final answer */ + int i, j, m; /* counters */ + ulong *valptr, *sgnptr; /* tmp pointer */ + ulong mask; /* tmp mask */ + ulong onesmask; /* word of all ones */ + sdddouble_plus *sorts = NULL; /* workspace */ + int sflag; /* compute s? */ + + f.val = 0; f.idx = 0; /* init f for error returns */ + + if ((A == NULL) || (y == NULL) || (x == NULL)) { + fprintf(stderr, "Error in subproblem input arguments.\n"); + return (f); + } + + bone(&onesmask, sizeof(ulong)); /* word of all ones */ + + /* allocate memory for the s and sorts */ + + m = (A->m > A->n) ? A->m : A->n; + + if (s == NULL) { /* s is not given */ + sflag = 1; + if ((s = (sdddouble*) calloc(m, sizeof(sdddouble))) == NULL) { + fprintf(stderr, "Error allocating work space.\n"); + return (f); + } + } + else + sflag = 0; /* don't compute s */ + + if ((sorts = (sdddouble_plus*) calloc(m, sizeof(sdddouble_plus))) == NULL) { + fprintf(stderr, "Error allocating work space.\n"); + return (f); + } + + m = x->m; /* copy to a local variable */ + + if (sflag) { + matrixxsv(s, A, y, tflag); /* s = A * y */ + sddxsv(s, B, y, tflag); /* s = s - B * y */ + } + + /* Initialize of s-values in x to 1 */ + + bone(x->val, numwords(m) * sizeof(ulong)); /* set every bit to 1 */ + bzero(x->sgn, numwords(m) * sizeof(ulong)); /* set every bit to 0 */ + + /* Fill in the sorts array with abs(s), and change the i-th s-value + in x to -1 if s[i] is negative. */ + + valptr = x->val; /* copy to local pointer */ + sgnptr = x->sgn; /* copy to a local pointer */ + mask = ONE; /* initialize */ + + for (i = 0; i < m; i ++) { + + sorts[i].idx = i; /* copy the index into array to be sorted */ + + /* If s[i] is negative, set the i-th bit of x->sgn to 1 w/o + affecting any other bits. Also, fill in sorts[i].val with + abs(s[i]). */ + + if (s[i] < 0) { /* make x[i] = -1 */ + sorts[i].val = -s[i]; /* copy -s[i] into array to be sorted */ + *sgnptr |= mask; /* swaps the correct bit of x->sgn to 1 */ + } + else + sorts[i].val = s[i]; /* copy s[i] into array to be sorted */ + + /* Update the mask and, if necessary, the pointer. */ + + if (mask == MAXMASK) { + mask = ONE; + sgnptr ++; + } + else + mask <<= 1; + } + + /* sort sorts */ +#ifdef QSORTOPT + qsortopt((char *) sorts, m); +#else + qsort(sorts, m, sizeof(sdddouble_plus), (int(*)(const void*, const void*)) compar); +#endif + + /* compute partial sums */ + s[0] = sorts[0].val; + for (i = 1; i < m; i ++) + s[i] = s[i-1] + sorts[i].val; + + /* compute function values */ + for (i = 0; i < m; i ++) + s[i] = (s[i] * s[i]) / (i + 1); + + /* find the maximum of the array s */ + f.val = s[0]; + f.idx = 0; + for (i = 1; i < m; i ++) + if (s[i] > f.val) { + f.val = s[i]; + f.idx = i; + } + + /* increment f.idx so that it is the number of nonzeros in x */ + f.idx ++; + + /* zero out certain elements of x with indices > f.idx in the sorted + array */ + + for (i = f.idx; i < m; i ++) { + + /* (j+1)st s-value in x should be zero */ + j = sorts[i].idx; + + /* causes bit j in x->val to be zero w/o affecting other bits */ + valptr[j >> IDXSHIFT] &= ((ONE << (j & IDXMASK)) ^ onesmask); + + } + + free(s); + free(sorts); + + return (f); + +} /* subproblem */ + +/*------------------------------------------------------------------------*/ + +sdd* compute_sdd (matrix *A, sdd *B, int kmin, int kmax, float rhomin, + int lmax, float alphamin, int initflag) +{ + + /* Computes the SDD of A. If the sdd B is non-null, preserves the + first kmin triplets, and then continues to expand. The SDD of A + will be such that either the norm of the residual is less than + rhomin or the number of terms is kmax. The inner iterations are + controlled by alphamin (the improvement tolerance) and lmax (the + maximum number of inner iterations). The initflag controls the + method used to initialize y; the choices are ... (TGK - fill this + in). */ + + int k; /* current number of terms in of SDD */ + int m, n; /* size of matrix */ + sddfloat d; /* current d-value */ + svector *x, *y; /* current x & y svectors */ + sdddouble_plus xmax, ymax; /* solutions to subproblems */ + int l, totall; /* iteration count and total */ + sddfloat rho0 = 0; /* square of initial residual norm */ + sddfloat rho = 0; /* square of residual norm */ + sddfloat alpha; /* improvement in change in residual */ + sddfloat beta, betabar; /* change in residual, and previous */ + sdddouble *s = NULL; /* product A*y produced by initialization */ + int initidx = 0; /* index used in initialization */ + + if (A == NULL) { + fprintf(stderr, "Error trying to compute SDD of NULL matrix.\n"); + return (NULL); + } + + if (kmin == kmax) { + fprintf(stderr, "No expansion is necessary.\n"); + return (NULL); + } + + /* initialization of lengths */ + m = A->m; + n = A->n; + + /* (Re)initialization of sdd decomposition (stored in B). */ + if ((B = create_sdd(B, m, n, kmin, kmax)) == NULL) { + fprintf(stderr, "Error initializing SDD.\n"); + return (NULL); + } + +#if INFO > 1 + fprintf(stdout, "\n"); +#endif + + /* Compute initial residual if kmin is zero. */ + rho = rho0 = fnormsq(A); + + /* Compute actual rho if expanding existing decomp. */ + if (kmin != 0) { + fprintf(stdout, "rho0 = %e\n", rho); + for (k = 0; k < kmin; k ++) { + rho -= (B->D->d[k] * B->D->d[k]) * svcount(B->X->col[k]) * svcount(B->Y->col[k]); + fprintf(stdout, "rho[%d] = %e\n", k+1, rho); + } + } + + totall = 0; + +#if INFO > 1 + fprintf(stdout, "Iteration Residual Improvement Inner Total\n"); + fprintf(stdout, " Number Squared (beta) Its InnerIts\n"); + fprintf(stdout, "--------- -------- ----------- ----- --------\n"); +#endif + + /* Outer iterations */ + for (k = kmin; k < kmax; k ++) { + +#if INFO > 1 + fprintf(stdout, " %3d ", k+1); +#endif + + if (((x = create_svector(NULL, m)) == NULL) || + ((y = create_svector(NULL, n)) == NULL)) { + fprintf(stderr, "Error creating svectors.\n"); + return (NULL); + } + + switch(initflag) { + case 1: /* Threshold */ + s = init_threshold(y, A, B, rho, &initidx); +#if INFO > 1 + fprintf(stdout, " %3d ", initidx); +#endif + break; + case 2: /* Cycling */ + init_cycle(y, k); + break; + case 3: /* All Ones */ + init_ones(y); + break; + case 4: /* Periodic Ones */ + init_pones(y); + break; + default: + fprintf(stderr, "Error in initflag.\n"); + return (NULL); + } + + beta = betabar = 0; + + for (l = 0; l < lmax; l ++) { /* inner iteration */ + + xmax = subproblem(A, B, y, x, 0, s); + s = NULL; + ymax = subproblem(A, B, x, y, 1, NULL); + + beta = ymax.val / xmax.idx; + + if (l > 0) { + alpha = (beta - betabar) / betabar; + if (alpha < alphamin) { + l ++; + break; + } + } + betabar = beta; + + } /* l-loop */ + + d = (sqrt(ymax.val * ymax.idx)) / (xmax.idx * ymax.idx); + expand_sdd(B, d, x, y); + totall += l; + rho = rho - beta; + +#if INFO > 1 + fprintf(stdout, "%7.2e %10.5e %2d %4d\n", rho, beta, l, totall); +#endif + + if (rho <= rhomin) { + if (rho < 0) rho = 0; + k ++; + break; + } + + } /* end k-loop */ + + +#if INFO > 0 + + /* Output information about the decomposition. */ + fprintf(stdout, "\n"); + fprintf(stdout, " -- SDD information --\n"); + fprintf(stdout, "final residual norm : "); + fprintf(stdout, "%10.4e\n", sqrt(rho)); + fprintf(stdout, "final relative residual norm: "); + fprintf(stdout, "%5.3f\n", sqrt(rho / rho0)); + fprintf(stdout, "total outer iterations : "); + fprintf(stdout, "%d\n", (k - kmin)); + fprintf(stdout, "average inner iterations : "); + fprintf(stdout, "%5.3f\n", ((float) totall) / (k - kmin)); + if (initflag == 1) { + fprintf(stdout, "average init iterations : "); + fprintf(stdout, "%5.3f\n", ((float) initidx) / (k - kmin)); + } + fprintf(stdout, "\n"); + +#endif + + return (B); + +} /* compute_sdd */ + diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/testdata/test1.gif b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/testdata/test1.gif new file mode 100644 index 0000000000000000000000000000000000000000..1313cf25a80ad29821cf07f5743556daa5770cec Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/testdata/test1.gif differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/testdata/test1.mtx b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/testdata/test1.mtx new file mode 100644 index 0000000000000000000000000000000000000000..11533773c2d1d79f9f094fd380d374e9977b8ac8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SDDPACK/testdata/test1.mtx @@ -0,0 +1,45 @@ +%% MatrixMarket matrix coordinate real general +% +%SDDPACK: Software for the Semidiscrete Decomposition. +%Copyright (c) 1999 Tamara G. Kolda and Dianne P. O'Leary. +% +% This program is free software; you can redistribute it and/or modify it +% under the terms of the GNU General Public License as published by the Free +% Software Foundation; either version 2 of the License, or (at your option) +% any later version. +% +% This program is distributed in the hope that it will be useful, but +% WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +% or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +% for more details. +% +% You should have received a copy of the GNU General Public License along +% with this program; if not, write to the Free Software Foundation, Inc., 59 +% Temple Place - Suite 330, Boston, MA 02111-1307, USA. +% +5 5 25 + 1 1 5.827917e-01 + 2 1 4.234963e-01 + 3 1 5.155118e-01 + 4 1 3.339515e-01 + 5 1 4.329066e-01 + 1 2 2.259499e-01 + 2 2 5.798069e-01 + 3 2 7.603650e-01 + 4 2 5.298231e-01 + 5 2 6.405265e-01 + 1 3 2.090694e-01 + 2 3 3.798184e-01 + 3 3 7.833286e-01 + 4 3 6.808458e-01 + 5 3 4.610951e-01 + 1 4 5.678287e-01 + 2 4 7.942107e-01 + 3 4 5.918259e-02 + 4 4 6.028691e-01 + 5 4 5.026880e-02 + 1 5 4.153749e-01 + 2 5 3.049987e-01 + 3 5 8.743672e-01 + 4 5 1.500950e-02 + 5 5 7.679504e-01 diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SPQR/spqr.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SPQR/spqr.m new file mode 100644 index 0000000000000000000000000000000000000000..cc37980ea663e3f53533666e400ebcb88f327a0b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/SPQR/spqr.m @@ -0,0 +1,247 @@ +%SPQR computes a pivoted semi-QR decomposition of an mxn matrix A. +% It is especially suited for computing low-rank approximations +% to a sparse matrix. +% +% BACKGROUND. A pivoted QR (PQR) decomposition of an mxn matrix A is a +% factorization of the form +% +% A*P = Q*R +% +% where P is a permutation matrix, Q is an orthonormal matrix, and R +% is an upper triangular matrix. The permutation P is chosen so +% that R(k,k)^2 >= norm(R(:,k:j),'fro')^2, (j=k:n). This tends to make +% the initial columns of AP well-conditioned and the trailing +% principal submatrix of R small. In particular, if we partition +% the decomposition B = A*P = Q*R in the form +% +% [B1 B2] = [Q1 Q2]*[R11 R12; (*) +% 0 R22] +% +% and R22 is small, then AP can be approximated by Q1*[R11 R12]. +% The Frobenius norm of the difference is NORM(R22, 'fro'). +% +% A semi-PQR (SPQR) approximation consists of P, R11 and R12. +% Since Q1 = B1*inv(R11) the action of Q1 on a vector can be calculated +% by operations involving B1 and Q1. For example, +% +% Q1'*x = R'\(B'*x) (**) +% +% SPQR computes a SPQR approximation using a quasi-Gram-Schmidt +% algorithm that takes advantage of (**) (and its equivalents) to +% avoid storing Q. This means that the algorithm's only operations +% involving A are matrix-vector products. The only storage +% requirements are for R11, R12 and a few work +% vectors of lengths m and n. Thus SPQR is ideally suited for the +% approximating sparse matrices. +% +% THE FUNCTION SPQR. The statement +% +% [ncols, R, colx, colnrm] = spqr(A, tol, maxcols, fullR, pivot, cn) +% +% returns +% +% ncols : the number of columns in B1 of (*). +% +% +% R : The matrix [R11 R12] or R11 depending on fullR. +% +% colx(n) : The permutation P. Specifically, AP = A(:,colx) +% and B1 = A(:,colx(1:ncols)). +% +% norms(n) : If norms are to be computed, norms contains +% the following information. For j<=ncols, +% norms(j) is the norm of R22 for the decomposition +% (*), where R11 is jxj. For j>ncols, norms(j) +% is the norm of R22(:,j) in (*), where R11 is +% ncols x ncols. +% If norms are not computed, norms=[]. +% +% The input arguments are +% +% A : The matrix whose SPQR approximation is to be +% computed. +% +% tol : The reduction stops when norm(R22,'fro) < tol. +% +% maxcols : Stops the reduction when ncols = maxcols. +% +% fullR : An optional argument with default value 1. +% If fullR~=0, SPQR returns [R11 R12]. Otherwise +% it returns only R11. +% +% pivot : An optional argument with default value 1. +% If pivot==0, pivoting is suppressed. +% +% cn : An optional argument with default value 1. +% If (fullR | pivot | cn)==0 computation of norms +% is suppressed and on return norms=[]. +% +% WARNING. The accuracy of the the approximation decreases as +% norm(R22,'fro') decreases. As a rule of thumb, if the norms of +% the columns of A are approximately equal, tol should be greater +% than 10^-8*norm(A,'fro'). +% +% NOTES. The combination of fullR = pivot = cn = 0 gives +% very fast factorization of the first maxcols columns of A. +% If maxcols = n, this gives an unpivoted semi-QR factorization +% of A, which can be use to solve least squares problems or +% compute projections. +% +% If tol.leq.0, SPQR will stop only when ncols is equal to colmax. +% +% When R12 is too large to store, a second application of SPQR +% gives the wherewithal to compute a sparse C-R approximation of the +% form +% +% A = XTY' +% +% where X consists of columns of A and Y' consists of rows of +% A. See SCRA. +% +% Author: Pete Stewart, May 20 2004 +% + +function [ncols, R, colx, norms] = spqr(A, tol, maxcols, fullR, pivot, cn); + +% Determine the maximum number of columns in the result. + +[m, n] = size(A); + +ncols = min([m, n, maxcols]); + +% Set default values of the optional arguments + +if nargin == 3 + fullR = 1; + pivot = 1; + cn = 1; +elseif nargin == 4 + pivot = 1; + cn = 1; +elseif nargin == 5 + cn = 1; +else + error('SPQR: Wrong number of input parameters.') +end + +% Initialize arrays. + +cn = fullR | pivot | cn; + +colx = 1:n; + +if cn + rkk = zeros(1,n); + for j=1:n + norms(j) = norm(A(:,j)); + end +else + norms = []; +end + +if fullR + R = zeros(ncols,n); +else + R = zeros(ncols,ncols); +end + +% Loop bringing columns of A into the decomposition. + +for k=1:ncols + + if pivot + + % Determine the pivot column and swap it with column k. + + [maxnrm, jmax] = max(norms(k:n)); + jmax = jmax + k - 1; + + cxk = colx(k); + colx(k) = colx(jmax); + colx(jmax) = cxk; + cnk = norms(k); + norms(k) = norms(jmax); + norms(jmax) = cnk; + else + jmax = k; + end + + if (fullR & k>1) + R(1:k-1,jmax) = R(1:k-1,k); + end + + % Get column k and incorporate it into the decomposition. + + a = A(:,colx(k)); + + if k == 1 + + % Special action for the first column + + R(1,1) = norm(a); + q = full(a/R(1,1)); + + else + + % Perform a quasi-Gram-Schmidt step with reorthogonalization. + + b = full(a'*A(:,colx(1:k-1))); + r = (b/R(1:k-1,1:k-1))'; + c = R(1:k-1,1:k-1)\r; + q = a - A(:,colx(1:k-1))*c; + b = q'*A(:,colx(1:k-1)); + rr = (b/R(1:k-1,1:k-1))'; + c = R(1:k-1,1:k-1)\rr; + q = q - A(:,colx(1:k-1))*c; + + % Update R. + + r = r + rr; + rho = norm(q); + R(1:k-1,k) = r; + R(k,k) = rho; + + % Compute the kth column of Q. + + c = R(1:k-1,1:k-1)\r; + q = (a - A(:,colx(1:k-1))*c)/rho; + end + + % Update norms and compute norm(R22,'fro') + + if k+1<=n + + if cn + + % Compute the k-th row of R. Note: For large matrices + % this step dominates the computation. + + rrk(k+1:n) = q'*A(:,colx(k+1:n)); + if fullR + R(k,k+1:n) = rrk(k+1:n); + end + + % Downdate the column norms and compute norm(R22,'fro'). + + norms(k+1:n) = ... + max([norms(k+1:n).^2 - rrk(k+1:n).^2; zeros(1,n-k)]); + norms(k) = sqrt(sum(norms(k+1:n))); + norms(k+1:n) = sqrt(norms(k+1:n)); + + % Check the stopping criterion. + + if (norms(k) < tol) break; end + end + else + norms(k) = 0; + end +end + +% Clean up. + +ncols = k; +if fullR + R = R(1:ncols,:); +else + R = R(1:ncols,1:ncols); +end diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/block_diagonalize.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/block_diagonalize.m new file mode 100644 index 0000000000000000000000000000000000000000..515ffb4311fe034cb5d0c4240278ed8349d7fe11 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/block_diagonalize.m @@ -0,0 +1,14 @@ +function [A, n_rows, n_cols, row_inds, col_inds]=block_diagonalize(A, clusters) +% BLOCK_DIAGONALIZE - reorders a matrix heuristically using a +% clustering result +% [A, N_ROWS, N_COLS, ROW_INDS, COL_INDS]=BLOCK_DIAGONALIZE(A, +% CLUSTERS) reorders matrix A using the clustering result +% represented by the structure CLUSTERS. N_ROWS and N_COLS +% store the last row and column index for each row and column +% block resprectively, while ROW_INDS and COL_INDS contain the +% permuted row and column indices. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +[A, n_rows, n_cols, row_inds, col_inds]=block_diagonalize_p(A, clusters); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/block_diagonalize_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/block_diagonalize_p.p new file mode 100644 index 0000000000000000000000000000000000000000..8595d783e56b5513aee012fe6fd0f5ade4fc253e Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/block_diagonalize_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/col_normalization.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/col_normalization.m new file mode 100644 index 0000000000000000000000000000000000000000..257cd9cdf0a8956c5958b1df708f62a097ce9948 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/col_normalization.m @@ -0,0 +1,8 @@ +function A=col_normalization(A) +% COL_NORMALIZATION - normalizes the columns of the input +% matrix. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +A=col_normalization_p(A); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/col_normalization_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/col_normalization_p.p new file mode 100644 index 0000000000000000000000000000000000000000..798fa4c4064700cd3c3b150ecaaee471c035bdee Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/col_normalization_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/column_norms.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/column_norms.m new file mode 100644 index 0000000000000000000000000000000000000000..c3b94f2b39a6fec6c990f299bebe1e263ac99156 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/column_norms.m @@ -0,0 +1,7 @@ +function tmp=column_norms(A) +% COLUMN_NORMS - returns the column norms of a matrix +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +tmp=column_norms_p(A); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/column_norms_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/column_norms_p.p new file mode 100644 index 0000000000000000000000000000000000000000..f0e7bb55dd634d34de40920bc5476d96154001b4 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/column_norms_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/compute_fro_norm.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/compute_fro_norm.m new file mode 100644 index 0000000000000000000000000000000000000000..27d26232de6e09c847ca667f022ac21cf4a75e9f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/compute_fro_norm.m @@ -0,0 +1,8 @@ +function s=compute_fro_norm(A, W, H) +% COMPUTE_FRO_NORM - returns the frobenius norm of a rank-l +% matrix A - W * H +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(3, 3, nargin)); +s=compute_fro_norm_p(A, W, H); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/compute_fro_norm_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/compute_fro_norm_p.p new file mode 100644 index 0000000000000000000000000000000000000000..2d1356ea98e821a60357deb1ca7ae3ba4d7184d6 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/compute_fro_norm_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/entropy.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/entropy.m new file mode 100644 index 0000000000000000000000000000000000000000..54e76284105d11bbc2358541c9b49250e0532b3b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/entropy.m @@ -0,0 +1,18 @@ +function [ventropy, confusion_matrix, mistakes]=entropy(clusters, labels) +% ENTROPY - computes the entropy of a clustering result +% [VENTROPY, CONFUSION_MATRIX, MISTAKES]=ENTROPY(CLUSTERS, +% LABELS) computes the entropy value of a clustering result +% represented by the CLUSTERS structure. LABELS is a vector +% of integers containing the true labeling of the objects. +% The entropy value is stored in VENTOPY, while +% CONFUSION_MATRIX is a k x r matrix, where k is the number +% of clusters and r the number of true classes, and +% CONFUSION_MATRIX(i, j) records the number of objects +% of class j assigned to cluster i. Finally, MISTAKES contains +% the number of misassigned objects, measured by m1+...+mk, +% where mi=sum(CONFUSION_MATRIX(i, j)), j~=i. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(2, 2, nargin)); +[ventropy, confusion_matrix, mistakes]=entropy_p(clusters, labels); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/entropy_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/entropy_p.p new file mode 100644 index 0000000000000000000000000000000000000000..50ddef05f7f97845da6051016f288e58ed54d6f5 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/entropy_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/make_labels.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/make_labels.m new file mode 100644 index 0000000000000000000000000000000000000000..ad6512a69acb80497c1fb57cf9b767de94e1c1b4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/make_labels.m @@ -0,0 +1,12 @@ +function [labels, unique_labels]=make_labels(input_labels) +% MAKE_LABELS - creates a label vector of integers for the input +% cell array of string +% [LABELS, UNIQUE_LABELS]=MAKE_LABELS(INPUT_LABELS) creates a +% vector of integer labels (LABELS) for the input cell array +% of strings INPUT_LABELS. UNIQUE_LABELS contains the strings +% of unique labels of the input cell array. +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(1, 1, nargin)); +[labels, unique_labels]=make_labels_p(input_labels); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/make_labels_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/make_labels_p.p new file mode 100644 index 0000000000000000000000000000000000000000..6f728a0f9319258cd73c4909c1d4be9f62ad8c5e Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/make_labels_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/pddp_extract_centroids.m b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/pddp_extract_centroids.m new file mode 100644 index 0000000000000000000000000000000000000000..7987daad2baed32580d2e593c1bf81e7d28547d0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/pddp_extract_centroids.m @@ -0,0 +1,8 @@ +function C = pddp_extract_centroids(tree_struct, m, k) +% PDDP_EXTRACT_CENTROIDS - returns the cluster centroids of a +% PDDP clustering result +% +% Copyright 2011 Dimitrios Zeimpekis, Eugenia Maria Kontopoulou, Efstratios Gallopoulos + +error(nargchk(3, 3, nargin)); +C = pddp_extract_centroids_p(tree_struct, m, k); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/pddp_extract_centroids_p.p b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/pddp_extract_centroids_p.p new file mode 100644 index 0000000000000000000000000000000000000000..e5e0c4e229756e1f767b2ec93b1119f6f9c7a889 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/TMG_6.0R7/var/pddp_extract_centroids_p.p differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoGrad.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoGrad.m new file mode 100644 index 0000000000000000000000000000000000000000..b9f5b4a43ae40719affcb3debc1c9267465ba06d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoGrad.m @@ -0,0 +1 @@ +function [f,g] = autoGrad(x,type,funObj,varargin) % [f,g] = autoGrad(x,useComplex,funObj,varargin) % % Numerically compute gradient of objective function from function values % % type = % 1 - forward-differencing (p+1 evaluations) % 2 - central-differencing (more accurate, but requires 2p evaluations) % 3 - complex-step derivative (most accurate and only requires p evaluations, but only works for certain objectives) p = length(x); if type == 1 % Use Finite Differencing f = funObj(x,varargin{:}); mu = 2*sqrt(1e-12)*(1+norm(x)); diff = zeros(p,1); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; diff(j,1) = funObj(x + mu*e_j,varargin{:}); end g = (diff-f)/mu; elseif type == 3 % Use Complex Differentials mu = 1e-150; diff = zeros(p,1); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; diff(j,1) = funObj(x + mu*i*e_j,varargin{:}); end f = mean(real(diff)); g = imag(diff)/mu; else % Use Central Differencing mu = 2*sqrt(1e-12)*(1+norm(x)); diff1 = zeros(p,1); diff2 = zeros(p,1); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; diff1(j,1) = funObj(x + mu*e_j,varargin{:}); diff2(j,1) = funObj(x - mu*e_j,varargin{:}); end f = mean([diff1;diff2]); g = (diff1 - diff2)/(2*mu); end if 0 % DEBUG CODE [fReal gReal] = funObj(x,varargin{:}); [fReal f] [gReal g] diff pause; end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoHess.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoHess.m new file mode 100644 index 0000000000000000000000000000000000000000..7916fe2d796beb12e7b8c693e0e348a172b38c70 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoHess.m @@ -0,0 +1 @@ +function [f,g,H] = autoHess(x,type,funObj,varargin) % Numerically compute Hessian of objective function from gradient values p = length(x); if type == 1 % Use finite differencing mu = 2*sqrt(1e-12)*(1+norm(x)); [f,g] = funObj(x,varargin{:}); diff = zeros(p); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; [f diff(:,j)] = funObj(x + mu*e_j,varargin{:}); end H = (diff-repmat(g,[1 p]))/mu; elseif type == 3 % Use Complex Differentials mu = 1e-150; diff = zeros(p); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; [f(j) diff(:,j)] = funObj(x + mu*i*e_j,varargin{:}); end f = mean(real(f)); g = mean(real(diff),2); H = imag(diff)/mu; else % Use central differencing mu = 2*sqrt(1e-12)*(1+norm(x)); f1 = zeros(p,1); f2 = zeros(p,1); diff1 = zeros(p); diff2 = zeros(p); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; [f1(j) diff1(:,j)] = funObj(x + mu*e_j,varargin{:}); [f2(j) diff2(:,j)] = funObj(x - mu*e_j,varargin{:}); end f = mean([f1;f2]); g = mean([diff1 diff2],2); H = (diff1-diff2)/(2*mu); end % Make sure H is symmetric H = (H+H')/2; if 0 % DEBUG CODE [fReal gReal HReal] = funObj(x,varargin{:}); [fReal f] [gReal g] [HReal H] pause; end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoHv.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoHv.m new file mode 100644 index 0000000000000000000000000000000000000000..5b040bf3b16e9e9a49329e165db7888fd08dcb7b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoHv.m @@ -0,0 +1,13 @@ +function [Hv] = autoHv(v,x,g,useComplex,funObj,varargin) +% [Hv] = autoHv(v,x,g,useComplex,funObj,varargin) +% +% Numerically compute Hessian-vector product H*v of funObj(x,varargin{:}) +% based on gradient values + +if useComplex + mu = 1e-150i; +else + mu = 2*sqrt(1e-12)*(1+norm(x))/norm(v); +end +[f,finDif] = funObj(x + v*mu,varargin{:}); +Hv = (finDif-g)/mu; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoTensor.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoTensor.m new file mode 100644 index 0000000000000000000000000000000000000000..84521e01dce25bd60f4e7d3bd9bce9a5332509e4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/autoTensor.m @@ -0,0 +1 @@ +function [f,g,H,T] = autoTensor(x,type,funObj,varargin) % [f,g,H,T] = autoTensor(x,useComplex,funObj,varargin) % Numerically compute Tensor of 3rd-derivatives of objective function from Hessian values p = length(x); if type == 2 mu = 2*sqrt(1e-12)*(1+norm(x)); f1 = zeros(p,1); f2 = zeros(p,2); g1 = zeros(p); g2 = zeros(p); diff = zeros(p,p,p); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; [f1(j) g1(:,j) diff1(:,:,j)] = funObj(x + mu*e_j,varargin{:}); [f2(j) g2(:,j) diff2(:,:,j)] = funObj(x + mu*e_j,varargin{:}); end f = mean([f1;f2]); g = mean([g1 g2],2); H = mean(cat(3,diff1,diff2),3); T = (diff1-diff2)/(2*mu); elseif type == 3 % Use Complex Differentials mu = 1e-150; f = zeros(p,1); g = zeros(p); diff = zeros(p,p,p); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; [f(j) g(:,j) diff(:,:,j)] = funObj(x + mu*i*e_j,varargin{:}); end f = mean(real(f)); g = mean(real(g),2); H = mean(real(diff),3); T = imag(diff)/mu; else % Use finite differencing mu = 2*sqrt(1e-12)*(1+norm(x)); [f,g,H] = funObj(x,varargin{:}); diff = zeros(p,p,p); for j = 1:p e_j = zeros(p,1); e_j(j) = 1; [~ ~ diff(:,:,j)] = funObj(x + mu*e_j,varargin{:}); end T = (diff-repmat(H,[1 1 p]))/mu; end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/derivativeCheck.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/derivativeCheck.m new file mode 100644 index 0000000000000000000000000000000000000000..dc71194f5df0b14df32e1639abd9dc38b7be8d15 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/derivativeCheck.m @@ -0,0 +1,42 @@ +function diff = derivativeCheck(funObj,x,order,type,varargin) +% diff = derivativeCheck(funObj,x,order,useComplex,varargin) +% +% type = 1 (simple forward-difference) +% type = 2 (central differencing - default) +% type = 3 (complex-step deriative) + +if nargin < 3 + order = 1; % Only check gradient by default + if nargin < 4 + type = 2; % Use central-differencing by default + end +end + +if order == 2 + [f,g,H] = funObj(x,varargin{:}); + + fprintf('Checking Hessian...\n'); + [f2,g2,H2] = autoHess(x,type,funObj,varargin{:}); + + fprintf('Max difference between user and numerical hessian: %e\n',max(abs(H(:)-H2(:)))); + if max(abs(H(:)-H2(:))) > 1e-4 + H + H2 + diff = abs(H-H2) + pause; + end +else + [f,g] = funObj(x,varargin{:}); + + fprintf('Checking Gradient...\n'); + [f2,g2] = autoGrad(x,type,funObj,varargin{:}); + + fprintf('Max difference between user and numerical gradient: %e\n',max(abs(g-g2))); + if max(abs(g-g2)) > 1e-4 + fprintf('User NumDif:\n'); + [g g2] + diff = abs(g-g2) + pause + end +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/fastDerivativeCheck.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/fastDerivativeCheck.m new file mode 100644 index 0000000000000000000000000000000000000000..6f7c0f123fd96099a8e2ae9190d78514b271d4c5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/autoDif/fastDerivativeCheck.m @@ -0,0 +1 @@ +function diff = derivativeCheck(funObj,x,order,type,varargin) % diff = fastDerivativeCheck(funObj,x,order,varargin) if nargin < 3 order = 1; % Only check gradient by default if nargin < 4 type = 2; % Use central-differencing by default end end p = length(x); d = sign(randn(p,1)); if order == 2 fprintf('Checking Hessian-vector product along random direction:\n'); [f,g,H] = funObj(x,varargin{:}); Hv = H*d; if type == 1 % Use Finite Differencing mu = 2*sqrt(1e-12)*(1+norm(x))/(1+norm(x)); [diff,diffa] = funObj(x+d*mu,varargin{:}); Hv2 = (diffa-g)/mu; elseif type == 3 % Use Complex Differentials mu = 1e-150; [diff,diffa] = funObj(x+d*mu*i,varargin{:}); Hv2 = imag(diffa-g)/mu; else % Use Central Differencing mu = 2*sqrt(1e-12)*(1+norm(x))/(1+norm(x)); [diff1,diffa] = funObj(x+d*mu,varargin{:}); [diff2,diffb] = funObj(x-d*mu,varargin{:}); Hv2 = (diffa-diffb)/(2*mu); end fprintf('Max difference between user and numerical Hessian-vector product: %e\n',max(abs(Hv-Hv2))); else fprintf('Checking Gradient along random direction:\n'); [f,g] = funObj(x,varargin{:}); gtd = g'*d; if type == 1 % Use Finite Differencing mu = 2*sqrt(1e-12)*(1+norm(x))/(1+norm(x)); diff = funObj(x+d*mu,varargin{:}); gtd2 = (diff-f)/mu; elseif type == 3 % Use Complex Differentials mu = 1e-150; [diff,diffa] = funObj(x+d*mu*i,varargin{:}); gtd2 = imag(diff)/mu; else % Use Central Differencing mu = 2*sqrt(1e-12)*(1+norm(x))/(1+norm(x)); diff1 = funObj(x+d*mu,varargin{:}); diff2 = funObj(x-d*mu,varargin{:}); gtd2 = (diff1-diff2)/(2*mu); end fprintf('Max difference between user and numerical directional-derivative: %e\n',max(abs(gtd-gtd2))); end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/example_derivativeCheck.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/example_derivativeCheck.m new file mode 100644 index 0000000000000000000000000000000000000000..2713c1491f106d78a14cc061490b1aca33a8a292 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/example_derivativeCheck.m @@ -0,0 +1,52 @@ +clear all + +nInst = 250; +nVars = 10; +X = randn(nInst,nVars); +w = randn(nVars,1); +y = sign(X*w + randn(nInst,1)); + +wTest = randn(nVars,1); + +fprintf('Testing gradient using forward-differencing...\n'); +order = 1; +derivativeCheck(@LogisticLoss,wTest,order,1,X,y); + +fprintf('Testing gradient using central-differencing...\n'); +derivativeCheck(@LogisticLoss,wTest,order,2,X,y); + +fprintf('Testing gradient using complex-step derivative...\n'); +derivativeCheck(@LogisticLoss,wTest,order,3,X,y); + +fprintf('\n\n\n'); +pause + +fprintf('Testing Hessian using forward-differencing\n'); +order = 2; +derivativeCheck(@LogisticLoss,wTest,order,1,X,y); + +fprintf('Testing Hessian using central-differencing\n'); +order = 2; +derivativeCheck(@LogisticLoss,wTest,order,2,X,y); + +fprintf('Testing Hessian using complex-step derivative\n'); +order = 2; +derivativeCheck(@LogisticLoss,wTest,order,3,X,y); + +fprintf('\n\n\n'); +pause + +fprintf('Testing gradient using fastDerivativeCheck...\n'); +order = 1; +fastDerivativeCheck(@LogisticLoss,wTest,order,1,X,y); +fastDerivativeCheck(@LogisticLoss,wTest,order,2,X,y); +fastDerivativeCheck(@LogisticLoss,wTest,order,3,X,y); + +fprintf('\n\n\n'); +pause + +fprintf('Testing Hessian using fastDerivativeCheck...\n'); +order = 2; +fastDerivativeCheck(@LogisticLoss,wTest,order,1,X,y); +fastDerivativeCheck(@LogisticLoss,wTest,order,2,X,y); +fastDerivativeCheck(@LogisticLoss,wTest,order,3,X,y); diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/example_minFunc.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/example_minFunc.m new file mode 100644 index 0000000000000000000000000000000000000000..0d7e4552ff9699af4b8e008b661a2b9087f2491a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/example_minFunc.m @@ -0,0 +1,75 @@ +% Runs various limited-memory solvers on 2D rosenbrock function for 25 +% function evaluations +maxFunEvals = 25; + +fprintf('Result after %d evaluations of limited-memory solvers on 2D rosenbrock:\n',maxFunEvals); + +fprintf('---------------------------------------\n'); +fprintf('x1 = %.4f, x2 = %.4f (starting point)\n',0,0); +fprintf('x1 = %.4f, x2 = %.4f (optimal solution)\n',1,1); +fprintf('---------------------------------------\n'); + +if exist('minimize') == 2 + % Minimize.m - conjugate gradient method + x = minimize([0 0]', 'rosenbrock', -maxFunEvals); + fprintf('x1 = %.4f, x2 = %.4f (minimize.m by C. Rasmussen)\n',x(1),x(2)); +end + +options = []; +options.display = 'none'; +options.maxFunEvals = maxFunEvals; + +% Steepest Descent +options.Method = 'sd'; +x = minFunc(@rosenbrock,[0 0]',options); +fprintf('x1 = %.4f, x2 = %.4f (minFunc with steepest descent)\n',x(1),x(2)); + +% Cyclic Steepest Descent +options.Method = 'csd'; +x = minFunc(@rosenbrock,[0 0]',options); +fprintf('x1 = %.4f, x2 = %.4f (minFunc with cyclic steepest descent)\n',x(1),x(2)); + +% Barzilai & Borwein +options.Method = 'bb'; +options.bbType = 1; +x = minFunc(@rosenbrock,[0 0]',options); +fprintf('x1 = %.4f, x2 = %.4f (minFunc with spectral gradient descent)\n',x(1),x(2)); + +% Hessian-Free Newton +options.Method = 'newton0'; +x = minFunc(@rosenbrock,[0 0]',options); +fprintf('x1 = %.4f, x2 = %.4f (minFunc with Hessian-free Newton)\n',x(1),x(2)); + +% Hessian-Free Newton w/ L-BFGS preconditioner +options.Method = 'pnewton0'; +x = minFunc(@rosenbrock,[0 0]',options); +fprintf('x1 = %.4f, x2 = %.4f (minFunc with preconditioned Hessian-free Newton)\n',x(1),x(2)); + +% Conjugate Gradient +options.Method = 'cg'; +x = minFunc(@rosenbrock,[0 0]',options); +fprintf('x1 = %.4f, x2 = %.4f (minFunc with conjugate gradient)\n',x(1),x(2)); + +% Scaled conjugate Gradient +options.Method = 'scg'; +x = minFunc(@rosenbrock,[0 0]',options); +fprintf('x1 = %.4f, x2 = %.4f (minFunc with scaled conjugate gradient)\n',x(1),x(2)); + +% Preconditioned Conjugate Gradient +options.Method = 'pcg'; +x = minFunc(@rosenbrock,[0 0]',options); +fprintf('x1 = %.4f, x2 = %.4f (minFunc with preconditioned conjugate gradient)\n',x(1),x(2)); + +% Default: L-BFGS (default) +options.Method = 'lbfgs'; +x = minFunc(@rosenbrock,[0 0]',options); +fprintf('x1 = %.4f, x2 = %.4f (minFunc with limited-memory BFGS - default)\n',x(1),x(2)); + +fprintf('---------------------------------------\n'); + + + + + + + diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/LogisticDiagPrecond.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/LogisticDiagPrecond.m new file mode 100644 index 0000000000000000000000000000000000000000..204a76131672ffb61fb1eb428ab85b61195cbb75 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/LogisticDiagPrecond.m @@ -0,0 +1,20 @@ +function [m] = LogisticHv(v,w,X,y) +% v(feature,1) - vector that we will apply diagonal preconditioner to +% w(feature,1) +% X(instance,feature) +% y(instance,1) + +sig = 1./(1+exp(-y.*(X*w))); + +% Compute diagonals of Hessian +sig = sig.*(1-sig); +for i = 1:length(w) + h(i,1) = (sig.*X(:,i))'*X(:,i); +end + +% Apply preconditioner +m = v./h; + +% Exact preconditioner +%H = X'*diag(sig.*(1-sig))*X; +%m = H\v; diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/LogisticHv.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/LogisticHv.m new file mode 100644 index 0000000000000000000000000000000000000000..0f80f519f1aa1546900e9763053dec2f77b0b50b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/LogisticHv.m @@ -0,0 +1,8 @@ +function [Hv] = LogisticHv(v,w,X,y) +% v(feature,1) - vector that we will multiply Hessian by +% w(feature,1) +% X(instance,feature) +% y(instance,1) + +sig = 1./(1+exp(-y.*(X*w))); +Hv = X.'*(sig.*(1-sig).*(X*v)); diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/LogisticLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/LogisticLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..c6aeda9a4bcd1b7b5fe48410ee44a493137b35cc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/LogisticLoss.m @@ -0,0 +1,36 @@ +function [nll,g,H,T] = LogisticLoss(w,X,y) +% w(feature,1) +% X(instance,feature) +% y(instance,1) + +[n,p] = size(X); + +Xw = X*w; +yXw = y.*Xw; + +nll = sum(mylogsumexp([zeros(n,1) -yXw])); + +if nargout > 1 + if nargout > 2 + sig = 1./(1+exp(-yXw)); + g = -X.'*(y.*(1-sig)); + else + %g = -X.'*(y./(1+exp(yXw))); + g = -(X.'*(y./(1+exp(yXw)))); + end +end + +if nargout > 2 + H = X.'*diag(sparse(sig.*(1-sig)))*X; +end + +if nargout > 3 + T = zeros(p,p,p); + for j1 = 1:p + for j2 = 1:p + for j3 = 1:p + T(j1,j2,j3) = sum(y(:).^3.*X(:,j1).*X(:,j2).*X(:,j3).*sig.*(1-sig).*(1-2*sig)); + end + end + end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/example_minFunc_LR.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/example_minFunc_LR.m new file mode 100644 index 0000000000000000000000000000000000000000..1573c0eb79f5d9ea6b1e6839b75f771e8f29e3a9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/example_minFunc_LR.m @@ -0,0 +1,79 @@ +clear all + +nInst = 500; +nVars = 200; +X = randn(nInst,nVars); +w = randn(nVars,1); +y = sign(X*w + randn(nInst,1)); + +w_init = zeros(nVars,1); +funObj = @(w)LogisticLoss(w,X,y); + +fprintf('\nRunning Steepest Descent\n'); +options.Method = 'sd'; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Cyclic Steepest Descent\n'); +options.Method = 'csd'; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Conjugate Gradient\n'); +options.Method = 'cg'; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Scaled Conjugate Gradient\n'); +options.Method = 'scg'; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Preconditioned Conjugate Gradient (Diagonal preconditioner)\n'); +options.Method = 'pcg'; +options.precFunc = @LogisticDiagPrecond; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Preconditioned Conjugate Gradient (L-BFGS preconditioner)\n'); +options.Method = 'pcg'; +options.precFunc = []; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Hessian-Free Newton w/ numerical Hessian-Vector products\n'); +options.Method = 'newton0'; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Preconditioned Hessian-Free Newton w/ numerical Hessian-Vector products (Diagonal preconditioner)\n'); +options.Method = 'pnewton0'; +options.precFunc = @LogisticDiagPrecond; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Preconditioned Hessian-Free Newton w/ numerical Hessian-Vector products (L-BFGS preconditioner)\n'); +options.Method = 'pnewton0'; +options.precFunc = []; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Hessian-Free Newton w/ analytic Hessian-Vector products\n'); +options.Method = 'newton0'; +options.HvFunc = @LogisticHv; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Preconditioned Hessian-Free Newton w/ analytic Hessian-Vector products (Diagonal preconditioner)\n'); +options.Method = 'pnewton0'; +options.HvFunc = @LogisticHv; +options.precFunc = @LogisticDiagPrecond; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; + +fprintf('\nRunning Preconditioned Hessian-Free Newton w/ analytic Hessian-Vector products (L-BFGS preconditioner)\n'); +options.Method = 'pnewton0'; +options.precFunc = []; +options.HvFunc = @LogisticHv; +minFunc(@LogisticLoss,w_init,options,X,y); +pause; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/mylogsumexp.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/mylogsumexp.m new file mode 100644 index 0000000000000000000000000000000000000000..e791efc197f5bc52843a1763ea67651d0d18fb5f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/logisticExample/mylogsumexp.m @@ -0,0 +1,8 @@ +function lse = mylogsumexp(b) +% does logsumexp across columns +B = max(b,[],2); +lse = log(sum(exp(b-repmat(B,[1 size(b,2)])),2))+B; + +% Old version that used repmatC +%lse = log(sum(exp(b-repmatC(B,[1 size(b,2)])),2))+B; +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/ExtremeLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/ExtremeLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..57a7c3f858cd7103d87532fb3e412c895ac1411f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/ExtremeLoss.m @@ -0,0 +1,14 @@ +function [nll,g,H] = ExtremeLoss(w,X,y) +% w(feature,1) +% X(instance,feature) +% y(instance,1) +% +% Binary response with complementary log-log link + +Xw = X*w; +p_1 = 1 - exp(-exp(Xw)); +nll = -sum(log(p_1(y==1)))-sum(log(1-p_1(y==-1))); + +tmp = exp(Xw - exp(Xw)); +g = -X(y==1,:)'*(tmp(y==1)./p_1(y==1)) - X(y==-1,:)'*(-tmp(y==-1)./(1-p_1(y==-1))); + diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/HuberLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/HuberLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..bfabeba89c6c1768fe59000bcd2a8444866879b1 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/HuberLoss.m @@ -0,0 +1,17 @@ +function [f,g,H,T] = HuberLoss(w,X,y,k) +% w(feature,1) +% X(instance,feature) +% y(instance,1) + +r = X*w-y; + +closeInd = abs(r) <= k; + +f = (1/2)*sum(r(closeInd).^2) + k*sum(abs(r(~closeInd))) - (1/2)*sum(~closeInd)*k^2; +if nargout > 1 + g = X(closeInd,:)'*(X(closeInd,:)*w - y(closeInd)) + k*X(~closeInd,:)'*sign(r(~closeInd)); +end + +if nargout > 2 + H = X(closeInd,:)'*X(closeInd,:); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/HuberSVMLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/HuberSVMLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..2e9473e85abf7e6a267d69eabb3c7a247d30e43e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/HuberSVMLoss.m @@ -0,0 +1,15 @@ +function [f,g,H] = HuberSVMLoss(w,X,y,t) +[n,p] = size(X); +f = 0; +g = zeros(p,1); +yhat = y.*(X*w); +ind1 = yhat <= t; +ind2 = yhat > t & yhat <= 1; +if any(ind1) + f = f + sum((1-t)^2 + 2*(1-t)*(t-yhat(ind1))); + g = g - X(ind1,:)'*(2)*(1-t)*y(ind1); +end +if any(ind2) + f = f + sum((1-yhat(ind2)).^2); + g = g - X(ind2,:)'*2*((1-yhat(ind2)).*y(ind2)); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/LogisticLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/LogisticLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..c6aeda9a4bcd1b7b5fe48410ee44a493137b35cc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/LogisticLoss.m @@ -0,0 +1,36 @@ +function [nll,g,H,T] = LogisticLoss(w,X,y) +% w(feature,1) +% X(instance,feature) +% y(instance,1) + +[n,p] = size(X); + +Xw = X*w; +yXw = y.*Xw; + +nll = sum(mylogsumexp([zeros(n,1) -yXw])); + +if nargout > 1 + if nargout > 2 + sig = 1./(1+exp(-yXw)); + g = -X.'*(y.*(1-sig)); + else + %g = -X.'*(y./(1+exp(yXw))); + g = -(X.'*(y./(1+exp(yXw)))); + end +end + +if nargout > 2 + H = X.'*diag(sparse(sig.*(1-sig)))*X; +end + +if nargout > 3 + T = zeros(p,p,p); + for j1 = 1:p + for j2 = 1:p + for j3 = 1:p + T(j1,j2,j3) = sum(y(:).^3.*X(:,j1).*X(:,j2).*X(:,j3).*sig.*(1-sig).*(1-2*sig)); + end + end + end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MDSstress.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MDSstress.m new file mode 100644 index 0000000000000000000000000000000000000000..3cfb5156cfa6e59f8fe87408750586e9d9bbf72f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MDSstress.m @@ -0,0 +1,39 @@ +function [S,g] = stress(z,D,visualize) +visualize = 1; +nInst = length(D); +nComp = numel(z)/nInst; + +z = reshape(z,nInst,nComp); + +if nargout > 1 + g = zeros(size(z)); +end + +S = 0; +for i = 1:nInst + for j = i+1:nInst + nrmDist = norm(z(i,:)-z(j,:)); + s = D(i,j) - nrmDist; + S = S + s^2; + + if nargout > 1 + g(i,:) = g(i,:) - 2*(s/nrmDist)*(z(i,:)-z(j,:)); + g(j,:) = g(j,:) - 2*(s/nrmDist)*(z(j,:)-z(i,:)); + end + end +end + +if nargout > 1 + g = g(:); +end + +if visualize + if nComp == 2 + plot(z(:,1),z(:,2),'.'); + pause(.01) + else + plot3(z(:,1),z(:,2),z(:,3),'.'); + pause(.01) + end +end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MLPbinaryLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MLPbinaryLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..895b5153c377c54e090c5264dd7969fd3db7496a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MLPbinaryLoss.m @@ -0,0 +1,74 @@ +function [f,g] = MLPregressionLoss(w,X,y,nHidden) + +[nInstances,nVars] = size(X); + +% Form Weights +inputWeights = reshape(w(1:nVars*nHidden(1)),nVars,nHidden(1)); +offset = nVars*nHidden(1); +for h = 2:length(nHidden) + hiddenWeights{h-1} = reshape(w(offset+1:offset+nHidden(h-1)*nHidden(h)),nHidden(h-1),nHidden(h)); + offset = offset+nHidden(h-1)*nHidden(h); +end +outputWeights = w(offset+1:offset+nHidden(end)); + +f = 0; +if nargout > 1 + gInput = zeros(size(inputWeights)); + for h = 2:length(nHidden) + gHidden{h-1} = zeros(size(hiddenWeights{h-1})); + end + gOutput = zeros(size(outputWeights)); +end + +% Compute Output +for i = 1:nInstances + ip{1} = X(i,:)*inputWeights; + fp{1} = tanh(ip{1}); + for h = 2:length(nHidden) + ip{h} = fp{h-1}*hiddenWeights{h-1}; + fp{h} = tanh(ip{h}); + end + + f = f + mylogsumexp([0 -y(i)*fp{end}*outputWeights]); + + if nargout > 1 + sigmoid = 1/(1+exp(y(i)*fp{end}*outputWeights)); + err = -y(i)*sigmoid; + + % Output Weights + gOutput = gOutput + err*fp{end}'; + + if length(nHidden) > 1 + % Last Layer of Hidden Weights + backprop = err*(sech(ip{end}).^2.*outputWeights'); + gHidden{end} = gHidden{end} + fp{end-1}'*backprop; + + % Other Hidden Layers + for h = length(nHidden)-2:-1:1 + backprop = (backprop*hiddenWeights{h+1}').*sech(ip{h+1}).^2; + gHidden{h} = gHidden{h} + fp{h}'*backprop; + end + + % Input Weights + backprop = (backprop*hiddenWeights{1}').*sech(ip{1}).^2; + gInput = gInput + X(i,:)'*backprop; + else + % Input Weights + gInput = gInput + err*X(i,:)'*(sech(ip{end}).^2.*outputWeights'); + end + + end + +end + +% Put Gradient into vector +if nargout > 1 + g = zeros(size(w)); + g(1:nVars*nHidden(1)) = gInput(:); + offset = nVars*nHidden(1); + for h = 2:length(nHidden) + g(offset+1:offset+nHidden(h-1)*nHidden(h)) = gHidden{h-1}; + offset = offset+nHidden(h-1)*nHidden(h); + end + g(offset+1:offset+nHidden(end)) = gOutput; +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MLPregressionLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MLPregressionLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..81acd1104c5054c638d6ea95c582b2a7843fb782 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MLPregressionLoss.m @@ -0,0 +1,75 @@ +function [f,g] = MLPregressionLoss(w,X,y,nHidden) + +[nInstances,nVars] = size(X); + +% Form Weights +inputWeights = reshape(w(1:nVars*nHidden(1)),nVars,nHidden(1)); +offset = nVars*nHidden(1); +for h = 2:length(nHidden) + hiddenWeights{h-1} = reshape(w(offset+1:offset+nHidden(h-1)*nHidden(h)),nHidden(h-1),nHidden(h)); + offset = offset+nHidden(h-1)*nHidden(h); +end +outputWeights = w(offset+1:offset+nHidden(end)); + +f = 0; +if nargout > 1 + gInput = zeros(size(inputWeights)); + for h = 2:length(nHidden) + gHidden{h-1} = zeros(size(hiddenWeights{h-1})); + end + gOutput = zeros(size(outputWeights)); +end + +% Compute Output +for i = 1:nInstances + ip{1} = X(i,:)*inputWeights; + fp{1} = tanh(ip{1}); + for h = 2:length(nHidden) + ip{h} = fp{h-1}*hiddenWeights{h-1}; + fp{h} = tanh(ip{h}); + end + yhat = fp{end}*outputWeights; + + relativeErr = yhat-y(i); + f = f + relativeErr^2; + + if nargout > 1 + err = 2*relativeErr; + + % Output Weights + gOutput = gOutput + err*fp{end}'; + + if length(nHidden) > 1 + % Last Layer of Hidden Weights + backprop = err*(sech(ip{end}).^2.*outputWeights'); + gHidden{end} = gHidden{end} + fp{end-1}'*backprop; + + % Other Hidden Layers + for h = length(nHidden)-2:-1:1 + backprop = (backprop*hiddenWeights{h+1}').*sech(ip{h+1}).^2; + gHidden{h} = gHidden{h} + fp{h}'*backprop; + end + + % Input Weights + backprop = (backprop*hiddenWeights{1}').*sech(ip{1}).^2; + gInput = gInput + X(i,:)'*backprop; + else + % Input Weights + gInput = gInput + err*X(i,:)'*(sech(ip{end}).^2.*outputWeights'); + end + + end + +end + +% Put Gradient into vector +if nargout > 1 + g = zeros(size(w)); + g(1:nVars*nHidden(1)) = gInput(:); + offset = nVars*nHidden(1); + for h = 2:length(nHidden) + g(offset+1:offset+nHidden(h-1)*nHidden(h)) = gHidden{h-1}; + offset = offset+nHidden(h-1)*nHidden(h); + end + g(offset+1:offset+nHidden(end)) = gOutput; +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MLPregressionPredict.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MLPregressionPredict.m new file mode 100644 index 0000000000000000000000000000000000000000..d9221723380c8ace2d9a94f7ef626c08dd943ef0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/MLPregressionPredict.m @@ -0,0 +1,23 @@ +function [y] = MLPregressionPredict(w,X,nHidden) + +[nInstances,nVars] = size(X); + +% Form Weights +inputWeights = reshape(w(1:nVars*nHidden(1)),nVars,nHidden(1)); +offset = nVars*nHidden(1); +for h = 2:length(nHidden) + hiddenWeights{h-1} = reshape(w(offset+1:offset+nHidden(h-1)*nHidden(h)),nHidden(h-1),nHidden(h)); + offset = offset+nHidden(h-1)*nHidden(h); +end +outputWeights = w(offset+1:offset+nHidden(end)); + +% Compute Output +for i = 1:nInstances + ip{1} = X(i,:)*inputWeights; + fp{1} = tanh(ip{1}); + for h = 2:length(nHidden) + ip{h} = fp{h-1}*hiddenWeights{h-1}; + fp{h} = tanh(ip{h}); + end + y(i) = fp{end}*outputWeights; +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/ProbitLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/ProbitLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..ad29d1038c4b93f9f13df7d304361298728992e6 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/ProbitLoss.m @@ -0,0 +1,18 @@ +function [nll,g,H] = ProbitLoss(w,X,y) +% w(feature,1) +% X(instance,feature) +% y(instance,1) + +yXw = y.*(X*w)/sqrt(2); +erf_yXw = erf(full(yXw)); +probit_yXw = (1/2)*(1+erf_yXw)+eps; +nll = -sum(log(probit_yXw)); + +if nargout > 1 + norm_yXw = (1/sqrt(2*pi))*exp(-yXw.^2); + g = -X'*(y.*norm_yXw./probit_yXw); +end + +if nargout > 2 + H = X'*diag(sparse(norm_yXw.*norm_yXw./probit_yXw.^2 + norm_yXw.*yXw.*sqrt(2)./probit_yXw))*X; +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SSVMLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SSVMLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..9b30f9500e4483460f55cf4d1a5632d5255721f8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SSVMLoss.m @@ -0,0 +1,23 @@ +function [f,g,H] = SSVMLoss(w,X,y) +% w(feature,1) +% X(instance,feature) +% y(instance,1) + +[n,p] = size(X); + +err = 1-y.*(X*w); +viol = find(err>=0); +f = sum(err(viol).^2); + +if nargout > 1 + if isempty(viol) + g = zeros(size(w)); + else + g = -2*X(viol,:)'*(err(viol).*y(viol)); + end +end + +if nargout > 2 + H = 2*X(viol,:)'*X(viol,:); +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SSVMMultiLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SSVMMultiLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..2fc26e172e65b0e84e7003e5bc44cfd5b9f025df --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SSVMMultiLoss.m @@ -0,0 +1,28 @@ +function [f,g] = SSVMMultiLoss(w,X,y,k) +% w(feature*class,1) +% X(instance,feature) +% y(instance,1) +% +% f = sum_k ( max(0, 1 + <w_k,x> - <w_y,x> ) ) + +[n,p] = size(X); +w = reshape(w,[p k]); + +f = 0; +g = zeros(p,k); +for i = 1:n + for c = 1:k + if c ~= y(i) + err = 1 + X(i,:)*(w(:,c) - w(:,y(i))); + if err > 0 + f = f + err^2; + + if nargout > 1 + g(:,c) = g(:,c) + 2*X(i,:)'*err; + g(:,y(i)) = g(:,y(i)) - 2*X(i,:)'*err; + end + end + end + end +end +g = g(:); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SSVRLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SSVRLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..6cf2961771141c2cbeebb849cfa03996327e1812 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SSVRLoss.m @@ -0,0 +1,36 @@ +function [f,g,H] = SSVMLoss(w,X,y,epsilon) +% w(feature,1) +% X(instance,feature) +% y(instance,1) + +[n,p] = size(X); + +Xw = X*w; +err1 = Xw - y - epsilon; +err2 = y - Xw - epsilon; + +viol1 = find(err1 >= 0); +viol2 = find(err2 >= 0); + +f = sum(err1(viol1).^2) + sum(err2(viol2).^2); + +if nargout > 1 + g = zeros(size(w)); + if ~isempty(viol1) + g = g + 2*X(viol1,:)'*err1(viol1); + end + if ~isempty(viol2) + g = g - 2*X(viol2,:)'*err2(viol2); + end +end + +if nargout > 2 + H = zeros(p); + if ~isempty(viol1) + H = H + 2*X(viol1,:)'*X(viol1,:); + end + if ~isempty(viol2) + H = H + 2*X(viol2,:)'*X(viol2,:); + end +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SoftmaxLoss2.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SoftmaxLoss2.m new file mode 100644 index 0000000000000000000000000000000000000000..750d406d743184534eb3c83574b99690b4f0e90f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/SoftmaxLoss2.m @@ -0,0 +1,34 @@ +function [nll,g,H] = SoftmaxLoss2(w,X,y,k) +% w(feature*class,1) - weights for last class assumed to be 0 +% X(instance,feature) +% y(instance,1) +% +% version of SoftmaxLoss where weights for last class are fixed at 0 +% to avoid overparameterization + +[n,p] = size(X); +w = reshape(w,[p k-1]); +w(:,k) = zeros(p,1); + +Z = sum(exp(X*w),2); +nll = -sum((sum(X.*w(:,y).',2) - log(Z))); + +if nargout > 1 + g = zeros(p,k-1); + + for c = 1:k-1 + g(:,c) = -sum(X.*repmat((y==c) - exp(X*w(:,c))./Z,[1 p])); + end + g = reshape(g,[p*(k-1) 1]); +end + +if nargout > 2 + H = zeros(p*(k-1)); + SM = exp(X*w(:,1:k-1))./repmat(Z,[1 k-1]); + for c1 = 1:k-1 + for c2 = 1:k-1 + D = SM(:,c1).*((c1==c2)-SM(:,c2)); + H((p*(c1-1)+1):p*c1,(p*(c2-1)+1):p*c2) = X'*diag(sparse(D))*X; + end + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/WeightedLogisticLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/WeightedLogisticLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..83c34854a169353b38ca4bf2a2364a1bb2edd53b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/WeightedLogisticLoss.m @@ -0,0 +1,24 @@ +function [nll,g,H] = WeightedLogisticLoss(w,X,y,weights) +% w(feature,1) +% X(instance,feature) +% y(instance,1) + +[n,p] = size(X); + +Xw = X*w; +yXw = y.*Xw; + +nll = sum(weights.*mylogsumexp([zeros(n,1) -yXw])); + +if nargout > 1 + if nargout > 2 + sig = 1./(1+exp(-yXw)); + g = -X.'*(weights.*y.*(1-sig)); + else + g = -X.'*(weights.*y.*(1-(1./(1+exp(-yXw))))); + end +end + +if nargout > 2 + H = X.'*diag(sparse(weights.*y.*sig.*(1-sig).*y))*X; +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/kernelLinear.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/kernelLinear.m new file mode 100644 index 0000000000000000000000000000000000000000..5980b33ded9d83ca60852bee7e9fec8bccbbdc1d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/kernelLinear.m @@ -0,0 +1,2 @@ +function [XX] = kernelLinear(X1,X2,varargin) +XX = X1*X2'; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/kernelPoly.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/kernelPoly.m new file mode 100644 index 0000000000000000000000000000000000000000..6212ae15f7697f589b7b17e64a5838aa4f36b47c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/kernelPoly.m @@ -0,0 +1,2 @@ +function [XX] = kernelLinear(X1,X2,d) +XX = (1+X1*X2').^d; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/kernelRBF.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/kernelRBF.m new file mode 100644 index 0000000000000000000000000000000000000000..4f6a769dff0c194d6f7fdf9a6ae2dfec59d0c3ee --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/kernelRBF.m @@ -0,0 +1,18 @@ +function [XX] = kernelRBF(X1,X2,sigma) +n1 = size(X1,1); +n2 = size(X2,1); +p = size(X1,2); +Z = 1/sqrt(2*pi*sigma^2); + +if 1 % Vectorized way from Alex Smola's blog + D = X1.^2*ones(p,n2) + ones(n1,p)*(X2').^2 - 2*X1*X2'; + XX = Z*exp(-D/(2*sigma^2)); +else % Slow way + XX = zeros(n1,n2); + for i = 1:n1 + for j = 1:n2 + dist = sum((X1(i,:)-X2(j,:)).^2); + XX(i,j) = Z*exp(-dist/(2*sigma^2)); + end + end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/multivariateT.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/multivariateT.m new file mode 100644 index 0000000000000000000000000000000000000000..646ac2ba054b757bac48b5fe97123069547fed2d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/multivariateT.m @@ -0,0 +1,56 @@ +function [nll,g] = multivariateT(X,mu,sigma,dof,deriv) +[n,d] = size(X); + +nll = 0; +switch deriv + case 1 + g = zeros(d,1); % derivative wrt mu + case 2 + % derivative wrt sigma + g = zeros(d); + case 3 + % derivative wrt dof + g = 0; +end + +if length(sigma) ~= d + sigma = reshape(sigma,d,d); + sigma = (sigma+sigma')/2; +end +[R,err]=chol(sigma); +if err == 0 + sigmaInv = sigma^-1; + for i = 1:n + tmp = 1 + (1/dof)*(X(i,:)'-mu)'*sigmaInv*(X(i,:)'-mu); + nll = nll + ((d+dof)/2)*log(tmp); + + switch deriv + case 1 + g = g - ((d+dof)/(dof*tmp))*sigmaInv*(X(i,:)'-mu); + case 2 + g = g - ((d+dof)/(2*dof*tmp))*sigmaInv*(X(i,:)'-mu)*(X(i,:)'-mu)'*sigmaInv; + case 3 + g = g - (d/(2*tmp*dof^2))*(X(i,:)'-mu)'*sigmaInv*(X(i,:)'-mu); + g = g - (dof/(2*tmp*dof^2))*(X(i,:)'-mu)'*sigmaInv*(X(i,:)'-mu); + g = g + (1/2)*log(tmp); + end + end +else + nll = inf; + g = g(:); + return +end + +% Now take into account logZ +logSqrtDetSigma = sum(log(diag(R))); +logZ = gammaln((dof+d)/2) - (d/2)*log(pi) - logSqrtDetSigma - gammaln(dof/2) - (d/2)*log(dof); +nll = nll - n*logZ; +switch deriv + case 2 + g = g + (n/2)*sigmaInv; + g = (g+g')/2; + g = g(:); + case 3 + g = g - (n/2)*psi((dof+d)/2) + (n/2)*psi(dof/2) + n*(d/(2*dof)); +end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/multivariateTpdf.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/multivariateTpdf.m new file mode 100644 index 0000000000000000000000000000000000000000..3be779e071bec3d16adb496c25be1ac7b9d7c384 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/multivariateTpdf.m @@ -0,0 +1,18 @@ +function [lik] = multivariateT(X,mu,sigma,dof,deriv) +[n,d] = size(X); +nll = zeros(n,1); + +[R,err]=chol(sigma); +if err == 0 + sigmaInv = sigma^-1; + for i = 1:n + tmp = 1 + (1/dof)*(X(i,:)'-mu)'*sigmaInv*(X(i,:)'-mu); + nll(i,1) = ((d+dof)/2)*log(tmp); + end + logSqrtDetSigma = sum(log(diag(R))); + logZ = gammaln((dof+d)/2) - (d/2)*log(pi) - logSqrtDetSigma - gammaln(dof/2) - (d/2)*log(dof); + nll = nll - logZ; + lik = exp(-nll); +else + lik(:) = inf; +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/penalizedKernelL2.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/penalizedKernelL2.m new file mode 100644 index 0000000000000000000000000000000000000000..297ae80c2fdb0c5ae29a75759515728898a840e7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/penalizedKernelL2.m @@ -0,0 +1,21 @@ +function [nll,g,H] = penalizedL2(w,K,gradFunc,lambda,varargin) +% Adds kernel L2-penalization to a loss function, when the weight vector +% (you can use this instead of always adding it to the loss function code) + +if nargout <= 1 + [nll] = gradFunc(w,varargin{:}); +elseif nargout == 2 + [nll,g] = gradFunc(w,varargin{:}); +else + [nll,g,H] = gradFunc(w,varargin{:}); +end + +nll = nll+sum(lambda*w'*K*w); + +if nargout > 1 + g = g + 2*lambda*K*w; +end + +if nargout > 2 + H = H + 2*lambda*K; +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/penalizedKernelL2_matrix.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/penalizedKernelL2_matrix.m new file mode 100644 index 0000000000000000000000000000000000000000..c3241888a943b58f69cc9b7f75973a7475124604 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/penalizedKernelL2_matrix.m @@ -0,0 +1,33 @@ +function [nll,g,H] = penalizedL2(w,K,nCols,gradFunc,lambda,varargin) +% Adds kernel L2-penalization to a loss function, when the weight vector +% is actually a matrix with nCols columns (and the kernel is +% block-diagonal with respect to the columns) +% (you can use this instead of always adding it to the loss function code) + +if nargout <= 1 + [nll] = gradFunc(w,varargin{:}); +elseif nargout == 2 + [nll,g] = gradFunc(w,varargin{:}); +else + [nll,g,H] = gradFunc(w,varargin{:}); +end + +nInstances = size(K,1); +w = reshape(w,[nInstances nCols]); + +for i = 1:nCols + nll = nll+lambda*sum(w(:,i)'*K*w(:,i)); +end + +if nargout > 1 + g = reshape(g,[nInstances nCols]); + for i = 1:nCols + g(:,i) = g(:,i) + 2*lambda*K*w(:,i); + end + g = g(:); +end + +if nargout > 2 + fprintf('Hessian Not Implemented for matrix kernels\n'); + pause; +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/penalizedL2.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/penalizedL2.m new file mode 100644 index 0000000000000000000000000000000000000000..a80d6962097a10517c1d91a9954deae7c2316231 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/penalizedL2.m @@ -0,0 +1,26 @@ +function [nll,g,H] = penalizedL2(w,gradFunc,lambda,varargin) +% [nll,g,H] = penalizedL2(w,gradFunc,lambda,varargin) +% Adds L2-penalization to a loss function +% (you can use this instead of always adding it to the loss function code) + +if nargout <= 1 + [nll] = gradFunc(w,varargin{:}); +elseif nargout == 2 + [nll,g] = gradFunc(w,varargin{:}); +else + [nll,g,H] = gradFunc(w,varargin{:}); +end + +nll = nll+sum(lambda.*(w.^2)); + +if nargout > 1 + g = g + 2*lambda.*w; +end + +if nargout > 2 + if isscalar(lambda) + H = H + 2*lambda*eye(length(w)); + else + H = H + diag(2*lambda); + end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/sparsePrecisionObj.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/sparsePrecisionObj.m new file mode 100644 index 0000000000000000000000000000000000000000..5a6da3bfaa711e2e72b6a5d6a0655ad4533196af --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/sparsePrecisionObj.m @@ -0,0 +1,22 @@ +function [f,g] = sparsePrecisionObj(x,nVars,nonZero,sigma) + +X = zeros(nVars); +X(nonZero) = x; + +[R,p] = chol(X); + +if p== 0 + % Fast Way to compute -logdet(X) + tr(X*sigma) + f = -2*sum(log(diag(R))) + sum(sum(sigma.*X)); + g = -inv(X) + sigma; + g = g(nonZero); +else + % Matrix not in positive-definite cone, set f to Inf + % to force minFunc to backtrack + f = inf; + g = zeros(size(x)); + + % If backtracking too much: + % optimal projection is given by projecting coefficients + % of spectral decomposition onto non-negative orthant) +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/studentLoss.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/studentLoss.m new file mode 100644 index 0000000000000000000000000000000000000000..a0e034e229a3e74c79e9bb648838a02a9d5f6b5c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/lossFuncs/studentLoss.m @@ -0,0 +1,23 @@ +function [loglik,g] = studentLoss(X,y,w,lambda,dof) +[nInstances,nVars] = size(X); + +if lambda > 0 && dof > 0 + logZ = gammaln(dof/2+1/2) - gammaln(dof/2) + (1/2)*log(lambda) - (1/2)*log(pi*dof); + err = X*w-y; + logLiks = 1 + (lambda/dof)*err.^2; + sumLL = sum(log(logLiks)); + loglik = -nInstances*logZ - (-dof/2 - 1/2)*sumLL; + + if nargout > 1 + g = zeros(nVars+2,1); + g(1:nVars) = -2*(lambda/dof)*(-dof/2 - 1/2)*X'*(err./logLiks); + g(nVars+1,1) = -(nInstances/2)*(1/lambda) - (-dof/2 - 1/2)*(1/dof)*sum((err.^2)./logLiks); + g(end,1) = -(nInstances/2)*psi(dof/2+1/2) + (nInstances/2)*psi(dof/2) + nInstances/(2*dof); + g(end,1) = g(end,1) + (-1/2 - dof/2)*(lambda/dof^2)*sum((err.^2)./logLiks); + g(end,1) = g(end,1) + (1/2)*sumLL; + end +else + loglik = inf; + g = zeros(nVars+2,1); +end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/mexAll.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/mexAll.m new file mode 100644 index 0000000000000000000000000000000000000000..2f8226e44bf8e743afb6ee4676eeb29940dab03a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/mexAll.m @@ -0,0 +1,7 @@ +% minFunc +fprintf('Compiling minFunc files...\n'); +mex -outdir minFunc/compiled minFunc/mex/mcholC.c +mex -outdir minFunc/compiled minFunc/mex/lbfgsC.c +mex -outdir minFunc/compiled minFunc/mex/lbfgsAddC.c +mex -outdir minFunc/compiled minFunc/mex/lbfgsProdC.c + diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/ArmijoBacktrack.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/ArmijoBacktrack.m new file mode 100644 index 0000000000000000000000000000000000000000..2cc01551b85a7bf2244050b3813182412b56f730 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/ArmijoBacktrack.m @@ -0,0 +1,139 @@ +function [t,x_new,f_new,g_new,funEvals,H] = ArmijoBacktrack(... + x,t,d,f,fr,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,saveHessianComp,funObj,varargin) +% [t,x_new,f_new,g_new,funEvals,H] = ArmijoBacktrack(... +% x,t,d,f,fr,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,saveHessianComp,funObj,varargin) +% +% Backtracking linesearch to satisfy Armijo condition +% +% Inputs: +% x: starting location +% t: initial step size +% d: descent direction +% f: function value at starting location +% fr: reference function value (usually funObj(x)) +% gtd: directional derivative at starting location +% c1: sufficient decrease parameter +% debug: display debugging information +% LS_interp: type of interpolation +% progTol: minimum allowable step length +% doPlot: do a graphical display of interpolation +% funObj: objective function +% varargin: parameters of objective function +% +% Outputs: +% t: step length +% f_new: function value at x+t*d +% g_new: gradient value at x+t*d +% funEvals: number function evaluations performed by line search +% H: Hessian at initial guess (only computed if requested) +% +% recet change: LS changed to LS_interp and LS_multi + +% Evaluate the Objective and Gradient at the Initial Step +if nargout == 6 + [f_new,g_new,H] = funObj(x + t*d,varargin{:}); +else + [f_new,g_new] = funObj(x+t*d,varargin{:}); +end +funEvals = 1; + +while f_new > fr + c1*t*gtd || ~isLegal(f_new) + temp = t; + + if LS_interp == 0 || ~isLegal(f_new) + % Ignore value of new point + if debug + fprintf('Fixed BT\n'); + end + t = 0.5*t; + elseif LS_interp == 1 || ~isLegal(g_new) + % Use function value at new point, but not its derivative + if funEvals < 2 || LS_multi == 0 || ~isLegal(f_prev) + % Backtracking w/ quadratic interpolation based on two points + if debug + fprintf('Quad BT\n'); + end + t = polyinterp([0 f gtd; t f_new sqrt(-1)],doPlot,0,t); + else + % Backtracking w/ cubic interpolation based on three points + if debug + fprintf('Cubic BT\n'); + end + t = polyinterp([0 f gtd; t f_new sqrt(-1); t_prev f_prev sqrt(-1)],doPlot,0,t); + end + else + % Use function value and derivative at new point + + if funEvals < 2 || LS_multi == 0 || ~isLegal(f_prev) + % Backtracking w/ cubic interpolation w/ derivative + if debug + fprintf('Grad-Cubic BT\n'); + end + t = polyinterp([0 f gtd; t f_new g_new'*d],doPlot,0,t); + elseif ~isLegal(g_prev) + % Backtracking w/ quartic interpolation 3 points and derivative + % of two + if debug + fprintf('Grad-Quartic BT\n'); + end + t = polyinterp([0 f gtd; t f_new g_new'*d; t_prev f_prev sqrt(-1)],doPlot,0,t); + else + % Backtracking w/ quintic interpolation of 3 points and derivative + % of two + if debug + fprintf('Grad-Quintic BT\n'); + end + t = polyinterp([0 f gtd; t f_new g_new'*d; t_prev f_prev g_prev'*d],doPlot,0,t); + end + end + + % Adjust if change in t is too small/large + if t < temp*1e-3 + if debug + fprintf('Interpolated Value Too Small, Adjusting\n'); + end + t = temp*1e-3; + elseif t > temp*0.6 + if debug + fprintf('Interpolated Value Too Large, Adjusting\n'); + end + t = temp*0.6; + end + + % Store old point if doing three-point interpolation + if LS_multi + f_prev = f_new; + t_prev = temp; + if LS_interp == 2 + g_prev = g_new; + end + end + + if ~saveHessianComp && nargout == 6 + [f_new,g_new,H] = funObj(x + t*d,varargin{:}); + else + [f_new,g_new] = funObj(x + t*d,varargin{:}); + end + funEvals = funEvals+1; + + % Check whether step size has become too small + if max(abs(t*d)) <= progTol + if debug + fprintf('Backtracking Line Search Failed\n'); + end + t = 0; + f_new = f; + g_new = g; + break; + end +end + +% Evaluate Hessian at new point +if nargout == 6 && funEvals > 1 && saveHessianComp + [f_new,g_new,H] = funObj(x + t*d,varargin{:}); + funEvals = funEvals+1; +end + +x_new = x + t*d; + +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/WolfeLineSearch.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/WolfeLineSearch.m new file mode 100644 index 0000000000000000000000000000000000000000..30b684b559b703995aa78058319cd57c321f7c9c --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/WolfeLineSearch.m @@ -0,0 +1,359 @@ +function [t,f_new,g_new,funEvals,H] = WolfeLineSearch(... + x,t,d,f,g,gtd,c1,c2,LS_interp,LS_multi,maxLS,progTol,debug,doPlot,saveHessianComp,funObj,varargin) +% +% Bracketing Line Search to Satisfy Wolfe Conditions +% +% Inputs: +% x: starting location +% t: initial step size +% d: descent direction +% f: function value at starting location +% g: gradient at starting location +% gtd: directional derivative at starting location +% c1: sufficient decrease parameter +% c2: curvature parameter +% debug: display debugging information +% LS_interp: type of interpolation +% maxLS: maximum number of iterations +% progTol: minimum allowable step length +% doPlot: do a graphical display of interpolation +% funObj: objective function +% varargin: parameters of objective function +% +% Outputs: +% t: step length +% f_new: function value at x+t*d +% g_new: gradient value at x+t*d +% funEvals: number function evaluations performed by line search +% H: Hessian at initial guess (only computed if requested + +% Evaluate the Objective and Gradient at the Initial Step +if nargout == 5 + [f_new,g_new,H] = funObj(x + t*d,varargin{:}); +else + [f_new,g_new] = funObj(x+t*d,varargin{:}); +end +funEvals = 1; +gtd_new = g_new'*d; + +% Bracket an Interval containing a point satisfying the +% Wolfe criteria + +LSiter = 0; +t_prev = 0; +f_prev = f; +g_prev = g; +gtd_prev = gtd; +nrmD = max(abs(d)); +done = 0; + +while LSiter < maxLS + + %% Bracketing Phase + if ~isLegal(f_new) || ~isLegal(g_new) + if debug + fprintf('Extrapolated into illegal region, switching to Armijo line-search\n'); + end + t = (t + t_prev)/2; + % Do Armijo + if nargout == 5 + [t,x_new,f_new,g_new,armijoFunEvals,H] = ArmijoBacktrack(... + x,t,d,f,f,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,saveHessianComp,... + funObj,varargin{:}); + else + [t,x_new,f_new,g_new,armijoFunEvals] = ArmijoBacktrack(... + x,t,d,f,f,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,saveHessianComp,... + funObj,varargin{:}); + end + funEvals = funEvals + armijoFunEvals; + return; + end + + + if f_new > f + c1*t*gtd || (LSiter > 1 && f_new >= f_prev) + bracket = [t_prev t]; + bracketFval = [f_prev f_new]; + bracketGval = [g_prev g_new]; + break; + elseif abs(gtd_new) <= -c2*gtd + bracket = t; + bracketFval = f_new; + bracketGval = g_new; + done = 1; + break; + elseif gtd_new >= 0 + bracket = [t_prev t]; + bracketFval = [f_prev f_new]; + bracketGval = [g_prev g_new]; + break; + end + temp = t_prev; + t_prev = t; + minStep = t + 0.01*(t-temp); + maxStep = t*10; + if LS_interp <= 1 + if debug + fprintf('Extending Braket\n'); + end + t = maxStep; + elseif LS_interp == 2 + if debug + fprintf('Cubic Extrapolation\n'); + end + t = polyinterp([temp f_prev gtd_prev; t f_new gtd_new],doPlot,minStep,maxStep); + elseif LS_interp == 3 + t = mixedExtrap(temp,f_prev,gtd_prev,t,f_new,gtd_new,minStep,maxStep,debug,doPlot); + end + + f_prev = f_new; + g_prev = g_new; + gtd_prev = gtd_new; + if ~saveHessianComp && nargout == 5 + [f_new,g_new,H] = funObj(x + t*d,varargin{:}); + else + [f_new,g_new] = funObj(x + t*d,varargin{:}); + end + funEvals = funEvals + 1; + gtd_new = g_new'*d; + LSiter = LSiter+1; +end + +if LSiter == maxLS + bracket = [0 t]; + bracketFval = [f f_new]; + bracketGval = [g g_new]; +end + +%% Zoom Phase + +% We now either have a point satisfying the criteria, or a bracket +% surrounding a point satisfying the criteria +% Refine the bracket until we find a point satisfying the criteria +insufProgress = 0; +Tpos = 2; +LOposRemoved = 0; +while ~done && LSiter < maxLS + + % Find High and Low Points in bracket + [f_LO LOpos] = min(bracketFval); + HIpos = -LOpos + 3; + + % Compute new trial value + if LS_interp <= 1 || ~isLegal(bracketFval) || ~isLegal(bracketGval) + if debug + fprintf('Bisecting\n'); + end + t = mean(bracket); + elseif LS_interp == 2 + if debug + fprintf('Grad-Cubic Interpolation\n'); + end + t = polyinterp([bracket(1) bracketFval(1) bracketGval(:,1)'*d + bracket(2) bracketFval(2) bracketGval(:,2)'*d],doPlot); + else + % Mixed Case %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + nonTpos = -Tpos+3; + if LOposRemoved == 0 + oldLOval = bracket(nonTpos); + oldLOFval = bracketFval(nonTpos); + oldLOGval = bracketGval(:,nonTpos); + end + t = mixedInterp(bracket,bracketFval,bracketGval,d,Tpos,oldLOval,oldLOFval,oldLOGval,debug,doPlot); + end + + + % Test that we are making sufficient progress + if min(max(bracket)-t,t-min(bracket))/(max(bracket)-min(bracket)) < 0.1 + if debug + fprintf('Interpolation close to boundary'); + end + if insufProgress || t>=max(bracket) || t <= min(bracket) + if debug + fprintf(', Evaluating at 0.1 away from boundary\n'); + end + if abs(t-max(bracket)) < abs(t-min(bracket)) + t = max(bracket)-0.1*(max(bracket)-min(bracket)); + else + t = min(bracket)+0.1*(max(bracket)-min(bracket)); + end + insufProgress = 0; + else + if debug + fprintf('\n'); + end + insufProgress = 1; + end + else + insufProgress = 0; + end + + % Evaluate new point + if ~saveHessianComp && nargout == 5 + [f_new,g_new,H] = funObj(x + t*d,varargin{:}); + else + [f_new,g_new] = funObj(x + t*d,varargin{:}); + end + funEvals = funEvals + 1; + gtd_new = g_new'*d; + LSiter = LSiter+1; + + armijo = f_new < f + c1*t*gtd; + if ~armijo || f_new >= f_LO + % Armijo condition not satisfied or not lower than lowest + % point + bracket(HIpos) = t; + bracketFval(HIpos) = f_new; + bracketGval(:,HIpos) = g_new; + Tpos = HIpos; + else + if abs(gtd_new) <= - c2*gtd + % Wolfe conditions satisfied + done = 1; + elseif gtd_new*(bracket(HIpos)-bracket(LOpos)) >= 0 + % Old HI becomes new LO + bracket(HIpos) = bracket(LOpos); + bracketFval(HIpos) = bracketFval(LOpos); + bracketGval(:,HIpos) = bracketGval(:,LOpos); + if LS_interp == 3 + if debug + fprintf('LO Pos is being removed!\n'); + end + LOposRemoved = 1; + oldLOval = bracket(LOpos); + oldLOFval = bracketFval(LOpos); + oldLOGval = bracketGval(:,LOpos); + end + end + % New point becomes new LO + bracket(LOpos) = t; + bracketFval(LOpos) = f_new; + bracketGval(:,LOpos) = g_new; + Tpos = LOpos; + end + + if ~done && abs(bracket(1)-bracket(2))*nrmD < progTol + if debug + fprintf('Line-search bracket has been reduced below progTol\n'); + end + break; + end + +end + +%% +if LSiter == maxLS + if debug + fprintf('Line Search Exceeded Maximum Line Search Iterations\n'); + end +end + +[f_LO LOpos] = min(bracketFval); +t = bracket(LOpos); +f_new = bracketFval(LOpos); +g_new = bracketGval(:,LOpos); + + + +% Evaluate Hessian at new point +if nargout == 5 && funEvals > 1 && saveHessianComp + [f_new,g_new,H] = funObj(x + t*d,varargin{:}); + funEvals = funEvals + 1; +end + +end + + +%% +function [t] = mixedExtrap(x0,f0,g0,x1,f1,g1,minStep,maxStep,debug,doPlot); +alpha_c = polyinterp([x0 f0 g0; x1 f1 g1],doPlot,minStep,maxStep); +alpha_s = polyinterp([x0 f0 g0; x1 sqrt(-1) g1],doPlot,minStep,maxStep); +if alpha_c > minStep && abs(alpha_c - x1) < abs(alpha_s - x1) + if debug + fprintf('Cubic Extrapolation\n'); + end + t = alpha_c; +else + if debug + fprintf('Secant Extrapolation\n'); + end + t = alpha_s; +end +end + +%% +function [t] = mixedInterp(bracket,bracketFval,bracketGval,d,Tpos,oldLOval,oldLOFval,oldLOGval,debug,doPlot); + +% Mixed Case %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +nonTpos = -Tpos+3; + +gtdT = bracketGval(:,Tpos)'*d; +gtdNonT = bracketGval(:,nonTpos)'*d; +oldLOgtd = oldLOGval'*d; +if bracketFval(Tpos) > oldLOFval + alpha_c = polyinterp([oldLOval oldLOFval oldLOgtd + bracket(Tpos) bracketFval(Tpos) gtdT],doPlot); + alpha_q = polyinterp([oldLOval oldLOFval oldLOgtd + bracket(Tpos) bracketFval(Tpos) sqrt(-1)],doPlot); + if abs(alpha_c - oldLOval) < abs(alpha_q - oldLOval) + if debug + fprintf('Cubic Interpolation\n'); + end + t = alpha_c; + else + if debug + fprintf('Mixed Quad/Cubic Interpolation\n'); + end + t = (alpha_q + alpha_c)/2; + end +elseif gtdT'*oldLOgtd < 0 + alpha_c = polyinterp([oldLOval oldLOFval oldLOgtd + bracket(Tpos) bracketFval(Tpos) gtdT],doPlot); + alpha_s = polyinterp([oldLOval oldLOFval oldLOgtd + bracket(Tpos) sqrt(-1) gtdT],doPlot); + if abs(alpha_c - bracket(Tpos)) >= abs(alpha_s - bracket(Tpos)) + if debug + fprintf('Cubic Interpolation\n'); + end + t = alpha_c; + else + if debug + fprintf('Quad Interpolation\n'); + end + t = alpha_s; + end +elseif abs(gtdT) <= abs(oldLOgtd) + alpha_c = polyinterp([oldLOval oldLOFval oldLOgtd + bracket(Tpos) bracketFval(Tpos) gtdT],... + doPlot,min(bracket),max(bracket)); + alpha_s = polyinterp([oldLOval sqrt(-1) oldLOgtd + bracket(Tpos) bracketFval(Tpos) gtdT],... + doPlot,min(bracket),max(bracket)); + if alpha_c > min(bracket) && alpha_c < max(bracket) + if abs(alpha_c - bracket(Tpos)) < abs(alpha_s - bracket(Tpos)) + if debug + fprintf('Bounded Cubic Extrapolation\n'); + end + t = alpha_c; + else + if debug + fprintf('Bounded Secant Extrapolation\n'); + end + t = alpha_s; + end + else + if debug + fprintf('Bounded Secant Extrapolation\n'); + end + t = alpha_s; + end + + if bracket(Tpos) > oldLOval + t = min(bracket(Tpos) + 0.66*(bracket(nonTpos) - bracket(Tpos)),t); + else + t = max(bracket(Tpos) + 0.66*(bracket(nonTpos) - bracket(Tpos)),t); + end +else + t = polyinterp([bracket(nonTpos) bracketFval(nonTpos) gtdNonT + bracket(Tpos) bracketFval(Tpos) gtdT],doPlot); +end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsAddC.mexa64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsAddC.mexa64 new file mode 100644 index 0000000000000000000000000000000000000000..53a9de4cafd4f2ed2f6002b68f2f2d05262706bb Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsAddC.mexa64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsAddC.mexmaci64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsAddC.mexmaci64 new file mode 100644 index 0000000000000000000000000000000000000000..67a7171d56aeca99931886c3f22dd89d9baff1d8 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsAddC.mexmaci64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsAddC.mexw64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsAddC.mexw64 new file mode 100644 index 0000000000000000000000000000000000000000..6c4ceb5860c1222319bae69e520827599ec5a61e Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsAddC.mexw64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexa64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexa64 new file mode 100644 index 0000000000000000000000000000000000000000..c93deaed0c3cc5d53ed2243b93947397bb4eeb32 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexa64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexglx b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexglx new file mode 100644 index 0000000000000000000000000000000000000000..60b76123053233b7991fef692587a7cdd322cabe Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexglx differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexmac b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexmac new file mode 100644 index 0000000000000000000000000000000000000000..8279beb632cf0d76761e9bbfe551d4892e239a7b Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexmac differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexmaci b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexmaci new file mode 100644 index 0000000000000000000000000000000000000000..7484e51a497a0089614905dd70f2d4ac42962c28 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexmaci differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexmaci64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexmaci64 new file mode 100644 index 0000000000000000000000000000000000000000..8e81bf5d57181e7e7d003de7413b1ad98e258618 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexmaci64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexw32 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexw32 new file mode 100644 index 0000000000000000000000000000000000000000..1a87a91020b7d7610c1011038dcebc2993674075 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexw32 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexw64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexw64 new file mode 100644 index 0000000000000000000000000000000000000000..f7b050f13980c3dce208f558d16c5100357a8208 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsC.mexw64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsProdC.mexa64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsProdC.mexa64 new file mode 100644 index 0000000000000000000000000000000000000000..08af9548840f6a0b63a65d4269751ca1420b1967 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsProdC.mexa64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsProdC.mexmaci64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsProdC.mexmaci64 new file mode 100644 index 0000000000000000000000000000000000000000..fbeb993e420d7076ef5c7df2785cda623ee8cd11 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsProdC.mexmaci64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsProdC.mexw64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsProdC.mexw64 new file mode 100644 index 0000000000000000000000000000000000000000..9cdbac403d85f609ca9ddbd6e9def1a981e5f2a2 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/lbfgsProdC.mexw64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexa64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexa64 new file mode 100644 index 0000000000000000000000000000000000000000..029f62be8d0ed8cf9882f4aa6291d7b11832949b Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexa64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexglx b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexglx new file mode 100644 index 0000000000000000000000000000000000000000..949e3416bbcb570ecd4e879c81f110376956f43c Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexglx differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexmac b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexmac new file mode 100644 index 0000000000000000000000000000000000000000..10d8d6531277a22c22f61c1400560a24e6f05309 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexmac differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexmaci64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexmaci64 new file mode 100644 index 0000000000000000000000000000000000000000..8f12194e7a02cc62ace85831d0b7e4a195c128ad Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexmaci64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexw32 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexw32 new file mode 100644 index 0000000000000000000000000000000000000000..7507a40eed6aa86fe7e378336dd817ae1a40ee93 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexw32 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexw64 b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexw64 new file mode 100644 index 0000000000000000000000000000000000000000..1a816f10ca9e8167409201bf520cc5e8ad63b7b9 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/compiled/mcholC.mexw64 differ diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/conjGrad.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/conjGrad.m new file mode 100644 index 0000000000000000000000000000000000000000..5ad5fd93ef4df39dbd4eb7c5a2871ee4e03a3fb7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/conjGrad.m @@ -0,0 +1,86 @@ +function [x,k,res,negCurv] = cg(A,b,optTol,maxIter,verbose,precFunc,precArgs,matrixVectFunc,matrixVectArgs) +% [x,k,res,negCurv] = +% cg(A,b,optTol,maxIter,verbose,precFunc,precArgs,matrixVectFunc,matrixVect +% Args) +% Linear Conjugate Gradient, where optionally we use +% - preconditioner on vector v with precFunc(v,precArgs{:}) +% - matrix multipled by vector with matrixVectFunc(v,matrixVectArgs{:}) + +if nargin <= 4 + verbose = 0; +end + +x = zeros(size(b)); +r = -b; + +% Apply preconditioner (if supplied) +if nargin >= 7 && ~isempty(precFunc) + y = precFunc(r,precArgs{:}); +else + y = r; +end + +ry = r'*y; +p = -y; +k = 0; + +res = norm(r); +done = 0; +negCurv = []; +while res > optTol & k < maxIter & ~done + % Compute Matrix-vector product + if nargin >= 9 + Ap = matrixVectFunc(p,matrixVectArgs{:}); + else + Ap = A*p; + end + pAp = p'*Ap; + + % Check for negative Curvature + if pAp <= 1e-16 + if verbose + fprintf('Negative Curvature Detected!\n'); + end + + if nargout == 4 + if pAp < 0 + negCurv = p; + return + end + end + + if k == 0 + if verbose + fprintf('First-Iter, Proceeding...\n'); + end + done = 1; + else + if verbose + fprintf('Stopping\n'); + end + break; + end + end + + % Conjugate Gradient + alpha = ry/(pAp); + x = x + alpha*p; + r = r + alpha*Ap; + + % If supplied, apply preconditioner + if nargin >= 7 && ~isempty(precFunc) + y = precFunc(r,precArgs{:}); + else + y = r; + end + + ry_new = r'*y; + beta = ry_new/ry; + p = -y + beta*p; + k = k + 1; + + % Update variables + ry = ry_new; + res = norm(r); +end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/dampedUpdate.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/dampedUpdate.m new file mode 100644 index 0000000000000000000000000000000000000000..2f6803ea13938d47e5e7a253858fd7cecd36e796 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/dampedUpdate.m @@ -0,0 +1,43 @@ +function [old_dirs,old_stps,Hdiag,Bcompact] = dampedUpdate(y,s,corrections,debug,old_dirs,old_stps,Hdiag) + +%B0 = eye(length(y))/Hdiag; +S = old_dirs(:,2:end); +Y = old_stps(:,2:end); +k = size(Y,2); +L = zeros(k); +for j = 1:k + for i = j+1:k + L(i,j) = S(:,i)'*Y(:,j); + end +end +D = diag(diag(S'*Y)); +N = [S/Hdiag Y]; +M = [S'*S/Hdiag L;L' -D]; + +ys = y'*s; +Bs = s/Hdiag - N*(M\(N'*s)); % Product B*s +sBs = s'*Bs; + +eta = .02; +if ys < eta*sBs + if debug + fprintf('Damped Update\n'); + end + theta = min(max(0,((1-eta)*sBs)/(sBs - ys)),1); + y = theta*y + (1-theta)*Bs; +end + + +numCorrections = size(old_dirs,2); +if numCorrections < corrections + % Full Update + old_dirs(:,numCorrections+1) = s; + old_stps(:,numCorrections+1) = y; +else + % Limited-Memory Update + old_dirs = [old_dirs(:,2:corrections) s]; + old_stps = [old_stps(:,2:corrections) y]; +end + +% Update scale of initial Hessian approximation +Hdiag = (y'*s)/(y'*y); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/isLegal.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/isLegal.m new file mode 100644 index 0000000000000000000000000000000000000000..cf86b0b5ba7a64c8327241cfa35796f2536c647b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/isLegal.m @@ -0,0 +1,2 @@ +function [legal] = isLegal(v) +legal = sum(any(imag(v(:))))==0 & sum(isnan(v(:)))==0 & sum(isinf(v(:)))==0; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgs.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgs.m new file mode 100644 index 0000000000000000000000000000000000000000..da339bf74c14664c5b531122cc26d96ec9675dba --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgs.m @@ -0,0 +1,40 @@ +function [d] = lbfgs(g,s,y,Hdiag) +% BFGS Search Direction +% +% This function returns the (L-BFGS) approximate inverse Hessian, +% multiplied by the gradient +% +% If you pass in all previous directions/sizes, it will be the same as full BFGS +% If you truncate to the k most recent directions/sizes, it will be L-BFGS +% +% s - previous search directions (p by k) +% y - previous step sizes (p by k) +% g - gradient (p by 1) +% Hdiag - value of initial Hessian diagonal elements (scalar) + +[p,k] = size(s); + +for i = 1:k + ro(i,1) = 1/(y(:,i)'*s(:,i)); +end + +q = zeros(p,k+1); +r = zeros(p,k+1); +al =zeros(k,1); +be =zeros(k,1); + +q(:,k+1) = g; + +for i = k:-1:1 + al(i) = ro(i)*s(:,i)'*q(:,i+1); + q(:,i) = q(:,i+1)-al(i)*y(:,i); +end + +% Multiply by Initial Hessian +r(:,1) = Hdiag*q(:,1); + +for i = 1:k + be(i) = ro(i)*y(:,i)'*r(:,i); + r(:,i+1) = r(:,i) + s(:,i)*(al(i)-be(i)); +end +d=r(:,k+1); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgsAdd.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgsAdd.m new file mode 100644 index 0000000000000000000000000000000000000000..bbeb7076f356309e8bff1b87361ff43396e9e67a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgsAdd.m @@ -0,0 +1,32 @@ +function [S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,skipped] = lbfgsAdd(y,s,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,useMex) +ys = y'*s; +skipped = 0; +corrections = size(S,2); +if ys > 1e-10 + if lbfgs_end < corrections + lbfgs_end = lbfgs_end+1; + if lbfgs_start ~= 1 + if lbfgs_start == corrections + lbfgs_start = 1; + else + lbfgs_start = lbfgs_start+1; + end + end + else + lbfgs_start = min(2,corrections); + lbfgs_end = 1; + end + + if useMex + lbfgsAddC(y,s,Y,S,ys,int32(lbfgs_end)); + else + S(:,lbfgs_end) = s; + Y(:,lbfgs_end) = y; + end + YS(lbfgs_end) = ys; + + % Update scale of initial Hessian approximation + Hdiag = ys/(y'*y); +else + skipped = 1; +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgsProd.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgsProd.m new file mode 100644 index 0000000000000000000000000000000000000000..93ee757a99f547c2700e432dd3e4f4f8563eac74 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgsProd.m @@ -0,0 +1,32 @@ +function [d] = lbfgsProd(g,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag) +% BFGS Search Direction +% +% This function returns the (L-BFGS) approximate inverse Hessian, +% multiplied by the negative gradient + +% Set up indexing +[nVars,maxCorrections] = size(S); +if lbfgs_start == 1 + ind = 1:lbfgs_end; + nCor = lbfgs_end-lbfgs_start+1; +else + ind = [lbfgs_start:maxCorrections 1:lbfgs_end]; + nCor = maxCorrections; +end +al = zeros(nCor,1); +be = zeros(nCor,1); + +d = -g; +for j = 1:length(ind) + i = ind(end-j+1); + al(i) = (S(:,i)'*d)/YS(i); + d = d-al(i)*Y(:,i); +end + +% Multiply by Initial Hessian +d = Hdiag*d; + +for i = ind + be(i) = (Y(:,i)'*d)/YS(i); + d = d + S(:,i)*(al(i)-be(i)); +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgsUpdate.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgsUpdate.m new file mode 100644 index 0000000000000000000000000000000000000000..de5d3ae8e2bcef9202b912d6d3ea9cfd6be32c23 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/lbfgsUpdate.m @@ -0,0 +1,21 @@ +function [old_dirs,old_stps,Hdiag] = lbfgsUpdate(y,s,corrections,debug,old_dirs,old_stps,Hdiag) +ys = y'*s; +if ys > 1e-10 + numCorrections = size(old_dirs,2); + if numCorrections < corrections + % Full Update + old_dirs(:,numCorrections+1) = s; + old_stps(:,numCorrections+1) = y; + else + % Limited-Memory Update + old_dirs = [old_dirs(:,2:corrections) s]; + old_stps = [old_stps(:,2:corrections) y]; + end + + % Update scale of initial Hessian approximation + Hdiag = ys/(y'*y); +else + if debug + fprintf('Skipping Update\n'); + end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mchol.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mchol.m new file mode 100644 index 0000000000000000000000000000000000000000..581a7fb9a0a5215d07ae167108bcb7ebac7c077d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mchol.m @@ -0,0 +1,60 @@ +function [l,d,perm] = mchol(A,mu) +% [l,d,perm] = mchol(A,mu) +% Compute the Gill-Murray modified LDL factorization of A, + +if nargin < 2 + mu = 1e-12; +end + +n = size(A,1); +l = eye(n); +d = zeros(n,1); +perm = 1:n; + +for i = 1:n + c(i,i) = A(i,i); +end + +% Compute modification parameters +gamma = max(abs(diag(A))); +xi = max(max(abs(setdiag(A,0)))); +delta = mu*max(gamma+xi,1); +if n > 1 + beta = sqrt(max([gamma xi/sqrt(n^2-1) mu])); +else + beta = sqrt(max([gamma mu])); +end + +for j = 1:n + + % Find q that results in Best Permutation with j + [maxVal maxPos] = max(abs(diag(c(j:end,j:end)))); + q = maxPos+j-1; + + % Permute d,c,l,a + d([j q]) = d([q j]); + perm([j q]) = perm([q j]); + c([j q],:) = c([q j],:); + c(:,[j q]) = c(:,[q j]); + l([j q],:) = l([q j],:); + l(:,[j q]) = l(:,[q j]); + A([j q],:) = A([q j],:); + A(:,[j q]) = A(:,[q j]); + + for s = 1:j-1 + l(j,s) = c(j,s)/d(s); + end + for i = j+1:n + c(i,j) = A(i,j) - sum(l(j,1:j-1).*c(i,1:j-1)); + end + theta = 0; + if j < n + theta = max(abs(c(j+1:n,j))); + end + d(j) = max([abs(c(j,j)) (theta/beta)^2 delta]); + if j < n + for i = j+1:n + c(i,i) = c(i,i) - (c(i,j)^2)/d(j); + end + end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mcholinc.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mcholinc.m new file mode 100644 index 0000000000000000000000000000000000000000..ef66131a3a1a8380dc426a233d4d83b655ac09d4 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mcholinc.m @@ -0,0 +1,25 @@ +function [R,tau] = mcholinc(H,verbose) +% Computes Cholesky of H+tau*I, for suitably large tau that matrix is pd + +p = size(H,1); + +beta = norm(H,'fro'); +if min(diag(H)) > 1e-12 + tau = 0; +else + if verbose + fprintf('Small Value on Diagonal, Adjusting Hessian\n'); + end + tau = max(beta/2,1e-12); +end +while 1 + [R,posDef] = chol(H+tau*eye(p)); + if posDef == 0 + break; + else + if verbose + fprintf('Cholesky Failed, Adjusting Hessian\n'); + end + tau = max(2*tau,beta/2); + end +end diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/lbfgsAddC.c b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/lbfgsAddC.c new file mode 100644 index 0000000000000000000000000000000000000000..c091a47d0cc750c6df54fa23ea0a201fd2e3c9b7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/lbfgsAddC.c @@ -0,0 +1,34 @@ +#include <math.h> +#include "mex.h" + +/* See lbfgsAdd.m for details */ +/* This function will not exit gracefully on bad input! */ + +void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) +{ + /* Variable Declarations */ + + double *s,*y,*S, *Y, ys; + int i,j,nVars,lbfgs_end; + + /* Get Input Pointers */ + + y = mxGetPr(prhs[0]); + s = mxGetPr(prhs[1]); + Y = mxGetPr(prhs[2]); + S = mxGetPr(prhs[3]); + ys= mxGetScalar(prhs[4]); + lbfgs_end = (int)mxGetScalar(prhs[5]); + + if (!mxIsClass(prhs[5],"int32")) + mexErrMsgTxt("lbfgs_end must be int32"); + + /* Compute number of variables, maximum number of corrections */ + + nVars = mxGetDimensions(prhs[2])[0]; + + for(j=0;j<nVars;j++) { + S[j+nVars*(lbfgs_end-1)] = s[j]; + Y[j+nVars*(lbfgs_end-1)] = y[j]; + } +} diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/lbfgsC.c b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/lbfgsC.c new file mode 100644 index 0000000000000000000000000000000000000000..c292f265f9be5f29e82369769f1754e09e1938aa --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/lbfgsC.c @@ -0,0 +1,115 @@ +#include <math.h> +#include "mex.h" + +/* See lbfgs.m for details! */ +/* This function may not exit gracefully on bad input! */ + + +void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) +{ + /* Variable Declarations */ + + double *s, *y, *g, *H, *d, *ro, *alpha, *beta, *q, *r; + int nVars,nSteps,lhs_dims[2]; + double temp; + int i,j; + + /* Get Input Pointers */ + + g = mxGetPr(prhs[0]); + s = mxGetPr(prhs[1]); + y = mxGetPr(prhs[2]); + H = mxGetPr(prhs[3]); + + /* Compute number of variables (p), rank of update (d) */ + + nVars = mxGetDimensions(prhs[1])[0]; + nSteps = mxGetDimensions(prhs[1])[1]; + + /* Allocated Memory for Function Variables */ + ro = mxCalloc(nSteps,sizeof(double)); + alpha = mxCalloc(nSteps,sizeof(double)); + beta = mxCalloc(nSteps,sizeof(double)); + q = mxCalloc(nVars*(nSteps+1),sizeof(double)); + r = mxCalloc(nVars*(nSteps+1),sizeof(double)); + + /* Set-up Output Vector */ + + lhs_dims[0] = nVars; + lhs_dims[1] = 1; + + plhs[0] = mxCreateNumericArray(2,lhs_dims,mxDOUBLE_CLASS,mxREAL); + d = mxGetPr(plhs[0]); + + /* ro = 1/(y(:,i)'*s(:,i)) */ + for(i=0;i<nSteps;i++) + { + temp = 0; + for(j=0;j<nVars;j++) + { + temp += y[j+nVars*i]*s[j+nVars*i]; + } + ro[i] = 1/temp; + } + + /* q(:,k+1) = g */ + for(i=0;i<nVars;i++) + { + q[i+nVars*nSteps] = g[i]; + } + + for(i=nSteps-1;i>=0;i--) + { + /* alpha(i) = ro(i)*s(:,i)'*q(:,i+1) */ + alpha[i] = 0; + for(j=0;j<nVars;j++) + { + alpha[i] += s[j+nVars*i]*q[j+nVars*(i+1)]; + } + alpha[i] *= ro[i]; + + /* q(:,i) = q(:,i+1)-alpha(i)*y(:,i) */ + for(j=0;j<nVars;j++) + { + q[j+nVars*i]=q[j+nVars*(i+1)]-alpha[i]*y[j+nVars*i]; + } + } + + /* r(:,1) = q(:,1) */ + for(i=0;i<nVars;i++) + { + r[i] = H[0]*q[i]; + } + + for(i=0;i<nSteps;i++) + { + /* beta(i) = ro(i)*y(:,i)'*r(:,i) */ + beta[i] = 0; + for(j=0;j<nVars;j++) + { + beta[i] += y[j+nVars*i]*r[j+nVars*i]; + } + beta[i] *= ro[i]; + + /* r(:,i+1) = r(:,i) + s(:,i)*(alpha(i)-beta(i)) */ + for(j=0;j<nVars;j++) + { + r[j+nVars*(i+1)]=r[j+nVars*i]+s[j+nVars*i]*(alpha[i]-beta[i]); + } + } + + /* d = r(:,k+1) */ + for(i=0;i<nVars;i++) + { + d[i]=r[i+nVars*nSteps]; + } + + /* Free Memory */ + + mxFree(ro); + mxFree(alpha); + mxFree(beta); + mxFree(q); + mxFree(r); + +} diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/lbfgsProdC.c b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/lbfgsProdC.c new file mode 100644 index 0000000000000000000000000000000000000000..adddfc0db44e004a88cf82ac55f2c6ff2ad69214 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/lbfgsProdC.c @@ -0,0 +1,93 @@ +#include <math.h> +#include "mex.h" + +/* See lbfgsProd.m for details */ +/* This function will not exit gracefully on bad input! */ + +void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) +{ + /* Variable Declarations */ + + double *S, *Y, *YS, *g, Hdiag, *d, *alpha, *beta; + int i,j,nVars,nCor,maxCor,lbfgs_start,lbfgs_end; + + /* Get Input Pointers */ + + g = mxGetPr(prhs[0]); + S = mxGetPr(prhs[1]); + Y = mxGetPr(prhs[2]); + YS= mxGetPr(prhs[3]); + lbfgs_start = (int)mxGetScalar(prhs[4]); + lbfgs_end = (int)mxGetScalar(prhs[5]); + Hdiag = mxGetScalar(prhs[6]); + + if (!mxIsClass(prhs[4],"int32")||!mxIsClass(prhs[5],"int32")) + mexErrMsgTxt("lbfgs_start and lbfgs_end must be int32"); + + /* Compute number of variables, maximum number of corrections */ + + nVars = mxGetDimensions(prhs[1])[0]; + maxCor = mxGetDimensions(prhs[1])[1]; + + /* Compute number of corrections available */ + if (lbfgs_start == 1) + nCor = lbfgs_end-lbfgs_start+1; + else + nCor = maxCor; + + /* Allocate Memory for Local Variables */ + alpha = mxCalloc(nCor,sizeof(double)); + beta = mxCalloc(nCor,sizeof(double)); + + /* Set-up Output Vector */ + plhs[0] = mxCreateDoubleMatrix(nVars,1,mxREAL); + d = mxGetPr(plhs[0]); + + for(j=0;j<nVars;j++) + d[j] = -g[j]; + + for(i = lbfgs_end-1;i >= 0;i--) { + alpha[i] = 0; + for(j=0;j<nVars;j++) + alpha[i] += S[j + nVars*i]*d[j]; + alpha[i] /= YS[i]; + for(j=0;j<nVars;j++) + d[j] -= alpha[i]*Y[j + nVars*i]; + } + if(lbfgs_start != 1) { + for(i = maxCor-1;i >= lbfgs_start-1;i--) { + alpha[i] = 0; + for(j=0;j<nVars;j++) + alpha[i] += S[j + nVars*i]*d[j]; + alpha[i] /= YS[i]; + for(j=0;j<nVars;j++) + d[j] -= alpha[i]*Y[j + nVars*i]; + } + } + + for(j=0;j<nVars;j++) + d[j] *= Hdiag; + + if(lbfgs_start != 1) { + for(i = lbfgs_start-1; i < maxCor; i++) { + beta[i] = 0; + for(j=0;j<nVars;j++) + beta[i] += Y[j + nVars*i]*d[j]; + beta[i] /= YS[i]; + for(j=0;j<nVars;j++) + d[j] += S[j+nVars*i]*(alpha[i]-beta[i]); + } + } + for(i = 0; i < lbfgs_end; i++) { + beta[i] = 0; + for(j=0;j<nVars;j++) + beta[i] += Y[j + nVars*i]*d[j]; + beta[i] /= YS[i]; + for(j=0;j<nVars;j++) + d[j] += S[j+nVars*i]*(alpha[i]-beta[i]); + } + + mxFree(alpha); + mxFree(beta); + +} diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/mcholC.c b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/mcholC.c new file mode 100644 index 0000000000000000000000000000000000000000..968870addeac64d5164a45acee4cc60fb2ddc35a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/mex/mcholC.c @@ -0,0 +1,199 @@ +#include <math.h> +#include "mex.h" + +double mymax(double x, double y) +{ + if (x > y) + return x; + else + return y; +} + +double absolute(double x) +{ + if (x >= -x) + return x; + else + return -x; +} + +void permuteInt(int *x, int p, int q) +{ + int temp; + temp = x[p]; + x[p] = x[q]; + x[q] = temp; +} + +void permute(double *x, int p, int q) +{ + double temp; + temp = x[p]; + x[p] = x[q]; + x[q] = temp; +} + +void permuteRows(double *x, int p, int q,int n) +{ + int i; + double temp; + for(i = 0; i < n; i++) + { + temp = x[p+i*n]; + x[p+i*n] = x[q+i*n]; + x[q+i*n] = temp; + } +} + +void permuteCols(double *x, int p, int q,int n) +{ + int i; + double temp; + for(i = 0; i < n; i++) + { + temp = x[i+p*n]; + x[i+p*n] = x[i+q*n]; + x[i+q*n] = temp; + } +} + +void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) +{ + int n,sizL[2],sizD[2],i,j,q,s, + *P; + + double mu,gamma,xi,delta,beta,maxVal,theta, + *c, *H, *L, *D, *A; + + /* Input */ + H = mxGetPr(prhs[0]); + if (nrhs == 1) + { + mu = 1e-12; + } + else + { + mu = mxGetScalar(prhs[1]); + } + + /* Compute Sizes */ + n = mxGetDimensions(prhs[0])[0]; + + /* Form Output */ + sizL[0] = n; + sizL[1] = n; + plhs[0] = mxCreateNumericArray(2,sizL,mxDOUBLE_CLASS,mxREAL); + L = mxGetPr(plhs[0]); + sizD[0] = n; + sizD[1] = 1; + plhs[1] = mxCreateNumericArray(2,sizD,mxDOUBLE_CLASS,mxREAL); + D = mxGetPr(plhs[1]); + plhs[2] = mxCreateNumericArray(2,sizD,mxINT32_CLASS,mxREAL); + P = (int*)mxGetData(plhs[2]); + + /* Initialize */ + c = mxCalloc(n*n,sizeof(double)); + A = mxCalloc(n*n,sizeof(double)); + + for (i = 0; i < n; i++) + { + P[i] = i; + for (j = 0;j < n; j++) + { + A[i+n*j] = H[i+n*j]; + } + } + + gamma = 0; + for (i = 0; i < n; i++) + { + L[i+n*i] = 1; + c[i+n*i] = A[i+n*i]; + } + + /* Compute modification parameters */ + gamma = -1; + xi = -1; + for (i = 0; i < n; i++) + { + gamma = mymax(gamma,absolute(A[i+n*i])); + for (j = 0;j < n; j++) + { + /*printf("A(%d,%d) = %f, %f\n",i,j,A[i+n*j],absolute(A[i+n*j]));*/ + if (i != j) + xi = mymax(xi,absolute(A[i+n*j])); + } + } + delta = mu*mymax(gamma+xi,1); + + if (n > 1) + { + beta = sqrt(mymax(gamma,mymax(mu,xi/sqrt(n*n-1)))); + } + else + { + beta = sqrt(mymax(gamma,mu)); + } + + for (j = 0; j < n; j++) + { + + /* Find q that results in Best Permutation with j */ + maxVal = -1; + q = 0; + for(i = j; i < n; i++) + { + if (absolute(c[i+n*i]) > maxVal) + { + maxVal = mymax(maxVal,absolute(c[i+n*i])); + q = i; + } + } + + /* Permute D,c,L,A,P */ + permute(D,j,q); + permuteInt(P,j,q); + permuteRows(c,j,q,n); + permuteCols(c,j,q,n); + permuteRows(L,j,q,n); + permuteCols(L,j,q,n); + permuteRows(A,j,q,n); + permuteCols(A,j,q,n); + + for(s = 0; s <= j-1; s++) + L[j+n*s] = c[j+n*s]/D[s]; + + for(i = j+1; i < n; i++) + { + c[i+j*n] = A[i+j*n]; + for(s = 0; s <= j-1; s++) + { + c[i+j*n] -= L[j+n*s]*c[i+n*s]; + } + } + + theta = 0; + if (j < n-1) + { + for(i = j+1;i < n; i++) + theta = mymax(theta,absolute(c[i+n*j])); + } + + D[j] = mymax(absolute(c[j+n*j]),mymax(delta,theta*theta/(beta*beta))); + + if (j < n-1) + { + for(i = j+1; i < n; i++) + { + c[i+n*i] = c[i+n*i] - c[i+n*j]*c[i+n*j]/D[j]; + } + } + + } + + for(i = 0; i < n; i++) + P[i]++; + + mxFree(c); + mxFree(A); +} \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/minFunc.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/minFunc.m new file mode 100644 index 0000000000000000000000000000000000000000..a731da3473a7b5930c5e314365dadc8f337ff321 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/minFunc.m @@ -0,0 +1,1170 @@ +function [x,f,exitflag,output] = minFunc(funObj,x0,options,varargin) +% [x,f,exitflag,output] = minFunc(funObj,x0,options,varargin) +% +% Unconstrained optimizer using a line search strategy +% +% Uses an interface very similar to fminunc +% (it doesn't support all of the optimization toolbox options, +% but supports many other options). +% +% It computes descent directions using one of ('Method'): +% - 'sd': Steepest Descent +% (no previous information used, not recommended) +% - 'csd': Cyclic Steepest Descent +% (uses previous step length for a fixed length cycle) +% - 'bb': Barzilai and Borwein Gradient +% (uses only previous step) +% - 'cg': Non-Linear Conjugate Gradient +% (uses only previous step and a vector beta) +% - 'scg': Scaled Non-Linear Conjugate Gradient +% (uses previous step and a vector beta, +% and Hessian-vector products to initialize line search) +% - 'pcg': Preconditionined Non-Linear Conjugate Gradient +% (uses only previous step and a vector beta, preconditioned version) +% - 'lbfgs': Quasi-Newton with Limited-Memory BFGS Updating +% (default: uses a predetermined nunber of previous steps to form a +% low-rank Hessian approximation) +% - 'newton0': Hessian-Free Newton +% (numerically computes Hessian-Vector products) +% - 'pnewton0': Preconditioned Hessian-Free Newton +% (numerically computes Hessian-Vector products, preconditioned +% version) +% - 'qnewton': Quasi-Newton Hessian approximation +% (uses dense Hessian approximation) +% - 'mnewton': Newton's method with Hessian calculation after every +% user-specified number of iterations +% (needs user-supplied Hessian matrix) +% - 'newton': Newton's method with Hessian calculation every iteration +% (needs user-supplied Hessian matrix) +% - 'tensor': Tensor +% (needs user-supplied Hessian matrix and Tensor of 3rd partial derivatives) +% +% Several line search strategies are available for finding a step length satisfying +% the termination criteria ('LS_type') +% - 0 : A backtracking line-search based on the Armijo condition (default for 'bb') +% - 1 : A bracekting line-search based on the strong Wolfe conditions (default for all other methods) +% - 2 : The line-search from the Matlab Optimization Toolbox (requires Matlab's linesearch.m to be added to the path) +% +% For the Armijo line-search, several interpolation strategies are available ('LS_interp'): +% - 0 : Step size halving +% - 1 : Polynomial interpolation using new function values +% - 2 : Polynomial interpolation using new function and gradient values (default) +% +% When (LS_interp = 1), the default setting of (LS_multi = 0) uses quadratic interpolation, +% while if (LS_multi = 1) it uses cubic interpolation if more than one point are available. +% +% When (LS_interp = 2), the default setting of (LS_multi = 0) uses cubic interpolation, +% while if (LS_multi = 1) it uses quartic or quintic interpolation if more than one point are available +% +% To use the non-monotonic Armijo condition, set the 'Fref' value to the number of previous function values to store +% +% For the Wolfe line-search, these interpolation strategies are available ('LS_interp'): +% - 0 : Step Size Doubling and Bisection +% - 1 : Cubic interpolation/extrapolation using new function and gradient values (default) +% - 2 : Mixed quadratic/cubic interpolation/extrapolation +% +% Several strategies for choosing the initial step size are avaiable ('LS_init'): +% - 0: Always try an initial step length of 1 (default for all except 'sd' and 'cg') +% (t = 1) +% - 1: Use a step similar to the previous step +% (t = t_old*min(2,g'd/g_old'd_old)) +% - 2: Quadratic Initialization using previous function value and new +% function value/gradient (use this if steps tend to be very long, default for 'sd' and 'cg') +% (t = min(1,2*(f-f_old)/g)) +% - 3: The minimum between 1 and twice the previous step length +% (t = min(1,2*t) +% - 4: The scaled conjugate gradient step length (may accelerate +% conjugate gradient methods, but requires a Hessian-vector product, default for 'scg') +% (t = g'd/d'Hd) +% +% Inputs: +% funObj - is a function handle +% x0 - is a starting vector; +% options - is a struct containing parameters (defaults are used for non-existent or blank fields) +% varargin{:} - all other arguments are passed as additional arguments to funObj +% +% Outputs: +% x is the minimum value found +% f is the function value at the minimum found +% exitflag returns an exit condition +% output returns a structure with other information +% +% Supported Input Options +% Display - Level of display [ off | final | (iter) | full | excessive ] +% MaxFunEvals - Maximum number of function evaluations allowed (1000) +% MaxIter - Maximum number of iterations allowed (500) +% optTol - Termination tolerance on the first-order optimality (1e-5) +% progTol - Termination tolerance on progress in terms of function/parameter changes (1e-9) +% Method - [ sd | csd | bb | cg | scg | pcg | {lbfgs} | newton0 | pnewton0 | +% qnewton | mnewton | newton | tensor ] +% c1 - Sufficient Decrease for Armijo condition (1e-4) +% c2 - Curvature Decrease for Wolfe conditions (.2 for cg methods, .9 otherwise) +% LS_init - Line Search Initialization - see above (2 for cg/sd, 4 for scg, 0 otherwise) +% LS - Line Search type - see above (2 for bb, 4 otherwise) +% Fref - Setting this to a positive integer greater than 1 +% will use non-monotone Armijo objective in the line search. +% (20 for bb, 10 for csd, 1 for all others) +% numDiff - [ 0 | 1 | 2] compute derivatives using user-supplied function (0), +% numerically user forward-differencing (1), or numerically using central-differencing (2) +% (default: 0) +% (this option has a different effect for 'newton', see below) +% useComplex - if 1, use complex differentials if computing numerical derivatives +% to get very accurate values (default: 0) +% DerivativeCheck - if 'on', computes derivatives numerically at initial +% point and compares to user-supplied derivative (default: 'off') +% outputFcn - function to run after each iteration (default: []). It +% should have the following interface: +% outputFcn(x,iterationType,i,funEvals,f,t,gtd,g,d,optCond,varargin{:}); +% useMex - where applicable, use mex files to speed things up (default: 1) +% +% Method-specific input options: +% newton: +% HessianModify - type of Hessian modification for direct solvers to +% use if the Hessian is not positive definite (default: 0) +% 0: Minimum Euclidean norm s.t. eigenvalues sufficiently large +% (requires eigenvalues on iterations where matrix is not pd) +% 1: Start with (1/2)*||A||_F and increment until Cholesky succeeds +% (an approximation to method 0, does not require eigenvalues) +% 2: Modified LDL factorization +% (only 1 generalized Cholesky factorization done and no eigenvalues required) +% 3: Modified Spectral Decomposition +% (requires eigenvalues) +% 4: Modified Symmetric Indefinite Factorization +% 5: Uses the eigenvector of the smallest eigenvalue as negative +% curvature direction +% cgSolve - use conjugate gradient instead of direct solver (default: 0) +% 0: Direct Solver +% 1: Conjugate Gradient +% 2: Conjugate Gradient with Diagonal Preconditioner +% 3: Conjugate Gradient with LBFGS Preconditioner +% x: Conjugate Graident with Symmetric Successive Over Relaxation +% Preconditioner with parameter x +% (where x is a real number in the range [0,2]) +% x: Conjugate Gradient with Incomplete Cholesky Preconditioner +% with drop tolerance -x +% (where x is a real negative number) +% numDiff - compute Hessian numerically +% (default: 0, done with complex differentials if useComplex = 1) +% LS_saveHessiancomp - when on, only computes the Hessian at the +% first and last iteration of the line search (default: 1) +% mnewton: +% HessianIter - number of iterations to use same Hessian (default: 5) +% qnewton: +% initialHessType - scale initial Hessian approximation (default: 1) +% qnUpdate - type of quasi-Newton update (default: 3): +% 0: BFGS +% 1: SR1 (when it is positive-definite, otherwise BFGS) +% 2: Hoshino +% 3: Self-Scaling BFGS +% 4: Oren's Self-Scaling Variable Metric method +% 5: McCormick-Huang asymmetric update +% Damped - use damped BFGS update (default: 1) +% newton0/pnewton0: +% HvFunc - user-supplied function that returns Hessian-vector products +% (by default, these are computed numerically using autoHv) +% HvFunc should have the following interface: HvFunc(v,x,varargin{:}) +% useComplex - use a complex perturbation to get high accuracy +% Hessian-vector products (default: 0) +% (the increased accuracy can make the method much more efficient, +% but gradient code must properly support complex inputs) +% useNegCurv - a negative curvature direction is used as the descent +% direction if one is encountered during the cg iterations +% (default: 1) +% precFunc (for pnewton0 only) - user-supplied preconditioner +% (by default, an L-BFGS preconditioner is used) +% precFunc should have the following interfact: +% precFunc(v,x,varargin{:}) +% lbfgs: +% Corr - number of corrections to store in memory (default: 100) +% (higher numbers converge faster but use more memory) +% Damped - use damped update (default: 0) +% cg/scg/pcg: +% cgUpdate - type of update (default for cg/scg: 2, default for pcg: 1) +% 0: Fletcher Reeves +% 1: Polak-Ribiere +% 2: Hestenes-Stiefel (not supported for pcg) +% 3: Gilbert-Nocedal +% HvFunc (for scg only)- user-supplied function that returns Hessian-vector +% products +% (by default, these are computed numerically using autoHv) +% HvFunc should have the following interface: +% HvFunc(v,x,varargin{:}) +% precFunc (for pcg only) - user-supplied preconditioner +% (by default, an L-BFGS preconditioner is used) +% precFunc should have the following interface: +% precFunc(v,x,varargin{:}) +% bb: +% bbType - type of bb step (default: 0) +% 0: min_alpha ||delta_x - alpha delta_g||_2 +% 1: min_alpha ||alpha delta_x - delta_g||_2 +% 2: Conic BB +% 3: Gradient method with retards +% csd: +% cycle - length of cycle (default: 3) +% +% Supported Output Options +% iterations - number of iterations taken +% funcCount - number of function evaluations +% algorithm - algorithm used +% firstorderopt - first-order optimality +% message - exit message +% trace.funccount - function evaluations after each iteration +% trace.fval - function value after each iteration +% +% Author: Mark Schmidt (2005) +% Web: http://www.di.ens.fr/~mschmidt/Software/minFunc.html +% +% Sources (in order of how much the source material contributes): +% J. Nocedal and S.J. Wright. 1999. "Numerical Optimization". Springer Verlag. +% R. Fletcher. 1987. "Practical Methods of Optimization". Wiley. +% J. Demmel. 1997. "Applied Linear Algebra. SIAM. +% R. Barret, M. Berry, T. Chan, J. Demmel, J. Dongarra, V. Eijkhout, R. +% Pozo, C. Romine, and H. Van der Vost. 1994. "Templates for the Solution of +% Linear Systems: Building Blocks for Iterative Methods". SIAM. +% J. More and D. Thuente. "Line search algorithms with guaranteed +% sufficient decrease". ACM Trans. Math. Softw. vol 20, 286-307, 1994. +% M. Raydan. "The Barzilai and Borwein gradient method for the large +% scale unconstrained minimization problem". SIAM J. Optim., 7, 26-33, +% (1997). +% "Mathematical Optimization". The Computational Science Education +% Project. 1995. +% C. Kelley. 1999. "Iterative Methods for Optimization". Frontiers in +% Applied Mathematics. SIAM. + +if nargin < 3 + options = []; +end + +% Get Parameters +[verbose,verboseI,debug,doPlot,maxFunEvals,maxIter,optTol,progTol,method,... + corrections,c1,c2,LS_init,cgSolve,qnUpdate,cgUpdate,initialHessType,... + HessianModify,Fref,useComplex,numDiff,LS_saveHessianComp,... + Damped,HvFunc,bbType,cycle,... + HessianIter,outputFcn,useMex,useNegCurv,precFunc,... + LS_type,LS_interp,LS_multi,checkGrad] = ... + minFunc_processInputOptions(options); + +% Constants +SD = 0; +CSD = 1; +BB = 2; +CG = 3; +PCG = 4; +LBFGS = 5; +QNEWTON = 6; +NEWTON0 = 7; +NEWTON = 8; +TENSOR = 9; + +% Initialize +p = length(x0); +d = zeros(p,1); +x = x0; +t = 1; + +% If necessary, form numerical differentiation functions +funEvalMultiplier = 1; +if useComplex + numDiffType = 3; +else + numDiffType = numDiff; +end +if numDiff && method ~= TENSOR + varargin(3:end+2) = varargin(1:end); + varargin{1} = numDiffType; + varargin{2} = funObj; + if method ~= NEWTON + if debug + if useComplex + fprintf('Using complex differentials for gradient computation\n'); + else + fprintf('Using finite differences for gradient computation\n'); + end + end + funObj = @autoGrad; + else + if debug + if useComplex + fprintf('Using complex differentials for Hessian computation\n'); + else + fprintf('Using finite differences for Hessian computation\n'); + end + end + funObj = @autoHess; + end + + if method == NEWTON0 && useComplex == 1 + if debug + fprintf('Turning off the use of complex differentials for Hessian-vector products\n'); + end + useComplex = 0; + end + + if useComplex + funEvalMultiplier = p; + elseif numDiff == 2 + funEvalMultiplier = 2*p; + else + funEvalMultiplier = p+1; + end +end + +% Evaluate Initial Point +if method < NEWTON + [f,g] = funObj(x,varargin{:}); + computeHessian = 0; +else + [f,g,H] = funObj(x,varargin{:}); + computeHessian = 1; +end +funEvals = 1; + +% Derivative Check +if checkGrad + if numDiff + fprintf('Can not do derivative checking when numDiff is 1\n'); + pause + end + derivativeCheck(funObj,x,1,numDiffType,varargin{:}); % Checks gradient + if computeHessian + derivativeCheck(funObj,x,2,numDiffType,varargin{:}); + end +end + +% Output Log +if verboseI + fprintf('%10s %10s %15s %15s %15s\n','Iteration','FunEvals','Step Length','Function Val','Opt Cond'); +end + +% Compute optimality of initial point +optCond = max(abs(g)); + +if nargout > 3 + % Initialize Trace + trace.fval = f; + trace.funcCount = funEvals; + trace.optCond = optCond; +end + +% Exit if initial point is optimal +if optCond <= optTol + exitflag=1; + msg = 'Optimality Condition below optTol'; + if verbose + fprintf('%s\n',msg); + end + if nargout > 3 + output = struct('iterations',0,'funcCount',1,... + 'algorithm',method,'firstorderopt',max(abs(g)),'message',msg,'trace',trace); + end + return; +end + +% Output Function +if ~isempty(outputFcn) + stop = outputFcn(x,'init',0,funEvals,f,[],[],g,[],max(abs(g)),varargin{:}); + if stop + exitflag=-1; + msg = 'Stopped by output function'; + if verbose + fprintf('%s\n',msg); + end + if nargout > 3 + output = struct('iterations',0,'funcCount',1,... + 'algorithm',method,'firstorderopt',max(abs(g)),'message',msg,'trace',trace); + end + return; + end +end + +% Perform up to a maximum of 'maxIter' descent steps: +for i = 1:maxIter + + % ****************** COMPUTE DESCENT DIRECTION ***************** + + switch method + case SD % Steepest Descent + d = -g; + + case CSD % Cyclic Steepest Descent + + if mod(i,cycle) == 1 % Use Steepest Descent + alpha = 1; + LS_init = 2; + LS_type = 1; % Wolfe line search + elseif mod(i,cycle) == mod(1+1,cycle) % Use Previous Step + alpha = t; + LS_init = 0; + LS_type = 0; % Armijo line search + end + d = -alpha*g; + + case BB % Steepest Descent with Barzilai and Borwein Step Length + + if i == 1 + d = -g; + else + y = g-g_old; + s = t*d; + if bbType == 0 + yy = y'*y; + alpha = (s'*y)/(yy); + if alpha <= 1e-10 || alpha > 1e10 + alpha = 1; + end + elseif bbType == 1 + sy = s'*y; + alpha = (s'*s)/sy; + if alpha <= 1e-10 || alpha > 1e10 + alpha = 1; + end + elseif bbType == 2 % Conic Interpolation ('Modified BB') + sy = s'*y; + ss = s'*s; + alpha = ss/sy; + if alpha <= 1e-10 || alpha > 1e10 + alpha = 1; + end + alphaConic = ss/(6*(myF_old - f) + 4*g'*s + 2*g_old'*s); + if alphaConic > .001*alpha && alphaConic < 1000*alpha + alpha = alphaConic; + end + elseif bbType == 3 % Gradient Method with retards (bb type 1, random selection of previous step) + sy = s'*y; + alpha = (s'*s)/sy; + if alpha <= 1e-10 || alpha > 1e10 + alpha = 1; + end + v(1+mod(i-2,5)) = alpha; + alpha = v(ceil(rand*length(v))); + end + d = -alpha*g; + end + g_old = g; + myF_old = f; + + + case CG % Non-Linear Conjugate Gradient + + if i == 1 + d = -g; % Initially use steepest descent direction + else + gotgo = g_old'*g_old; + + if cgUpdate == 0 + % Fletcher-Reeves + beta = (g'*g)/(gotgo); + elseif cgUpdate == 1 + % Polak-Ribiere + beta = (g'*(g-g_old)) /(gotgo); + elseif cgUpdate == 2 + % Hestenes-Stiefel + beta = (g'*(g-g_old))/((g-g_old)'*d); + else + % Gilbert-Nocedal + beta_FR = (g'*(g-g_old)) /(gotgo); + beta_PR = (g'*g-g'*g_old)/(gotgo); + beta = max(-beta_FR,min(beta_PR,beta_FR)); + end + + d = -g + beta*d; + + % Restart if not a direction of sufficient descent + if g'*d > -progTol + if debug + fprintf('Restarting CG\n'); + end + beta = 0; + d = -g; + end + + % Old restart rule: + %if beta < 0 || abs(gtgo)/(gotgo) >= 0.1 || g'*d >= 0 + + end + g_old = g; + + case PCG % Preconditioned Non-Linear Conjugate Gradient + + % Apply preconditioner to negative gradient + if isempty(precFunc) + % Use L-BFGS Preconditioner + if i == 1 + S = zeros(p,corrections); + Y = zeros(p,corrections); + YS = zeros(corrections,1); + lbfgs_start = 1; + lbfgs_end = 0; + Hdiag = 1; + s = -g; + else + [S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,skipped] = lbfgsAdd(g-g_old,t*d,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,useMex); + if debug && skipped + fprintf('Skipped L-BFGS updated\n'); + end + if useMex + s = lbfgsProdC(g,S,Y,YS,int32(lbfgs_start),int32(lbfgs_end),Hdiag); + else + s = lbfgsProd(g,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag); + end + end + else % User-supplied preconditioner + s = precFunc(-g,x,varargin{:}); + end + + if i == 1 + d = s; + else + + if cgUpdate == 0 + % Preconditioned Fletcher-Reeves + beta = (g'*s)/(g_old'*s_old); + elseif cgUpdate < 3 + % Preconditioned Polak-Ribiere + beta = (g'*(s-s_old))/(g_old'*s_old); + else + % Preconditioned Gilbert-Nocedal + beta_FR = (g'*s)/(g_old'*s_old); + beta_PR = (g'*(s-s_old))/(g_old'*s_old); + beta = max(-beta_FR,min(beta_PR,beta_FR)); + end + d = s + beta*d; + + if g'*d > -progTol + if debug + fprintf('Restarting CG\n'); + end + beta = 0; + d = s; + end + + end + g_old = g; + s_old = s; + case LBFGS % L-BFGS + + % Update the direction and step sizes + if Damped + if i == 1 + d = -g; % Initially use steepest descent direction + old_dirs = zeros(length(g),0); + old_stps = zeros(length(d),0); + Hdiag = 1; + else + [old_dirs,old_stps,Hdiag] = dampedUpdate(g-g_old,t*d,corrections,debug,old_dirs,old_stps,Hdiag); + if useMex + d = lbfgsC(-g,old_dirs,old_stps,Hdiag); + else + d = lbfgs(-g,old_dirs,old_stps,Hdiag); + end + end + else + if i == 1 + d = -g; % Initially use steepest descent direction + S = zeros(p,corrections); + Y = zeros(p,corrections); + YS = zeros(corrections,1); + lbfgs_start = 1; + lbfgs_end = 0; + Hdiag = 1; + else + [S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,skipped] = lbfgsAdd(g-g_old,t*d,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,useMex); + if debug && skipped + fprintf('Skipped L-BFGS updated\n'); + end + if useMex + d = lbfgsProdC(g,S,Y,YS,int32(lbfgs_start),int32(lbfgs_end),Hdiag); + else + d = lbfgsProd(g,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag); + end + end + end + g_old = g; + + case QNEWTON % Use quasi-Newton Hessian approximation + + if i == 1 + d = -g; + else + % Compute difference vectors + y = g-g_old; + s = t*d; + + if i == 2 + % Make initial Hessian approximation + if initialHessType == 0 + % Identity + if qnUpdate <= 1 + R = eye(length(g)); + else + H = eye(length(g)); + end + else + % Scaled Identity + if debug + fprintf('Scaling Initial Hessian Approximation\n'); + end + if qnUpdate <= 1 + % Use Cholesky of Hessian approximation + R = sqrt((y'*y)/(y'*s))*eye(length(g)); + else + % Use Inverse of Hessian approximation + H = eye(length(g))*(y'*s)/(y'*y); + end + end + end + + if qnUpdate == 0 % Use BFGS updates + Bs = R'*(R*s); + if Damped + eta = .02; + if y'*s < eta*s'*Bs + if debug + fprintf('Damped Update\n'); + end + theta = min(max(0,((1-eta)*s'*Bs)/(s'*Bs - y'*s)),1); + y = theta*y + (1-theta)*Bs; + end + R = cholupdate(cholupdate(R,y/sqrt(y'*s)),Bs/sqrt(s'*Bs),'-'); + else + if y'*s > 1e-10 + R = cholupdate(cholupdate(R,y/sqrt(y'*s)),Bs/sqrt(s'*Bs),'-'); + else + if debug + fprintf('Skipping Update\n'); + end + end + end + elseif qnUpdate == 1 % Perform SR1 Update if it maintains positive-definiteness + + Bs = R'*(R*s); + ymBs = y-Bs; + if abs(s'*ymBs) >= norm(s)*norm(ymBs)*1e-8 && (s-((R\(R'\y))))'*y > 1e-10 + R = cholupdate(R,-ymBs/sqrt(ymBs'*s),'-'); + else + if debug + fprintf('SR1 not positive-definite, doing BFGS Update\n'); + end + if Damped + eta = .02; + if y'*s < eta*s'*Bs + if debug + fprintf('Damped Update\n'); + end + theta = min(max(0,((1-eta)*s'*Bs)/(s'*Bs - y'*s)),1); + y = theta*y + (1-theta)*Bs; + end + R = cholupdate(cholupdate(R,y/sqrt(y'*s)),Bs/sqrt(s'*Bs),'-'); + else + if y'*s > 1e-10 + R = cholupdate(cholupdate(R,y/sqrt(y'*s)),Bs/sqrt(s'*Bs),'-'); + else + if debug + fprintf('Skipping Update\n'); + end + end + end + end + elseif qnUpdate == 2 % Use Hoshino update + v = sqrt(y'*H*y)*(s/(s'*y) - (H*y)/(y'*H*y)); + phi = 1/(1 + (y'*H*y)/(s'*y)); + H = H + (s*s')/(s'*y) - (H*y*y'*H)/(y'*H*y) + phi*v*v'; + + elseif qnUpdate == 3 % Self-Scaling BFGS update + ys = y'*s; + Hy = H*y; + yHy = y'*Hy; + gamma = ys/yHy; + v = sqrt(yHy)*(s/ys - Hy/yHy); + H = gamma*(H - Hy*Hy'/yHy + v*v') + (s*s')/ys; + elseif qnUpdate == 4 % Oren's Self-Scaling Variable Metric update + + % Oren's method + if (s'*y)/(y'*H*y) > 1 + phi = 1; % BFGS + omega = 0; + elseif (s'*(H\s))/(s'*y) < 1 + phi = 0; % DFP + omega = 1; + else + phi = (s'*y)*(y'*H*y-s'*y)/((s'*(H\s))*(y'*H*y)-(s'*y)^2); + omega = phi; + end + + gamma = (1-omega)*(s'*y)/(y'*H*y) + omega*(s'*(H\s))/(s'*y); + v = sqrt(y'*H*y)*(s/(s'*y) - (H*y)/(y'*H*y)); + H = gamma*(H - (H*y*y'*H)/(y'*H*y) + phi*v*v') + (s*s')/(s'*y); + + elseif qnUpdate == 5 % McCormick-Huang asymmetric update + theta = 1; + phi = 0; + psi = 1; + omega = 0; + t1 = s*(theta*s + phi*H'*y)'; + t2 = (theta*s + phi*H'*y)'*y; + t3 = H*y*(psi*s + omega*H'*y)'; + t4 = (psi*s + omega*H'*y)'*y; + H = H + t1/t2 - t3/t4; + end + + if qnUpdate <= 1 + d = -R\(R'\g); + else + d = -H*g; + end + + end + g_old = g; + + case NEWTON0 % Hessian-Free Newton + + cgMaxIter = min(p,maxFunEvals-funEvals); + cgForce = min(0.5,sqrt(norm(g)))*norm(g); + + % Set-up preconditioner + precondFunc = []; + precondArgs = []; + if cgSolve == 1 + if isempty(precFunc) % Apply L-BFGS preconditioner + if i == 1 + S = zeros(p,corrections); + Y = zeros(p,corrections); + YS = zeros(corrections,1); + lbfgs_start = 1; + lbfgs_end = 0; + Hdiag = 1; + else + [S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,skipped] = lbfgsAdd(g-g_old,t*d,S,Y,YS,lbfgs_start,lbfgs_end,Hdiag,useMex); + if debug && skipped + fprintf('Skipped L-BFGS updated\n'); + end + if useMex + precondFunc = @lbfgsProdC; + else + precondFunc = @lbfgsProd; + end + precondArgs = {S,Y,YS,int32(lbfgs_start),int32(lbfgs_end),Hdiag}; + end + g_old = g; + else + % Apply user-defined preconditioner + precondFunc = precFunc; + precondArgs = {x,varargin{:}}; + end + end + + % Solve Newton system using cg and hessian-vector products + if isempty(HvFunc) + % No user-supplied Hessian-vector function, + % use automatic differentiation + HvFun = @autoHv; + HvArgs = {x,g,useComplex,funObj,varargin{:}}; + else + % Use user-supplid Hessian-vector function + HvFun = HvFunc; + HvArgs = {x,varargin{:}}; + end + + if useNegCurv + [d,cgIter,cgRes,negCurv] = conjGrad([],-g,cgForce,cgMaxIter,debug,precondFunc,precondArgs,HvFun,HvArgs); + else + [d,cgIter,cgRes] = conjGrad([],-g,cgForce,cgMaxIter,debug,precondFunc,precondArgs,HvFun,HvArgs); + end + + funEvals = funEvals+cgIter; + if debug + fprintf('newtonCG stopped on iteration %d w/ residual %.5e\n',cgIter,cgRes); + + end + + if useNegCurv + if ~isempty(negCurv) + %if debug + fprintf('Using negative curvature direction\n'); + %end + d = negCurv/norm(negCurv); + d = d/sum(abs(g)); + end + end + + case NEWTON % Newton search direction + + if cgSolve == 0 + if HessianModify == 0 + % Attempt to perform a Cholesky factorization of the Hessian + [R,posDef] = chol(H); + + % If the Cholesky factorization was successful, then the Hessian is + % positive definite, solve the system + if posDef == 0 + d = -R\(R'\g); + + else + % otherwise, adjust the Hessian to be positive definite based on the + % minimum eigenvalue, and solve with QR + % (expensive, we don't want to do this very much) + if debug + fprintf('Adjusting Hessian\n'); + end + H = H + eye(length(g)) * max(0,1e-12 - min(real(eig(H)))); + d = -H\g; + end + elseif HessianModify == 1 + % Modified Incomplete Cholesky + R = mcholinc(H,debug); + d = -R\(R'\g); + elseif HessianModify == 2 + % Modified Generalized Cholesky + if useMex + [L D perm] = mcholC(H); + else + [L D perm] = mchol(H); + end + d(perm) = -L' \ ((D.^-1).*(L \ g(perm))); + + elseif HessianModify == 3 + % Modified Spectral Decomposition + [V,D] = eig((H+H')/2); + D = diag(D); + D = max(abs(D),max(max(abs(D)),1)*1e-12); + d = -V*((V'*g)./D); + elseif HessianModify == 4 + % Modified Symmetric Indefinite Factorization + [L,D,perm] = ldl(H,'vector'); + [blockPos junk] = find(triu(D,1)); + for diagInd = setdiff(setdiff(1:p,blockPos),blockPos+1) + if D(diagInd,diagInd) < 1e-12 + D(diagInd,diagInd) = 1e-12; + end + end + for blockInd = blockPos' + block = D(blockInd:blockInd+1,blockInd:blockInd+1); + block_a = block(1); + block_b = block(2); + block_d = block(4); + lambda = (block_a+block_d)/2 - sqrt(4*block_b^2 + (block_a - block_d)^2)/2; + D(blockInd:blockInd+1,blockInd:blockInd+1) = block+eye(2)*(lambda+1e-12); + end + d(perm) = -L' \ (D \ (L \ g(perm))); + else + % Take Newton step if Hessian is pd, + % otherwise take a step with negative curvature + [R,posDef] = chol(H); + if posDef == 0 + d = -R\(R'\g); + else + if debug + fprintf('Taking Direction of Negative Curvature\n'); + end + [V,D] = eig(H); + u = V(:,1); + d = -sign(u'*g)*u; + end + end + + else + % Solve with Conjugate Gradient + cgMaxIter = p; + cgForce = min(0.5,sqrt(norm(g)))*norm(g); + + % Select Preconditioner + if cgSolve == 1 + % No preconditioner + precondFunc = []; + precondArgs = []; + elseif cgSolve == 2 + % Diagonal preconditioner + precDiag = diag(H); + precDiag(precDiag < 1e-12) = 1e-12 - min(precDiag); + precondFunc = @precondDiag; + precondArgs = {precDiag.^-1}; + elseif cgSolve == 3 + % L-BFGS preconditioner + if i == 1 + old_dirs = zeros(length(g),0); + old_stps = zeros(length(g),0); + Hdiag = 1; + else + [old_dirs,old_stps,Hdiag] = lbfgsUpdate(g-g_old,t*d,corrections,debug,old_dirs,old_stps,Hdiag); + end + g_old = g; + if useMex + precondFunc = @lbfgsC; + else + precondFunc = @lbfgs; + end + precondArgs = {old_dirs,old_stps,Hdiag}; + elseif cgSolve > 0 + % Symmetric Successive Overelaxation Preconditioner + omega = cgSolve; + D = diag(H); + D(D < 1e-12) = 1e-12 - min(D); + precDiag = (omega/(2-omega))*D.^-1; + precTriu = diag(D/omega) + triu(H,1); + precondFunc = @precondTriuDiag; + precondArgs = {precTriu,precDiag.^-1}; + else + % Incomplete Cholesky Preconditioner + opts.droptol = -cgSolve; + opts.rdiag = 1; + R = cholinc(sparse(H),opts); + if min(diag(R)) < 1e-12 + R = cholinc(sparse(H + eye*(1e-12 - min(diag(R)))),opts); + end + precondFunc = @precondTriu; + precondArgs = {R}; + end + + % Run cg with the appropriate preconditioner + if isempty(HvFunc) + % No user-supplied Hessian-vector function + [d,cgIter,cgRes] = conjGrad(H,-g,cgForce,cgMaxIter,debug,precondFunc,precondArgs); + else + % Use user-supplied Hessian-vector function + [d,cgIter,cgRes] = conjGrad(H,-g,cgForce,cgMaxIter,debug,precondFunc,precondArgs,HvFunc,{x,varargin{:}}); + end + if debug + fprintf('CG stopped after %d iterations w/ residual %.5e\n',cgIter,cgRes); + %funEvals = funEvals + cgIter; + end + end + + case TENSOR % Tensor Method + + if numDiff + % Compute 3rd-order Tensor Numerically + [junk1 junk2 junk3 T] = autoTensor(x,numDiffType,funObj,varargin{:}); + else + % Use user-supplied 3rd-derivative Tensor + [junk1 junk2 junk3 T] = funObj(x,varargin{:}); + end + options_sub.Method = 'newton'; + options_sub.Display = 'none'; + options_sub.progTol = progTol; + options_sub.optTol = optTol; + d = minFunc(@taylorModel,zeros(p,1),options_sub,f,g,H,T); + + if any(abs(d) > 1e5) || all(abs(d) < 1e-5) || g'*d > -progTol + if debug + fprintf('Using 2nd-Order Step\n'); + end + [V,D] = eig((H+H')/2); + D = diag(D); + D = max(abs(D),max(max(abs(D)),1)*1e-12); + d = -V*((V'*g)./D); + else + if debug + fprintf('Using 3rd-Order Step\n'); + end + end + end + + if ~isLegal(d) + fprintf('Step direction is illegal!\n'); + pause; + return + end + + % ****************** COMPUTE STEP LENGTH ************************ + + % Directional Derivative + gtd = g'*d; + + % Check that progress can be made along direction + if gtd > -progTol + exitflag=2; + msg = 'Directional Derivative below progTol'; + break; + end + + % Select Initial Guess + if i == 1 + if method < NEWTON0 + t = min(1,1/sum(abs(g))); + else + t = 1; + end + else + if LS_init == 0 + % Newton step + t = 1; + elseif LS_init == 1 + % Close to previous step length + t = t*min(2,(gtd_old)/(gtd)); + elseif LS_init == 2 + % Quadratic Initialization based on {f,g} and previous f + t = min(1,2*(f-f_old)/(gtd)); + elseif LS_init == 3 + % Double previous step length + t = min(1,t*2); + elseif LS_init == 4 + % Scaled step length if possible + if isempty(HvFunc) + % No user-supplied Hessian-vector function, + % use automatic differentiation + dHd = d'*autoHv(d,x,g,0,funObj,varargin{:}); + else + % Use user-supplid Hessian-vector function + dHd = d'*HvFunc(d,x,varargin{:}); + end + + funEvals = funEvals + 1; + if dHd > 0 + t = -gtd/(dHd); + else + t = min(1,2*(f-f_old)/(gtd)); + end + end + + if t <= 0 + t = 1; + end + end + f_old = f; + gtd_old = gtd; + + % Compute reference fr if using non-monotone objective + if Fref == 1 + fr = f; + else + if i == 1 + old_fvals = repmat(-inf,[Fref 1]); + end + + if i <= Fref + old_fvals(i) = f; + else + old_fvals = [old_fvals(2:end);f]; + end + fr = max(old_fvals); + end + + computeHessian = 0; + if method >= NEWTON + if HessianIter == 1 + computeHessian = 1; + elseif i > 1 && mod(i-1,HessianIter) == 0 + computeHessian = 1; + end + end + + % Line Search + f_old = f; + if LS_type == 0 % Use Armijo Bactracking + % Perform Backtracking line search + if computeHessian + [t,x,f,g,LSfunEvals,H] = ArmijoBacktrack(x,t,d,f,fr,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,LS_saveHessianComp,funObj,varargin{:}); + else + [t,x,f,g,LSfunEvals] = ArmijoBacktrack(x,t,d,f,fr,g,gtd,c1,LS_interp,LS_multi,progTol,debug,doPlot,1,funObj,varargin{:}); + end + funEvals = funEvals + LSfunEvals; + + elseif LS_type == 1 % Find Point satisfying Wolfe conditions + + if computeHessian + [t,f,g,LSfunEvals,H] = WolfeLineSearch(x,t,d,f,g,gtd,c1,c2,LS_interp,LS_multi,25,progTol,debug,doPlot,LS_saveHessianComp,funObj,varargin{:}); + else + [t,f,g,LSfunEvals] = WolfeLineSearch(x,t,d,f,g,gtd,c1,c2,LS_interp,LS_multi,25,progTol,debug,doPlot,1,funObj,varargin{:}); + end + funEvals = funEvals + LSfunEvals; + x = x + t*d; + + else + % Use Matlab optim toolbox line search + [t,f_new,fPrime_new,g_new,LSexitFlag,LSiter]=... + lineSearch({'fungrad',[],funObj},x,p,1,p,d,f,gtd,t,c1,c2,-inf,maxFunEvals-funEvals,... + progTol,[],[],[],varargin{:}); + funEvals = funEvals + LSiter; + if isempty(t) + exitflag = -2; + msg = 'Matlab LineSearch failed'; + break; + end + + if method >= NEWTON + [f_new,g_new,H] = funObj(x + t*d,varargin{:}); + funEvals = funEvals + 1; + end + x = x + t*d; + f = f_new; + g = g_new; + end + + % Compute Optimality Condition + optCond = max(abs(g)); + + % Output iteration information + if verboseI + fprintf('%10d %10d %15.5e %15.5e %15.5e\n',i,funEvals*funEvalMultiplier,t,f,optCond); + end + + if nargout > 3 + % Update Trace + trace.fval(end+1,1) = f; + trace.funcCount(end+1,1) = funEvals; + trace.optCond(end+1,1) = optCond; + end + + % Output Function + if ~isempty(outputFcn) + stop = outputFcn(x,'iter',i,funEvals,f,t,gtd,g,d,optCond,varargin{:}); + if stop + exitflag=-1; + msg = 'Stopped by output function'; + break; + end + end + + % Check Optimality Condition + if optCond <= optTol + exitflag=1; + msg = 'Optimality Condition below optTol'; + break; + end + + % ******************* Check for lack of progress ******************* + + if max(abs(t*d)) <= progTol + exitflag=2; + msg = 'Step Size below progTol'; + break; + end + + + if abs(f-f_old) < progTol + exitflag=2; + msg = 'Function Value changing by less than progTol'; + break; + end + + % ******** Check for going over iteration/evaluation limit ******************* + + if funEvals*funEvalMultiplier >= maxFunEvals + exitflag = 0; + msg = 'Reached Maximum Number of Function Evaluations'; + break; + end + + if i == maxIter + exitflag = 0; + msg='Reached Maximum Number of Iterations'; + break; + end + +end + +if verbose + fprintf('%s\n',msg); +end +if nargout > 3 + output = struct('iterations',i,'funcCount',funEvals*funEvalMultiplier,... + 'algorithm',method,'firstorderopt',max(abs(g)),'message',msg,'trace',trace); +end + +% Output Function +if ~isempty(outputFcn) + outputFcn(x,'done',i,funEvals,f,t,gtd,g,d,max(abs(g)),varargin{:}); + end + +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/minFunc_processInputOptions.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/minFunc_processInputOptions.m new file mode 100644 index 0000000000000000000000000000000000000000..112bdc19b28a35f16485b09774d8061fbc075add --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/minFunc_processInputOptions.m @@ -0,0 +1,168 @@ + +function [verbose,verboseI,debug,doPlot,maxFunEvals,maxIter,optTol,progTol,method,... + corrections,c1,c2,LS_init,cgSolve,qnUpdate,cgUpdate,initialHessType,... + HessianModify,Fref,useComplex,numDiff,LS_saveHessianComp,... + Damped,HvFunc,bbType,cycle,... + HessianIter,outputFcn,useMex,useNegCurv,precFunc,... + LS_type,LS_interp,LS_multi,DerivativeCheck] = ... + minFunc_processInputOptions(o) + +% Constants +SD = 0; +CSD = 1; +BB = 2; +CG = 3; +PCG = 4; +LBFGS = 5; +QNEWTON = 6; +NEWTON0 = 7; +NEWTON = 8; +TENSOR = 9; + +verbose = 1; +verboseI= 1; +debug = 0; +doPlot = 0; +method = LBFGS; +cgSolve = 0; + +o = toUpper(o); + +if isfield(o,'DISPLAY') + switch(upper(o.DISPLAY)) + case 0 + verbose = 0; + verboseI = 0; + case 'FINAL' + verboseI = 0; + case 'OFF' + verbose = 0; + verboseI = 0; + case 'NONE' + verbose = 0; + verboseI = 0; + case 'FULL' + debug = 1; + case 'EXCESSIVE' + debug = 1; + doPlot = 1; + end +end + +DerivativeCheck = 0; +if isfield(o,'DERIVATIVECHECK') + switch(upper(o.DERIVATIVECHECK)) + case 1 + DerivativeCheck = 1; + case 'ON' + DerivativeCheck = 1; + end +end + +LS_init = 0; +LS_type = 1; +LS_interp = 2; +LS_multi = 0; +Fref = 1; +Damped = 0; +HessianIter = 1; +c2 = 0.9; +if isfield(o,'METHOD') + m = upper(o.METHOD); + switch(m) + case 'TENSOR' + method = TENSOR; + case 'NEWTON' + method = NEWTON; + case 'MNEWTON' + method = NEWTON; + HessianIter = 5; + case 'PNEWTON0' + method = NEWTON0; + cgSolve = 1; + case 'NEWTON0' + method = NEWTON0; + case 'QNEWTON' + method = QNEWTON; + Damped = 1; + case 'LBFGS' + method = LBFGS; + case 'BB' + method = BB; + LS_type = 0; + Fref = 20; + case 'PCG' + method = PCG; + c2 = 0.2; + LS_init = 2; + case 'SCG' + method = CG; + c2 = 0.2; + LS_init = 4; + case 'CG' + method = CG; + c2 = 0.2; + LS_init = 2; + case 'CSD' + method = CSD; + c2 = 0.2; + Fref = 10; + LS_init = 2; + case 'SD' + method = SD; + LS_init = 2; + end +end + +maxFunEvals = getOpt(o,'MAXFUNEVALS',1000); +maxIter = getOpt(o,'MAXITER',500); +optTol = getOpt(o,'OPTTOL',1e-5); +progTol = getOpt(o,'PROGTOL',1e-9); +corrections = getOpt(o,'CORRECTIONS',100); +corrections = getOpt(o,'CORR',corrections); +c1 = getOpt(o,'C1',1e-4); +c2 = getOpt(o,'C2',c2); +LS_init = getOpt(o,'LS_INIT',LS_init); +cgSolve = getOpt(o,'CGSOLVE',cgSolve); +qnUpdate = getOpt(o,'QNUPDATE',3); +cgUpdate = getOpt(o,'CGUPDATE',2); +initialHessType = getOpt(o,'INITIALHESSTYPE',1); +HessianModify = getOpt(o,'HESSIANMODIFY',0); +Fref = getOpt(o,'FREF',Fref); +useComplex = getOpt(o,'USECOMPLEX',0); +numDiff = getOpt(o,'NUMDIFF',0); +LS_saveHessianComp = getOpt(o,'LS_SAVEHESSIANCOMP',1); +Damped = getOpt(o,'DAMPED',Damped); +HvFunc = getOpt(o,'HVFUNC',[]); +bbType = getOpt(o,'BBTYPE',0); +cycle = getOpt(o,'CYCLE',3); +HessianIter = getOpt(o,'HESSIANITER',HessianIter); +outputFcn = getOpt(o,'OUTPUTFCN',[]); +useMex = getOpt(o,'USEMEX',1); +useNegCurv = getOpt(o,'USENEGCURV',1); +precFunc = getOpt(o,'PRECFUNC',[]); +LS_type = getOpt(o,'LS_type',LS_type); +LS_interp = getOpt(o,'LS_interp',LS_interp); +LS_multi = getOpt(o,'LS_multi',LS_multi); +end + +function [v] = getOpt(options,opt,default) +if isfield(options,opt) + if ~isempty(getfield(options,opt)) + v = getfield(options,opt); + else + v = default; + end +else + v = default; +end +end + +function [o] = toUpper(o) +if ~isempty(o) + fn = fieldnames(o); + for i = 1:length(fn) + o = setfield(o,upper(fn{i}),getfield(o,fn{i})); + end +end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/polyinterp.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/polyinterp.m new file mode 100644 index 0000000000000000000000000000000000000000..c997615d2fac88c7ac42dcc2cfe9ffccbed183f0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/polyinterp.m @@ -0,0 +1,144 @@ +function [minPos,fmin] = polyinterp(points,doPlot,xminBound,xmaxBound) +% function [minPos] = polyinterp(points,doPlot,xminBound,xmaxBound) +% +% Minimum of interpolating polynomial based on function and derivative +% values +% +% It can also be used for extrapolation if {xmin,xmax} are outside +% the domain of the points. +% +% Input: +% points(pointNum,[x f g]) +% doPlot: set to 1 to plot, default: 0 +% xmin: min value that brackets minimum (default: min of points) +% xmax: max value that brackets maximum (default: max of points) +% +% set f or g to sqrt(-1) if they are not known +% the order of the polynomial is the number of known f and g values minus 1 + +if nargin < 2 + doPlot = 0; +end + +nPoints = size(points,1); +order = sum(sum((imag(points(:,2:3))==0)))-1; + +xmin = min(points(:,1)); +xmax = max(points(:,1)); + +% Compute Bounds of Interpolation Area +if nargin < 3 + xminBound = xmin; +end +if nargin < 4 + xmaxBound = xmax; +end + +% Code for most common case: +% - cubic interpolation of 2 points +% w/ function and derivative values for both + +if nPoints == 2 && order ==3 && doPlot == 0 + % Solution in this case (where x2 is the farthest point): + % d1 = g1 + g2 - 3*(f1-f2)/(x1-x2); + % d2 = sqrt(d1^2 - g1*g2); + % minPos = x2 - (x2 - x1)*((g2 + d2 - d1)/(g2 - g1 + 2*d2)); + % t_new = min(max(minPos,x1),x2); + [minVal minPos] = min(points(:,1)); + notMinPos = -minPos+3; + d1 = points(minPos,3) + points(notMinPos,3) - 3*(points(minPos,2)-points(notMinPos,2))/(points(minPos,1)-points(notMinPos,1)); + d2 = sqrt(d1^2 - points(minPos,3)*points(notMinPos,3)); + if isreal(d2) + t = points(notMinPos,1) - (points(notMinPos,1) - points(minPos,1))*((points(notMinPos,3) + d2 - d1)/(points(notMinPos,3) - points(minPos,3) + 2*d2)); + minPos = min(max(t,xminBound),xmaxBound); + else + minPos = (xmaxBound+xminBound)/2; + end + return; +end + +% Constraints Based on available Function Values +A = zeros(0,order+1); +b = zeros(0,1); +for i = 1:nPoints + if imag(points(i,2))==0 + constraint = zeros(1,order+1); + for j = order:-1:0 + constraint(order-j+1) = points(i,1)^j; + end + A = [A;constraint]; + b = [b;points(i,2)]; + end +end + +% Constraints based on available Derivatives +for i = 1:nPoints + if isreal(points(i,3)) + constraint = zeros(1,order+1); + for j = 1:order + constraint(j) = (order-j+1)*points(i,1)^(order-j); + end + A = [A;constraint]; + b = [b;points(i,3)]; + end +end + +% Find interpolating polynomial +[params,ignore] = linsolve(A,b); + +% Compute Critical Points +dParams = zeros(order,1); +for i = 1:length(params)-1 + dParams(i) = params(i)*(order-i+1); +end + +if any(isinf(dParams)) + cp = [xminBound;xmaxBound;points(:,1)].'; +else + cp = [xminBound;xmaxBound;points(:,1);roots(dParams)].'; +end + +% Test Critical Points +fmin = inf; +minPos = (xminBound+xmaxBound)/2; % Default to Bisection if no critical points valid +for xCP = cp + if imag(xCP)==0 && xCP >= xminBound && xCP <= xmaxBound + fCP = polyval(params,xCP); + if imag(fCP)==0 && fCP < fmin + minPos = real(xCP); + fmin = real(fCP); + end + end +end + +% Plot Situation +if doPlot + clf; hold on; + + % Plot Points + plot(points(:,1),points(:,2),'b*'); + + % Plot Derivatives + for i = 1:nPoints + if isreal(points(i,3)) + m = points(i,3); + b = points(i,2) - m*points(i,1); + plot([points(i,1)-.05 points(i,1)+.05],... + [(points(i,1)-.05)*m+b (points(i,1)+.05)*m+b],'c.-'); + end + end + + % Plot Function + x = min(xmin,xminBound)-.1:(max(xmax,xmaxBound)+.1-min(xmin,xminBound)+.1)/100:max(xmax,xmaxBound)+.1; + for i = 1:length(x) + f(i) = polyval(params,x(i)); + end + plot(x,f,'y'); + axis([x(1)-.1 x(end)+.1 min(f)-.1 max(f)+.1]); + + % Plot Minimum + plot(minPos,fmin,'g+'); + if doPlot == 1 + pause(1); + end +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/precondDiag.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/precondDiag.m new file mode 100644 index 0000000000000000000000000000000000000000..cdd44a942e8db1e182c3e0ff24a0830d775384cb --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/precondDiag.m @@ -0,0 +1,2 @@ +function [y] = precondDiag(r,D) +y = D.*r; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/precondTriu.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/precondTriu.m new file mode 100644 index 0000000000000000000000000000000000000000..a6676815c0544baa4c08b6520c0503f27b0d6488 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/precondTriu.m @@ -0,0 +1,2 @@ +function [y] = precondUpper(r,U) +y = U \ (U' \ r); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/precondTriuDiag.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/precondTriuDiag.m new file mode 100644 index 0000000000000000000000000000000000000000..fd3598b97274f59a01989a94a1c91be07708aa86 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/precondTriuDiag.m @@ -0,0 +1,2 @@ +function [y] = precondUpper(r,U,D) +y = U \ (D .* (U' \ r)); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/taylorModel.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/taylorModel.m new file mode 100644 index 0000000000000000000000000000000000000000..9f667268e5a375793a6a984bcda3370c56d3b3e5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/minFunc/taylorModel.m @@ -0,0 +1,38 @@ +function [f,g,H] = taylorModel(d,f,g,H,T) + +p = length(d); + +fd3 = 0; +gd2 = zeros(p,1); +Hd = zeros(p); +for t1 = 1:p + for t2 = 1:p + for t3 = 1:p + fd3 = fd3 + T(t1,t2,t3)*d(t1)*d(t2)*d(t3); + + if nargout > 1 + gd2(t3) = gd2(t3) + T(t1,t2,t3)*d(t1)*d(t2); + end + + if nargout > 2 + Hd(t2,t3) = Hd(t2,t3) + T(t1,t2,t3)*d(t1); + end + end + + end +end + +f = f + g'*d + (1/2)*d'*H*d + (1/6)*fd3; + +if nargout > 1 + g = g + H*d + (1/2)*gd2; +end + +if nargout > 2 + H = H + Hd; +end + +if any(abs(d) > 1e5) + % We want the optimizer to stop if the solution is unbounded + g = zeros(p,1); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/rosenbrock.m b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/rosenbrock.m new file mode 100644 index 0000000000000000000000000000000000000000..9292f2c601f0d49cd0bc694eca8ecbaf93ab33f9 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/minFunc_2012/rosenbrock.m @@ -0,0 +1,26 @@ +function [f, df, ddf] = rosenbrock(x); + +% rosenbrock.m This function returns the function value, partial derivatives +% and Hessian of the (general dimension) rosenbrock function, given by: +% +% f(x) = sum_{i=1:D-1} 100*(x(i+1) - x(i)^2)^2 + (1-x(i))^2 +% +% where D is the dimension of x. The true minimum is 0 at x = (1 1 ... 1). +% +% Carl Edward Rasmussen, 2001-07-21. + +D = length(x); +f = sum(100*(x(2:D)-x(1:D-1).^2).^2 + (1-x(1:D-1)).^2); + +if nargout > 1 + df = zeros(D, 1); + df(1:D-1) = - 400*x(1:D-1).*(x(2:D)-x(1:D-1).^2) - 2*(1-x(1:D-1)); + df(2:D) = df(2:D) + 200*(x(2:D)-x(1:D-1).^2); +end + +if nargout > 2 + ddf = zeros(D,D); + ddf(1:D-1,1:D-1) = diag(-400*x(2:D) + 1200*x(1:D-1).^2 + 2); + ddf(2:D,2:D) = ddf(2:D,2:D) + 200*eye(D-1); + ddf = ddf - diag(400*x(1:D-1),1) - diag(400*x(1:D-1),-1); +end diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/demo_script.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/demo_script.m new file mode 100644 index 0000000000000000000000000000000000000000..41f679d10da068a4c17c99f4e28bdd90bb952b1b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/demo_script.m @@ -0,0 +1,36 @@ +% This is a script that shows the usage of the binary neural classifier +% when training on the pima indian data set + +% Load the pima indian data: +% The data set containes 2 classes and 7 inputs. There are 200 examples used +% for training and 332 for testing. +% See 'Pattern Recognition and Neural Networks' by B.D. Ripley (1996) page 13 for detailes. +load pima_indian_data + +% Set the number of hidden units +Nh = 10; + +% Train the network +disp('Network training, this will not take long...') +results = nc_main(x,t,x_test,t_test,Nh); + +% Plot the error +figure(1) +x_axis = 0:length(results.Etest)-1; +plot(x_axis,results.Etest,'r*-',x_axis,results.Etrain,'bo-') +xlabel('Number of hyperparameter updates') +ylabel('Average cross-entropy error') +legend('Test set','Training set') + +% Plot the classification error +figure(2) +plot(x_axis,results.Ctest,'r*-',x_axis,results.Ctrain,'bo-') +xlabel('Number of hyperparameter updates') +ylabel('Classification error') +legend('Test set','Training set') + +% Plot the evolution of the hyperparameters +figure(3) +plot(x_axis,results.alpha,'b*-') +xlabel('Number of hyperparameter updates') +ylabel('alpha value') diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_W2Wio.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_W2Wio.m new file mode 100644 index 0000000000000000000000000000000000000000..213ce0364320645bcfe68e686198399cb0c7f18f --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_W2Wio.m @@ -0,0 +1,20 @@ +function [Wi,Wo] = nc_W2Wio(W,Ni,Nh) + +%NC_W2WIO - Change the weight format from vector to 2xMatrices +% +% [Wi,Wo] = nr_W2Wio(Weights,Ni,Nh) +% +% Inputs: +% Weights : The weight vector +% Ni : Number of inputs +% Nh : Number of hidden units +% +% Outputs: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +Wi = reshape(W(1:(Ni+1)*Nh),Nh,Ni+1); +Wo = reshape(W((Ni+1)*Nh+1:end),1,Nh+1); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_alpha.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_alpha.m new file mode 100644 index 0000000000000000000000000000000000000000..476d2e6ac647c02d3f0e7a3632afbc378dfbe0d7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_alpha.m @@ -0,0 +1,35 @@ +function [alpha,gamma] = nc_alpha(W,par) + +%NC_ALPHA - Compute the regularization parameter with +% MacKay's MLII scheme and the number of well +% determined weights +% +% [alpha,gamma] = nc_alpha(W,par) +% +% Input: +% W : The weight vector +% par : Struct variable with a number of parameters +% +% Output: +% alpha : The regularization parameter +% gamma : The number of well determined weights +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Transform the weights from a weight vector to matrices +[Wi,Wo] = nc_W2Wio(W,par.Ni,par.Nh); + +% Change variable names +Inputs = par.x; +Targets = par.t; +alpha = par.alpha; + +% Get the number of weights +Nw = length(W); + +% Estimate the alpha parameter and number of effective weights +Ew = 0.5*sum(W.^2); +A = nc_gnhess(Wi,Wo,alpha,Inputs,Targets); +gamma = Nw-alpha*trace(inv(A)); +alpha = gamma/(2*Ew); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_cost.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_cost.m new file mode 100644 index 0000000000000000000000000000000000000000..561cc9c30d20422ccfba069ca759f41ada9e88fc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_cost.m @@ -0,0 +1,31 @@ +function cost = nc_cost(Wi,Wo,alpha,Inputs,Targets) + +%NC_COST - Neural classifier costfunction with regularization +% +% cost = nc_cost(Wi,Wo,alpha,Inputs,Targets) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% alpha: : Weight decay parameter +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Output: +% cost : Value of regularized cost function +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Calculate the estimated posterior for all examples and classes +[Vj,yj] = nc_forward(Wi,Wo,Inputs); +Targets_est = nc_logistic(yj); + +% Determine the number of classes and examples +N = length(Targets); + +% Compute the likelihood error +cost = -sum([log(Targets_est(Targets==1));log(1-Targets_est(Targets==0))]); + +% Add the regularization term to give the error +cost = cost + 0.5*alpha*(sum(sum(Wi.^2)) + sum(sum(Wo.^2))); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_err_frac.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_err_frac.m new file mode 100644 index 0000000000000000000000000000000000000000..bcbc99f02ae56a93edfec8d8c2281a135c1252fa --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_err_frac.m @@ -0,0 +1,30 @@ +function rate = nc_err_frac(Wi,Wo,Inputs,Targets) + +%NC_ERR_FRAC - Neural classifier fraction of misclassified examples +% +% rate = nc_err_frac(Wi,Wo,Inputs,Targets) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Output: +% rate : The fraction of misclassified examples +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of examples and classes +N = size(Inputs,1); + +% Calculate the class probabilities without outlier probability +[Vj,probs] = nc_forward(Wi,Wo,Inputs); +probs = nc_logistic(probs); + +% Choose the target class boundary as 0.5 +t_est = round(probs); + +% Compute the misclassification rate +rate = sum(Targets ~= t_est)/N; diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_forward.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_forward.m new file mode 100644 index 0000000000000000000000000000000000000000..ea2b03d2fdef0998fcadbe25095b30376ca85246 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_forward.m @@ -0,0 +1,27 @@ +function [Vj,phi] = nc_forward(Wi,Wo,Inputs) + +%NC_FORWARD - Propagate examples forward through network +% without the softmax +% +% [Vj,phi] = nc_forward(Wi,Wo,Inputs) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% Inputs : Matrix with example inputs as rows +% +% Output: +% Vj : Matrix with hidden unit outputs as rows +% phi : Matrix with output unit outputs as rows +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the size of the problem +[examples inp] = size(Inputs); + +% Calculate hidden unit outputs for every example +Vj = tanh([Inputs ones(examples,1) ] * Wi'); + +% Calculate (linear) output unit outputs for every example +phi = [Vj ones(examples,1)] * Wo'; diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_gnhess.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_gnhess.m new file mode 100644 index 0000000000000000000000000000000000000000..cc4e4004c532f320c66541ea2fd8b56a4f93bb8a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_gnhess.m @@ -0,0 +1,32 @@ +function H = nc_gnhess(Wi,Wo,alpha,Inputs,Targets) + +% NC_GNHESS - Evaluate the Gauss-Newton Hessian matrix of the cost function +% +% A = nc_gnhess(Wi,Wo,alpha,Inputs,Targets) +% +% Inputs: +% Wi : The input-to-hidden weight matrix +% Wo : The hidden-to-output weight matrix +% alpha : The regularization parameter +% Inputs : The input data matrix +% Targets : The target labels +% +% Output: +% A : The Gauss-Newton approximated Hessian matrix +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Gradient of the outputs w.r.t. the inputs of the network +[grad_Wi,grad_Wo] = nc_gradientnet(Wi,Wo,Inputs,Targets); +g = [grad_Wi grad_Wo]; + +% Determine the number of weights and examples +Nw = size(g,2); +%N = size(Inputs,1); + +% Compute the GN-Hessian +H = g'*g; + +% Add the regularization term +H = H + alpha*eye(Nw); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_gradient.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_gradient.m new file mode 100644 index 0000000000000000000000000000000000000000..b79e2c75dd8ee8dfbf73e5ab25bda40eabf6a267 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_gradient.m @@ -0,0 +1,46 @@ +function [dWi,dWo] = nc_gradient(Wi,Wo,alpha,Inputs,Targets) + +%NC_GRADIENT Neural classifier gradient of the cost function +% with respect to the weights +% +% [dWi,dWo] = nc_gradient(Wi,Wo,alpha,Inputs,Targets) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% alpha : Weight decay parameter +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Output: +% dWi : Matrix with gradient for input weights +% dWo : Matrix with gradient for output weights +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of examples, classes and hidden units +[exam inp] = size(Inputs); +Nh = size(Wi,1); + +% Calculate hidden and output unit activations +[Vj,yj] = nc_forward(Wi,Wo,Inputs); + +% Apply logistic sigmoidal +yj = nc_logistic(yj); + +% Output unit deltas +delta_o = (yj-Targets); + +% Hidden unit deltas +delta_h = (1.0 - Vj.^2) .* (delta_o * Wo(:,1:Nh)); + +% Partial derivatives for the output weights +dWo = delta_o' * [Vj ones(exam,1)]; + +% Partial derivatives for the input weights +dWi = delta_h' * [Inputs ones(exam,1)]; + +% Add derivatives of the weight decay term +dWi = dWi + alpha*Wi; +dWo = dWo + alpha*Wo; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_gradientnet.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_gradientnet.m new file mode 100644 index 0000000000000000000000000000000000000000..cef402db44ad69c3d9f73ae79bd8b527aefbd93a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_gradientnet.m @@ -0,0 +1,34 @@ +function [grad_Wi,grad_Wo] = nc_gradientnet(Wi,Wo,Inputs,Targets) + +% NC_GRADIENTNET - Partial derivative of network output before softmax +% w.r.t. weights for all examples +% +% [grad_Wi,grad_Wo] = nc_gradientnet(Wi,Wo,Inputs,Targets) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Outputs: +% grad_Wi : Matrix with gradient for input weights +% grad_Wo : Matrix with gradient for output weights +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of examples +[exam inp] = size(Inputs); + +% Calculate hidden and output unit activations +[Vj,yj] = nc_forward(Wi,Wo,Inputs); + +% Compute the gradient for the hidden-to-output weights for each example +grad_Wo = [Vj ones(exam,1)]; + +% Compute the gradient for the input-to-hidden weights for each example +hidden_part = repmat((1.0-Vj.^2),1,size(Wi,2)); +input_part = (kron([Inputs ones(exam,1)],ones(1,size(Wi,1)))); +output_part = repmat(Wo(1,1:end-1),exam,size(Wi,2)); +grad_Wi = hidden_part.*input_part.*output_part; diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_logistic.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_logistic.m new file mode 100644 index 0000000000000000000000000000000000000000..5c538bc4d3ee144575643156556c0e9e356f25ed --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_logistic.m @@ -0,0 +1,22 @@ +function probs = nc_logistic(phi) + +%NC_LOGISTIC - Neural classifier logistic sigmoidal function +% +% probs = nc_logistic(phi) +% +% Input: +% phi : Vector of outputs of the network from NC_FORWARD +% where rows are the individual output neurons. +% Output: +% probs: Vector of posterior probabilities. Each row is the +% class probability for class with target value 1 +% for a specific example. +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Number of classes +Nc = size(phi,2); + +% Compute the class probabilities +probs = 1./(1+exp(-phi)); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_main.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_main.m new file mode 100644 index 0000000000000000000000000000000000000000..a19b4beaaccda9b439f58cf5b471d33e745ef031 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_main.m @@ -0,0 +1,233 @@ +function results = nc_main(x,t,x_test,t_test,Nh,state); +%NC_MAIN Neural classifier main program +% Main program for neural network training +% This program implements binary classification +% using the logistic sigmoidal function +% +% The network is trained using a BFGS optimization algorithm +% using soft line search to determine step length. +% +% Regularization is adapted with MacKays Bayesian MLII scheme +% with only one regularization parameter for all weights. +% +% This program is based on an older neural classifier programmed by +% Morten With Pedersen in February 1997. The following has been added +% *Adaptive regularization with MacKays evidence scheme. 2001 Siggi +% *Gauss-Newton Hessian matrix evaluation. 2001 Siggi +% *Use BFGS algorithm for weigth optimization. 2001 Siggi +% *Binary classification. 2002 Siggi +% +% The BFGS optimization program 'ucminf.m' +% was written by Hans Bruun Nielsen at IMM, DTU. +% +%results = nc_main(x,t,x_test,t_test,Nh,state); +% +% Inputs: +% x : Matrix with training examples as rows +% t : Column vector with class labels (1 to #Classes) +% x_test : Matrix with test examples as rows +% t_test : Column vector with class labels (1 to #Class) +% Nh : Number of hidden units +% state : Intger random seed for weight initialization (Optional) +% +% Output: +% results : Struct variable with all information on the network +% .Ctest : A vector representing the classification error +% on the test set at each hyperparameter update +% .Ctrain : A vector representing the classification error +% on the training set at each hyperparameter update +% .Etest : A vector representing the cross-entropy error +% on the test set at each hyperparameter update, +% averaged over test examples +% .Etrain : A vector representing the cross-entropy error +% on the training set at each hyperparameter update, +% averaged over training examples +% .alpha : A vector representing the value of the alpha +% hyperparameter updates +% .gamma : A vector representing the number of "well determined" +% weights at each hyperparameter update +% .cputime : The cpu training time in seconds +% .Nh : The number of hidden units +% .x : The normalized input patterns for training where +% x = (x_argin - repmat(mean_x,Ntrain,1))./repmat(std_x,Ntrain,1) +% .t : The target class labels for training +% .x_test : The normalized input patterns for testing +% x_test = (x_argin_test - repmat(mean_x,Ntest,1))./repmat(std_x,Ntest,1) +% .t_test : The target class labels for testing +% .mean_x : The mean subtracted from input patterns for normalization +% .std_x : The scaling of the input patterns for normalization +% .p_train : The conditional class probability for all training examples +% and classes using the outlier probability +% .p_test : The conditional class probability for all test examples +% and classes using the outlier probability +% .t_est_train : The estimated class labels for the training examples +% .t_est_test : The estimated class labels for the test examples +% .state : The random seed used for initializing the weights +% .Wi : The input-to-hidden weight matrix +% .Wo : The hidden-to-output weight matrix +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% References: +% +%@article{ mackay92evidence, +% author = "MacKay, D.", +% title = "The Evidence Framework Applied to Classification Networks", +% journal = "Neural Computation", +% volume = "4", +% number = "5", +% pages = "720--736", +% year = "1992", +% url = "citeseer.nj.nec.com/mackay92evidence.html" } +% +%@article{ mackay92practical, +% author = "David J. C. MacKay", +% title = "A practical {B}ayesian framework for backpropagation networks", +% journal = "Neural Computation", +% volume = "4", +% pages = "448--472", +% year = "1992"} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Initialization of various parameters % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Scale and remove the mean of the input patterns +[x,x_test,results.mean_x,results.std_x] = nc_normalize_data(x,x_test); + +% Get the number of inputs and outputs +Ni = size(x,2); + +% Get the number of training and test examples +Ntrain = length(t); +Ntest = length(t_test); + +% Random seed for the weight initialization +if nargin < 6 + state = sum(100*clock); + rand('state',state); +else + rand('state',state); +end + +% Initial regularization value +par.alpha = Ni; + +% Parameters for network convergence +max_count = 100; + +% Initialize network weights +[Wi,Wo] = nc_winit(Ni,Nh); + +% Collect data and parameters for training +par.x = x; +par.t = t; +par.Ni = Ni; +par.Nh = Nh; + +% Options for the BFGS algorithm and soft linesearch +% see the ucminf.m file for detailes +opts = [1 1e-4 1e-8 1000]; + +% Make a weight vector from the two layer matrices +W = [Wi(:);Wo(:)]; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Train the network % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Start taking the training time +t_cpu = cputime; + +% Initialize the counter for hyperparameter update +count = 0; + +% Train the network until parameters have converged +STOP = 0; +while (STOP==0) + + % Increment the counter + count = count+1; + + % Training of the network weights + W = ucminf('nc_network',par,W,opts); + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Save some results of hyperparameters convergence % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Convert the weights from vector to matrices % + [Wi,Wo] = nc_W2Wio(W,Ni,Nh); % + + + % Classification error for test and training % + results.Ctest(count) = nc_err_frac(Wi,Wo,x_test,t_test); % + results.Ctrain(count) = nc_err_frac(Wi,Wo,x,t); % + % Mean square error for test and training % + results.Etest(count) = nc_cost(Wi,Wo,0,x_test,t_test)/Ntest; % + results.Etrain(count) = nc_cost(Wi,Wo,0,x,t)/Ntrain; % + % Regularization parameters % + results.alpha(count) = par.alpha; % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + % Save the old hyperparameters + par.old_alpha = par.alpha; + + % Adapt the regularization parameters + [par.alpha,results.gamma(count)] = nc_alpha(W,par); + + % Check for convergence of hyperparameters (internal function) + STOP = check_convergence(par,max_count,count); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Save some results from the modeling % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Time used for training +results.cputime = cputime-t_cpu; + +% Number of hidden units +results.Nh = Nh; + +% The dataset, inputs and labels +results.x = x; +results.t = t; +results.x_test = x_test; +results.t_test = t_test; + +% The output probability of the training and test set for both classes +[results.p_train,results.t_est_train] = nc_output_probs(Wi,Wo,x); +[results.p_test,results.t_est_test] = nc_output_probs(Wi,Wo,x_test); + +% Save the random state +results.state = state; + +% Save the weights +results.Wi = Wi; +results.Wo = Wo; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Internal functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function STOP = check_convergence(par,max_count,count) +% Check if modeling is finished + +% Stop if exceeding maximum number of iteration +if (count >= max_count) + STOP = 1; + return; +end + +% Check the relative changes of the hyperparameters +alpha_diff = abs(par.alpha-par.old_alpha)/par.alpha; + +% Determine the convergence +if (alpha_diff < 1e-5) + STOP = 1; +else + STOP = 0; +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_network.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_network.m new file mode 100644 index 0000000000000000000000000000000000000000..280fc3d07db7a95ebd08879e1f268df77b0e1475 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_network.m @@ -0,0 +1,28 @@ +function [err,grad] = nc_network(W,par) + +%NC_NETWORK - Information for the BFGS algorithm, +% computes the cost and partial derivative +% of the cost function w.r.t. the weights +% +% [err,grad] = nc_network(W,par) +% +% Input: +% W : The weight vector +% par : Struct variable with a number of parameters +% +% Output: +% err : The value of the cost function +% grad : The gradient of the weights +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Change the weight format from vector to 2xMatrices +[Wi,Wo] = nc_W2Wio(W,par.Ni,par.Nh); + +% Compute the value of the costfunction +err = nc_cost(Wi,Wo,par.alpha,par.x,par.t); + +% Evaluate the gradient +[dWi,dWo] = nc_gradient(Wi,Wo,par.alpha,par.x,par.t); +grad = [dWi(:);dWo(:)]; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_normalize_data.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_normalize_data.m new file mode 100644 index 0000000000000000000000000000000000000000..9edb1cc33b3f16426c6534d0b03c557ce382c0b3 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_normalize_data.m @@ -0,0 +1,33 @@ +function [x,x_test,mean_x,std_x] = nc_normalize_data(x,x_test); + +%NC_NORMALIZE_DATA - Normalize the input patterns +% to have mean zero and variance one +% +% [x,x_test,mean_x,std_x] = nc_normalize_data(x,x_test) +% +% Inputs: +% x : The input training patterns +% x_test : The input test patterns +% +% Outputs: +% x : The normalized input training patterns +% x_test : The normalized input test patterns +% x_mean : The mean that was subtracted +% x_std : The standard deviation for scaling +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of examples and dimension +[Ntest,D] = size(x_test); +[N,D] = size(x); + +% Compute the standard deviation and mean +std_x = std(x,0,1); +mean_x = mean(x,1); + +% Normalize the training input data +x = (x-repmat(mean_x,N,1))./repmat(std_x,N,1); + +% Normalize the test input data +x_test = (x_test-repmat(mean_x,Ntest,1))./repmat(std_x,Ntest,1); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_output_probs.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_output_probs.m new file mode 100644 index 0000000000000000000000000000000000000000..52bfd63899f518202a7708a39d599ab8e7626082 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_output_probs.m @@ -0,0 +1,24 @@ +function [p_est,Targets_est] = nc_output_probs(Wi,Wo,Inputs) + +%NC_OUTPUT_PROBS - Compute estimated class probabilities and target label +% +% [p_est,Targets_est] = nc_output_probs(Wi,Wo,Inputs) +% +% Inputs: +% Wi : The input-to-hidden weight matrix +% Wo : The hidden-to-output weight matrix +% Inputs : The input data matrix +% +% Output: +% p_est : The estimated class probability +% Targets_est : The estimated target labels +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Calculate the estimated posterior for all examples and both classes +[Vj,yj] = nc_forward(Wi,Wo,Inputs); +p_est = nc_logistic(yj); + +% Calculate the estimated posterior for all examples and classes +Targets_est = round(p_est); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_winit.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_winit.m new file mode 100644 index 0000000000000000000000000000000000000000..b3e5845b2a620d4bb72edd74993930584ee8ac90 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/nc_winit.m @@ -0,0 +1,20 @@ +function [Wi,Wo] = nc_winit(Ni,Nh) + +%NC_WINIT - Initialize weights in the network with +% a Gaussian distribution N(0,1/alpha) +% +% [Wi,Wo] = NR_WINIT(Ni,Nh) +% +% Input: +% Ni : Number of input neurons +% Nh : Number of hidden neurons +% +% Output: +% Wi : Input-to-hidden initial weights +% Wo : Hidden-to-output initial weights +% +% Binary Neural Classifier, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +Wi = randn(Nh,Ni+1)/sqrt(Ni); +Wo = randn(1,Nh+1)/sqrt(Ni); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/pima_indian_data.mat b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/pima_indian_data.mat new file mode 100644 index 0000000000000000000000000000000000000000..3a7020cb61df772498509b4b7be7582f3bc3fcfa Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/pima_indian_data.mat differ diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_binclass/ucminf.m b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/ucminf.m new file mode 100644 index 0000000000000000000000000000000000000000..c79905065cdcf007f8cf2b73b7f9ca6a27b4ab48 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_binclass/ucminf.m @@ -0,0 +1,207 @@ +function [X, info, perf, D] = ucminf(fun,par, x0, opts, D0) +%UCMINF BFGS method for unconstrained nonlinear optimization: +% Find xm = argmin{f(x)} , where x is an n-vector and the scalar +% function F with gradient g (with elements g(i) = DF/Dx_i ) +% must be given by a MATLAB function with with declaration +% function [F, g] = fun(x, par) +% par holds parameters of the function. It may be dummy. +% +% Call: [X, info {, perf {, D}}] = ucminf(fun,par, x0, opts {,D0}) +% +% Input parameters +% fun : String with the name of the function. +% par : Parameters of the function. May be empty. +% x0 : Starting guess for x . +% opts : Vector with 4 elements: +% opts(1) : Expected length of initial step +% opts(2:4) used in stopping criteria: +% ||g||_inf <= opts(2) or +% ||dx||_2 <= opts(3)*(opts(3) + ||x||_2) or +% no. of function evaluations exceeds opts(4) . +% Any illegal element in opts is replaced by its +% default value, [1 1e-4*||g(x0)||_inf 1e-8 100] +% D0 : (optional) If present, then approximate inverse Hessian +% at x0 . Otherwise, D0 := I +% Output parameters +% X : If perf is present, then array, holding the iterates +% columnwise. Otherwise, computed solution vector. +% info : Performance information, vector with 6 elements: +% info(1:3) = final values of [f(x) ||g||_inf ||dx||_2] +% info(4:5) = no. of iteration steps and evaluations of (F,g) +% info(6) = 1 : Stopped by small gradient +% 2 : Stopped by small x-step +% 3 : Stopped by opts(4) . +% 4 : Stopped by zero step. +% perf : (optional). If present, then array, holding +% perf(1:2,:) = values of f(x) and ||g||_inf +% perf(3:5,:) = Line search info: values of +% alpha, phi'(alpha), no. fct. evals. +% perf(6,:) = trust region radius. +% D : (optional). If present, then array holding the +% approximate inverse Hessian at X(:,end) . + +% Hans Bruun Nielsen, IMM, DTU. 00.12.18 / 02.01.22 + + % Check call + [x n F g] = check(fun,par,x0,opts); + if nargin > 4, D = checkD(n,D0); fst = 0; + else, D = eye(n); fst = 1; end + % Finish initialization + k = 1; kmax = opts(4); neval = 1; ng = norm(g,inf); + Delta = opts(1); + Trace = nargout > 2; + if Trace + X = x(:)*ones(1,kmax+1); + perf = [F; ng; zeros(3,1); Delta]*ones(1,kmax+1); + end + found = ng <= opts(2); + h = zeros(size(x)); nh = 0; + ngs = ng * ones(1,3); + + while ~found + % Previous values + xp = x; gp = g; Fp = F; nx = norm(x); + ngs = [ngs(2:3) ng]; + h = D*(-g(:)); nh = norm(h); red = 0; + if nh <= opts(3)*(opts(3) + nx), found = 2; + else + if fst | nh > Delta % Scale to ||h|| = Delta + h = (Delta / nh) * h; nh = Delta; + fst = 0; red = 1; + end + k = k+1; + % Line search + [al F g dval slrat] = softline(fun,par,x,F,g, h); + if al < 1 % Reduce Delta + Delta = .35 * Delta; + elseif red & (slrat > .7) % Increase Delta + Delta = 3*Delta; + end + % Update x, neval and ||g|| + x = x + al*h; neval = neval + dval; ng = norm(g,inf); + if Trace + X(:,k) = x(:); + perf(:,k) = [F; ng; al; dot(h,g); dval; Delta]; end + h = x - xp; nh = norm(h); + if nh == 0, + found = 4; + else + y = g - gp; yh = dot(y,h); + if yh > sqrt(eps) * nh * norm(y) + % Update D + v = D*y(:); yv = dot(y,v); + a = (1 + yv/yh)/yh; w = (a/2)*h(:) - v/yh; + D = D + w*h' + h*w'; + end % update D + % Check stopping criteria + thrx = opts(3)*(opts(3) + norm(x)); + if ng <= opts(2), found = 1; + elseif nh <= thrx, found = 2; + elseif neval >= kmax, found = 3; +% elseif neval > 20 & ng > 1.1*max(ngs), found = 5; + else, Delta = max(Delta, 2*thrx); end + end + end % Nonzero h + end % iteration + + % Set return values + if Trace + X = X(:,1:k); perf = perf(:,1:k); + else, X = x; end + info = [F ng nh k-1 neval found]; + +% ========== auxiliary functions ================================= + +function [x,n, F,g, opts] = check(fun,par,x0,opts0) +% Check function call + x = x0(:); sx = size(x); n = max(sx); + if (min(sx) > 1) + error('x0 should be a vector'), end + [F g] = feval(fun,x,par); + sf = size(F); sg = size(g); + if any(sf-1) | ~isreal(F) + error('F should be a real valued scalar'), end + if (min(sg) ~= 1) | (max(sg) ~= n) + error('g should be a vector of the same length as x'), end + so = size(opts0); + if (min(so) ~= 1) | (max(so) < 4) | any(~isreal(opts0(1:4))) + error('opts should be a real valued vector of length 4'), end + opts = opts0(1:4); opts = opts(:).'; + i = find(opts <= 0); + if length(i) % Set default values + d = [1 1e-4*norm(g, inf) 1e-8 100]; + opts(i) = d(i); + end +% ---------- end of check --------------------------------------- + +function D = checkD(n,D0) +% Check given inverse Hessian + D = D0; sD = size(D); + if any(sD - n) + error(sprintf('D should be a square matrix of size %g',n)), end + % Check symmetry + dD = D - D'; ndD = norm(dD(:),inf); + if ndD > 10*eps*norm(D(:),inf) + error('The given D0 is not symmetric'), end + if ndD, D = (D + D')/2; end % Symmetrize + [R p] = chol(D); + if p + error('The given D0 is not positive definite'), end + +function [alpha,fn,gn,neval,slrat] = ... + softline(fun,fpar, x,f,g, h) +% Soft line search: Find alpha = argmin_a{f(x+a*h)} + % Default return values + alpha = 0; fn = f; gn = g; neval = 0; slrat = 1; + n = length(x); + + % Initial values + dfi0 = dot(h,gn); if dfi0 >= 0, return, end + fi0 = f; slope0 = .05*dfi0; slopethr = .995*dfi0; + dfia = dfi0; stop = 0; ok = 0; neval = 0; b = 1; + + while ~stop + [fib g] = feval(fun,x+b*h,fpar); neval = neval + 1; + dfib = dot(g,h); + if b == 1, slrat = dfib/dfi0; end + if fib <= fi0 + slope0*b % New lower bound + if dfib > abs(slopethr), stop = 1; + else + alpha = b; fn = fib; gn = g; dfia = dfib; + ok = 1; slrat = dfib/dfi0; + if (neval < 5) & (b < 2) & (dfib < slopethr) + % Augment right hand end + b = 2*b; + else, stop = 1; end + end + else, stop = 1; end + end + + stop = ok; xfd = [alpha fn dfia; b fib dfib; b fib dfib]; + while ~stop + c = interpolate(xfd,n); + [fic g] = feval(fun, x+c*h, fpar); neval = neval+1; + xfd(3,:) = [c fic dot(g,h)]; + if fic < fi0 + slope0*c % New lower bound + xfd(1,:) = xfd(3,:); ok = 1; + alpha = c; fn = fic; gn = g; slrat = xfd(3,3)/dfi0; + else, xfd(2,:) = xfd(3,:); ok = 0; end + % Check stopping criteria + ok = ok & abs(xfd(3,3)) <= abs(slopethr); + stop = ok | neval >= 5 | diff(xfd(1:2,1)) <= 0; + end % while +%------------ end of softline ------------------------------ + +function alpha = interpolate(xfd,n); +% Minimizer of parabola given by +% xfd(1:2,1:3) = [a fi(a) fi'(a); b fi(b) dummy] + + a = xfd(1,1); b = xfd(2,1); d = b - a; dfia = xfd(1,3); + C = diff(xfd(1:2,2)) - d*dfia; + if C >= 5*n*eps*b % Minimizer exists + A = a - .5*dfia*(d^2/C); + d = 0.1*d; alpha = min(max(a+d, A), b-d); + else + alpha = (a+b)/2; + end +%------------ end of interpolate -------------------------- diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/demo_script.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/demo_script.m new file mode 100644 index 0000000000000000000000000000000000000000..6ba6ed9d0069ddc84dab3d3891a73127d38d8134 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/demo_script.m @@ -0,0 +1,41 @@ +% An script that shows the usage of the neural classifier for multiple +% classes. The data set used is the well known forensic glass data. + +% Load the forensic glass data: +% The data set containes 6 classes and 9 inputs. The 107 examples are use +% for training and 53 are used for testing. +% See 'Pattern Recognition and Neural Networks' by B.D. Ripley (1996) page 13 for detailes. +load forensic_glass_data_small + +% Set the number of hidden units +Nh = 7; + +% Train the network +disp('Network training, this might take a couple of minutes ...') +results = nc_main(x,t,x_test,t_test,Nh); + +% Plot the error +figure(1) +x_axis = 0:length(results.Etest)-1; +plot(x_axis,results.Etest,'r*-',x_axis,results.Etrain,'bo-') +xlabel('Number of hyperparameter updates') +ylabel('Average cross-entropy error') +legend('Test set','Training set') + +% Plot the classification error +figure(2) +plot(x_axis,results.Ctest,'r*-',x_axis,results.Ctrain,'bo-') +xlabel('Number of hyperparameter updates') +ylabel('Classification error') +legend('Test set','Training set') + +% Plot the evolution of the hyperparameters +figure(3) +subplot(2,1,1) +plot(x_axis,results.alpha,'b*-') +xlabel('Number of hyperparameter updates') +ylabel('alpha value') +subplot(2,1,2) +plot(x_axis,results.beta,'b*-') +xlabel('Number of hyperparameter updates') +ylabel('beta value') diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/forensic_glass_data_small.mat b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/forensic_glass_data_small.mat new file mode 100644 index 0000000000000000000000000000000000000000..cf93f63a7bfedecbd584807de3ec6b3dcdf27e12 Binary files /dev/null and b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/forensic_glass_data_small.mat differ diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_W2Wio.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_W2Wio.m new file mode 100644 index 0000000000000000000000000000000000000000..e0aac5bb8fded37f63708706c28199f2c3778cd2 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_W2Wio.m @@ -0,0 +1,21 @@ +function [Wi,Wo] = nc_W2Wio(W,Ni,Nh,No) + +%NC_W2WIO - Change the weight format from vector to 2xMatrices +% +% [Wi,Wo] = nr_W2Wio(Weights,Ni,Nh,No) +% +% Inputs: +% Weights : The weight vector +% Ni : Number of inputs +% Nh : Number of hidden units +% No : Number of outputs +% +% Outputs: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +Wi = reshape(W(1:(Ni+1)*Nh),Nh,Ni+1); +Wo = reshape(W((Ni+1)*Nh+1:end),No,Nh+1); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_alpha.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_alpha.m new file mode 100644 index 0000000000000000000000000000000000000000..cd697581b00b86e2f485b22017effab1c1c7e360 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_alpha.m @@ -0,0 +1,36 @@ +function [alpha,gamma] = nc_alpha(W,par) + +%NC_ALPHA - Compute the regularization parameter and +% the number of well determined weights with +% MacKay's MLII scheme +% +% [alpha,gamma] = nc_alpha(W,par) +% +% Input: +% W : The weight vector +% par : Struct variable with a number of parameters +% +% Output: +% alpha : The regularization parameter +% gamma : The number of well determined weights +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Transform the weights from a weight vector to matrices +[Wi,Wo] = nc_W2Wio(W,par.Ni,par.Nh,par.No); + +% Change variable names +Inputs = par.x; +Targets = par.t; +alpha = par.alpha; +beta = par.old_beta; + +% Get the number of weights +Nw = length(W); + +% Estimate the alpha parameter and number of effective weights +Ew = 0.5*sum(W.^2); +A = nc_gnhess(Wi,Wo,alpha,beta,Inputs,Targets); +gamma = Nw-alpha*trace(inv(A)); +alpha = gamma/(2*Ew); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_beta.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_beta.m new file mode 100644 index 0000000000000000000000000000000000000000..be57b9d4066e161e53b2507cace0e1b9efe8535a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_beta.m @@ -0,0 +1,143 @@ +function beta = nc_beta(W,par) + +%NC_BETA - Compute the estimated scaled outlier probability with +% Brent's method for fitting quadratic functions. For further +% information see 'Numerical recipies in C'. +% +% beta = nc_beta(W,par) +% +% Input: +% W : The weight vector +% par : Struct variable with all other parameters +% +% Output: +% beta : The estimated scaled outlier probability +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Transform the weights from a weight vector to matrices +[Wi,Wo] = nc_W2Wio(W,par.Ni,par.Nh,par.No); + +% Change variable names +Inputs = par.x; +Targets = par.t; +alpha = par.alpha; +beta = par.beta; + +% Some constants for Brent's method +tol = sqrt(eps)*2; +ZEPS = 1e-10; +ee = 0; +CGOLD = 0.3819660; +ITMAX = 100; + +% Initial values to search beta +xx = [0 beta 0.99*1/size(Wo,1)]; + +% Initialize the points +for i = 1:3 + % Compute the Hessian + A = nc_gnhess(Wi,Wo,alpha,xx(i),Inputs,Targets); + % Compute the log det of the Hessian + logdetA = 2*sum(log(diag(chol(A)))); + % Compute the value of the function for point i + f(i) = nc_cost(Wi,Wo,alpha,xx(i),Inputs,Targets)+0.5*logdetA; +end + +% Initialization +a = xx(1);b = xx(3);x = xx(2);w = xx(2);v = xx(2); +fx = f(2);fw = f(2);fv = f(2); + +for iter = 1:ITMAX + + xm = 0.5*(a+b); + tol1 = tol*abs(x)+ZEPS; + tol2 = 2*tol1; + + if (abs(x-xm) <= (tol2-0.5*(b-a))) + beta = x; + break; + end + + if (abs(ee) > tol1) + r = (x-w)*(fx-fv); + q = (x-v)*(fx-fw); + p = (x-v)*q-(x-w)*r; + q = 2*(q-r); + if (q > 0) + p = -p; + end + q = abs(q); + etemp = ee; + ee = d; + if (abs(p) >= abs(0.5*q*etemp) | p <= q*(a-x) | p >= q*(b-x)) + if (x >= xm) + ee = a-x; + else + ee = b-x; + end + d = CGOLD*ee; + else + d = p/q; + u = x+d; + if (u-a < tol2 | b-u < tol2) + if (xm-x >= 0) + d = abs(tol1); + else + d = -abs(tol1); + end + end + end + else + if (x >= xm) + ee = a-x; + else + ee = b-x; + end + d = CGOLD*ee; + end + + if (abs(d) >= tol1) + u = x+d; + else + if d >= 0 + u = x+abs(tol1); + else + u = x-abs(tol1); + end + end + + % Compute the Hessian + A = nc_gnhess(Wi,Wo,alpha,u,Inputs,Targets); + % Compute the log det of the Hessian + logdetA = 2*sum(log(diag(chol(A)))); + % Compute the value of the function for point i + fu = nc_cost(Wi,Wo,alpha,u,Inputs,Targets)+0.5*logdetA; + + if (fu <= fx) + if (u >= x) + a = x; + else + b = x; + end + v = w;w = x;x = u; + fv = fw;fw = fx;fx = fu; + else + if (u < x) + a = u; + else + b = u; + end + if (fu <= fw | w == x) + v = w;w = u;fv = fw;fw = fu; + elseif (fu <= fv | v == x | v == w) + v = u;fv = fu; + end + end + if (iter == ITMAX) + disp('Maximun number of iterations') + beta = x; + end +end + diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_cost.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_cost.m new file mode 100644 index 0000000000000000000000000000000000000000..bfdd34094940cd8ce402af916e29675625b0c579 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_cost.m @@ -0,0 +1,42 @@ +function cost = nc_cost(Wi,Wo,alpha,beta,Inputs,Targets) + +%NC_COST - Neural classifier costfunction with regularization +% +% cost = nc_cost(Wi,Wo,alpha,Inputs,Targets) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% alpha: : Weight decay parameter +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Output: +% cost : Value of regularized negative log-likelihood cost function +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Get the number of classes +Nc = size(Wo,1); + +% Calculate the estimated posterior for all examples and classes +[Vj,yj] = nc_forward(Wi,Wo,Inputs); +Targets_est = nc_softmax(yj); + +% Modify with outlier probability +Targets_est = Targets_est*(1-beta*Nc)+beta; + +% Determine the number of classes and examples +N = length(Targets); + +% Convert the Target variable to 1-of-c coded +Targets_true = zeros(N,Nc); +index = (Targets-1)*N+(1:N)'; +Targets_true(index) = ones(N,1); + +% Compute the likelihood error +cost = -sum(sum(Targets_true.*log(Targets_est))); + +% Add the regularization term to give the error +cost = cost + 0.5*alpha*(sum(sum(Wi.^2)) + sum(sum(Wo.^2))); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_err_frac.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_err_frac.m new file mode 100644 index 0000000000000000000000000000000000000000..7ae31ef43953e3ba31e38731141dc277aae3479d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_err_frac.m @@ -0,0 +1,34 @@ +function rate = nc_err_frac(Wi,Wo,beta,Inputs, Targets) + +%NC_ERR_FRAC - Neural classifier fraction of misclassified examples +% +% rate = nc_err_frac(Wi,Wo,Inputs,Targets) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Output: +% rate : The fraction of misclassified examples +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of examples and classes +N = size(Inputs,1); +Nc = size(Wo,1); + +% Calculate the class probabilities without outlier probability +[Vj,probs] = nc_forward(Wi,Wo,Inputs); +probs = nc_softmax(probs); + +% Use the outlier probability model +probs = probs*(1-beta*Nc) + beta; + +% Choose maxima as target classes +[v t_est] = max(probs,[],2); + +% Compute the misclassification rate +rate = sum(Targets ~= t_est)/N; diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_eval.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_eval.m new file mode 100644 index 0000000000000000000000000000000000000000..81cff9e7629d1927d99dadcbada49dcd3eb130de --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_eval.m @@ -0,0 +1,26 @@ +function y = nc_eval(netwrk, x) + +%NR_EVAL - Compute output of neural network +% +% y = nr_eval(netwrk, x) +% +% Input: +% netwrk : Neural network, struct variable returned from nr_main +% x : Matrix with example inputs as rows +% +% Output: +% y : Vector with output unit outputs as rows +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. +% Mikkel N. Schmidt and Morten M�rup 2011, Tehcnical Unviersit of Denmark + +% Determine the number of examples and dimension +[N,D] = size(x); + +% Normalize the training input data +x = (x-repmat(netwrk.mean_x,N,1))./repmat(netwrk.std_x,N,1); + +% Forward +[dummy, y] = nc_forward(netwrk.Wi, netwrk.Wo, x); +y=nc_softmax(y); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_forward.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_forward.m new file mode 100644 index 0000000000000000000000000000000000000000..09865717b142c7f644c75121bf32ddd3e7d6c977 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_forward.m @@ -0,0 +1,27 @@ +function [Vj,phi] = nc_forward(Wi,Wo,Inputs) + +%NC_FORWARD - Propagate examples forward through network +% without the softmax +% +% [Vj,phi] = nc_forward(Wi,Wo,Inputs) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% Inputs : Matrix with example inputs as rows +% +% Output: +% Vj : Matrix with hidden unit outputs as rows +% phi : Matrix with output unit outputs as rows +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the size of the problem +[examples inp] = size(Inputs); + +% Calculate hidden unit outputs for every example +Vj = tanh([Inputs ones(examples,1) ] * Wi'); + +% Calculate (linear) output unit outputs for every example +phi = [Vj ones(examples,1)] * Wo'; diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_gnhess.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_gnhess.m new file mode 100644 index 0000000000000000000000000000000000000000..0afc06a2879f555274c07b2dcbabb0f69ba7fd04 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_gnhess.m @@ -0,0 +1,62 @@ +function H = nc_gnhess(Wi,Wo,alpha,beta,Inputs,Targets) + +% NC_GNHESS - Evaluate the Gauss-Newton approximated Hessian matrix of the cost function +% +% A = nc_gnhess(Wi,Wo,alpha,beta,Inputs,Targets) +% +% Inputs: +% Wi : The input-to-hidden weight matrix +% Wo : The hidden-to-output weight matrix +% alpha : The regularization parameter +% beta : The estimated scaled outlier probability +% Inputs : The input data matrix +% Targets : The target labels +% +% Output: +% A : The Gauss-Newton Hessian matrix +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Gradient of the outputs w.r.t. the inputs of the network +[grad_Wi,grad_Wo] = nc_gradientnet(Wi,Wo,Inputs,Targets); +g = [grad_Wi grad_Wo]; + +% Get some constants +Nc = size(grad_Wi,3); +Nwi = length(Wi(:)); +Nwo = length(Wo(:)); +Nw = Nwi + Nwo; +N = size(Inputs,1); + +% Evaluate the network output +[Vj,yj] = nc_forward(Wi,Wo,Inputs); +z = nc_softmax(yj); + +% Variable for the Hessian computation +zz = 1./(z*(1-beta*Nc)+beta); + +% Start evaluating the Hessian +H = zeros(Nw); +for i = 1:Nc + dt_dw_i = zeros(N,Nw); + for j = 1:Nc + fi_j = g(:,:,j); + if i == Nc + dt_dw_i = dt_dw_i-repmat(z(:,i),1,Nw).*repmat(z(:,j),1,Nw).*fi_j; + else + if i==j + dt_dw_i = dt_dw_i+repmat(z(:,i),1,Nw).*repmat(1-z(:,j),1,Nw).*fi_j; + else + dt_dw_i = dt_dw_i+repmat(z(:,i),1,Nw).*repmat(-z(:,j),1,Nw).*fi_j; + end + end + end + H = H+(repmat(zz(:,i),1,Nw).*dt_dw_i)'*dt_dw_i; +end + +% Add the outlier term +H = (1-beta*Nc)^2*H; + +% Add the regularization term +H = H + alpha*eye(Nw); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_gradient.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_gradient.m new file mode 100644 index 0000000000000000000000000000000000000000..616b76a0738163884ef589d3ba2f16e1287d7c0d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_gradient.m @@ -0,0 +1,51 @@ +function [dWi,dWo] = nc_gradient(Wi,Wo,alpha,beta,Inputs,Targets) + +%NC_GRADIENT Neural classifier gradient of the cost function +% with respect to the weights +% +% [dWi,dWo] = nc_gradient(Wi,Wo,alpha,beta,Inputs,Targets) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% alpha : Weight decay parameter +% beta : Estimated scaled outlier probability +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Output: +% dWi : Matrix with gradient for input weights +% dWo : Matrix with gradient for output weights +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of examples, classes and hidden units +[exam inp] = size(Inputs); +Nc = size(Wo,1); +Nh = size(Wi,1); + +% Calculate hidden and output unit activations +[Vj,yj] = nc_forward(Wi,Wo,Inputs); + +% Apply softmax +yj = nc_softmax(yj); + +% Create indices in matrix for outputs corresp. to the correct class +indx = (Targets-1)*exam + (1:exam)'; + +% Subtract target value (=1) from correct class probabilities +yj(indx) = yj(indx) - 1; + +% Hidden unit deltas +delta_h =(1.0 - Vj.^2) .* (yj * Wo(:,1:Nh)); + +% Partial derivatives for the output weights +dWo = yj' * [Vj ones(exam,1)]; + +% Partial derivatives for the input weights +dWi = delta_h' * [Inputs ones(exam,1)]; + +% Add derivatives of the regularization term +dWi = (dWi + alpha * Wi); +dWo = (dWo + alpha * Wo); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_gradientnet.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_gradientnet.m new file mode 100644 index 0000000000000000000000000000000000000000..b032360dad3bad8fa1a4ee8e38dc97b6b59bae00 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_gradientnet.m @@ -0,0 +1,41 @@ +function [grad_Wi,grad_Wo] = nc_gradientnet(Wi,Wo,Inputs,Targets) + +% NC_GRADIENTNET - Partial derivative of outputs +% w.r.t. weights for all examples (Jacobian) +% +% [grad_Wi,grad_Wo] = nc_gradientnet(Wi,Wo,Inputs,Targets) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Outputs: +% grad_Wi : Matrix with gradient for input weights +% grad_Wo : Matrix with gradient for output weights +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of examples +[exam inp] = size(Inputs); + +% Calculate hidden and output unit activations +[Vj,yj] = nc_forward(Wi,Wo,Inputs); + +% Compute the gradient of the net for each example and each output +hidden_part = repmat((1.0-Vj.^2),1,size(Wi,2)); +input_part = (kron([Inputs ones(exam,1)],ones(1,size(Wi,1)))); +dWo = [Vj ones(exam,1)]; +for i = 1:size(Wo,1) + + % The gradient for input-to-hidden weights + output_part = repmat(Wo(i,1:end-1),exam,size(Wi,2)); + grad_Wi(:,:,i) = hidden_part.*input_part.*output_part; + + % The gradient for hidden-to-output weights + index_Wo = i:size(Wo,1):length(Wo(:)); + grad_Wo(:,index_Wo,i) = dWo; + +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_main.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_main.m new file mode 100644 index 0000000000000000000000000000000000000000..df9c4ca4327ea3aae71853a91b6b3c8538991401 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_main.m @@ -0,0 +1,256 @@ +function results = nc_main(x,t,x_test,t_test,Nh,state); + +%NC_MAIN Neural classifier main program +% Main program for neural network training +% This program implements classification using the SOFTMAX function +% +% The network is trained using the BFGS optimization algorithm +% using soft line search to determine step lengths. +% The regularization is adapted with MacKays Bayesian MLII scheme +% with only one regularization parameter for all weights. +% Outlier probability is also implemented using Bayesian MLII estimates and +% Brent's method for fitting quadratic functions +% +% This program is based on an older neural classifier programmed by +% Morten With Pedersen in February 1997. The following has been added +% *Adaptive regularization with MacKays evidence scheme. 2001 Siggi +% *Gauss-Newton Hessian matrix evaluation. 2001 Siggi +% *Outlier model based on Gaussian approximation. 2001 Siggi +% *Use BFGS algorithm for weigth optimization. 2001 Siggi +% +% The BFGS program was written by Hans Bruun Nielsen at IMM, DTU. +% +% results = nc_main_outlier(x,t,x_test,t_test,Nh,state); +% +% Inputs: +% x : Matrix with training examples as rows +% t : Column vector with class labels (1 to #Classes) +% x_test : Matrix with test examples as rows +% t_test : Column vector with class labels (1 to #Class) +% Nh : Number of hidden units +% state : Intger random seed for weight initialization (Optional) +% +% Output: +% results : Struct variable with all information on the network +% .Ctest : A vector representing the classification error +% on the test set at each hyperparameter update +% .Ctrain : A vector representing the classification error +% on the training set at each hyperparameter update +% .Etest : A vector representing the cross-entropy error +% on the test set at each hyperparameter update +% with beta set to 0 and averaged over test examples +% .Etrain : A vector representing the cross-entropy error +% on the training set at each hyperparameter update +% with beta set to 0 and averaged over training examples +% .alpha : A vector representing the value of the alpha +% hyperparameter updates +% .beta : A vector representing the value of the beta +% hyperparameter updates +% .gamma : A vector representing the number of "well determined" +% weights at each hyperparameter update +% .cputime : The training time in seconds +% .Nh : The number of hidden units +% .x : The normalized input patterns for training where +% x = (x_argin - repmat(mean_x,Ntrain,1))./repmat(std_x,Ntrain,1) +% .t : The target class labels for training +% .x_test : The normalized input patterns for testing +% x_test = (x_argin_test - repmat(mean_x,Ntest,1))./repmat(std_x,Ntest,1) +% .t_test : The target class labels for testing +% .mean_x : The mean subtracted from input patterns for normalization +% .std_x : The scaling of the input patterns for normalization +% .Poutlier : The outlier probability of each example in the training set where +% a value higher than 0.5 indicates that the examples is an outlier +% .p_train : The conditional class probability for all training examples +% and classes using the outlier probability +% .p_test : The conditional class probability for all test examples +% and classes using the outlier probability +% .t_est_train : The estimated class labels for the training examples +% .t_est_test : The estimated class labels for the test examples +% .state : The random seed used for initializing the weights +% .Wi : The input-to-hidden weight matrix +% .Wo : The hidden-to-output weight matrix +% +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% References +% +%@article{ mackay92evidence, +% author = "MacKay, D.", +% title = "The Evidence Framework Applied to Classification Networks", +% journal = "Neural Computation", +% volume = "4", +% number = "5", +% pages = "720--736", +% year = "1992", +% url = "citeseer.nj.nec.com/mackay92evidence.html" } +% +%@article{ mackay92practical, +% author = "David J. C. MacKay", +% title = "A practical {B}ayesian framework for backpropagation networks", +% journal = "Neural Computation", +% volume = "4", +% pages = "448--472", +% year = "1992"} +% +%@InProceedings{sigurdsson02, +% author = {S.\ Sigurdsson and J.\ Larsen and L.K.\ Hansen}, +% title = {{Outlier estimation and detection: Application to Skin Lesion Classification}}, +% booktitle = {{To appear in Proceedings of the 2002 International Conference on +% Acoustics, Speech and Signal Processing}},} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Initialization of various parameters % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Scale and remove the mean of the input patterns +[x,x_test,results.mean_x,results.std_x] = nc_normalize_data(x,x_test); + +% Determine the number of inputs and outputs +Ni = size(x,2); +No = max(t); + +% Determine the number of training and test examples +Ntrain = length(t); +Ntest = length(t_test); + +% Random seed for the weight initialization +if nargin < 6 + state = sum(100*clock); +end +randn('state',state); + +% Initial hyperparameter values, small values +par.alpha = Ni; +par.beta = 0; + +% Parameters for network convergence; +% Number of hyperparameter updates +max_count = 100; + +% Initialize network weights +[Wi,Wo] = nc_winit(Ni,Nh,No); + +% Collect data and parameters for training +par.x = x; +par.t = t; +par.Ni = Ni; +par.No = No; +par.Nh = Nh; + +% Options for the BFGS algorithm and soft linesearch +% see the ucminf.m file for detailes +opts = [1 1e-4 1e-8 1000]; + +% Make a weight vector from the two layer matrices +W = [Wi(:);Wo(:)]; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Train the network % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Start taking the training time +t_cpu = cputime; + +% Initialize the counter for hyperparameter update +count = 0; + +% Train the network until parameters have converged +STOP = 0; +while (STOP==0) + + % Increment the counter + count = count+1; + + % Training of the network weights + W = ucminf('nc_network',par,W,opts); + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Save some results of hyperparameters update % + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + % Convert the weights from vector to matrices % + [Wi,Wo] = nc_W2Wio(W,Ni,Nh,No); % + % Classification error for test and training % + results.Ctest(count) = nc_err_frac(Wi,Wo,par.beta,x_test,t_test); % + results.Ctrain(count) = nc_err_frac(Wi,Wo,par.beta,x,t); % + % Mean square error for test and training % + results.Etest(count) = 2/Ntest*nc_cost(Wi,Wo,0,0,x_test,t_test); % + results.Etrain(count) = 2/Ntrain*nc_cost(Wi,Wo,0,0,x,t); % + % Hyperparameters % + results.alpha(count) = par.alpha; % + results.beta(count) = par.beta; % + % Model selection % + %results.log_evidence(count) = nc_evidence(Wi,Wo,par.alpha,par.beta,x,t);% + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + % Save the old hyperparameters + par.old_alpha = par.alpha; + par.old_beta = par.beta; + + % Update the estimated outlier probability + par.beta = nc_beta(W,par); + + % Adapt the regularization parameters + [par.alpha,results.gamma(count)] = nc_alpha(W,par); + + % Check for convergence of hyperparameters (internal function) + STOP = check_convergence(par,max_count,count); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Save some results from the training % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Time used for training +results.cputime = cputime-t_cpu; + +% Number of hidden units +results.Nh = Nh; + +% The data set; inputs and labels for both test and training set +results.x = x; +results.t = t; +results.x_test = x_test; +results.t_test = t_test; + +% The outlier probability of the training examples +results.Poutlier = nc_outlier_probs(Wi,Wo,par.beta,x,t); + +% The output probability of the training and test set for all classes +[results.p_train,results.t_est_train] = nc_output_probs(Wi,Wo,par.beta,x); +[results.p_test,results.t_est_test] = nc_output_probs(Wi,Wo,par.beta,x_test); + +% Save the random state +results.state = state; + +% Save the weights +results.Wi = Wi; +results.Wo = Wo; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Internal functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function STOP = check_convergence(par,max_count,count) +% Check if the hyperparameters have converged + +% Stop if exceeding maximum number of iteration +if (count >= max_count) + STOP = 1; + return; +end + +% Check the relative changes of the hyperparameters +alpha_diff = abs(par.alpha-par.old_alpha)/par.alpha; +if par.beta == 0 + beta_diff = abs(par.beta-par.old_beta); +else + beta_diff = abs(par.beta-par.old_beta)/par.beta; +end + +% Determine the convergence +if (alpha_diff < 1e-5) & (beta_diff < 1e-5) + STOP = 1; +else + STOP = 0; +end diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_network.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_network.m new file mode 100644 index 0000000000000000000000000000000000000000..50b41dca3f3dddd77e36ae9c6da3ed236eceed89 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_network.m @@ -0,0 +1,28 @@ +function [err,grad] = nc_network(W,par) + +%NC_NETWORK - Information for the bfgs algorithm +% computes the cost and partial derivative +% of the cost function w.r.t. the weights +% +% [err,grad] = nc_network(W,par) +% +% Input: +% W : The weight vector +% par : Struct variable with a number of parameters +% +% Output: +% err : The value of the cost function +% grad : The gradient of the weights +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Change the weight format from vector to 2xMatrices +[Wi,Wo] = nc_W2Wio(W,par.Ni,par.Nh,par.No); + +% Compute the value of the costfunction +err = nc_cost(Wi,Wo,par.alpha,par.beta,par.x,par.t); + +% Evaluate the gradient +[dWi,dWo] = nc_gradient(Wi,Wo,par.alpha,par.beta,par.x,par.t); +grad = [dWi(:);dWo(:)]; diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_normalize_data.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_normalize_data.m new file mode 100644 index 0000000000000000000000000000000000000000..4b8eabdf7b6ac8090b937518d84252621ca50da0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_normalize_data.m @@ -0,0 +1,33 @@ +function [x,x_test,mean_x,std_x] = nc_normalize_data(x,x_test); + +%NC_NORMALIZE_DATA - Normalize the input patterns +% to have mean zero and variance one +% +% [x,x_test,mean_x,std_x] = nc_normalize_data(x,x_test) +% +% Inputs: +% x : The input training patterns +% x_test : The input test patterns +% +% Outputs: +% x : The normalized input training patterns +% x_test : The normalized input test patterns +% x_mean : The mean that was subtracted +% x_std : The standard deviation for scaling +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of examples and dimension +[Ntest,D] = size(x_test); +[N,D] = size(x); + +% Compute the standard deviation and mean +std_x = std(x,0,1); +mean_x = mean(x,1); + +% Normalize the training input data +x = (x-repmat(mean_x,N,1))./repmat(std_x,N,1); + +% Normalize the test input data +x_test = (x_test-repmat(mean_x,Ntest,1))./repmat(std_x,Ntest,1); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_outlier_probs.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_outlier_probs.m new file mode 100644 index 0000000000000000000000000000000000000000..ce98eecba490dd4d753e1cfba6605d515f9dfe8d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_outlier_probs.m @@ -0,0 +1,35 @@ +function Poutlier = nc_outlier_probs(Wi,Wo,beta,Inputs,Targets) + +%NC_OUTLIER_PROBS - Compute the estimated outlier probability +% of the training set +% +% Poutlier = nc_outlier_probs(Wi,Wo,beta,Inputs,Targets) +% +% Inputs: +% Wi : The input-to-hidden weight matrix +% Wo : The hidden-to-output weight matrix +% beta : The estimated scaled outlier probability +% Inputs : The input data matrix +% Targets : The target labels +% +% Output: +% Poutlier : The outlier probability of the training set where an example +% with a outlier value higher that 0.5 is considered an outlier +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of classes +Nc = size(Wo,1); + +% Calculate the estimated posterior for all examples and classes +[Vj,yj] = nc_forward(Wi,Wo,Inputs); +Targets_est = nc_softmax(yj); + +% Find the class probability without outlier probability +N = length(Targets); +index = (Targets-1)*N+(1:N)'; +P0 = Targets_est(index); + +% Compute the estimated outlier probability for each training example +Poutlier = beta*(1-P0)./(P0*(1-beta*Nc)+beta); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_output_probs.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_output_probs.m new file mode 100644 index 0000000000000000000000000000000000000000..ab8c789276e7bf388436fb49438c102dc15c0af5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_output_probs.m @@ -0,0 +1,32 @@ +function [p_est,Targets_est] = nc_output_probs(Wi,Wo,beta,Inputs) + +%NC_OUTPUT_PROBS - Compute estimated class probabilities with +% outlier probabilities and estimate the target labels +% +% [p_est,Targets_est] = nc_output_probs(Wi,Wo,beta,Inputs) +% +% Inputs: +% Wi : The input-to-hidden weight matrix +% Wo : The hidden-to-output weight matrix +% beta : The estimated scaled outlier probability +% Inputs : The input data matrix +% +% Output: +% p_est : The estimated condiational class probability +% Targets_est : The estimated target labels +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Calculate the estimated posterior for all examples and classes +% without outlier probability +[Vj,yj] = nc_forward(Wi,Wo,Inputs); +p_est_beta0 = nc_softmax(yj); + +% Calculate the estimated posterior for all examples and classes +% with outlier probability +Nc = size(Wo,1); +p_est = p_est_beta0*(1-beta*Nc)+beta; + +% Compute the estimated target label +[d,Targets_est] = max(p_est,[],2); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_softmax.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_softmax.m new file mode 100644 index 0000000000000000000000000000000000000000..049d4e29d536d76c6b75bdcc799ecbd0ec8d0720 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_softmax.m @@ -0,0 +1,23 @@ +function probs = nc_softmax(phi) + +%NC_SOFTMAX - Neural classifier softmax function +% +% probs = nc_softmax(phi) +% +% Input: +% phi : Matrix with values of outputs of the network (NC_FORWARD) +% +% Output: +% probs: Matrix of posterior probabilities. Each row is the +% are individual class probabilities for a specific example. +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Number of classes +Nc = size(phi,2); + +% Compute the class probabilities +exp_phi = exp(phi); +sumexp_phi = sum(exp_phi,2); +probs = exp_phi./repmat(sumexp_phi,1,Nc); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_winit.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_winit.m new file mode 100644 index 0000000000000000000000000000000000000000..3d5ca87c4937d45a526ccaca3760c395c811bd27 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/nc_winit.m @@ -0,0 +1,21 @@ +function [Wi,Wo] = nc_winit(Ni,Nh,No) + +%NC_WINIT - Initialize weights in the network with +% a Gaussian distribution N(0,1/alpha) +% +% [Wi,Wo] = NR_WINIT(Ni,Nh,No) +% +% Input: +% Ni : Number of input neurons +% Nh : Number of hidden neurons +% No : Number of output neurons +% +% Output: +% Wi : Input-to-hidden initial weights +% Wo : Hidden-to-output initial weights +% +% Neural classifier for multiple classes, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +Wi = randn(Nh,Ni+1)/sqrt(Ni); +Wo = randn(No,Nh+1)/sqrt(Ni); diff --git a/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/ucminf.m b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/ucminf.m new file mode 100644 index 0000000000000000000000000000000000000000..c79905065cdcf007f8cf2b73b7f9ca6a27b4ab48 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nc_multiclass/ucminf.m @@ -0,0 +1,207 @@ +function [X, info, perf, D] = ucminf(fun,par, x0, opts, D0) +%UCMINF BFGS method for unconstrained nonlinear optimization: +% Find xm = argmin{f(x)} , where x is an n-vector and the scalar +% function F with gradient g (with elements g(i) = DF/Dx_i ) +% must be given by a MATLAB function with with declaration +% function [F, g] = fun(x, par) +% par holds parameters of the function. It may be dummy. +% +% Call: [X, info {, perf {, D}}] = ucminf(fun,par, x0, opts {,D0}) +% +% Input parameters +% fun : String with the name of the function. +% par : Parameters of the function. May be empty. +% x0 : Starting guess for x . +% opts : Vector with 4 elements: +% opts(1) : Expected length of initial step +% opts(2:4) used in stopping criteria: +% ||g||_inf <= opts(2) or +% ||dx||_2 <= opts(3)*(opts(3) + ||x||_2) or +% no. of function evaluations exceeds opts(4) . +% Any illegal element in opts is replaced by its +% default value, [1 1e-4*||g(x0)||_inf 1e-8 100] +% D0 : (optional) If present, then approximate inverse Hessian +% at x0 . Otherwise, D0 := I +% Output parameters +% X : If perf is present, then array, holding the iterates +% columnwise. Otherwise, computed solution vector. +% info : Performance information, vector with 6 elements: +% info(1:3) = final values of [f(x) ||g||_inf ||dx||_2] +% info(4:5) = no. of iteration steps and evaluations of (F,g) +% info(6) = 1 : Stopped by small gradient +% 2 : Stopped by small x-step +% 3 : Stopped by opts(4) . +% 4 : Stopped by zero step. +% perf : (optional). If present, then array, holding +% perf(1:2,:) = values of f(x) and ||g||_inf +% perf(3:5,:) = Line search info: values of +% alpha, phi'(alpha), no. fct. evals. +% perf(6,:) = trust region radius. +% D : (optional). If present, then array holding the +% approximate inverse Hessian at X(:,end) . + +% Hans Bruun Nielsen, IMM, DTU. 00.12.18 / 02.01.22 + + % Check call + [x n F g] = check(fun,par,x0,opts); + if nargin > 4, D = checkD(n,D0); fst = 0; + else, D = eye(n); fst = 1; end + % Finish initialization + k = 1; kmax = opts(4); neval = 1; ng = norm(g,inf); + Delta = opts(1); + Trace = nargout > 2; + if Trace + X = x(:)*ones(1,kmax+1); + perf = [F; ng; zeros(3,1); Delta]*ones(1,kmax+1); + end + found = ng <= opts(2); + h = zeros(size(x)); nh = 0; + ngs = ng * ones(1,3); + + while ~found + % Previous values + xp = x; gp = g; Fp = F; nx = norm(x); + ngs = [ngs(2:3) ng]; + h = D*(-g(:)); nh = norm(h); red = 0; + if nh <= opts(3)*(opts(3) + nx), found = 2; + else + if fst | nh > Delta % Scale to ||h|| = Delta + h = (Delta / nh) * h; nh = Delta; + fst = 0; red = 1; + end + k = k+1; + % Line search + [al F g dval slrat] = softline(fun,par,x,F,g, h); + if al < 1 % Reduce Delta + Delta = .35 * Delta; + elseif red & (slrat > .7) % Increase Delta + Delta = 3*Delta; + end + % Update x, neval and ||g|| + x = x + al*h; neval = neval + dval; ng = norm(g,inf); + if Trace + X(:,k) = x(:); + perf(:,k) = [F; ng; al; dot(h,g); dval; Delta]; end + h = x - xp; nh = norm(h); + if nh == 0, + found = 4; + else + y = g - gp; yh = dot(y,h); + if yh > sqrt(eps) * nh * norm(y) + % Update D + v = D*y(:); yv = dot(y,v); + a = (1 + yv/yh)/yh; w = (a/2)*h(:) - v/yh; + D = D + w*h' + h*w'; + end % update D + % Check stopping criteria + thrx = opts(3)*(opts(3) + norm(x)); + if ng <= opts(2), found = 1; + elseif nh <= thrx, found = 2; + elseif neval >= kmax, found = 3; +% elseif neval > 20 & ng > 1.1*max(ngs), found = 5; + else, Delta = max(Delta, 2*thrx); end + end + end % Nonzero h + end % iteration + + % Set return values + if Trace + X = X(:,1:k); perf = perf(:,1:k); + else, X = x; end + info = [F ng nh k-1 neval found]; + +% ========== auxiliary functions ================================= + +function [x,n, F,g, opts] = check(fun,par,x0,opts0) +% Check function call + x = x0(:); sx = size(x); n = max(sx); + if (min(sx) > 1) + error('x0 should be a vector'), end + [F g] = feval(fun,x,par); + sf = size(F); sg = size(g); + if any(sf-1) | ~isreal(F) + error('F should be a real valued scalar'), end + if (min(sg) ~= 1) | (max(sg) ~= n) + error('g should be a vector of the same length as x'), end + so = size(opts0); + if (min(so) ~= 1) | (max(so) < 4) | any(~isreal(opts0(1:4))) + error('opts should be a real valued vector of length 4'), end + opts = opts0(1:4); opts = opts(:).'; + i = find(opts <= 0); + if length(i) % Set default values + d = [1 1e-4*norm(g, inf) 1e-8 100]; + opts(i) = d(i); + end +% ---------- end of check --------------------------------------- + +function D = checkD(n,D0) +% Check given inverse Hessian + D = D0; sD = size(D); + if any(sD - n) + error(sprintf('D should be a square matrix of size %g',n)), end + % Check symmetry + dD = D - D'; ndD = norm(dD(:),inf); + if ndD > 10*eps*norm(D(:),inf) + error('The given D0 is not symmetric'), end + if ndD, D = (D + D')/2; end % Symmetrize + [R p] = chol(D); + if p + error('The given D0 is not positive definite'), end + +function [alpha,fn,gn,neval,slrat] = ... + softline(fun,fpar, x,f,g, h) +% Soft line search: Find alpha = argmin_a{f(x+a*h)} + % Default return values + alpha = 0; fn = f; gn = g; neval = 0; slrat = 1; + n = length(x); + + % Initial values + dfi0 = dot(h,gn); if dfi0 >= 0, return, end + fi0 = f; slope0 = .05*dfi0; slopethr = .995*dfi0; + dfia = dfi0; stop = 0; ok = 0; neval = 0; b = 1; + + while ~stop + [fib g] = feval(fun,x+b*h,fpar); neval = neval + 1; + dfib = dot(g,h); + if b == 1, slrat = dfib/dfi0; end + if fib <= fi0 + slope0*b % New lower bound + if dfib > abs(slopethr), stop = 1; + else + alpha = b; fn = fib; gn = g; dfia = dfib; + ok = 1; slrat = dfib/dfi0; + if (neval < 5) & (b < 2) & (dfib < slopethr) + % Augment right hand end + b = 2*b; + else, stop = 1; end + end + else, stop = 1; end + end + + stop = ok; xfd = [alpha fn dfia; b fib dfib; b fib dfib]; + while ~stop + c = interpolate(xfd,n); + [fic g] = feval(fun, x+c*h, fpar); neval = neval+1; + xfd(3,:) = [c fic dot(g,h)]; + if fic < fi0 + slope0*c % New lower bound + xfd(1,:) = xfd(3,:); ok = 1; + alpha = c; fn = fic; gn = g; slrat = xfd(3,3)/dfi0; + else, xfd(2,:) = xfd(3,:); ok = 0; end + % Check stopping criteria + ok = ok & abs(xfd(3,3)) <= abs(slopethr); + stop = ok | neval >= 5 | diff(xfd(1:2,1)) <= 0; + end % while +%------------ end of softline ------------------------------ + +function alpha = interpolate(xfd,n); +% Minimizer of parabola given by +% xfd(1:2,1:3) = [a fi(a) fi'(a); b fi(b) dummy] + + a = xfd(1,1); b = xfd(2,1); d = b - a; dfia = xfd(1,3); + C = diff(xfd(1:2,2)) - d*dfia; + if C >= 5*n*eps*b % Minimizer exists + A = a - .5*dfia*(d^2/C); + d = 0.1*d; alpha = min(max(a+d, A), b-d); + else + alpha = (a+b)/2; + end +%------------ end of interpolate -------------------------- diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/demo_script.m b/exercises/02450Toolbox_Matlab/Tools/nr/demo_script.m new file mode 100644 index 0000000000000000000000000000000000000000..664555cdd99128a79dbb053054dc874a00256eb7 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/demo_script.m @@ -0,0 +1,59 @@ +% An script that shows the usage of the neural network regressor. +% The data set used is the sunspot data. + +% Load the sunspot data: +% The data set has 12 inputs. There are 209 examples used +% for training and 35 are used for testing. +[x,t,x_test,t_test] = load_sunspot_data; + +% Set the number of hidden units +Nh = 6; + +% Train the network +disp('Network training, this might take a couple of minutes...') +results = nr_main(x,t,x_test,t_test,Nh); + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% PLOT RESULTS % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Plot the error +figure(1) +x_axis = 0:length(results.mse_test)-1; +plot(x_axis,results.mse_test,'r*-',x_axis,results.mse_train,'bo-') +xlabel('Number of hyperparameter updates') +ylabel('Mean square error') +legend('Test set','Training set') + +% Plot the evolution of the hyperparameters +figure(2) +subplot(2,1,1) +plot(x_axis,results.alpha,'b*-') +xlabel('Number of hyperparameter updates') +ylabel('alpha value') +subplot(2,1,2) +plot(x_axis,results.beta,'b*-') +xlabel('Number of hyperparameter updates') +ylabel('beta value') + +% Plot the network predictions +% Get the x-axis +load sunspot.dat +x_axis_train = sunspot(1:length(t),1); +x_axis_test = sunspot(length(t)+1:length(t)+length(t_test),1); + +figure(3) +subplot(2,1,1) +plot(x_axis_train,results.t,'bo-',x_axis_train,results.t_pred_train,'r*-'); +axis([1850 1900 0 1.0]) +xlabel('Year') +ylabel('Number of sunspots (scaled)') +legend('Training set','Network prediction') + +subplot(2,1,2) +plot(x_axis_test,results.t_test,'bo-',x_axis_test,results.t_pred_test,'r*-'); +axis([1909 1943 0 1.2]) +xlabel('Year') +ylabel('Number of sunspots (scaled)') +legend('Test set','Network prediction',2) diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/load_sunspot_data.m b/exercises/02450Toolbox_Matlab/Tools/nr/load_sunspot_data.m new file mode 100644 index 0000000000000000000000000000000000000000..7e51b341813f4baeef854e09653485704b17bd98 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/load_sunspot_data.m @@ -0,0 +1,27 @@ +function [x,t,x_test,t_test] = load_sunspot_data + +% Load the sunspot data +% [x,t,x_test,t_test,x_test1,t_test1] = load_sunspot_data + +% Load the raw data +load sunspot.dat +sunspot = sunspot(:,2); + +% Set the number of inputs and examples +Ninputs = 12; +N = 244; + +% Make the targets and scale +T = sunspot((Ninputs+1):(N+Ninputs),:)/max(sunspot(1:N+Ninputs)); + +% Make the input patterns +X = zeros(N,Ninputs); +for n = 1:N + X(n,:) = sunspot(n:n+Ninputs-1)'; +end + +% Split data into training and test sets +x = X(1:209,:); +x_test = X(210:end,:); +t = T(1:209); +t_test = T(210:end); diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_W2Wio.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_W2Wio.m new file mode 100644 index 0000000000000000000000000000000000000000..71278ecbf562763ef6ae70f275a8507ed4c98b9d --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_W2Wio.m @@ -0,0 +1,20 @@ +function [Wi,Wo] = nr_W2Wio(Weights,Ni,Nh) + +%NR_W2WIO - Change the weight format from vector to 2xMatrices +% +% [Wi,Wo] = nr_W2Wio(Weights,Ni,Nh) +% +% Inputs: +% Weights : The weight vector +% Ni : Number of inputs +% Nh : Number of hidden units +% +% Outputs: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +Wi = reshape(Weights(1:(Ni+1)*Nh),Nh,Ni+1); +Wo = reshape(Weights((Ni+1)*Nh+1:end),1,Nh+1); diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_cost.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_cost.m new file mode 100644 index 0000000000000000000000000000000000000000..c177cadd40afe2929804cdeb12e6d0f165eca8cc --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_cost.m @@ -0,0 +1,31 @@ +function cost = nr_cost(Wi,Wo,alpha,beta,Inputs,Targets) + +%NR_COST - Quadratic cost function with quadratic regularization term +% +% cost = nr_cost(Wi,Wo,alpha,Inputs,Targets) +% +% Inputs: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% alpha : Weight decay parameter +% beta : Noise variance parameter +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Output: +% cost : Value of augmented quadratic cost function +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +% Calculate network outputs for all examples +[Vj,yj] = nr_forward(Wi,Wo,Inputs); + +% Calculate the deviations from desired outputs +ej = Targets - yj; + +% Calculate the sum of squared errors +cost = 0.5 * beta * sum(sum(ej .^ 2)); + +% Add the regularization term +cost = cost + 0.5 * alpha*(sum(sum(Wi.^2)) + sum(sum(Wo.^2))); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_eval.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_eval.m new file mode 100644 index 0000000000000000000000000000000000000000..1cd8efd74f162a71ad4bb1c046e4dabeee4f6567 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_eval.m @@ -0,0 +1,36 @@ +function y = nr_eval(netwrk, x) + +%NR_EVAL - Compute output of neural network +% +% y = nr_eval(netwrk, x) +% +% Input: +% netwrk : Neural network, struct variable returned from nr_main +% x : Matrix with example inputs as rows +% +% Output: +% y : Vector with output unit outputs as rows +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. +% Mikkel N. Schmidt 2011, Tehcnical Unviersit of Denmark +% Morten M�rup 2011, Tehcnical Unviersit of Denmark + +% Determine the number of examples and dimension +[N,D] = size(x); + +% Normalize the training input data +if iscell(netwrk) + y=zeros(N,length(netwrk)); + for c=1:length(netwrk) + xt = (x-repmat(netwrk{c}.mean_x,N,1))./repmat(netwrk{c}.std_x,N,1); + + % Forward + [dummy, y(:,c)] = nr_forward(netwrk{c}.Wi, netwrk{c}.Wo, xt); + end +else + xt = (x-repmat(netwrk.mean_x,N,1))./repmat(netwrk.std_x,N,1); + + % Forward + [dummy, y] = nr_forward(netwrk.Wi, netwrk.Wo, xt); +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_forward.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_forward.m new file mode 100644 index 0000000000000000000000000000000000000000..39a0422962de14cd2198e7a2fd51bc711263f47b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_forward.m @@ -0,0 +1,26 @@ +function [Vj,yj] = nr_forward(Wi,Wo,Inputs) + +%NR_FORWARD - Propagate example forward through the network +% +% [Vj,yj] = nr_forward(Wi,Wo,Inputs) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% Inputs : Matrix with example inputs as rows +% +% Output: +% Vj : Matrix with hidden unit outputs as rows +% yj : Vector with output unit outputs as rows +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +% Determine the size of the problem +[examples inp] = size(Inputs); + +% Calculate hidden unit outputs for every example +Vj = tanh([Inputs ones(examples,1) ] * Wi'); + +% Calculate (linear) output unit outputs for every example +yj = [Vj ones(examples,1)] * Wo'; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_gnhessian.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_gnhessian.m new file mode 100644 index 0000000000000000000000000000000000000000..58a99574f624177b056a37a686a6d4ee685cb016 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_gnhessian.m @@ -0,0 +1,28 @@ +function invH = nr_gnhessian(Weights,par) + +%NR_GNHESSIAN - Compute the inverse Gauss-Newton Hessian matrix +% +% invH = nr_gnhessian(Weights,par) +% +% Inputs: +% Weights : The weight vector +% par : Struct varible with other network parameters +% +% Output: +% invH : The inverse Gauss-Newton Hessian matrix +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +% Reformat the weights +[Wi,Wo] = nr_W2Wio(Weights,par.Ni,par.Nh); + +% Determine the number of examples and weights +N = length(par.t); +W = length(Weights); + +% Compute the Jacobian +J = nr_gradnet(Wi,Wo,par.x); + +% Evaluate the inverse Hessian +invH = inv(par.beta*J*J'+par.alpha*eye(W)); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_grad.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_grad.m new file mode 100644 index 0000000000000000000000000000000000000000..1571e62551831cf8bd21f5117a9d8d7e77db007e --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_grad.m @@ -0,0 +1,56 @@ +function [dWi,dWo] = nr_grad(Wi,Wo,alpha,beta,Inputs,Targets) + +%NR_GRAD - Calculate the partial derivatives of the quadratic cost +% function with the regularization term +% +% [dWi,dWo] = nr_grad(Wi,Wo,alpha,beta,Inputs,Targets) +% +% Input: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% alpha : Weight decay parameter for output weights +% beta : The noise variance parameter +% Inputs : Matrix with examples as rows +% Targets : Matrix with target values as rows +% +% Output: +% dWi : Matrix with gradient for input weights +% dWo : Matrix with gradient for output weights +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +% Determine the number of examples +[exam inp] = size(Inputs); + +%%%%%%%%%%%%%%%%%%%% +%%% FORWARD PASS %%% +%%%%%%%%%%%%%%%%%%%% + +% Calculate hidden and output unit activations +[Vj,yj] = nr_forward(Wi,Wo,Inputs); + +%%%%%%%%%%%%%%%%%%%%% +%%% BACKWARD PASS %%% +%%%%%%%%%%%%%%%%%%%%% + +% Calculate derivative of +% by backpropagating the errors from the +% desired outputs + +% Output unit deltas +delta_o = -(Targets - yj); + +% Hidden unit deltas +[r c] = size(Wo); +delta_h =(1.0 - Vj.^2) .* (delta_o * Wo(:,1:c-1)); + +% Partial derivatives for the output weights +dWo = delta_o' * [Vj ones(exam,1)]; + +% Partial derivatives for the input weights +dWi = delta_h' * [Inputs ones(exam,1)]; + +% Add derivatives of the weight decay term +dWi = beta * dWi + alpha*Wi; +dWo = beta * dWo + alpha*Wo; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_gradnet.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_gradnet.m new file mode 100644 index 0000000000000000000000000000000000000000..a659685b1dbf21752a1cb4f88264755139ddeadf --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_gradnet.m @@ -0,0 +1,33 @@ +function J = nr_gradnet(Wi,Wo,Inputs) + +%NR_GRADNET - Calculate the Jacobian matrix for the network +% +% J = nr_gradnet(Wi,Wo,Inputs) +% +% Inputs: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% Inputs : Matrix with examples as rows +% +% Output: +% J : The Jacobian with weights as rows +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +% Determine the number of examples, hidden units and inputs +N = size(Inputs,1); +[Nh,Ni] = size(Wi); + +% Calculate hidden and output unit activations +[Vj,yj] = nr_forward(Wi,Wo,Inputs); + +% Partial derivatives for the output weights +dWo = [Vj ones(N,1)]'; + +% Partial derivatives for the input weights +dWi = (kron([Inputs ones(N,1)]',ones(Nh,1))).* ... + (repmat((1-Vj.^2)'.*repmat(Wo(:,1:end-1)',1,N),Ni,1)); + +% Make the Jacobian matrix +J = [dWi;dWo]; diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_hyperparameters.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_hyperparameters.m new file mode 100644 index 0000000000000000000000000000000000000000..943425a4f93d3b5f7f04957c33954ac9bc25a735 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_hyperparameters.m @@ -0,0 +1,37 @@ +function [par,g] = nr_hyperparameters(Weights,par) + +%NR_HYPERPARAMETERS - Update the hyperparameters alpha and beta +% +% [par,gamma] = nr_hyperparameters(Weights,par) +% +% Inputs: +% Weights : The weight vector +% par : Struct varible with other network parameters +% +% Output: +% par : Struct varible with the updated +% hyperparameters +% gamma : The number of well determined weights +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +% Determine the number of weights and examples +W = length(Weights); +N = length(par.t); + +% Compute the inverse Hessian +invH = nr_gnhessian(Weights,par); + +% Compute the gamma +g = W - par.alpha*trace(invH); + +% Update the alpha +par.alpha = g/(Weights'*Weights); + +% Reformat the weights +[Wi,Wo] = nr_W2Wio(Weights,par.Ni,par.Nh); + +% Update the beta +E_D = nr_cost(Wi,Wo,0,1,par.x,par.t); +par.beta = (N-g)/(2*E_D); diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_main.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_main.m new file mode 100644 index 0000000000000000000000000000000000000000..54d32af6453363609a715c634e15611c3c1fcff8 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_main.m @@ -0,0 +1,206 @@ +function results = nr_main(x,t,x_test,t_test,Nh,state) + +%NR_MAIN +% +% Main program for feed-forward neural network regression training +% +% The architecture has two-layers of weights and +% tangent hyperbolic sigmoidal function. +% +% The network is trained using the BFGS optimization algorithm +% using soft line search to determine step lengths. The BFGS program +% was written by Hans Bruun Nielsen at IMM, DTU. +% +% The hyperparameters alpha and beta are adapted with MacKays +% Bayesian MLII scheme with one regularization parameter for all weights. +% +% The Hessian matrix is evaluated using the Gauss-Newton approximation. +% +% This program is based on an older neural regression toolbox by +% Morten With Pedersen in October 1995. Most of the routines have +% though been changed. +% +% res = nr_main(Inputs,Targets,Inputs_test,Targets_test,Nh,state); +% +% Inputs: +% x : Matrix with example inputs as rows +% t : Matrix with example targets as rows +% x_test : Matrix with example test inputs as rows +% t_test : Matrix with example test targets as rows +% Nh : Number of hidden units +% state : Random seed for weight initialization (Optional) +% +% Output: +% results : Struct variable holding the results from the network +% .mse_test : A vector representing the mean square error +% on the test set at each hyperparameter update +% .mse_train : A vector representing the mean square error +% on the training set at each hyperparameter update +% .alpha : A vector representing the value of the alpha +% hyperparameter updates +% .beta : A vector representing the value of the beta +% hyperparameter updates +% .gamma : A vector representing the number of "well determined" +% weights at each hyperparameter update +% .cputime : The training time in seconds +% .Nh : The number of hidden units +% .x : The normalized input patterns for training where +% x = (x_argin - repmat(mean_x,Ntrain,1))./repmat(std_x,Ntrain,1) +% .t : The target class labels for training +% .x_test : The normalized input patterns for testing +% x_test = (x_argin_test - repmat(mean_x,Ntest,1))./repmat(std_x,Ntest,1) +% .t_test : The target class labels for testing +% .mean_x : The mean subtracted from input patterns for normalization +% .std_x : The scaling of the input patterns for normalization +% .t_pred_train : The networks predicted target values on the test set +% .var_pred_train : The variance of the predicted target values, from +% the estimated noise variance and network uncertainty +% .errorbars_train : The errorbar on each prediction, 2 times the standard deviation +% .t_pred_test : The networks predicted target values on the test set +% .var_pred_test : The variance of the predicted target values, from +% the estimated noise variance and network uncertainty +% .errorbars_test : The errorbar on each prediction, 2 times the standard deviation +% .state : The random seed used for initializing the weights +% .Wi : The input-to-hidden weight matrix +% .Wo : The hidden-to-output weight matrix +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Initialization of various parameters % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Scale and remove the mean of the input patterns +[x,x_test,results.mean_x,results.std_x] = nr_normalize_data(x,x_test); + +% Get some size parameters +[N,Ni] = size(x); % Number of external inputs and example +No = 1; % Number of output units +N_test = length(t_test); % Number of test examples + +% Initialize the hyperparameters +par.alpha = Ni; % Regularization parameter +par.beta = 1; % Inverse variance of additive noise + +% Initialize the random seed for the weight initialization +if nargin < 6 + state = sum(100*clock); +end +randn('state',state); + +% Parameters for hyperparameter convergence +max_count = 100; +STOP = 0; + +% Collect parameters for the bfgs function +par.x = x; +par.t = t; +par.Ni = Ni; +par.Nh = Nh; + +% Initialize network weights +[Wi,Wo] = nr_winit(Ni,Nh); + +% Change the weights matrices into a weight vector +Weights = [Wi(:);Wo(:)]; + +% Options for the BFGS algorithm and soft linesearch +% see the ucminf.m file for detailes +opts = [1 1e-4 1e-8 1000]; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Train the network % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Start taking the training time +t_cpu = cputime; + +% Initialize the counter +count = 0; + +% Train the network until parameters have converged +while (STOP==0) + + % Increment counter + count = count + 1; + + % Train the weights + Weights = ucminf('nr_net',par,Weights,opts); + + % Save some values of hyperparameters convergence + results.alpha(count) = par.alpha; + results.beta(count) = par.beta; + + % Save the test and training MSE + [Wi,Wo] = nr_W2Wio(Weights,Ni,Nh); + results.mse_test(count) = nr_cost(Wi,Wo,0,2/N_test,x_test,t_test); + results.mse_train(count) = nr_cost(Wi,Wo,0,2/N,x,t); + + % Save the old hyperparameters + par.old_alpha = par.alpha; + par.old_beta = par.beta; + + % Update the hyperparameters + [par,results.gamma(count)] = nr_hyperparameters(Weights,par); + + % Check for convergence of hyperparameters (internal function) + STOP = check_convergence(par,max_count,count); + +end + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Save some results from the modeling % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Save the random state +results.state = state; + +% Time used for training +results.cputime = cputime-t_cpu; + +% Number of hidden units +results.Nh = Nh; + +% The dataset, inputs and labels +results.x = x; +results.t = t; +results.x_test = x_test; +results.t_test = t_test; + +% Save the weights +results.Wi = Wi; +results.Wo = Wo; + +% Compute the predictions on the test set, variance and errorbars +[results.t_pred_test,results.var_pred_test] = nr_predictions(Wi,Wo,par,x_test); +results.errorbars_test = 2*sqrt(results.var_pred_test); + +% Compute the predictions on the traing set, variance and errorbars +[results.t_pred_train,results.var_pred_train] = nr_predictions(Wi,Wo,par,x); +results.errorbars_train = 2*sqrt(results.var_pred_train); + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Internal functions % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function STOP = check_convergence(par,max_count,count) +% Check if modeling is finished + +% Stop if exceeding maximum number of iteration +if (count >= max_count) + STOP = 1; + return; +end + +% Check the relative changes of the hyperparameters +alpha_diff = abs(par.alpha-par.old_alpha)/par.alpha; +beta_diff = abs(par.beta-par.old_beta)/par.beta; + +% Determine the convergence +if (alpha_diff < 1e-5) & (beta_diff < 1e-5) + STOP = 1; +else + STOP = 0; +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_net.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_net.m new file mode 100644 index 0000000000000000000000000000000000000000..837879d48b2811044b3c0857891634ab0fb86165 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_net.m @@ -0,0 +1,28 @@ +function [cost,dW] = nr_net(Weights,par) + +%NR_NET - Gives the cost and the gradient w.r.t. the weights +% and is used for optimization with the BFGS algorithm +% +% [cost,dW] = nr_net(Weights,par) +% +% Inputs: +% Weights : The weight vector +% par : Struct varible with other parameters +% +% Output: +% cost : The value of the cost function +% dW : The gradient of the cost function wrt. the weights +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + + +% Reformat the weights +[Wi,Wo] = nr_W2Wio(Weights,par.Ni,par.Nh); + +% Compute the cost +cost = nr_cost(Wi,Wo,par.alpha,par.beta,par.x,par.t); + +% Compute the gradient +[dWi,dWo] = nr_grad(Wi,Wo,par.alpha,par.beta,par.x,par.t); +dW = [dWi(:);dWo(:)]; \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_normalize_data.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_normalize_data.m new file mode 100644 index 0000000000000000000000000000000000000000..718192615aefd493c72195cd8fadcbdf6f6dc29b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_normalize_data.m @@ -0,0 +1,33 @@ +function [x,x_test,mean_x,std_x] = nc_normalize_data(x,x_test); + +%NC_NORMALIZE_DATA - Normalize the input patterns +% to have mean zero and variance one +% +% [x,x_test,mean_x,std_x] = nc_normalize_data(x,x_test) +% +% Inputs: +% x : The input training patterns +% x_test : The input test patterns +% +% Outputs: +% x : The normalized input training patterns +% x_test : The normalized input test patterns +% x_mean : The mean that was subtracted +% x_std : The standard deviation for scaling +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +% Determine the number of examples and dimension +[Ntest,D] = size(x_test); +[N,D] = size(x); + +% Compute the standard deviation and mean +std_x = std(x,0,1); +mean_x = mean(x,1); + +% Normalize the training input data +x = (x-repmat(mean_x,N,1))./repmat(std_x,N,1); + +% Normalize the test input data +x_test = (x_test-repmat(mean_x,Ntest,1))./repmat(std_x,Ntest,1); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_predictions.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_predictions.m new file mode 100644 index 0000000000000000000000000000000000000000..428eea01251f321c0ac170be76d62f61a50ce54b --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_predictions.m @@ -0,0 +1,33 @@ +function [t_pred,var_pred] = nr_predictions(Wi,Wo,par,x_test) + +%NR_PREDICTIONS - Make predictions and estimate variance of the predictions +% +% [t_pred,t_var] = nr_predictions(Wi,Wo,par,Inputs) +% +% Inputs: +% Wi : Matrix with input-to-hidden weights +% Wo : Matrix with hidden-to-outputs weights +% par : Struct variable with other parameters +% Inputs : Matrix with examples as rows +% +% Output: +% t_pred : Target predictions from Inputs +% t_var : Variance of the predictions +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DTU, IMM, DSP. + +% Make the weight vector +Weights = [Wi(:);Wo(:)]; + +% Compute the inverse Hessian +invH = nr_gnhessian(Weights,par); + +% Make predicions with the network +[dummy,t_pred] = nr_forward(Wi,Wo,x_test); + +% Compute the Jacobian of the network +J = nr_gradnet(Wi,Wo,x_test); + +% Compute errorbars on the prediction +var_pred = 1/par.beta + diag(J'*invH*J); \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/nr_winit.m b/exercises/02450Toolbox_Matlab/Tools/nr/nr_winit.m new file mode 100644 index 0000000000000000000000000000000000000000..34c6065b351ed8c9fe6024f47e29201948a19c31 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/nr_winit.m @@ -0,0 +1,20 @@ +function [Wi,Wo] = nr_winit(Ni,Nh) + +%NR_WINIT - Initialize weights in the network with +% a uniform distribution +% +% [Wi,Wo] = NR_WINIT(Ni,Nh) +% +% Input: +% Ni : Number of input neurons +% Nh : Number of hidden neurons +% +% Output: +% Wi : Input-to-hidden initial weights +% Wo : Hidden-to-output initial weights +% +% Neural network regressor, version 1.0 +% Sigurdur Sigurdsson 2002, DSP, IMM, DTU. + +Wi = randn(Nh,Ni+1)/sqrt(Ni); +Wo = randn(1,Nh+1)/sqrt(Ni); diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/sunspot.dat b/exercises/02450Toolbox_Matlab/Tools/nr/sunspot.dat new file mode 100644 index 0000000000000000000000000000000000000000..32f124c371a3adc9638ced1abdcb7d558c1c5bf0 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/sunspot.dat @@ -0,0 +1,288 @@ +1700 5.0 +1701 11.0 +1702 16.0 +1703 23.0 +1704 36.0 +1705 58.0 +1706 29.0 +1707 20.0 +1708 10.0 +1709 8.0 +1710 3.0 +1711 0.0 +1712 0.0 +1713 2.0 +1714 11.0 +1715 27.0 +1716 47.0 +1717 63.0 +1718 60.0 +1719 39.0 +1720 28.0 +1721 26.0 +1722 22.0 +1723 11.0 +1724 21.0 +1725 40.0 +1726 78.0 +1727 122.0 +1728 103.0 +1729 73.0 +1730 47.0 +1731 35.0 +1732 11.0 +1733 5.0 +1734 16.0 +1735 34.0 +1736 70.0 +1737 81.0 +1738 111.0 +1739 101.0 +1740 73.0 +1741 40.0 +1742 20.0 +1743 16.0 +1744 5.0 +1745 11.0 +1746 22.0 +1747 40.0 +1748 60.0 +1749 80.9 +1750 83.4 +1751 47.7 +1752 47.8 +1753 30.7 +1754 12.2 +1755 9.6 +1756 10.2 +1757 32.4 +1758 47.6 +1759 54.0 +1760 62.9 +1761 85.9 +1762 61.2 +1763 45.1 +1764 36.4 +1765 20.9 +1766 11.4 +1767 37.8 +1768 69.8 +1769 106.1 +1770 100.8 +1771 81.6 +1772 66.5 +1773 34.8 +1774 30.6 +1775 7.0 +1776 19.8 +1777 92.5 +1778 154.4 +1779 125.9 +1780 84.8 +1781 68.1 +1782 38.5 +1783 22.8 +1784 10.2 +1785 24.1 +1786 82.9 +1787 132.0 +1788 130.9 +1789 118.1 +1790 89.9 +1791 66.6 +1792 60.0 +1793 46.9 +1794 41.0 +1795 21.3 +1796 16.0 +1797 6.4 +1798 4.1 +1799 6.8 +1800 14.5 +1801 34.0 +1802 45.0 +1803 43.1 +1804 47.5 +1805 42.2 +1806 28.1 +1807 10.1 +1808 8.1 +1809 2.5 +1810 0.0 +1811 1.4 +1812 5.0 +1813 12.2 +1814 13.9 +1815 35.4 +1816 45.8 +1817 41.1 +1818 30.1 +1819 23.9 +1820 15.6 +1821 6.6 +1822 4.0 +1823 1.8 +1824 8.5 +1825 16.6 +1826 36.3 +1827 49.6 +1828 64.2 +1829 67.0 +1830 70.9 +1831 47.8 +1832 27.5 +1833 8.5 +1834 13.2 +1835 56.9 +1836 121.5 +1837 138.3 +1838 103.2 +1839 85.7 +1840 64.6 +1841 36.7 +1842 24.2 +1843 10.7 +1844 15.0 +1845 40.1 +1846 61.5 +1847 98.5 +1848 124.7 +1849 96.3 +1850 66.6 +1851 64.5 +1852 54.1 +1853 39.0 +1854 20.6 +1855 6.7 +1856 4.3 +1857 22.7 +1858 54.8 +1859 93.8 +1860 95.8 +1861 77.2 +1862 59.1 +1863 44.0 +1864 47.0 +1865 30.5 +1866 16.3 +1867 7.3 +1868 37.6 +1869 74.0 +1870 139.0 +1871 111.2 +1872 101.6 +1873 66.2 +1874 44.7 +1875 17.0 +1876 11.3 +1877 12.4 +1878 3.4 +1879 6.0 +1880 32.3 +1881 54.3 +1882 59.7 +1883 63.7 +1884 63.5 +1885 52.2 +1886 25.4 +1887 13.1 +1888 6.8 +1889 6.3 +1890 7.1 +1891 35.6 +1892 73.0 +1893 85.1 +1894 78.0 +1895 64.0 +1896 41.8 +1897 26.2 +1898 26.7 +1899 12.1 +1900 9.5 +1901 2.7 +1902 5.0 +1903 24.4 +1904 42.0 +1905 63.5 +1906 53.8 +1907 62.0 +1908 48.5 +1909 43.9 +1910 18.6 +1911 5.7 +1912 3.6 +1913 1.4 +1914 9.6 +1915 47.4 +1916 57.1 +1917 103.9 +1918 80.6 +1919 63.6 +1920 37.6 +1921 26.1 +1922 14.2 +1923 5.8 +1924 16.7 +1925 44.3 +1926 63.9 +1927 69.0 +1928 77.8 +1929 64.9 +1930 35.7 +1931 21.2 +1932 11.1 +1933 5.7 +1934 8.7 +1935 36.1 +1936 79.7 +1937 114.4 +1938 109.6 +1939 88.8 +1940 67.8 +1941 47.5 +1942 30.6 +1943 16.3 +1944 9.6 +1945 33.2 +1946 92.6 +1947 151.6 +1948 136.3 +1949 134.7 +1950 83.9 +1951 69.4 +1952 31.5 +1953 13.9 +1954 4.4 +1955 38.0 +1956 141.7 +1957 190.2 +1958 184.8 +1959 159.0 +1960 112.3 +1961 53.9 +1962 37.5 +1963 27.9 +1964 10.2 +1965 15.1 +1966 47.0 +1967 93.8 +1968 105.9 +1969 105.5 +1970 104.5 +1971 66.6 +1972 68.9 +1973 38.0 +1974 34.5 +1975 15.5 +1976 12.6 +1977 27.5 +1978 92.5 +1979 155.4 +1980 154.6 +1981 140.4 +1982 115.9 +1983 66.6 +1984 45.9 +1985 17.9 +1986 13.4 +1987 29.3 diff --git a/exercises/02450Toolbox_Matlab/Tools/nr/ucminf.m b/exercises/02450Toolbox_Matlab/Tools/nr/ucminf.m new file mode 100644 index 0000000000000000000000000000000000000000..c79905065cdcf007f8cf2b73b7f9ca6a27b4ab48 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/Tools/nr/ucminf.m @@ -0,0 +1,207 @@ +function [X, info, perf, D] = ucminf(fun,par, x0, opts, D0) +%UCMINF BFGS method for unconstrained nonlinear optimization: +% Find xm = argmin{f(x)} , where x is an n-vector and the scalar +% function F with gradient g (with elements g(i) = DF/Dx_i ) +% must be given by a MATLAB function with with declaration +% function [F, g] = fun(x, par) +% par holds parameters of the function. It may be dummy. +% +% Call: [X, info {, perf {, D}}] = ucminf(fun,par, x0, opts {,D0}) +% +% Input parameters +% fun : String with the name of the function. +% par : Parameters of the function. May be empty. +% x0 : Starting guess for x . +% opts : Vector with 4 elements: +% opts(1) : Expected length of initial step +% opts(2:4) used in stopping criteria: +% ||g||_inf <= opts(2) or +% ||dx||_2 <= opts(3)*(opts(3) + ||x||_2) or +% no. of function evaluations exceeds opts(4) . +% Any illegal element in opts is replaced by its +% default value, [1 1e-4*||g(x0)||_inf 1e-8 100] +% D0 : (optional) If present, then approximate inverse Hessian +% at x0 . Otherwise, D0 := I +% Output parameters +% X : If perf is present, then array, holding the iterates +% columnwise. Otherwise, computed solution vector. +% info : Performance information, vector with 6 elements: +% info(1:3) = final values of [f(x) ||g||_inf ||dx||_2] +% info(4:5) = no. of iteration steps and evaluations of (F,g) +% info(6) = 1 : Stopped by small gradient +% 2 : Stopped by small x-step +% 3 : Stopped by opts(4) . +% 4 : Stopped by zero step. +% perf : (optional). If present, then array, holding +% perf(1:2,:) = values of f(x) and ||g||_inf +% perf(3:5,:) = Line search info: values of +% alpha, phi'(alpha), no. fct. evals. +% perf(6,:) = trust region radius. +% D : (optional). If present, then array holding the +% approximate inverse Hessian at X(:,end) . + +% Hans Bruun Nielsen, IMM, DTU. 00.12.18 / 02.01.22 + + % Check call + [x n F g] = check(fun,par,x0,opts); + if nargin > 4, D = checkD(n,D0); fst = 0; + else, D = eye(n); fst = 1; end + % Finish initialization + k = 1; kmax = opts(4); neval = 1; ng = norm(g,inf); + Delta = opts(1); + Trace = nargout > 2; + if Trace + X = x(:)*ones(1,kmax+1); + perf = [F; ng; zeros(3,1); Delta]*ones(1,kmax+1); + end + found = ng <= opts(2); + h = zeros(size(x)); nh = 0; + ngs = ng * ones(1,3); + + while ~found + % Previous values + xp = x; gp = g; Fp = F; nx = norm(x); + ngs = [ngs(2:3) ng]; + h = D*(-g(:)); nh = norm(h); red = 0; + if nh <= opts(3)*(opts(3) + nx), found = 2; + else + if fst | nh > Delta % Scale to ||h|| = Delta + h = (Delta / nh) * h; nh = Delta; + fst = 0; red = 1; + end + k = k+1; + % Line search + [al F g dval slrat] = softline(fun,par,x,F,g, h); + if al < 1 % Reduce Delta + Delta = .35 * Delta; + elseif red & (slrat > .7) % Increase Delta + Delta = 3*Delta; + end + % Update x, neval and ||g|| + x = x + al*h; neval = neval + dval; ng = norm(g,inf); + if Trace + X(:,k) = x(:); + perf(:,k) = [F; ng; al; dot(h,g); dval; Delta]; end + h = x - xp; nh = norm(h); + if nh == 0, + found = 4; + else + y = g - gp; yh = dot(y,h); + if yh > sqrt(eps) * nh * norm(y) + % Update D + v = D*y(:); yv = dot(y,v); + a = (1 + yv/yh)/yh; w = (a/2)*h(:) - v/yh; + D = D + w*h' + h*w'; + end % update D + % Check stopping criteria + thrx = opts(3)*(opts(3) + norm(x)); + if ng <= opts(2), found = 1; + elseif nh <= thrx, found = 2; + elseif neval >= kmax, found = 3; +% elseif neval > 20 & ng > 1.1*max(ngs), found = 5; + else, Delta = max(Delta, 2*thrx); end + end + end % Nonzero h + end % iteration + + % Set return values + if Trace + X = X(:,1:k); perf = perf(:,1:k); + else, X = x; end + info = [F ng nh k-1 neval found]; + +% ========== auxiliary functions ================================= + +function [x,n, F,g, opts] = check(fun,par,x0,opts0) +% Check function call + x = x0(:); sx = size(x); n = max(sx); + if (min(sx) > 1) + error('x0 should be a vector'), end + [F g] = feval(fun,x,par); + sf = size(F); sg = size(g); + if any(sf-1) | ~isreal(F) + error('F should be a real valued scalar'), end + if (min(sg) ~= 1) | (max(sg) ~= n) + error('g should be a vector of the same length as x'), end + so = size(opts0); + if (min(so) ~= 1) | (max(so) < 4) | any(~isreal(opts0(1:4))) + error('opts should be a real valued vector of length 4'), end + opts = opts0(1:4); opts = opts(:).'; + i = find(opts <= 0); + if length(i) % Set default values + d = [1 1e-4*norm(g, inf) 1e-8 100]; + opts(i) = d(i); + end +% ---------- end of check --------------------------------------- + +function D = checkD(n,D0) +% Check given inverse Hessian + D = D0; sD = size(D); + if any(sD - n) + error(sprintf('D should be a square matrix of size %g',n)), end + % Check symmetry + dD = D - D'; ndD = norm(dD(:),inf); + if ndD > 10*eps*norm(D(:),inf) + error('The given D0 is not symmetric'), end + if ndD, D = (D + D')/2; end % Symmetrize + [R p] = chol(D); + if p + error('The given D0 is not positive definite'), end + +function [alpha,fn,gn,neval,slrat] = ... + softline(fun,fpar, x,f,g, h) +% Soft line search: Find alpha = argmin_a{f(x+a*h)} + % Default return values + alpha = 0; fn = f; gn = g; neval = 0; slrat = 1; + n = length(x); + + % Initial values + dfi0 = dot(h,gn); if dfi0 >= 0, return, end + fi0 = f; slope0 = .05*dfi0; slopethr = .995*dfi0; + dfia = dfi0; stop = 0; ok = 0; neval = 0; b = 1; + + while ~stop + [fib g] = feval(fun,x+b*h,fpar); neval = neval + 1; + dfib = dot(g,h); + if b == 1, slrat = dfib/dfi0; end + if fib <= fi0 + slope0*b % New lower bound + if dfib > abs(slopethr), stop = 1; + else + alpha = b; fn = fib; gn = g; dfia = dfib; + ok = 1; slrat = dfib/dfi0; + if (neval < 5) & (b < 2) & (dfib < slopethr) + % Augment right hand end + b = 2*b; + else, stop = 1; end + end + else, stop = 1; end + end + + stop = ok; xfd = [alpha fn dfia; b fib dfib; b fib dfib]; + while ~stop + c = interpolate(xfd,n); + [fic g] = feval(fun, x+c*h, fpar); neval = neval+1; + xfd(3,:) = [c fic dot(g,h)]; + if fic < fi0 + slope0*c % New lower bound + xfd(1,:) = xfd(3,:); ok = 1; + alpha = c; fn = fic; gn = g; slrat = xfd(3,3)/dfi0; + else, xfd(2,:) = xfd(3,:); ok = 0; end + % Check stopping criteria + ok = ok & abs(xfd(3,3)) <= abs(slopethr); + stop = ok | neval >= 5 | diff(xfd(1:2,1)) <= 0; + end % while +%------------ end of softline ------------------------------ + +function alpha = interpolate(xfd,n); +% Minimizer of parabola given by +% xfd(1:2,1:3) = [a fi(a) fi'(a); b fi(b) dummy] + + a = xfd(1,1); b = xfd(2,1); d = b - a; dfia = xfd(1,3); + C = diff(xfd(1:2,2)) - d*dfia; + if C >= 5*n*eps*b % Minimizer exists + A = a - .5*dfia*(d^2/C); + d = 0.1*d; alpha = min(max(a+d, A), b-d); + else + alpha = (a+b)/2; + end +%------------ end of interpolate -------------------------- diff --git a/exercises/02450Toolbox_Matlab/setup.m b/exercises/02450Toolbox_Matlab/setup.m new file mode 100644 index 0000000000000000000000000000000000000000..7f320418c36d54e423ef109a51a4b86c0f6ec2f5 --- /dev/null +++ b/exercises/02450Toolbox_Matlab/setup.m @@ -0,0 +1,76 @@ + +function setup() +disp('Resetting path...'); +restoredefaultpath(); +disp('Setting up the 02450 Toolbox...'); +cdir = pwd(); +path = fileparts(mfilename('fullpath')); +% Setup path +if nargin < 1, nntoolbox_type = 'mul'; end +if strcmp(nntoolbox_type,'mul'), + nn_bin = false; +elseif strcmp(nntoolbox_type,'bin'), + nn_bin = true; +else + disp('Wrong type of neural network toolbox selected') + nntoolbox_type = false; + asser(false); +end + +if strcmp(path(1),'/') % linux system + addpath([path '/Tools/TMG_6.0R7']) + addpath([path '/Tools/MBox']) + if ~nn_bin, + addpath([path '/Tools/nr']) + addpath([path '/Tools/nc_multiclass']) + else + addpath([path '/Tools/nc_binclass']) + end + addpath([path '/Tools/02450Tools']) + addpath(genpath([path '/Tools/minFunc_2012'])) + addpath([path '/Scripts']) +else % Windows system + addpath([path '\Tools\TMG_6.0R7']) + addpath([path '\Tools\MBox']) + if ~nn_bin, + addpath([path '\Tools\nr']) + addpath([path '\Tools\nc_multiclass']) + else + addpath([path '\Tools\nc_binclass']) + end + addpath([path '\Tools\02450Tools']) + addpath(genpath([path '\Tools\minFunc_2012'])) + addpath([path '\Scripts']) +end +clear path; + +% Chech version number +v = ver('MATLAB'); +verVec = sscanf(v.Version, '%d.%d.%d'); +verNum = sum(verVec.*logspace(0, 1-length(verVec), length(verVec))'); +fprintf('Running Matlab version %s\n',v.Version); +if verNum<7.7 + fprintf('WARNING: We recommend using Matlab version 7.7 or newer!\n'); +end + +% Disable glmfit warning +warning('off', 'stats:glmfit:IllConditioned'); +warning('off', 'stats:glmfit:IterationLimit'); +% Disable xlsread warning +warning('off', 'MATLAB:xlsread:ActiveX'); +warning('off', 'MATLAB:xlsread:Mode'); +% Disable NaiveBayes warning +warning('off', 'stats:NaiveBayes:BadDataforMVMN'); +warning('off', 'stats:NaiveBayes:BadDataforMN'); +% Disable neural network warining +warning('off', 'MATLAB:nearlySingularMatrix'); +% Disable GMM warning +warning('off', 'stats:gmdistribution:IllCondCov'); +warning('off', 'stats:gmdistribution:FailedToConverge'); + +% Done +disp('Setup of the 02450 Toolbox completed.'); +cd(cdir); +rehash path + +end \ No newline at end of file diff --git a/exercises/02450Toolbox_Matlab/testAllScripts.m b/exercises/02450Toolbox_Matlab/testAllScripts.m new file mode 100644 index 0000000000000000000000000000000000000000..444809488951785289c73781683dc1f301327c7a --- /dev/null +++ b/exercises/02450Toolbox_Matlab/testAllScripts.m @@ -0,0 +1,12 @@ +cwd=pwd(); +if ~strcmp(cwd(end-6:end),'Scripts') + cd('.\Scripts') +end +scripts = dir(); +for t=1:length(scripts) + if scripts(t).name(end)=='m' && ~strcmp(scripts(t).name,'testAllScripts.m') && ~strcmp(scripts(t).name,'ex3_1_3.m') && ~strcmp(scripts(t).name,'ex3_1_4.m') && ~strcmp(scripts(t).name,'ex3_1_5.m') + disp(['operating on script: ' scripts(t).name]); + run(scripts(t).name); + scripts = dir(); % fixes issues in case clear all invoked in a script + end +end diff --git a/exercises/02450Toolbox_Python/Data/body.mat b/exercises/02450Toolbox_Python/Data/body.mat new file mode 100644 index 0000000000000000000000000000000000000000..813ae289c6d502ff0a9241334017cbc43ee29bab Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/body.mat differ diff --git a/exercises/02450Toolbox_Python/Data/courses.txt b/exercises/02450Toolbox_Python/Data/courses.txt new file mode 100644 index 0000000000000000000000000000000000000000..da22d2b8fb121647f4dbeda6edc3a3f4cae2f366 --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/courses.txt @@ -0,0 +1,6 @@ +2,5,6,7,8 +1,2,3,6,7,8 +2,4,6,8 +3,6,7 +2,6,7 +2,3,6,7,8 diff --git a/exercises/02450Toolbox_Python/Data/digits.mat b/exercises/02450Toolbox_Python/Data/digits.mat new file mode 100644 index 0000000000000000000000000000000000000000..434cf47348fd6709f94ee19381b428904d7d0530 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/digits.mat differ diff --git a/exercises/02450Toolbox_Python/Data/faithful.mat b/exercises/02450Toolbox_Python/Data/faithful.mat new file mode 100644 index 0000000000000000000000000000000000000000..2a87a34731996624bffc3d0af8930ea59fff5d34 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/faithful.mat differ diff --git a/exercises/02450Toolbox_Python/Data/faithful.txt b/exercises/02450Toolbox_Python/Data/faithful.txt new file mode 100644 index 0000000000000000000000000000000000000000..d31bbd2a0c0dfeda95ca878b54fb502db0d9aa57 --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/faithful.txt @@ -0,0 +1,272 @@ +3.600000 79.000000 +1.800000 54.000000 +3.333000 74.000000 +2.283000 62.000000 +4.533000 85.000000 +2.883000 55.000000 +4.700000 88.000000 +3.600000 85.000000 +1.950000 51.000000 +4.350000 85.000000 +1.833000 54.000000 +3.917000 84.000000 +4.200000 78.000000 +1.750000 47.000000 +4.700000 83.000000 +2.167000 52.000000 +1.750000 62.000000 +4.800000 84.000000 +1.600000 52.000000 +4.250000 79.000000 +1.800000 51.000000 +1.750000 47.000000 +3.450000 78.000000 +3.067000 69.000000 +4.533000 74.000000 +3.600000 83.000000 +1.967000 55.000000 +4.083000 76.000000 +3.850000 78.000000 +4.433000 79.000000 +4.300000 73.000000 +4.467000 77.000000 +3.367000 66.000000 +4.033000 80.000000 +3.833000 74.000000 +2.017000 52.000000 +1.867000 48.000000 +4.833000 80.000000 +1.833000 59.000000 +4.783000 90.000000 +4.350000 80.000000 +1.883000 58.000000 +4.567000 84.000000 +1.750000 58.000000 +4.533000 73.000000 +3.317000 83.000000 +3.833000 64.000000 +2.100000 53.000000 +4.633000 82.000000 +2.000000 59.000000 +4.800000 75.000000 +4.716000 90.000000 +1.833000 54.000000 +4.833000 80.000000 +1.733000 54.000000 +4.883000 83.000000 +3.717000 71.000000 +1.667000 64.000000 +4.567000 77.000000 +4.317000 81.000000 +2.233000 59.000000 +4.500000 84.000000 +1.750000 48.000000 +4.800000 82.000000 +1.817000 60.000000 +4.400000 92.000000 +4.167000 78.000000 +4.700000 78.000000 +2.067000 65.000000 +4.700000 73.000000 +4.033000 82.000000 +1.967000 56.000000 +4.500000 79.000000 +4.000000 71.000000 +1.983000 62.000000 +5.067000 76.000000 +2.017000 60.000000 +4.567000 78.000000 +3.883000 76.000000 +3.600000 83.000000 +4.133000 75.000000 +4.333000 82.000000 +4.100000 70.000000 +2.633000 65.000000 +4.067000 73.000000 +4.933000 88.000000 +3.950000 76.000000 +4.517000 80.000000 +2.167000 48.000000 +4.000000 86.000000 +2.200000 60.000000 +4.333000 90.000000 +1.867000 50.000000 +4.817000 78.000000 +1.833000 63.000000 +4.300000 72.000000 +4.667000 84.000000 +3.750000 75.000000 +1.867000 51.000000 +4.900000 82.000000 +2.483000 62.000000 +4.367000 88.000000 +2.100000 49.000000 +4.500000 83.000000 +4.050000 81.000000 +1.867000 47.000000 +4.700000 84.000000 +1.783000 52.000000 +4.850000 86.000000 +3.683000 81.000000 +4.733000 75.000000 +2.300000 59.000000 +4.900000 89.000000 +4.417000 79.000000 +1.700000 59.000000 +4.633000 81.000000 +2.317000 50.000000 +4.600000 85.000000 +1.817000 59.000000 +4.417000 87.000000 +2.617000 53.000000 +4.067000 69.000000 +4.250000 77.000000 +1.967000 56.000000 +4.600000 88.000000 +3.767000 81.000000 +1.917000 45.000000 +4.500000 82.000000 +2.267000 55.000000 +4.650000 90.000000 +1.867000 45.000000 +4.167000 83.000000 +2.800000 56.000000 +4.333000 89.000000 +1.833000 46.000000 +4.383000 82.000000 +1.883000 51.000000 +4.933000 86.000000 +2.033000 53.000000 +3.733000 79.000000 +4.233000 81.000000 +2.233000 60.000000 +4.533000 82.000000 +4.817000 77.000000 +4.333000 76.000000 +1.983000 59.000000 +4.633000 80.000000 +2.017000 49.000000 +5.100000 96.000000 +1.800000 53.000000 +5.033000 77.000000 +4.000000 77.000000 +2.400000 65.000000 +4.600000 81.000000 +3.567000 71.000000 +4.000000 70.000000 +4.500000 81.000000 +4.083000 93.000000 +1.800000 53.000000 +3.967000 89.000000 +2.200000 45.000000 +4.150000 86.000000 +2.000000 58.000000 +3.833000 78.000000 +3.500000 66.000000 +4.583000 76.000000 +2.367000 63.000000 +5.000000 88.000000 +1.933000 52.000000 +4.617000 93.000000 +1.917000 49.000000 +2.083000 57.000000 +4.583000 77.000000 +3.333000 68.000000 +4.167000 81.000000 +4.333000 81.000000 +4.500000 73.000000 +2.417000 50.000000 +4.000000 85.000000 +4.167000 74.000000 +1.883000 55.000000 +4.583000 77.000000 +4.250000 83.000000 +3.767000 83.000000 +2.033000 51.000000 +4.433000 78.000000 +4.083000 84.000000 +1.833000 46.000000 +4.417000 83.000000 +2.183000 55.000000 +4.800000 81.000000 +1.833000 57.000000 +4.800000 76.000000 +4.100000 84.000000 +3.966000 77.000000 +4.233000 81.000000 +3.500000 87.000000 +4.366000 77.000000 +2.250000 51.000000 +4.667000 78.000000 +2.100000 60.000000 +4.350000 82.000000 +4.133000 91.000000 +1.867000 53.000000 +4.600000 78.000000 +1.783000 46.000000 +4.367000 77.000000 +3.850000 84.000000 +1.933000 49.000000 +4.500000 83.000000 +2.383000 71.000000 +4.700000 80.000000 +1.867000 49.000000 +3.833000 75.000000 +3.417000 64.000000 +4.233000 76.000000 +2.400000 53.000000 +4.800000 94.000000 +2.000000 55.000000 +4.150000 76.000000 +1.867000 50.000000 +4.267000 82.000000 +1.750000 54.000000 +4.483000 75.000000 +4.000000 78.000000 +4.117000 79.000000 +4.083000 78.000000 +4.267000 78.000000 +3.917000 70.000000 +4.550000 79.000000 +4.083000 70.000000 +2.417000 54.000000 +4.183000 86.000000 +2.217000 50.000000 +4.450000 90.000000 +1.883000 54.000000 +1.850000 54.000000 +4.283000 77.000000 +3.950000 79.000000 +2.333000 64.000000 +4.150000 75.000000 +2.350000 47.000000 +4.933000 86.000000 +2.900000 63.000000 +4.583000 85.000000 +3.833000 82.000000 +2.083000 57.000000 +4.367000 82.000000 +2.133000 67.000000 +4.350000 74.000000 +2.200000 54.000000 +4.450000 83.000000 +3.567000 73.000000 +4.500000 73.000000 +4.150000 88.000000 +3.817000 80.000000 +3.917000 71.000000 +4.450000 83.000000 +2.000000 56.000000 +4.283000 79.000000 +4.767000 78.000000 +4.533000 84.000000 +1.850000 58.000000 +4.250000 83.000000 +1.983000 43.000000 +2.250000 60.000000 +4.750000 75.000000 +4.117000 81.000000 +2.150000 46.000000 +4.417000 90.000000 +1.817000 46.000000 +4.467000 74.000000 diff --git a/exercises/02450Toolbox_Python/Data/female.txt b/exercises/02450Toolbox_Python/Data/female.txt new file mode 100644 index 0000000000000000000000000000000000000000..03a0f10d30373cd4d5d1ac1613028885c23dce77 --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/female.txt @@ -0,0 +1,4999 @@ +Abagael +Abagail +Abbe +Abbey +Abbi +Abbie +Abby +Abigael +Abigail +Abigale +Abra +Acacia +Ada +Adah +Adaline +Adara +Addie +Addis +Adel +Adela +Adelaide +Adele +Adelice +Adelina +Adelind +Adeline +Adella +Adelle +Adena +Adey +Adi +Adiana +Adina +Adora +Adore +Adoree +Adorne +Adrea +Adria +Adriaens +Adrian +Adriana +Adriane +Adrianna +Adrianne +Adrien +Adriena +Adrienne +Aeriel +Aeriela +Aeriell +Ag +Agace +Agata +Agatha +Agathe +Aggi +Aggie +Aggy +Agna +Agnella +Agnes +Agnese +Agnesse +Agneta +Agnola +Agretha +Aida +Aidan +Aigneis +Aila +Aile +Ailee +Aileen +Ailene +Ailey +Aili +Ailina +Ailyn +Aime +Aimee +Aimil +Aina +Aindrea +Ainslee +Ainsley +Ainslie +Ajay +Alaine +Alameda +Alana +Alanah +Alane +Alanna +Alayne +Alberta +Albertina +Albertine +Albina +Alecia +Aleda +Aleece +Aleecia +Aleen +Alejandra +Alejandrina +Alena +Alene +Alessandra +Aleta +Alethea +Alex +Alexa +Alexandra +Alexandrina +Alexi +Alexia +Alexina +Alexine +Alexis +Alfie +Alfreda +Ali +Alia +Alica +Alice +Alicea +Alicia +Alida +Alidia +Alina +Aline +Alis +Alisa +Alisha +Alison +Alissa +Alisun +Alix +Aliza +Alla +Alleen +Allegra +Allene +Alli +Allianora +Allie +Allina +Allis +Allison +Allissa +Allsun +Ally +Allyce +Allyn +Allys +Allyson +Alma +Almeda +Almeria +Almeta +Almira +Almire +Aloise +Aloisia +Aloysia +Alpa +Alta +Althea +Alvera +Alvina +Alvinia +Alvira +Alyce +Alyda +Alys +Alysa +Alyse +Alysia +Alyson +Alyss +Alyssa +Amabel +Amabelle +Amalea +Amalee +Amaleta +Amalia +Amalie +Amalita +Amalle +Amanda +Amandi +Amandie +Amandy +Amara +Amargo +Amata +Amber +Amberly +Ambrosia +Ambur +Ame +Amelia +Amelie +Amelina +Ameline +Amelita +Ami +Amie +Amity +Ammamaria +Amy +Ana +Anabel +Anabella +Anabelle +Anais +Analiese +Analise +Anallese +Anallise +Anastasia +Anastasie +Anastassia +Anatola +Andee +Andi +Andie +Andra +Andrea +Andreana +Andree +Andrei +Andria +Andriana +Andriette +Andromache +Andromeda +Andy +Anestassia +Anet +Anett +Anetta +Anette +Ange +Angel +Angela +Angele +Angelia +Angelica +Angelika +Angelina +Angeline +Angelique +Angelita +Angelle +Angie +Angil +Angy +Ania +Anica +Anissa +Anita +Anitra +Anja +Anjanette +Anjela +Ann +Ann-Mari +Ann-Marie +Anna +Anna-Diana +Anna-Diane +Anna-Maria +Annabal +Annabel +Annabela +Annabell +Annabella +Annabelle +Annadiana +Annadiane +Annalee +Annalena +Annaliese +Annalisa +Annalise +Annalyse +Annamari +Annamaria +Annamarie +Anne +Anne-Corinne +Anne-Mar +Anne-Marie +Annecorinne +Anneliese +Annelise +Annemarie +Annetta +Annette +Anni +Annice +Annie +Annissa +Annmaria +Annmarie +Annnora +Annora +Anny +Anselma +Ansley +Anstice +Anthe +Anthea +Anthia +Antoinette +Antonella +Antonetta +Antonia +Antonie +Antonietta +Antonina +Anya +Aphrodite +Appolonia +April +Aprilette +Ara +Arabel +Arabela +Arabele +Arabella +Arabelle +Arda +Ardath +Ardeen +Ardelia +Ardelis +Ardella +Ardelle +Arden +Ardene +Ardenia +Ardine +Ardis +Ardith +Ardra +Ardyce +Ardys +Ardyth +Aretha +Ariadne +Ariana +Arianne +Aridatha +Ariel +Ariela +Ariella +Arielle +Arlana +Arlee +Arleen +Arlen +Arlena +Arlene +Arleta +Arlette +Arleyne +Arlie +Arliene +Arlina +Arlinda +Arline +Arly +Arlyn +Arlyne +Aryn +Ashely +Ashlee +Ashleigh +Ashlen +Ashley +Ashli +Ashlie +Ashly +Asia +Astra +Astrid +Astrix +Atalanta +Athena +Athene +Atlanta +Atlante +Auberta +Aubine +Aubree +Aubrette +Aubrey +Aubrie +Aubry +Audi +Audie +Audra +Audre +Audrey +Audrie +Audry +Audrye +Audy +Augusta +Auguste +Augustina +Augustine +Aura +Aurea +Aurel +Aurelea +Aurelia +Aurelie +Auria +Aurie +Aurilia +Aurlie +Auroora +Aurora +Aurore +Austin +Austina +Austine +Ava +Aveline +Averil +Averyl +Avie +Avis +Aviva +Avivah +Avril +Avrit +Ayn +Bab +Babara +Babette +Babita +Babs +Bambi +Bambie +Bamby +Barb +Barbabra +Barbara +Barbara-Anne +Barbaraanne +Barbe +Barbee +Barbette +Barbey +Barbi +Barbie +Barbra +Barby +Bari +Barrie +Barry +Basia +Bathsheba +Batsheva +Bea +Beatrice +Beatrisa +Beatrix +Beatriz +Beau +Bebe +Becca +Becka +Becki +Beckie +Becky +Bee +Beilul +Beitris +Bekki +Bel +Belia +Belicia +Belinda +Belita +Bell +Bella +Bellamy +Bellanca +Belle +Bellina +Belva +Belvia +Bendite +Benedetta +Benedicta +Benedikta +Benetta +Benita +Benni +Bennie +Benny +Benoite +Berenice +Beret +Berget +Berna +Bernadene +Bernadette +Bernadina +Bernadine +Bernardina +Bernardine +Bernelle +Bernete +Bernetta +Bernette +Berni +Bernice +Bernie +Bernita +Berny +Berri +Berrie +Berry +Bert +Berta +Berte +Bertha +Berthe +Berti +Bertie +Bertina +Bertine +Berty +Beryl +Beryle +Bess +Bessie +Bessy +Beth +Bethanne +Bethany +Bethena +Bethina +Betsey +Betsy +Betta +Bette +Bette-Ann +Betteann +Betteanne +Betti +Bettie +Bettina +Bettine +Betty +Bettye +Beulah +Bev +Beverie +Beverlee +Beverlie +Beverly +Bevvy +Bianca +Bianka +Biddy +Bidget +Bill +Billi +Billie +Billy +Binni +Binnie +Binny +Bird +Birdie +Birgit +Birgitta +Blair +Blaire +Blake +Blakelee +Blakeley +Blanca +Blanch +Blancha +Blanche +Blinni +Blinnie +Blinny +Bliss +Blisse +Blithe +Blondell +Blondelle +Blondie +Blondy +Blythe +Bo +Bobbette +Bobbi +Bobbie +Bobby +Bobette +Bobina +Bobine +Bobinette +Bonita +Bonnee +Bonni +Bonnie +Bonny +Brana +Brandais +Brande +Brandea +Brandi +Brandice +Brandie +Brandise +Brandy +Brea +Breanne +Brear +Bree +Breena +Bren +Brena +Brenda +Brenn +Brenna +Brett +Bria +Briana +Brianna +Brianne +Bride +Bridget +Bridgett +Bridgette +Bridie +Brier +Brietta +Brigid +Brigida +Brigit +Brigitta +Brigitte +Brina +Briney +Briny +Brit +Brita +Britaney +Britani +Briteny +Britney +Britni +Britt +Britta +Brittan +Brittany +Britte +Brittney +Brook +Brooke +Brooks +Brunella +Brunhilda +Brunhilde +Bryana +Bryn +Bryna +Brynn +Brynna +Brynne +Buffy +Bunni +Bunnie +Bunny +Burta +Cabrina +Cacilia +Cacilie +Caitlin +Caitrin +Cal +Calida +Calla +Calley +Calli +Callida +Callie +Cally +Calypso +Cam +Camala +Camel +Camella +Camellia +Cameo +Cami +Camila +Camile +Camilla +Camille +Cammi +Cammie +Cammy +Canada +Candace +Candi +Candice +Candida +Candide +Candie +Candis +Candra +Candy +Cappella +Caprice +Cara +Caralie +Caren +Carena +Caresa +Caressa +Caresse +Carey +Cari +Caria +Carie +Caril +Carilyn +Carin +Carina +Carine +Cariotta +Carissa +Carita +Caritta +Carla +Carlee +Carleen +Carlen +Carlena +Carlene +Carley +Carli +Carlie +Carlin +Carlina +Carline +Carlisle +Carlita +Carlota +Carlotta +Carly +Carlye +Carlyn +Carlynn +Carlynne +Carma +Carmel +Carmela +Carmelia +Carmelina +Carmelita +Carmella +Carmelle +Carmen +Carmina +Carmine +Carmita +Carmon +Caro +Carol +Carol-Jean +Carola +Carolan +Carolann +Carole +Carolee +Caroleen +Carolie +Carolin +Carolina +Caroline +Caroljean +Carolyn +Carolyne +Carolynn +Caron +Carree +Carri +Carrie +Carrissa +Carrol +Carroll +Carry +Cary +Caryl +Caryn +Casandra +Casey +Casi +Casia +Casie +Cass +Cassandra +Cassandre +Cassandry +Cassaundra +Cassey +Cassi +Cassie +Cassondra +Cassy +Cat +Catarina +Cate +Caterina +Catha +Catharina +Catharine +Cathe +Cathee +Catherin +Catherina +Catherine +Cathi +Cathie +Cathleen +Cathlene +Cathrin +Cathrine +Cathryn +Cathy +Cathyleen +Cati +Catie +Catina +Catlaina +Catlee +Catlin +Catrina +Catriona +Caty +Cayla +Cecelia +Cecil +Cecile +Ceciley +Cecilia +Cecilla +Cecily +Ceil +Cele +Celene +Celesta +Celeste +Celestia +Celestina +Celestine +Celestyn +Celestyna +Celia +Celie +Celina +Celinda +Celine +Celinka +Celisse +Celle +Cesya +Chad +Chanda +Chandal +Chandra +Channa +Chantal +Chantalle +Charil +Charin +Charis +Charissa +Charisse +Charita +Charity +Charla +Charlean +Charleen +Charlena +Charlene +Charline +Charlot +Charlott +Charlotta +Charlotte +Charmain +Charmaine +Charmane +Charmian +Charmine +Charmion +Charo +Charyl +Chastity +Chelsae +Chelsea +Chelsey +Chelsie +Chelsy +Cher +Chere +Cherey +Cheri +Cherianne +Cherice +Cherida +Cherie +Cherilyn +Cherilynn +Cherin +Cherise +Cherish +Cherlyn +Cherri +Cherrita +Cherry +Chery +Cherye +Cheryl +Cheslie +Chiarra +Chickie +Chicky +Chiquita +Chloe +Chloette +Chloris +Chris +Chriss +Chrissa +Chrissie +Chrissy +Christa +Christabel +Christabella +Christabelle +Christal +Christalle +Christan +Christean +Christel +Christen +Christi +Christian +Christiana +Christiane +Christie +Christin +Christina +Christine +Christy +Christyna +Chrysa +Chrysler +Chrystal +Chryste +Chrystel +Ciara +Cicely +Cicily +Ciel +Cilka +Cinda +Cindee +Cindelyn +Cinderella +Cindi +Cindie +Cindra +Cindy +Cinnamon +Cissie +Cissy +Clair +Claire +Clara +Clarabelle +Clare +Claresta +Clareta +Claretta +Clarette +Clarey +Clari +Claribel +Clarice +Clarie +Clarinda +Clarine +Clarisa +Clarissa +Clarisse +Clarita +Clary +Claude +Claudelle +Claudetta +Claudette +Claudia +Claudie +Claudina +Claudine +Clea +Clem +Clemence +Clementia +Clementina +Clementine +Clemmie +Clemmy +Cleo +Cleopatra +Clerissa +Cleva +Clio +Clo +Cloe +Cloris +Clotilda +Clovis +Codee +Codi +Codie +Cody +Coleen +Colene +Coletta +Colette +Colleen +Collete +Collette +Collie +Colline +Colly +Con +Concettina +Conchita +Concordia +Conney +Conni +Connie +Conny +Consolata +Constance +Constancia +Constancy +Constanta +Constantia +Constantina +Constantine +Consuela +Consuelo +Cookie +Cora +Corabel +Corabella +Corabelle +Coral +Coralie +Coraline +Coralyn +Cordelia +Cordelie +Cordey +Cordie +Cordula +Cordy +Coreen +Corella +Corena +Corenda +Corene +Coretta +Corette +Corey +Cori +Corie +Corilla +Corina +Corine +Corinna +Corinne +Coriss +Corissa +Corliss +Corly +Cornela +Cornelia +Cornelle +Cornie +Corny +Correna +Correy +Corri +Corrianne +Corrie +Corrina +Corrine +Corrinne +Corry +Cortney +Cory +Cosetta +Cosette +Courtenay +Courtney +Cresa +Cris +Crissie +Crissy +Crista +Cristabel +Cristal +Cristen +Cristi +Cristie +Cristin +Cristina +Cristine +Cristionna +Cristy +Crysta +Crystal +Crystie +Cyb +Cybal +Cybel +Cybelle +Cybil +Cybill +Cyndi +Cyndy +Cynthea +Cynthia +Cynthie +Cynthy +Dacey +Dacia +Dacie +Dacy +Dael +Daffi +Daffie +Daffy +Dafna +Dagmar +Dahlia +Daile +Daisey +Daisi +Daisie +Daisy +Dale +Dalenna +Dalia +Dalila +Dallas +Daloris +Damara +Damaris +Damita +Dana +Danell +Danella +Danelle +Danette +Dani +Dania +Danica +Danice +Daniel +Daniela +Daniele +Daniella +Danielle +Danika +Danila +Danit +Danita +Danna +Danni +Dannie +Danny +Dannye +Danya +Danyelle +Danyette +Daphene +Daphna +Daphne +Dara +Darb +Darbie +Darby +Darcee +Darcey +Darci +Darcie +Darcy +Darda +Dareen +Darell +Darelle +Dari +Daria +Darice +Darla +Darleen +Darlene +Darline +Darryl +Darsey +Darsie +Darya +Daryl +Daryn +Dasha +Dasi +Dasie +Dasya +Datha +Daune +Daveen +Daveta +Davida +Davina +Davine +Davita +Dawn +Dawna +Dayle +Dayna +Dea +Deana +Deane +Deanna +Deanne +Deb +Debbi +Debbie +Debbra +Debby +Debee +Debera +Debi +Debor +Debora +Deborah +Debra +Dede +Dedie +Dedra +Dee +Dee Dee +Deeann +Deeanne +Deedee +Deena +Deerdre +Dehlia +Deidre +Deina +Deirdre +Del +Dela +Delaney +Delcina +Delcine +Delia +Delila +Delilah +Delinda +Dell +Della +Delly +Delora +Delores +Deloria +Deloris +Delphina +Delphine +Delphinia +Demeter +Demetra +Demetria +Demetris +Dena +Deni +Denice +Denise +Denna +Denni +Dennie +Denny +Deny +Denys +Denyse +Deonne +Desaree +Desdemona +Desirae +Desiree +Desiri +Deva +Devan +Devi +Devin +Devina +Devinne +Devon +Devondra +Devonna +Devonne +Devora +Dew +Di +Diahann +Diamond +Dian +Diana +Diandra +Diane +Diane-Marie +Dianemarie +Diann +Dianna +Dianne +Diannne +Didi +Dido +Diena +Dierdre +Dina +Dinah +Dinnie +Dinny +Dion +Dione +Dionis +Dionne +Dita +Dix +Dixie +Dode +Dodi +Dodie +Dody +Doe +Doll +Dolley +Dolli +Dollie +Dolly +Dolora +Dolores +Dolorita +Doloritas +Dominica +Dominique +Dona +Donella +Donelle +Donetta +Donia +Donica +Donielle +Donna +Donnajean +Donnamarie +Donni +Donnie +Donny +Dora +Doralia +Doralin +Doralyn +Doralynn +Doralynne +Dorcas +Dore +Doreen +Dorelia +Dorella +Dorelle +Dorena +Dorene +Doretta +Dorette +Dorey +Dori +Doria +Dorian +Dorice +Dorie +Dorine +Doris +Dorisa +Dorise +Dorit +Dorita +Doro +Dorolice +Dorolisa +Dorotea +Doroteya +Dorothea +Dorothee +Dorothy +Dorree +Dorri +Dorrie +Dorris +Dorry +Dorthea +Dorthy +Dory +Dosi +Dot +Doti +Dotti +Dottie +Dotty +Dove +Drea +Drew +Dulce +Dulcea +Dulci +Dulcia +Dulciana +Dulcie +Dulcine +Dulcinea +Dulcy +Dulsea +Dusty +Dyan +Dyana +Dyane +Dyann +Dyanna +Dyanne +Dyna +Dynah +Eada +Eadie +Eadith +Ealasaid +Eartha +Easter +Eba +Ebba +Ebonee +Ebony +Eda +Eddi +Eddie +Eddy +Ede +Edee +Edeline +Eden +Edi +Edie +Edin +Edita +Edith +Editha +Edithe +Ediva +Edna +Edwina +Edy +Edyth +Edythe +Effie +Eileen +Eilis +Eimile +Eirena +Ekaterina +Elaina +Elaine +Elana +Elane +Elayne +Elberta +Elbertina +Elbertine +Eleanor +Eleanora +Eleanore +Electra +Elena +Elene +Eleni +Elenore +Eleonora +Eleonore +Elfie +Elfreda +Elfrida +Elfrieda +Elga +Elianora +Elianore +Elicia +Elie +Elinor +Elinore +Elisa +Elisabet +Elisabeth +Elisabetta +Elise +Elisha +Elissa +Elita +Eliza +Elizabet +Elizabeth +Elka +Elke +Ella +Elladine +Elle +Ellen +Ellene +Ellette +Elli +Ellie +Ellissa +Elly +Ellyn +Ellynn +Elmira +Elna +Elnora +Elnore +Eloisa +Eloise +Elonore +Elora +Elsa +Elsbeth +Else +Elsey +Elsi +Elsie +Elsinore +Elspeth +Elsy +Elva +Elvera +Elvina +Elvira +Elwina +Elwira +Elyn +Elyse +Elysee +Elysha +Elysia +Elyssa +Em +Ema +Emalee +Emalia +Emanuela +Emelda +Emelia +Emelina +Emeline +Emelita +Emelyne +Emera +Emilee +Emili +Emilia +Emilie +Emiline +Emily +Emlyn +Emlynn +Emlynne +Emma +Emmalee +Emmaline +Emmalyn +Emmalynn +Emmalynne +Emmeline +Emmey +Emmi +Emmie +Emmy +Emmye +Emogene +Emyle +Emylee +Endora +Engracia +Enid +Enrica +Enrichetta +Enrika +Enriqueta +Enya +Eolanda +Eolande +Eran +Erda +Erena +Erica +Ericha +Ericka +Erika +Erin +Erina +Erinn +Erinna +Erma +Ermengarde +Ermentrude +Ermina +Erminia +Erminie +Erna +Ernaline +Ernesta +Ernestine +Ertha +Eryn +Esma +Esmaria +Esme +Esmeralda +Esmerelda +Essa +Essie +Essy +Esta +Estel +Estele +Estell +Estella +Estelle +Ester +Esther +Estrella +Estrellita +Ethel +Ethelda +Ethelin +Ethelind +Etheline +Ethelyn +Ethyl +Etta +Etti +Ettie +Etty +Eudora +Eugenia +Eugenie +Eugine +Eula +Eulalie +Eunice +Euphemia +Eustacia +Eva +Evaleen +Evangelia +Evangelin +Evangelina +Evangeline +Evania +Evanne +Eve +Eveleen +Evelina +Eveline +Evelyn +Evette +Evey +Evie +Evita +Evonne +Evvie +Evvy +Evy +Eyde +Eydie +Fabrianne +Fabrice +Fae +Faina +Faith +Fallon +Fan +Fanchette +Fanchon +Fancie +Fancy +Fanechka +Fania +Fanni +Fannie +Fanny +Fanya +Fara +Farah +Farand +Farica +Farra +Farrah +Farrand +Fatima +Faun +Faunie +Faustina +Faustine +Fawn +Fawna +Fawne +Fawnia +Fay +Faydra +Faye +Fayette +Fayina +Fayre +Fayth +Faythe +Federica +Fedora +Felecia +Felicdad +Felice +Felicia +Felicity +Felicle +Felipa +Felisha +Felita +Feliza +Fenelia +Feodora +Ferdinanda +Ferdinande +Fern +Fernanda +Fernande +Fernandina +Ferne +Fey +Fiann +Fianna +Fidela +Fidelia +Fidelity +Fifi +Fifine +Filia +Filide +Filippa +Fina +Fiona +Fionna +Fionnula +Fiorenze +Fleur +Fleurette +Flo +Flor +Flora +Florance +Flore +Florella +Florence +Florencia +Florentia +Florenza +Florette +Flori +Floria +Florice +Florida +Florie +Florina +Florinda +Floris +Florri +Florrie +Florry +Flory +Flossi +Flossie +Flossy +Flower +Fortuna +Fortune +Fran +France +Francene +Frances +Francesca +Francesmary +Francine +Francis +Francisca +Franciska +Francoise +Francyne +Frank +Frankie +Franky +Franni +Frannie +Franny +Frayda +Fred +Freda +Freddi +Freddie +Freddy +Fredelia +Frederica +Fredericka +Fredi +Fredia +Fredra +Fredrika +Freida +Frieda +Friederike +Fulvia +Gabbey +Gabbi +Gabbie +Gabey +Gabi +Gabie +Gabriel +Gabriela +Gabriell +Gabriella +Gabrielle +Gabriellia +Gabrila +Gaby +Gae +Gael +Gail +Gale +Galina +Garland +Garnet +Garnette +Gates +Gavra +Gavrielle +Gay +Gayla +Gayle +Gayleen +Gaylene +Gaynor +Geeta +Gelya +Gen +Gena +Gene +Geneva +Genevieve +Genevra +Genia +Genna +Genni +Gennie +Gennifer +Genny +Genovera +Genvieve +George +Georgeanna +Georgeanne +Georgena +Georgeta +Georgetta +Georgette +Georgia +Georgiamay +Georgiana +Georgianna +Georgianne +Georgie +Georgina +Georgine +Gera +Geralda +Geraldina +Geraldine +Gerda +Gerhardine +Geri +Gerianna +Gerianne +Gerladina +Germain +Germaine +Germana +Gerri +Gerrie +Gerrilee +Gerry +Gert +Gerta +Gerti +Gertie +Gertrud +Gertruda +Gertrude +Gertrudis +Gerty +Giacinta +Giana +Gianina +Gianna +Gigi +Gilberta +Gilberte +Gilbertina +Gilbertine +Gilda +Gill +Gillan +Gilli +Gillian +Gillie +Gilligan +Gilly +Gina +Ginelle +Ginevra +Ginger +Ginni +Ginnie +Ginnifer +Ginny +Giorgia +Giovanna +Gipsy +Giralda +Gisela +Gisele +Gisella +Giselle +Gita +Gizela +Glad +Gladi +Gladis +Gladys +Gleda +Glen +Glenda +Glenine +Glenn +Glenna +Glennie +Glennis +Glori +Gloria +Gloriana +Gloriane +Glorianna +Glory +Glyn +Glynda +Glynis +Glynnis +Godiva +Golda +Goldarina +Goldi +Goldia +Goldie +Goldina +Goldy +Grace +Gracia +Gracie +Grata +Gratia +Gratiana +Gray +Grayce +Grazia +Gredel +Greer +Greta +Gretal +Gretchen +Grete +Gretel +Grethel +Gretna +Gretta +Grier +Griselda +Grissel +Guendolen +Guenevere +Guenna +Guglielma +Gui +Guillema +Guillemette +Guinevere +Guinna +Gunilla +Gunvor +Gus +Gusella +Gussi +Gussie +Gussy +Gusta +Gusti +Gustie +Gusty +Gwen +Gwendolen +Gwendolin +Gwendolyn +Gweneth +Gwenette +Gwenn +Gwenneth +Gwenni +Gwennie +Gwenny +Gwenora +Gwenore +Gwyn +Gwyneth +Gwynne +Gypsy +Hadria +Hailee +Haily +Haleigh +Halette +Haley +Hali +Halie +Halimeda +Halley +Halli +Hallie +Hally +Hana +Hanna +Hannah +Hanni +Hannibal +Hannie +Hannis +Hanny +Happy +Harlene +Harley +Harli +Harlie +Harmonia +Harmonie +Harmony +Harri +Harrie +Harriet +Harriett +Harrietta +Harriette +Harriot +Harriott +Hatti +Hattie +Hatty +Havivah +Hayley +Hazel +Heath +Heather +Heda +Hedda +Heddi +Heddie +Hedi +Hedvig +Hedwig +Hedy +Heida +Heide +Heidi +Heidie +Helaina +Helaine +Helen +Helen-Elizabeth +Helena +Helene +Helga +Helge +Helise +Hellene +Helli +Heloise +Helsa +Helyn +Hendrika +Henka +Henrie +Henrieta +Henrietta +Henriette +Henryetta +Hephzibah +Hermia +Hermina +Hermine +Herminia +Hermione +Herta +Hertha +Hester +Hesther +Hestia +Hetti +Hettie +Hetty +Hilarie +Hilary +Hilda +Hildagard +Hildagarde +Hilde +Hildegaard +Hildegarde +Hildy +Hillary +Hilliary +Hinda +Holley +Holli +Hollie +Holly +Holly-Anne +Hollyanne +Honey +Honor +Honoria +Hope +Horatia +Hortense +Hortensia +Hulda +Hyacinth +Hyacintha +Hyacinthe +Hyacinthia +Hyacinthie +Hynda +Ianthe +Ibbie +Ibby +Ida +Idalia +Idalina +Idaline +Idell +Idelle +Idette +Ike +Ikey +Ilana +Ileana +Ileane +Ilene +Ilise +Ilka +Illa +Ilona +Ilsa +Ilse +Ilysa +Ilyse +Ilyssa +Imelda +Imogen +Imogene +Imojean +Ina +Inci +Indira +Ines +Inesita +Inessa +Inez +Inga +Ingaberg +Ingaborg +Inge +Ingeberg +Ingeborg +Inger +Ingrid +Ingunna +Inna +Ioana +Iolande +Iolanthe +Iona +Iormina +Ira +Irena +Irene +Irina +Iris +Irita +Irma +Isa +Isabeau +Isabel +Isabelita +Isabella +Isabelle +Isador +Isadora +Isadore +Isahella +Iseabal +Isidora +Isis +Isobel +Issi +Issie +Issy +Ivett +Ivette +Ivie +Ivonne +Ivory +Ivy +Izabel +Izzi +Jacenta +Jacinda +Jacinta +Jacintha +Jacinthe +Jackelyn +Jacki +Jackie +Jacklin +Jacklyn +Jackquelin +Jackqueline +Jacky +Jaclin +Jaclyn +Jacquelin +Jacqueline +Jacquelyn +Jacquelynn +Jacquenetta +Jacquenette +Jacquetta +Jacquette +Jacqui +Jacquie +Jacynth +Jada +Jade +Jaime +Jaimie +Jaine +Jaleh +Jami +Jamie +Jamima +Jammie +Jan +Jana +Janaya +Janaye +Jandy +Jane +Janean +Janeczka +Janeen +Janel +Janela +Janella +Janelle +Janene +Janenna +Janessa +Janet +Janeta +Janetta +Janette +Janeva +Janey +Jania +Janice +Janie +Janifer +Janina +Janine +Janis +Janith +Janka +Janna +Jannel +Jannelle +Janot +Jany +Jaquelin +Jaquelyn +Jaquenetta +Jaquenette +Jaquith +Jasmin +Jasmina +Jasmine +Jayme +Jaymee +Jayne +Jaynell +Jazmin +Jean +Jeana +Jeane +Jeanelle +Jeanette +Jeanie +Jeanine +Jeanna +Jeanne +Jeannette +Jeannie +Jeannine +Jehanna +Jelene +Jemie +Jemima +Jemimah +Jemmie +Jemmy +Jen +Jena +Jenda +Jenelle +Jenette +Jeni +Jenica +Jeniece +Jenifer +Jeniffer +Jenilee +Jenine +Jenn +Jenna +Jennee +Jennette +Jenni +Jennica +Jennie +Jennifer +Jennilee +Jennine +Jenny +Jeraldine +Jeralee +Jere +Jeri +Jermaine +Jerrie +Jerrilee +Jerrilyn +Jerrine +Jerry +Jerrylee +Jess +Jessa +Jessalin +Jessalyn +Jessamine +Jessamyn +Jesse +Jesselyn +Jessi +Jessica +Jessie +Jessika +Jessy +Jewel +Jewell +Jewelle +Jill +Jillana +Jillane +Jillayne +Jilleen +Jillene +Jilli +Jillian +Jillie +Jilly +Jinny +Jo +Jo Ann +Jo-Ann +JoAnn +Jo-Anne +JoAnne +Joan +Joana +Joane +Joanie +Joann +Joanna +Joanne +Joannes +Jobey +Jobi +Jobie +Jobina +Joby +Jobye +Jobyna +Jocelin +Joceline +Jocelyn +Jocelyne +Jodee +Jodi +Jodie +Jody +Joela +Joelie +Joell +Joella +Joelle +Joellen +Joelly +Joellyn +Joelynn +Joete +Joey +Johanna +Johannah +Johnette +Johnna +Joice +Jojo +Jolee +Joleen +Jolene +Joletta +Joli +Jolie +Joline +Joly +Jolyn +Jolynn +Jonell +Joni +Jonie +Jonis +Jordain +Jordan +Jordana +Jordanna +Jorey +Jori +Jorie +Jorrie +Jorry +Joscelin +Josee +Josefa +Josefina +Joselyn +Josepha +Josephina +Josephine +Josey +Josi +Josie +Joslyn +Josselyn +Josy +Jourdan +Joy +Joya +Joyan +Joyann +Joyce +Joycelin +Joye +Joyous +Juana +Juanita +Jude +Judi +Judie +Judith +Juditha +Judy +Judye +Julee +Juli +Julia +Juliana +Juliane +Juliann +Julianna +Julianne +Julie +Julienne +Juliet +Julieta +Julietta +Juliette +Julina +Juline +Julissa +Julita +June +Junette +Junia +Junie +Junina +Justin +Justina +Justine +Jyoti +Kaari +Kacey +Kacie +Kacy +Kai +Kaia +Kaila +Kaile +Kailey +Kaitlin +Kaitlyn +Kaitlynn +Kaja +Kakalina +Kala +Kaleena +Kali +Kalie +Kalila +Kalina +Kalinda +Kalindi +Kalli +Kally +Kameko +Kamila +Kamilah +Kamillah +Kandace +Kandy +Kania +Kanya +Kara +Kara-Lynn +Karalee +Karalynn +Kare +Karee +Karel +Karen +Karena +Kari +Karia +Karie +Karil +Karilynn +Karin +Karina +Karine +Kariotta +Karisa +Karissa +Karita +Karla +Karlee +Karleen +Karlen +Karlene +Karlie +Karlotta +Karlotte +Karly +Karlyn +Karmen +Karna +Karol +Karola +Karole +Karolina +Karoline +Karoly +Karon +Karrah +Karrie +Karry +Kary +Karyl +Karylin +Karyn +Kasey +Kass +Kassandra +Kassey +Kassi +Kassia +Kassie +Kaster +Kat +Kata +Katalin +Kate +Katee +Katerina +Katerine +Katey +Kath +Katha +Katharina +Katharine +Katharyn +Kathe +Katheleen +Katherina +Katherine +Katheryn +Kathi +Kathie +Kathleen +Kathlene +Kathlin +Kathrine +Kathryn +Kathryne +Kathy +Kathye +Kati +Katie +Katina +Katine +Katinka +Katleen +Katlin +Katrina +Katrine +Katrinka +Katti +Kattie +Katuscha +Katusha +Katy +Katya +Kay +Kaycee +Kaye +Kayla +Kayle +Kaylee +Kayley +Kaylil +Kaylyn +Kee +Keeley +Keelia +Keely +Kelcey +Kelci +Kelcie +Kelcy +Kelila +Kellen +Kelley +Kelli +Kellia +Kellie +Kellina +Kellsie +Kelly +Kellyann +Kelsey +Kelsi +Kelsy +Kendra +Kendre +Kenna +Keren +Keri +Keriann +Kerianne +Kerri +Kerrie +Kerrill +Kerrin +Kerry +Kerstin +Kesley +Keslie +Kessia +Kessiah +Ketti +Kettie +Ketty +Kevina +Kevyn +Ki +Kia +Kiah +Kial +Kiele +Kiersten +Kikelia +Kiley +Kim +Kimberlee +Kimberley +Kimberli +Kimberly +Kimberlyn +Kimbra +Kimmi +Kimmie +Kimmy +Kinna +Kip +Kipp +Kippie +Kippy +Kira +Kirbee +Kirbie +Kirby +Kiri +Kirsten +Kirsteni +Kirsti +Kirstie +Kirstin +Kirstyn +Kissee +Kissiah +Kissie +Kit +Kitti +Kittie +Kitty +Kizzee +Kizzie +Klara +Klarika +Klarrisa +Konstance +Konstanze +Koo +Kora +Koral +Koralle +Kordula +Kore +Korella +Koren +Koressa +Kori +Korie +Korney +Korrie +Korry +Kourtney +Kris +Krissie +Krissy +Krista +Kristal +Kristan +Kriste +Kristel +Kristen +Kristi +Kristien +Kristin +Kristina +Kristine +Kristy +Kristyn +Krysta +Krystal +Krystalle +Krystle +Krystyna +Kyla +Kyle +Kylen +Kylie +Kylila +Kylynn +Kym +Kynthia +Kyrstin +La +Lacee +Lacey +Lacie +Lacy +Ladonna +Laetitia +Laila +Laina +Lainey +Lamb +Lana +Lane +Lanette +Laney +Lani +Lanie +Lanita +Lanna +Lanni +Lanny +Lara +Laraine +Lari +Larina +Larine +Larisa +Larissa +Lark +Laryssa +Latashia +Latia +Latisha +Latrena +Latrina +Laura +Lauraine +Laural +Lauralee +Laure +Lauree +Laureen +Laurel +Laurella +Lauren +Laurena +Laurene +Lauretta +Laurette +Lauri +Laurianne +Laurice +Laurie +Lauryn +Lavena +Laverna +Laverne +Lavina +Lavinia +Lavinie +Layla +Layne +Layney +Lea +Leah +Leandra +Leann +Leanna +Leanne +Leanor +Leanora +Lebbie +Leda +Lee +LeeAnn +Leeann +Leeanne +Leela +Leelah +Leena +Leesa +Leese +Legra +Leia +Leiah +Leigh +Leigha +Leila +Leilah +Leisha +Lela +Lelah +Leland +Lelia +Lena +Lenee +Lenette +Lenka +Lenna +Lenora +Lenore +Leodora +Leoine +Leola +Leoline +Leona +Leonanie +Leone +Leonelle +Leonie +Leonora +Leonore +Leontine +Leontyne +Leora +Leorah +Leshia +Lesley +Lesli +Leslie +Lesly +Lesya +Leta +Lethia +Leticia +Letisha +Letitia +Letta +Letti +Lettie +Letty +Leyla +Lezlie +Lia +Lian +Liana +Liane +Lianna +Lianne +Lib +Libbey +Libbi +Libbie +Libby +Licha +Lida +Lidia +Lil +Lila +Lilah +Lilas +Lilia +Lilian +Liliane +Lilias +Lilith +Lilla +Lilli +Lillian +Lillis +Lilllie +Lilly +Lily +Lilyan +Lin +Lina +Lind +Linda +Lindi +Lindie +Lindsay +Lindsey +Lindsy +Lindy +Linea +Linell +Linet +Linette +Linn +Linnea +Linnell +Linnet +Linnie +Linzy +Liora +Liorah +Lira +Lisa +Lisabeth +Lisandra +Lisbeth +Lise +Lisetta +Lisette +Lisha +Lishe +Lissa +Lissi +Lissie +Lissy +Lita +Liuka +Livia +Liz +Liza +Lizabeth +Lizbeth +Lizette +Lizzie +Lizzy +Loella +Lois +Loise +Lola +Lolande +Loleta +Lolita +Lolly +Lona +Lonee +Loni +Lonna +Lonni +Lonnie +Lora +Lorain +Loraine +Loralee +Loralie +Loralyn +Loree +Loreen +Lorelei +Lorelle +Loren +Lorena +Lorene +Lorenza +Loretta +Lorettalorna +Lorette +Lori +Loria +Lorianna +Lorianne +Lorie +Lorilee +Lorilyn +Lorinda +Lorine +Lorita +Lorna +Lorne +Lorraine +Lorrayne +Lorri +Lorrie +Lorrin +Lorry +Lory +Lotta +Lotte +Lotti +Lottie +Lotty +Lou +Louella +Louisa +Louise +Louisette +Love +Luana +Luanna +Luce +Luci +Lucia +Luciana +Lucie +Lucienne +Lucila +Lucilia +Lucille +Lucina +Lucinda +Lucine +Lucita +Lucky +Lucretia +Lucy +Luella +Luelle +Luisa +Luise +Lula +Lulita +Lulu +Luna +Lura +Lurette +Lurleen +Lurlene +Lurline +Lusa +Lust +Lyda +Lydia +Lydie +Lyn +Lynda +Lynde +Lyndel +Lyndell +Lyndsay +Lyndsey +Lyndsie +Lyndy +Lynea +Lynelle +Lynett +Lynette +Lynn +Lynna +Lynne +Lynnea +Lynnell +Lynnelle +Lynnet +Lynnett +Lynnette +Lynsey +Lysandra +Lyssa +Mab +Mabel +Mabelle +Mable +Mada +Madalena +Madalyn +Maddalena +Maddi +Maddie +Maddy +Madel +Madelaine +Madeleine +Madelena +Madelene +Madelin +Madelina +Madeline +Madella +Madelle +Madelon +Madelyn +Madge +Madlen +Madlin +Madona +Madonna +Mady +Mae +Maegan +Mag +Magda +Magdaia +Magdalen +Magdalena +Magdalene +Maggee +Maggi +Maggie +Maggy +Magna +Mahala +Mahalia +Maia +Maible +Maiga +Mair +Maire +Mairead +Maisey +Maisie +Mala +Malanie +Malcah +Malena +Malia +Malina +Malinda +Malinde +Malissa +Malissia +Malka +Malkah +Mallissa +Mallorie +Mallory +Malorie +Malory +Malva +Malvina +Malynda +Mame +Mamie +Manda +Mandi +Mandie +Mandy +Manon +Manya +Mara +Marabel +Marcela +Marcelia +Marcella +Marcelle +Marcellina +Marcelline +Marchelle +Marci +Marcia +Marcie +Marcile +Marcille +Marcy +Mareah +Maren +Marena +Maressa +Marga +Margalit +Margalo +Margaret +Margareta +Margarete +Margaretha +Margarethe +Margaretta +Margarette +Margarita +Margaux +Marge +Margeaux +Margery +Marget +Margette +Margi +Margie +Margit +Marglerite +Margo +Margot +Margret +Marguerite +Margurite +Margy +Mari +Maria +Mariam +Marian +Mariana +Mariann +Marianna +Marianne +Maribel +Maribelle +Maribeth +Marice +Maridel +Marie +Marie-Ann +Marie-Jeanne +Marieann +Mariejeanne +Mariel +Mariele +Marielle +Mariellen +Marietta +Mariette +Marigold +Marijo +Marika +Marilee +Marilin +Marillin +Marilyn +Marin +Marina +Marinna +Marion +Mariquilla +Maris +Marisa +Mariska +Marissa +Marit +Marita +Maritsa +Mariya +Marj +Marja +Marje +Marji +Marjie +Marjorie +Marjory +Marjy +Marketa +Marla +Marlane +Marleah +Marlee +Marleen +Marlena +Marlene +Marley +Marlie +Marline +Marlo +Marlyn +Marna +Marne +Marney +Marni +Marnia +Marnie +Marquita +Marrilee +Marris +Marrissa +Marry +Marsha +Marsiella +Marta +Martelle +Martguerita +Martha +Marthe +Marthena +Marti +Martica +Martie +Martina +Martita +Marty +Martynne +Mary +Marya +Maryangelyn +Maryann +Maryanna +Maryanne +Marybelle +Marybeth +Maryellen +Maryjane +Maryjo +Maryl +Marylee +Marylin +Marylinda +Marylou +Marylynne +Maryrose +Marys +Marysa +Masha +Matelda +Mathilda +Mathilde +Matilda +Matilde +Matti +Mattie +Matty +Maud +Maude +Maudie +Maura +Maure +Maureen +Maureene +Maurene +Maurine +Maurise +Maurita +Mavis +Mavra +Max +Maxi +Maxie +Maxine +Maxy +May +Maya +Maybelle +Mayda +Maye +Mead +Meade +Meagan +Meaghan +Meara +Mechelle +Meg +Megan +Megen +Meggan +Meggi +Meggie +Meggy +Meghan +Meghann +Mehetabel +Mei +Meira +Mel +Mela +Melamie +Melania +Melanie +Melantha +Melany +Melba +Melesa +Melessa +Melicent +Melina +Melinda +Melinde +Melisa +Melisande +Melisandra +Melisenda +Melisent +Melissa +Melisse +Melita +Melitta +Mella +Melli +Mellicent +Mellie +Mellisa +Mellisent +Mellissa +Melloney +Melly +Melodee +Melodie +Melody +Melonie +Melony +Melosa +Melva +Mercedes +Merci +Mercie +Mercy +Meredith +Meredithe +Meridel +Meridith +Meriel +Merilee +Merilyn +Meris +Merissa +Merl +Merla +Merle +Merlina +Merline +Merna +Merola +Merralee +Merridie +Merrie +Merrielle +Merrile +Merrilee +Merrili +Merrill +Merrily +Merry +Mersey +Meryl +Meta +Mia +Micaela +Michaela +Michaelina +Michaeline +Michaella +Michal +Michel +Michele +Michelina +Micheline +Michell +Michelle +Micki +Mickie +Micky +Midge +Mignon +Mignonne +Miguela +Miguelita +Mikako +Mildred +Mildrid +Milena +Milicent +Milissent +Milka +Milli +Millicent +Millie +Millisent +Milly +Milzie +Mimi +Min +Mina +Minda +Mindy +Minerva +Minetta +Minette +Minna +Minni +Minnie +Minny +Minta +Miquela +Mira +Mirabel +Mirabella +Mirabelle +Miran +Miranda +Mireielle +Mireille +Mirella +Mirelle +Miriam +Mirilla +Mirna +Misha +Missie +Missy +Misti +Misty +Mitra +Mitzi +Mmarianne +Modesta +Modestia +Modestine +Modesty +Moina +Moira +Moll +Mollee +Molli +Mollie +Molly +Mommy +Mona +Monah +Monica +Monika +Monique +Mora +Moreen +Morena +Morgan +Morgana +Morganica +Morganne +Morgen +Moria +Morissa +Morlee +Morna +Moselle +Moya +Moyna +Moyra +Mozelle +Muffin +Mufi +Mufinella +Muire +Mureil +Murial +Muriel +Murielle +Myna +Myra +Myrah +Myranda +Myriam +Myrilla +Myrle +Myrlene +Myrna +Myrta +Myrtia +Myrtice +Myrtie +Myrtle +Nada +Nadean +Nadeen +Nadia +Nadine +Nadiya +Nady +Nadya +Nalani +Nan +Nana +Nananne +Nance +Nancee +Nancey +Nanci +Nancie +Nancy +Nanete +Nanette +Nani +Nanice +Nanine +Nannette +Nanni +Nannie +Nanny +Nanon +Naoma +Naomi +Nara +Nari +Nariko +Nat +Nata +Natala +Natalee +Natalia +Natalie +Natalina +Nataline +Natalya +Natasha +Natassia +Nathalia +Nathalie +Natka +Natty +Neala +Neda +Nedda +Nedi +Neely +Neila +Neile +Neilla +Neille +Nela +Nelia +Nelie +Nell +Nelle +Nelli +Nellie +Nelly +Nena +Nerissa +Nerita +Nert +Nerta +Nerte +Nerti +Nertie +Nerty +Nessa +Nessi +Nessie +Nessy +Nesta +Netta +Netti +Nettie +Nettle +Netty +Nevsa +Neysa +Nichol +Nichole +Nicholle +Nicki +Nickie +Nicky +Nicol +Nicola +Nicole +Nicolea +Nicolette +Nicoli +Nicolina +Nicoline +Nicolle +Nidia +Nike +Niki +Nikki +Nikkie +Nikoletta +Nikolia +Nil +Nina +Ninetta +Ninette +Ninnetta +Ninnette +Ninon +Nisa +Nissa +Nisse +Nissie +Nissy +Nita +Nitin +Nixie +Noami +Noel +Noelani +Noell +Noella +Noelle +Noellyn +Noelyn +Noemi +Nola +Nolana +Nolie +Nollie +Nomi +Nona +Nonah +Noni +Nonie +Nonna +Nonnah +Nora +Norah +Norean +Noreen +Norene +Norina +Norine +Norma +Norri +Norrie +Norry +Nova +Novelia +Nydia +Nyssa +Octavia +Odele +Odelia +Odelinda +Odella +Odelle +Odessa +Odetta +Odette +Odilia +Odille +Ofelia +Ofella +Ofilia +Ola +Olenka +Olga +Olia +Olimpia +Olive +Olivette +Olivia +Olivie +Oliy +Ollie +Olly +Olva +Olwen +Olympe +Olympia +Olympie +Ondrea +Oneida +Onida +Onlea +Oona +Opal +Opalina +Opaline +Ophelia +Ophelie +Oprah +Ora +Oralee +Oralia +Oralie +Oralla +Oralle +Orel +Orelee +Orelia +Orelie +Orella +Orelle +Oreste +Oriana +Orly +Orsa +Orsola +Ortensia +Otha +Othelia +Othella +Othilia +Othilie +Ottilie +Pacifica +Page +Paige +Paloma +Pam +Pamela +Pamelina +Pamella +Pammi +Pammie +Pammy +Pandora +Pansie +Pansy +Paola +Paolina +Parwane +Pat +Patience +Patrica +Patrice +Patricia +Patrizia +Patsy +Patti +Pattie +Patty +Paula +Paula-Grace +Paule +Pauletta +Paulette +Pauli +Paulie +Paulina +Pauline +Paulita +Pauly +Pavia +Pavla +Pearl +Pearla +Pearle +Pearline +Peg +Pegeen +Peggi +Peggie +Peggy +Pen +Penelopa +Penelope +Penni +Pennie +Penny +Pepi +Pepita +Peri +Peria +Perl +Perla +Perle +Perri +Perrine +Perry +Persis +Pet +Peta +Petra +Petrina +Petronella +Petronia +Petronilla +Petronille +Petunia +Phaedra +Phaidra +Phebe +Phedra +Phelia +Phil +Philipa +Philippa +Philippe +Philippine +Philis +Phillida +Phillie +Phillis +Philly +Philomena +Phoebe +Phylis +Phyllida +Phyllis +Phyllys +Phylys +Pia +Pier +Pierette +Pierrette +Pietra +Piper +Pippa +Pippy +Polly +Pollyanna +Pooh +Poppy +Portia +Pris +Prisca +Priscella +Priscilla +Prissie +Pru +Prudence +Prudi +Prudy +Prue +Prunella +Queada +Queenie +Quentin +Querida +Quinn +Quinta +Quintana +Quintilla +Quintina +Rachael +Rachel +Rachele +Rachelle +Rae +Raf +Rafa +Rafaela +Rafaelia +Rafaelita +Ragnhild +Rahal +Rahel +Raina +Raine +Rakel +Ralina +Ramona +Ramonda +Rana +Randa +Randee +Randene +Randi +Randie +Randy +Ranee +Rani +Rania +Ranice +Ranique +Ranna +Raphaela +Raquel +Raquela +Rasia +Rasla +Raven +Ray +Raychel +Raye +Rayna +Raynell +Rayshell +Rea +Reba +Rebbecca +Rebe +Rebeca +Rebecca +Rebecka +Rebeka +Rebekah +Rebekkah +Ree +Reeba +Reena +Reeta +Reeva +Regan +Reggi +Reggie +Regina +Regine +Reiko +Reina +Reine +Remy +Rena +Renae +Renata +Renate +Rene +Renee +Renel +Renell +Renelle +Renie +Rennie +Reta +Retha +Revkah +Rey +Reyna +Rhea +Rheba +Rheta +Rhetta +Rhiamon +Rhianna +Rhianon +Rhoda +Rhodia +Rhodie +Rhody +Rhona +Rhonda +Riane +Riannon +Rianon +Rica +Ricca +Rici +Ricki +Rickie +Ricky +Riki +Rikki +Rina +Risa +Rissa +Rita +Riva +Rivalee +Rivi +Rivkah +Rivy +Roana +Roanna +Roanne +Robbi +Robbie +Robbin +Robby +Robbyn +Robena +Robenia +Roberta +Robin +Robina +Robinet +Robinett +Robinetta +Robinette +Robinia +Roby +Robyn +Roch +Rochell +Rochella +Rochelle +Rochette +Roda +Rodi +Rodie +Rodina +Romola +Romona +Romonda +Romy +Rona +Ronalda +Ronda +Ronica +Ronna +Ronni +Ronnica +Ronnie +Ronny +Roobbie +Rora +Rori +Rorie +Rory +Ros +Rosa +Rosabel +Rosabella +Rosabelle +Rosaleen +Rosalia +Rosalie +Rosalind +Rosalinda +Rosalinde +Rosaline +Rosalyn +Rosalynd +Rosamond +Rosamund +Rosana +Rosanna +Rosanne +Rosario +Rose +Roseann +Roseanna +Roseanne +Roselia +Roselin +Roseline +Rosella +Roselle +Roselyn +Rosemaria +Rosemarie +Rosemary +Rosemonde +Rosene +Rosetta +Rosette +Roshelle +Rosie +Rosina +Rosita +Roslyn +Rosmunda +Rosy +Row +Rowe +Rowena +Roxana +Roxane +Roxanna +Roxanne +Roxi +Roxie +Roxine +Roxy +Roz +Rozalie +Rozalin +Rozamond +Rozanna +Rozanne +Roze +Rozele +Rozella +Rozelle +Rozina +Rubetta +Rubi +Rubia +Rubie +Rubina +Ruby +Ruella +Ruperta +Ruth +Ruthann +Ruthanne +Ruthe +Ruthi +Ruthie +Ruthy +Ryann +Rycca +Saba +Sabina +Sabine +Sabra +Sabrina +Sacha +Sada +Sadella +Sadie +Sal +Sallee +Salli +Sallie +Sally +Sallyann +Sallyanne +Salome +Sam +Samantha +Samara +Samaria +Sammy +Samuela +Samuella +Sande +Sandi +Sandie +Sandra +Sandy +Sandye +Sapphira +Sapphire +Sara +Sara-Ann +Saraann +Sarah +Sarajane +Saree +Sarena +Sarene +Sarette +Sari +Sarina +Sarine +Sarita +Sascha +Sasha +Sashenka +Saudra +Saundra +Savina +Sayre +Scarlet +Scarlett +Scotty +Sean +Seana +Secunda +Seka +Sela +Selena +Selene +Selestina +Selia +Selie +Selina +Selinda +Seline +Sella +Selle +Selma +Sena +Sephira +Serena +Serene +Shaina +Shaine +Shalna +Shalne +Shamit +Shana +Shanda +Shandee +Shandie +Shandra +Shandy +Shane +Shani +Shanie +Shanna +Shannah +Shannen +Shannon +Shanon +Shanta +Shantee +Shara +Sharai +Shari +Sharia +Sharie +Sharity +Sharl +Sharla +Sharleen +Sharlene +Sharline +Sharna +Sharon +Sharona +Sharra +Sharron +Sharyl +Shaun +Shauna +Shawn +Shawna +Shawnee +Shay +Shayla +Shaylah +Shaylyn +Shaylynn +Shayna +Shayne +Shea +Sheba +Sheela +Sheelagh +Sheelah +Sheena +Sheeree +Sheila +Sheila-Kathryn +Sheilah +Sheilakathryn +Shel +Shela +Shelagh +Shelba +Shelbi +Shelby +Shelia +Shell +Shelley +Shelli +Shellie +Shelly +Shena +Sher +Sheree +Sheri +Sherie +Sheril +Sherill +Sherilyn +Sherline +Sherri +Sherrie +Sherry +Sherye +Sheryl +Shilpa +Shina +Shir +Shira +Shirah +Shirl +Shirlee +Shirleen +Shirlene +Shirley +Shirline +Shoshana +Shoshanna +Shoshie +Siana +Sianna +Sib +Sibbie +Sibby +Sibeal +Sibel +Sibella +Sibelle +Sibilla +Sibley +Sibyl +Sibylla +Sibylle +Sidoney +Sidonia +Sidonnie +Sigrid +Sile +Sileas +Silva +Silvana +Silvia +Silvie +Simona +Simone +Simonette +Simonne +Sindee +Sinead +Siobhan +Sioux +Siouxie +Sisely +Sisile +Sissie +Sissy +Sofia +Sofie +Solange +Sondra +Sonia +Sonja +Sonni +Sonnie +Sonnnie +Sonny +Sonya +Sophey +Sophi +Sophia +Sophie +Sophronia +Sorcha +Sosanna +Stace +Stacee +Stacey +Staci +Stacia +Stacie +Stacy +Stafani +Star +Starla +Starlene +Starlin +Starr +Stefa +Stefania +Stefanie +Steffane +Steffi +Steffie +Stella +Stepha +Stephana +Stephani +Stephanie +Stephannie +Stephenie +Stephi +Stephie +Stephine +Stesha +Stevana +Stevena +Stoddard +Storey +Storm +Stormi +Stormie +Stormy +Sue +Sue-elle +Suellen +Sukey +Suki +Sula +Sunny +Sunshine +Susan +Susana +Susanetta +Susann +Susanna +Susannah +Susanne +Susette +Susi +Susie +Sussi +Susy +Suzan +Suzann +Suzanna +Suzanne +Suzetta +Suzette +Suzi +Suzie +Suzy +Suzzy +Sybil +Sybila +Sybilla +Sybille +Sybyl +Sydel +Sydelle +Sydney +Sylvia +Sylvie +Tabatha +Tabbatha +Tabbi +Tabbie +Tabbitha +Tabby +Tabina +Tabitha +Taffy +Talia +Tallia +Tallie +Tally +Talya +Talyah +Tamar +Tamara +Tamarah +Tamarra +Tamera +Tami +Tamiko +Tamma +Tammara +Tammi +Tammie +Tammy +Tamra +Tana +Tandi +Tandie +Tandy +Tani +Tania +Tansy +Tanya +Tara +Tarah +Tarra +Tarrah +Taryn +Tasha +Tasia +Tate +Tatiana +Tatiania +Tatum +Tawnya +Tawsha +Teane +Ted +Tedda +Teddi +Teddie +Teddy +Tedi +Tedra +Teena +Tella +Teodora +Tera +Teresa +TeresaAnne +Terese +Teresina +Teresita +Teressa +Teri +Teriann +Terina +Terra +Terri +Terri-Jo +Terrianne +Terrie +Terry +Terrye +Tersina +Teryl +Terza +Tess +Tessa +Tessi +Tessie +Tessy +Thalia +Thea +Theada +Theadora +Theda +Thekla +Thelma +Theo +Theodora +Theodosia +Theresa +Theresa-Marie +Therese +Theresina +Theresita +Theressa +Therine +Thia +Thomasa +Thomasin +Thomasina +Thomasine +Tia +Tiana +Tiena +Tierney +Tiertza +Tiff +Tiffani +Tiffanie +Tiffany +Tiffi +Tiffie +Tiffy +Tilda +Tildi +Tildie +Tildy +Tillie +Tilly +Tim +Timi +Timmi +Timmie +Timmy +Timothea +Tina +Tine +Tiphani +Tiphanie +Tiphany +Tish +Tisha +Tobe +Tobey +Tobi +Tobie +Toby +Tobye +Toinette +Toma +Tomasina +Tomasine +Tomi +Tomiko +Tommi +Tommie +Tommy +Toni +Tonia +Tonie +Tony +Tonya +Tootsie +Torey +Tori +Torie +Torrie +Tory +Tova +Tove +Trace +Tracee +Tracey +Traci +Tracie +Tracy +Trenna +Tresa +Trescha +Tressa +Tricia +Trina +Trish +Trisha +Trista +Trix +Trixi +Trixie +Trixy +Truda +Trude +Trudey +Trudi +Trudie +Trudy +Trula +Tuesday +Twila +Twyla +Tybi +Tybie +Tyne +Ula +Ulla +Ulrica +Ulrika +Ulrike +Umeko +Una +Ursa +Ursala +Ursola +Ursula +Ursulina +Ursuline +Uta +Val +Valaree +Valaria +Vale +Valeda +Valencia +Valene +Valenka +Valentia +Valentina +Valentine +Valera +Valeria +Valerie +Valery +Valerye +Valida +Valina +Valli +Vallie +Vally +Valma +Valry +Van +Vanda +Vanessa +Vania +Vanna +Vanni +Vannie +Vanny +Vanya +Veda +Velma +Velvet +Vena +Venita +Ventura +Venus +Vera +Veradis +Vere +Verena +Verene +Veriee +Verile +Verina +Verine +Verla +Verna +Vernice +Veronica +Veronika +Veronike +Veronique +Vi +Vicki +Vickie +Vicky +Victoria +Vida +Viki +Vikki +Vikkie +Vikky +Vilhelmina +Vilma +Vin +Vina +Vinita +Vinni +Vinnie +Vinny +Viola +Violante +Viole +Violet +Violetta +Violette +Virgie +Virgina +Virginia +Virginie +Vita +Vitia +Vitoria +Vittoria +Viv +Viva +Vivi +Vivia +Vivian +Viviana +Vivianna +Vivianne +Vivie +Vivien +Viviene +Vivienne +Viviyan +Vivyan +Vivyanne +Vonni +Vonnie +Vonny +Wallie +Wallis +Wally +Waly +Wanda +Wandie +Wandis +Waneta +Wenda +Wendeline +Wendi +Wendie +Wendy +Wenona +Wenonah +Whitney +Wileen +Wilhelmina +Wilhelmine +Wilie +Willa +Willabella +Willamina +Willetta +Willette +Willi +Willie +Willow +Willy +Willyt +Wilma +Wilmette +Wilona +Wilone +Wilow +Windy +Wini +Winifred +Winna +Winnah +Winne +Winni +Winnie +Winnifred +Winny +Winona +Winonah +Wren +Wrennie +Wylma +Wynn +Wynne +Wynnie +Wynny +Xaviera +Xena +Xenia +Xylia +Xylina +Yalonda +Yehudit +Yelena +Yetta +Yettie +Yetty +Yevette +Yoko +Yolanda +Yolande +Yolane +Yolanthe +Yonina +Yoshi +Yoshiko +Yovonnda +Yvette +Yvonne +Zabrina +Zahara +Zandra +Zaneta +Zara +Zarah +Zaria +Zarla +Zea +Zelda +Zelma +Zena +Zenia +Zia +Zilvia +Zita +Zitella +Zoe +Zola +Zonda +Zondra +Zonnya +Zora +Zorah +Zorana +Zorina +Zorine +Zsa Zsa +Zsazsa +Zulema +Zuzana diff --git a/exercises/02450Toolbox_Python/Data/iris.csv b/exercises/02450Toolbox_Python/Data/iris.csv new file mode 100644 index 0000000000000000000000000000000000000000..f984b2bf7779ea99e49697b02ae92f533c448ba6 --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/iris.csv @@ -0,0 +1,151 @@ +"Sepal Length","Sepal Width","Petal Length","Petal Width","Type" +5.1,3.5,1.4,0.2,"Iris-setosa" +4.9,3,1.4,0.2,"Iris-setosa" +4.7,3.2,1.3,0.2,"Iris-setosa" +4.6,3.1,1.5,0.2,"Iris-setosa" +5,3.6,1.4,0.2,"Iris-setosa" +5.4,3.9,1.7,0.4,"Iris-setosa" +4.6,3.4,1.4,0.3,"Iris-setosa" +5,3.4,1.5,0.2,"Iris-setosa" +4.4,2.9,1.4,0.2,"Iris-setosa" +4.9,3.1,1.5,0.1,"Iris-setosa" +5.4,3.7,1.5,0.2,"Iris-setosa" +4.8,3.4,1.6,0.2,"Iris-setosa" +4.8,3,1.4,0.1,"Iris-setosa" +4.3,3,1.1,0.1,"Iris-setosa" +5.8,4,1.2,0.2,"Iris-setosa" +5.7,4.4,1.5,0.4,"Iris-setosa" +5.4,3.9,1.3,0.4,"Iris-setosa" +5.1,3.5,1.4,0.3,"Iris-setosa" +5.7,3.8,1.7,0.3,"Iris-setosa" +5.1,3.8,1.5,0.3,"Iris-setosa" +5.4,3.4,1.7,0.2,"Iris-setosa" +5.1,3.7,1.5,0.4,"Iris-setosa" +4.6,3.6,1,0.2,"Iris-setosa" +5.1,3.3,1.7,0.5,"Iris-setosa" +4.8,3.4,1.9,0.2,"Iris-setosa" +5,3,1.6,0.2,"Iris-setosa" +5,3.4,1.6,0.4,"Iris-setosa" +5.2,3.5,1.5,0.2,"Iris-setosa" +5.2,3.4,1.4,0.2,"Iris-setosa" +4.7,3.2,1.6,0.2,"Iris-setosa" +4.8,3.1,1.6,0.2,"Iris-setosa" +5.4,3.4,1.5,0.4,"Iris-setosa" +5.2,4.1,1.5,0.1,"Iris-setosa" +5.5,4.2,1.4,0.2,"Iris-setosa" +4.9,3.1,1.5,0.1,"Iris-setosa" +5,3.2,1.2,0.2,"Iris-setosa" +5.5,3.5,1.3,0.2,"Iris-setosa" +4.9,3.1,1.5,0.1,"Iris-setosa" +4.4,3,1.3,0.2,"Iris-setosa" +5.1,3.4,1.5,0.2,"Iris-setosa" +5,3.5,1.3,0.3,"Iris-setosa" +4.5,2.3,1.3,0.3,"Iris-setosa" +4.4,3.2,1.3,0.2,"Iris-setosa" +5,3.5,1.6,0.6,"Iris-setosa" +5.1,3.8,1.9,0.4,"Iris-setosa" +4.8,3,1.4,0.3,"Iris-setosa" +5.1,3.8,1.6,0.2,"Iris-setosa" +4.6,3.2,1.4,0.2,"Iris-setosa" +5.3,3.7,1.5,0.2,"Iris-setosa" +5,3.3,1.4,0.2,"Iris-setosa" +7,3.2,4.7,1.4,"Iris-versicolor" +6.4,3.2,4.5,1.5,"Iris-versicolor" +6.9,3.1,4.9,1.5,"Iris-versicolor" +5.5,2.3,4,1.3,"Iris-versicolor" +6.5,2.8,4.6,1.5,"Iris-versicolor" +5.7,2.8,4.5,1.3,"Iris-versicolor" +6.3,3.3,4.7,1.6,"Iris-versicolor" +4.9,2.4,3.3,1,"Iris-versicolor" +6.6,2.9,4.6,1.3,"Iris-versicolor" +5.2,2.7,3.9,1.4,"Iris-versicolor" +5,2,3.5,1,"Iris-versicolor" +5.9,3,4.2,1.5,"Iris-versicolor" +6,2.2,4,1,"Iris-versicolor" +6.1,2.9,4.7,1.4,"Iris-versicolor" +5.6,2.9,3.6,1.3,"Iris-versicolor" +6.7,3.1,4.4,1.4,"Iris-versicolor" +5.6,3,4.5,1.5,"Iris-versicolor" +5.8,2.7,4.1,1,"Iris-versicolor" +6.2,2.2,4.5,1.5,"Iris-versicolor" +5.6,2.5,3.9,1.1,"Iris-versicolor" +5.9,3.2,4.8,1.8,"Iris-versicolor" +6.1,2.8,4,1.3,"Iris-versicolor" +6.3,2.5,4.9,1.5,"Iris-versicolor" +6.1,2.8,4.7,1.2,"Iris-versicolor" +6.4,2.9,4.3,1.3,"Iris-versicolor" +6.6,3,4.4,1.4,"Iris-versicolor" +6.8,2.8,4.8,1.4,"Iris-versicolor" +6.7,3,5,1.7,"Iris-versicolor" +6,2.9,4.5,1.5,"Iris-versicolor" +5.7,2.6,3.5,1,"Iris-versicolor" +5.5,2.4,3.8,1.1,"Iris-versicolor" +5.5,2.4,3.7,1,"Iris-versicolor" +5.8,2.7,3.9,1.2,"Iris-versicolor" +6,2.7,5.1,1.6,"Iris-versicolor" +5.4,3,4.5,1.5,"Iris-versicolor" +6,3.4,4.5,1.6,"Iris-versicolor" +6.7,3.1,4.7,1.5,"Iris-versicolor" +6.3,2.3,4.4,1.3,"Iris-versicolor" +5.6,3,4.1,1.3,"Iris-versicolor" +5.5,2.5,4,1.3,"Iris-versicolor" +5.5,2.6,4.4,1.2,"Iris-versicolor" +6.1,3,4.6,1.4,"Iris-versicolor" +5.8,2.6,4,1.2,"Iris-versicolor" +5,2.3,3.3,1,"Iris-versicolor" +5.6,2.7,4.2,1.3,"Iris-versicolor" +5.7,3,4.2,1.2,"Iris-versicolor" +5.7,2.9,4.2,1.3,"Iris-versicolor" +6.2,2.9,4.3,1.3,"Iris-versicolor" +5.1,2.5,3,1.1,"Iris-versicolor" +5.7,2.8,4.1,1.3,"Iris-versicolor" +6.3,3.3,6,2.5,"Iris-virginica" +5.8,2.7,5.1,1.9,"Iris-virginica" +7.1,3,5.9,2.1,"Iris-virginica" +6.3,2.9,5.6,1.8,"Iris-virginica" +6.5,3,5.8,2.2,"Iris-virginica" +7.6,3,6.6,2.1,"Iris-virginica" +4.9,2.5,4.5,1.7,"Iris-virginica" +7.3,2.9,6.3,1.8,"Iris-virginica" +6.7,2.5,5.8,1.8,"Iris-virginica" +7.2,3.6,6.1,2.5,"Iris-virginica" +6.5,3.2,5.1,2,"Iris-virginica" +6.4,2.7,5.3,1.9,"Iris-virginica" +6.8,3,5.5,2.1,"Iris-virginica" +5.7,2.5,5,2,"Iris-virginica" +5.8,2.8,5.1,2.4,"Iris-virginica" +6.4,3.2,5.3,2.3,"Iris-virginica" +6.5,3,5.5,1.8,"Iris-virginica" +7.7,3.8,6.7,2.2,"Iris-virginica" +7.7,2.6,6.9,2.3,"Iris-virginica" +6,2.2,5,1.5,"Iris-virginica" +6.9,3.2,5.7,2.3,"Iris-virginica" +5.6,2.8,4.9,2,"Iris-virginica" +7.7,2.8,6.7,2,"Iris-virginica" +6.3,2.7,4.9,1.8,"Iris-virginica" +6.7,3.3,5.7,2.1,"Iris-virginica" +7.2,3.2,6,1.8,"Iris-virginica" +6.2,2.8,4.8,1.8,"Iris-virginica" +6.1,3,4.9,1.8,"Iris-virginica" +6.4,2.8,5.6,2.1,"Iris-virginica" +7.2,3,5.8,1.6,"Iris-virginica" +7.4,2.8,6.1,1.9,"Iris-virginica" +7.9,3.8,6.4,2,"Iris-virginica" +6.4,2.8,5.6,2.2,"Iris-virginica" +6.3,2.8,5.1,1.5,"Iris-virginica" +6.1,2.6,5.6,1.4,"Iris-virginica" +7.7,3,6.1,2.3,"Iris-virginica" +6.3,3.4,5.6,2.4,"Iris-virginica" +6.4,3.1,5.5,1.8,"Iris-virginica" +6,3,4.8,1.8,"Iris-virginica" +6.9,3.1,5.4,2.1,"Iris-virginica" +6.7,3.1,5.6,2.4,"Iris-virginica" +6.9,3.1,5.1,2.3,"Iris-virginica" +5.8,2.7,5.1,1.9,"Iris-virginica" +6.8,3.2,5.9,2.3,"Iris-virginica" +6.7,3.3,5.7,2.5,"Iris-virginica" +6.7,3,5.2,2.3,"Iris-virginica" +6.3,2.5,5,1.9,"Iris-virginica" +6.5,3,5.2,2,"Iris-virginica" +6.2,3.4,5.4,2.3,"Iris-virginica" +5.9,3,5.1,1.8,"Iris-virginica" diff --git a/exercises/02450Toolbox_Python/Data/iris.mat b/exercises/02450Toolbox_Python/Data/iris.mat new file mode 100644 index 0000000000000000000000000000000000000000..df9348acff144a45cf7a7dd899395741201c3829 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/iris.mat differ diff --git a/exercises/02450Toolbox_Python/Data/iris.xls b/exercises/02450Toolbox_Python/Data/iris.xls new file mode 100644 index 0000000000000000000000000000000000000000..0a3950140b342d9ee3de3bb285be5f2bb0625953 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/iris.xls differ diff --git a/exercises/02450Toolbox_Python/Data/male.txt b/exercises/02450Toolbox_Python/Data/male.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacce977f4f80fe6df231891486daa62acaeded5 --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/male.txt @@ -0,0 +1,2943 @@ +Aamir +Aaron +Abbey +Abbie +Abbot +Abbott +Abby +Abdel +Abdul +Abdulkarim +Abdullah +Abe +Abel +Abelard +Abner +Abraham +Abram +Ace +Adair +Adam +Adams +Addie +Adger +Aditya +Adlai +Adnan +Adolf +Adolfo +Adolph +Adolphe +Adolpho +Adolphus +Adrian +Adrick +Adrien +Agamemnon +Aguinaldo +Aguste +Agustin +Aharon +Ahmad +Ahmed +Ahmet +Ajai +Ajay +Al +Alaa +Alain +Alan +Alasdair +Alastair +Albatros +Albert +Alberto +Albrecht +Alden +Aldis +Aldo +Aldric +Aldrich +Aldus +Aldwin +Alec +Aleck +Alejandro +Aleks +Aleksandrs +Alessandro +Alex +Alexander +Alexei +Alexis +Alf +Alfie +Alfonse +Alfonso +Alfonzo +Alford +Alfred +Alfredo +Algernon +Ali +Alic +Alister +Alix +Allah +Allan +Allen +Alley +Allie +Allin +Allyn +Alonso +Alonzo +Aloysius +Alphonse +Alphonso +Alston +Alton +Alvin +Alwin +Amadeus +Ambros +Ambrose +Ambrosi +Ambrosio +Ambrosius +Amery +Amory +Amos +Anatol +Anatole +Anatollo +Anatoly +Anders +Andie +Andonis +Andre +Andrea +Andreas +Andrej +Andres +Andrew +Andrey +Andri +Andros +Andrus +Andrzej +Andy +Angel +Angelico +Angelo +Angie +Angus +Ansel +Ansell +Anselm +Anson +Anthony +Antin +Antoine +Anton +Antone +Antoni +Antonin +Antonino +Antonio +Antonius +Antony +Anurag +Apollo +Apostolos +Aram +Archibald +Archibold +Archie +Archon +Archy +Arel +Ari +Arie +Ariel +Aristotle +Arlo +Armand +Armando +Armond +Armstrong +Arne +Arnie +Arnold +Arnoldo +Aron +Arron +Art +Arther +Arthur +Artie +Artur +Arturo +Arvie +Arvin +Arvind +Arvy +Ash +Ashby +Ashish +Ashley +Ashton +Aub +Aube +Aubert +Aubrey +Augie +August +Augustin +Augustine +Augusto +Augustus +Austen +Austin +Ave +Averell +Averil +Averill +Avery +Avi +Avraham +Avram +Avrom +Axel +Aylmer +Aziz +Bailey +Bailie +Baillie +Baily +Baird +Baldwin +Bancroft +Barbabas +Barclay +Bard +Barde +Barn +Barnabas +Barnabe +Barnaby +Barnard +Barnebas +Barnett +Barney +Barnie +Barny +Baron +Barr +Barret +Barrett +Barri +Barrie +Barris +Barron +Barry +Bart +Bartel +Barth +Barthel +Bartholemy +Bartholomeo +Bartholomeus +Bartholomew +Bartie +Bartlet +Bartlett +Bartolemo +Bartolomei +Bartolomeo +Barton +Barty +Bary +Basil +Batholomew +Baxter +Bay +Bayard +Beale +Bealle +Bear +Bearnard +Beau +Beaufort +Beauregard +Beck +Bela +Ben +Benedict +Bengt +Benito +Benjamen +Benjamin +Benji +Benjie +Benjy +Benn +Bennet +Bennett +Bennie +Benny +Benson +Bentley +Benton +Beowulf +Berchtold +Berk +Berke +Berkeley +Berkie +Berkley +Bernard +Bernardo +Bernd +Bernhard +Bernie +Bert +Bertie +Bertram +Bertrand +Bharat +Biff +Bill +Billie +Billy +Bing +Binky +Bishop +Bjorn +Bjorne +Blaine +Blair +Blake +Blare +Blayne +Bo +Bob +Bobbie +Bobby +Bogart +Bogdan +Boniface +Boris +Boyce +Boyd +Brad +Braden +Bradford +Bradley +Bradly +Brady +Brandon +Brandy +Brant +Brendan +Brent +Bret +Brett +Brewer +Brewster +Brian +Brice +Briggs +Brinkley +Britt +Brock +Broddie +Broddy +Broderic +Broderick +Brodie +Brody +Bronson +Brook +Brooke +Brooks +Bruce +Bruno +Bryan +Bryant +Bryce +Bryn +Bryon +Bubba +Buck +Bucky +Bud +Buddy +Burgess +Burke +Burl +Burnaby +Burt +Burton +Buster +Butch +Butler +Byram +Byron +Caesar +Cain +Cal +Caldwell +Caleb +Calhoun +Calvin +Cam +Cameron +Cammy +Carey +Carl +Carleigh +Carlie +Carlin +Carlo +Carlos +Carlton +Carlyle +Carmine +Carroll +Carson +Carsten +Carter +Cary +Caryl +Case +Casey +Caspar +Casper +Cass +Cat +Cecil +Cesar +Chad +Chadd +Chaddie +Chaddy +Chadwick +Chaim +Chalmers +Chan +Chance +Chancey +Chanderjit +Chandler +Chane +Chariot +Charles +Charleton +Charley +Charlie +Charlton +Chas +Chase +Chaunce +Chauncey +Che +Chelton +Chen +Chester +Cheston +Chet +Chev +Chevalier +Chevy +Chip +Chris +Chrissy +Christ +Christian +Christiano +Christie +Christof +Christofer +Christoph +Christophe +Christopher +Christorpher +Christos +Christy +Chrisy +Chuck +Churchill +Clair +Claire +Clancy +Clarance +Clare +Clarence +Clark +Clarke +Claude +Claudio +Claudius +Claus +Clay +Clayborn +Clayborne +Claybourne +Clayton +Cleland +Clem +Clemens +Clement +Clemente +Clemmie +Cletus +Cleveland +Cliff +Clifford +Clifton +Clint +Clinten +Clinton +Clive +Clyde +Cob +Cobb +Cobbie +Cobby +Cody +Colbert +Cole +Coleman +Colin +Collin +Collins +Conan +Connie +Connolly +Connor +Conrad +Conroy +Constantin +Constantine +Constantinos +Conway +Cooper +Corbin +Corby +Corey +Corky +Cornelius +Cornellis +Corrie +Cortese +Corwin +Cory +Cosmo +Costa +Courtney +Craig +Crawford +Creighton +Cris +Cristopher +Curt +Curtice +Curtis +Cy +Cyril +Cyrill +Cyrille +Cyrillus +Cyrus +Dabney +Daffy +Dale +Dallas +Dalton +Damian +Damien +Damon +Dan +Dana +Dane +Dani +Danie +Daniel +Dannie +Danny +Dante +Darby +Darcy +Daren +Darian +Darien +Darin +Dario +Darius +Darrel +Darrell +Darren +Darrick +Darrin +Darryl +Darth +Darwin +Daryl +Daryle +Dave +Davey +David +Davidde +Davide +Davidson +Davie +Davin +Davis +Davon +Davoud +Davy +Dawson +Dean +Deane +Del +Delbert +Dell +Delmar +Demetre +Demetri +Demetris +Demetrius +Demosthenis +Denis +Dennie +Dennis +Denny +Derby +Derek +Derick +Derk +Derrek +Derrick +Derrin +Derrol +Derron +Deryl +Desmond +Desmund +Devin +Devon +Dewey +Dewitt +Dexter +Dick +Dickey +Dickie +Diego +Dieter +Dietrich +Dillon +Dimitri +Dimitrios +Dimitris +Dimitrou +Dimitry +Dino +Dion +Dionis +Dionysus +Dirk +Dmitri +Dom +Domenic +Domenico +Dominic +Dominick +Dominique +Don +Donal +Donald +Donn +Donnie +Donny +Donovan +Dorian +Dory +Doug +Douggie +Dougie +Douglas +Douglass +Douglis +Dov +Doyle +Drake +Drew +Dru +Dryke +Duane +Dudley +Duffie +Duffy +Dugan +Duke +Dunc +Duncan +Dunstan +Durand +Durant +Durante +Durward +Dustin +Dwain +Dwaine +Dwane +Dwayne +Dwight +Dylan +Dyson +Earl +Earle +Easton +Eben +Ebeneser +Ebenezer +Eberhard +Ed +Eddie +Eddy +Edgar +Edgardo +Edie +Edmond +Edmund +Edouard +Edsel +Eduard +Eduardo +Edward +Edwin +Efram +Egbert +Ehud +Elbert +Elden +Eldon +Eli +Elias +Elihu +Elijah +Eliot +Eliott +Elisha +Elliot +Elliott +Ellis +Ellsworth +Ellwood +Elmer +Elmore +Elnar +Elric +Elroy +Elton +Elvin +Elvis +Elwin +Elwood +Elwyn +Ely +Emanuel +Emerson +Emery +Emil +Emile +Emilio +Emmanuel +Emmery +Emmet +Emmett +Emmit +Emmott +Emmy +Emory +Ender +Engelbart +Engelbert +Englebart +Englebert +Enoch +Enrico +Enrique +Ephraim +Ephram +Ephrayim +Ephrem +Er +Erasmus +Erastus +Erek +Erhard +Erhart +Eric +Erich +Erick +Erik +Erin +Erl +Ernest +Ernesto +Ernie +Ernst +Erny +Errol +Ervin +Erwin +Esau +Esme +Esteban +Ethan +Ethelbert +Ethelred +Etienne +Euclid +Eugen +Eugene +Eustace +Ev +Evan +Evelyn +Everard +Everett +Ewan +Ewart +Ez +Ezechiel +Ezekiel +Ezra +Fabian +Fabio +Fairfax +Farley +Fazeel +Federico +Felice +Felicio +Felipe +Felix +Ferd +Ferdie +Ferdinand +Ferdy +Fergus +Ferguson +Ferinand +Fernando +Fidel +Filbert +Filip +Filipe +Filmore +Finley +Finn +Fitz +Fitzgerald +Flem +Fleming +Flemming +Fletch +Fletcher +Flin +Flinn +Flint +Flipper +Florian +Floyd +Flynn +Fons +Fonsie +Fonz +Fonzie +Forbes +Ford +Forest +Forester +Forrest +Forrester +Forster +Foster +Fowler +Fox +Fran +Francesco +Francis +Francisco +Francois +Frank +Frankie +Franklin +Franklyn +Franky +Frans +Franz +Fraser +Frazier +Fred +Freddie +Freddy +Frederic +Frederich +Frederick +Frederico +Frederik +Fredric +Fredrick +Freeman +Freemon +Fremont +French +Friedric +Friedrich +Friedrick +Fritz +Fulton +Fyodor +Gabe +Gabriel +Gabriele +Gabriell +Gabriello +Gail +Gale +Galen +Gallagher +Gamaliel +Garcia +Garcon +Gardener +Gardiner +Gardner +Garey +Garfield +Garfinkel +Garold +Garp +Garret +Garrett +Garrot +Garrott +Garry +Garth +Garv +Garvey +Garvin +Garvy +Garwin +Garwood +Gary +Gaspar +Gasper +Gaston +Gav +Gaven +Gavin +Gavriel +Gay +Gayle +Gearard +Gene +Geo +Geof +Geoff +Geoffrey +Geoffry +Georg +George +Georges +Georgia +Georgie +Georgy +Gerald +Geraldo +Gerard +Gere +Gerhard +Gerhardt +Geri +Germaine +Gerold +Gerome +Gerrard +Gerri +Gerrit +Gerry +Gershom +Gershon +Giacomo +Gian +Giancarlo +Giavani +Gibb +Gideon +Giff +Giffard +Giffer +Giffie +Gifford +Giffy +Gil +Gilbert +Gilberto +Gilburt +Giles +Gill +Gilles +Ginger +Gino +Giordano +Giorgi +Giorgio +Giovanne +Giovanni +Giraldo +Giraud +Giuseppe +Glen +Glenn +Glynn +Godard +Godart +Goddard +Goddart +Godfree +Godfrey +Godfry +Godwin +Gomer +Gonzales +Gonzalo +Goober +Goose +Gordan +Gordie +Gordon +Grace +Grady +Graehme +Graeme +Graham +Graig +Grant +Granville +Greg +Gregg +Greggory +Gregor +Gregorio +Gregory +Gretchen +Griff +Griffin +Griffith +Griswold +Grove +Grover +Guido +Guillaume +Guillermo +Gunner +Gunter +Gunther +Gus +Gustaf +Gustav +Gustave +Gustavo +Gustavus +Guthrey +Guthrie +Guthry +Guy +Hadleigh +Hadley +Hadrian +Hagan +Hagen +Hailey +Hakeem +Hakim +Hal +Hale +Haleigh +Haley +Hall +Hallam +Halvard +Ham +Hamel +Hamid +Hamil +Hamilton +Hamish +Hamlen +Hamlet +Hamlin +Hammad +Hamnet +Han +Hanan +Hanford +Hank +Hannibal +Hans +Hans-Peter +Hansel +Hanson +Harald +Harcourt +Hari +Harlan +Harland +Harley +Harlin +Harman +Harmon +Harold +Harris +Harrison +Harrold +Harry +Hart +Hartley +Hartwell +Harv +Harvard +Harvey +Harvie +Harwell +Hasheem +Hashim +Haskel +Haskell +Hassan +Hastings +Hasty +Haven +Hayden +Haydon +Hayes +Hayward +Haywood +Hazel +Heath +Heathcliff +Hebert +Hector +Heinrich +Heinz +Helmuth +Henderson +Hendrick +Hendrik +Henri +Henrie +Henrik +Henrique +Henry +Herb +Herbert +Herbie +Herby +Hercule +Hercules +Herculie +Herman +Hermann +Hermon +Hermy +Hernando +Herold +Herrick +Herrmann +Hersch +Herschel +Hersh +Hershel +Herve +Hervey +Hew +Hewe +Hewet +Hewett +Hewie +Hewitt +Heywood +Hezekiah +Higgins +Hilary +Hilbert +Hill +Hillard +Hillary +Hillel +Hillery +Hilliard +Hilton +Hiralal +Hiram +Hiro +Hirsch +Hobart +Hodge +Hogan +Hollis +Holly +Homer +Horace +Horacio +Horatio +Horatius +Horst +Howard +Howie +Hoyt +Hubert +Hudson +Huey +Hugh +Hugo +Humbert +Humphrey +Hunt +Hunter +Huntington +Huntlee +Huntley +Hurley +Husain +Husein +Hussein +Hy +Hyatt +Hyman +Hymie +Iago +Iain +Ian +Ibrahim +Ichabod +Iggie +Iggy +Ignace +Ignacio +Ignacius +Ignatius +Ignaz +Ignazio +Igor +Ike +Ikey +Immanuel +Ingamar +Ingelbert +Ingemar +Inglebert +Ingmar +Ingram +Inigo +Ira +Irvin +Irvine +Irving +Irwin +Isa +Isaac +Isaak +Isador +Isadore +Isaiah +Ishmael +Isidore +Ismail +Israel +Istvan +Ivan +Ivor +Izaak +Izak +Izzy +Jabez +Jack +Jackie +Jackson +Jacob +Jacques +Jae +Jaime +Jake +Jakob +James +Jameson +Jamey +Jamie +Jan +Janos +Janus +Jared +Jarrett +Jarvis +Jason +Jasper +Javier +Jay +Jean +Jean-Christophe +Jean-Francois +Jean-Lou +Jean-Luc +Jean-Marc +Jean-Paul +Jean-Pierre +Jeb +Jed +Jedediah +Jef +Jeff +Jefferey +Jefferson +Jeffery +Jeffie +Jeffrey +Jeffry +Jefry +Jehu +Jennings +Jens +Jephthah +Jerald +Jeramie +Jere +Jereme +Jeremiah +Jeremias +Jeremie +Jeremy +Jermain +Jermaine +Jermayne +Jerold +Jerome +Jeromy +Jerri +Jerrie +Jerrold +Jerrome +Jerry +Jervis +Jerzy +Jess +Jesse +Jessee +Jessey +Jessie +Jesus +Jeth +Jethro +Jim +Jimbo +Jimmie +Jimmy +Jo +Joab +Joachim +Joao +Joaquin +Job +Jock +Jodi +Jodie +Jody +Joe +Joel +Joey +Johan +Johann +Johannes +John +John-David +John-Patrick +Johnathan +Johnathon +Johnnie +Johnny +Johny +Jon +Jonah +Jonas +Jonathan +Jonathon +Jonny +Jordan +Jordon +Jordy +Jorge +Jory +Jose +Josef +Joseph +Josephus +Josh +Joshua +Joshuah +Josiah +Jotham +Juan +Juanita +Jud +Judah +Judas +Judd +Jude +Judith +Judson +Judy +Juergen +Jule +Jules +Julian +Julie +Julio +Julius +Justin +Justis +Kaiser +Kaleb +Kalil +Kalle +Kalman +Kalvin +Kam +Kane +Kareem +Karel +Karim +Karl +Karsten +Kaspar +Keefe +Keenan +Keene +Keil +Keith +Kellen +Kelley +Kelly +Kelsey +Kelvin +Kelwin +Ken +Kendal +Kendall +Kendrick +Kenn +Kennedy +Kenneth +Kenny +Kent +Kenton +Kenyon +Kermie +Kermit +Kerry +Kevan +Kevin +Kim +Kimball +Kimmo +Kin +Kincaid +King +Kingsley +Kingsly +Kingston +Kip +Kirby +Kirk +Kit +Klaus +Klee +Knox +Konrad +Konstantin +Kory +Kostas +Kraig +Kris +Krishna +Kristian +Kristopher +Kristos +Kurt +Kurtis +Kyle +Laird +Lamar +Lambert +Lamont +Lance +Lancelot +Lane +Langston +Lanny +Larry +Lars +Laurance +Lauren +Laurence +Laurens +Laurent +Laurie +Lawerence +Lawrence +Lawson +Lawton +Lay +Layton +Lazar +Lazare +Lazaro +Lazarus +Lazlo +Lee +Lefty +Leif +Leigh +Leighton +Leland +Lem +Lemar +Lemmie +Lemmy +Lemuel +Len +Lenard +Lennie +Lenny +Leo +Leon +Leonard +Leonardo +Leonerd +Leonhard +Leonid +Leonidas +Leopold +Leroy +Les +Lesley +Leslie +Lester +Lev +Levi +Levin +Levon +Levy +Lew +Lewis +Lex +Liam +Lin +Lincoln +Lind +Lindsay +Lindsey +Lindy +Linoel +Linus +Lion +Lionel +Lionello +Llewellyn +Lloyd +Locke +Lockwood +Logan +Lon +Lonnie +Lonny +Loren +Lorenzo +Lorne +Lorrie +Lothar +Lou +Louie +Louis +Lovell +Lowell +Lucas +Luce +Lucian +Luciano +Lucien +Lucio +Lucius +Ludvig +Ludwig +Luigi +Luis +Lukas +Luke +Luther +Lyle +Lyn +Lyndon +Lynn +Mac +Mace +Mack +Mackenzie +Maddie +Maddy +Madison +Magnum +Magnus +Mahesh +Mahmoud +Mahmud +Maison +Major +Malcolm +Manfred +Manish +Manny +Manuel +Marc +Marcel +Marcello +Marcellus +Marcelo +Marchall +Marcio +Marco +Marcos +Marcus +Marietta +Marilu +Mario +Marion +Marius +Mark +Marko +Markos +Markus +Marlin +Marlo +Marlon +Marlow +Marlowe +Marmaduke +Marsh +Marshal +Marshall +Mart +Martainn +Marten +Martie +Martin +Martino +Marty +Martyn +Marv +Marve +Marven +Marvin +Marwin +Mason +Mateo +Mathew +Mathias +Matias +Matt +Matteo +Matthaeus +Mattheus +Matthew +Matthias +Matthieu +Matthiew +Matthus +Mattias +Mattie +Matty +Maurice +Mauricio +Maurie +Maurise +Maurits +Mauritz +Maury +Max +Maxfield +Maxie +Maxim +Maximilian +Maximilien +Maxwell +Mayer +Maynard +Maynord +Mayor +Mead +Meade +Meier +Meir +Mel +Melvin +Melvyn +Menard +Mendel +Mendie +Meredeth +Meredith +Merell +Merill +Merle +Merlin +Merrel +Merrick +Merril +Merrill +Merry +Merv +Mervin +Merwin +Meryl +Meyer +Mic +Micah +Michael +Michail +Michal +Michale +Micheal +Micheil +Michel +Michele +Mick +Mickey +Mickie +Micky +Miguel +Mika +Mikael +Mike +Mikel +Mikey +Mikhail +Miles +Millicent +Milo +Milt +Milton +Mischa +Mitch +Mitchael +Mitchel +Mitchell +Moe +Mohamad +Mohamed +Mohammad +Mohammed +Mohan +Moise +Moises +Moishe +Monroe +Montague +Monte +Montgomery +Monty +Moore +Mordecai +Morgan +Morlee +Morley +Morly +Morrie +Morris +Morry +Morse +Mort +Morten +Mortie +Mortimer +Morton +Morty +Mose +Moses +Moshe +Moss +Muffin +Mugsy +Muhammad +Munmro +Munroe +Murdoch +Murdock +Murphy +Murray +Mustafa +Myke +Myles +Mylo +Myron +Nahum +Napoleon +Nat +Natale +Nate +Nathan +Nathanael +Nathanial +Nathaniel +Nathanil +Neal +Neale +Neall +Nealon +Nealson +Nealy +Ned +Neddie +Neddy +Neel +Neil +Nels +Nelsen +Nelson +Nero +Neron +Nester +Nestor +Nev +Nevil +Nevile +Neville +Nevin +Nevins +Newton +Niall +Niccolo +Nicholas +Nichole +Nichols +Nick +Nickey +Nickie +Nickolas +Nicky +Nico +Nicolas +Niels +Nigel +Niki +Nikita +Nikki +Nikolai +Nikos +Niles +Nils +Nilson +Niven +Noach +Noah +Noam +Noble +Noe +Noel +Nolan +Noland +Norbert +Norm +Norman +Normand +Normie +Norris +Northrop +Northrup +Norton +Norwood +Nunzio +Obadiah +Obadias +Oberon +Obie +Octavius +Odell +Odie +Odin +Odysseus +Olaf +Olag +Ole +Oleg +Olin +Oliver +Olivier +Olle +Ollie +Omar +Oral +Oran +Orazio +Orbadiah +Oren +Orin +Orion +Orlando +Orren +Orrin +Orson +Orton +Orville +Osbert +Osborn +Osborne +Osbourn +Osbourne +Oscar +Osgood +Osmond +Osmund +Ossie +Oswald +Oswell +Otes +Othello +Otho +Otis +Otto +Owen +Ozzie +Ozzy +Pablo +Pace +Paco +Paddie +Paddy +Padraig +Page +Paige +Pail +Palmer +Paolo +Park +Parke +Parker +Parnell +Parrnell +Parry +Parsifal +Partha +Pascal +Pascale +Pasquale +Pat +Pate +Patel +Paten +Patin +Paton +Patric +Patrice +Patricio +Patrick +Patrik +Patsy +Pattie +Patty +Paul +Paulo +Pavel +Pearce +Pedro +Peirce +Pembroke +Pen +Penn +Pennie +Penny +Penrod +Pepe +Pepillo +Pepito +Perceval +Percival +Percy +Perry +Pete +Peter +Petey +Petr +Peyter +Peyton +Phil +Philbert +Philip +Phillip +Phillipe +Phillipp +Phineas +Phip +Pierce +Pierre +Pierson +Piet +Pieter +Pietro +Piggy +Pincas +Pinchas +Pincus +Piotr +Pip +Plato +Pooh +Porter +Poul +Powell +Praneetf +Prasad +Prasun +Prent +Prentice +Prentiss +Prescott +Preston +Price +Prince +Pryce +Puff +Purcell +Putnam +Pyotr +Quent +Quentin +Quiggly +Quigly +Quigman +Quill +Quillan +Quincey +Quincy +Quinlan +Quinn +Quint +Quintin +Quinton +Quintus +Rab +Rabbi +Rabi +Rad +Radcliffe +Rafael +Rafe +Ragnar +Rahul +Raimund +Rainer +Raj +Rajeev +Raleigh +Ralf +Ralph +Ram +Ramesh +Ramon +Ramsay +Ramsey +Rand +Randal +Randall +Randell +Randi +Randie +Randolf +Randolph +Randy +Ransell +Ransom +Raoul +Raphael +Raul +Ravi +Ravil +Rawley +Ray +Raymond +Raymund +Raymundo +Raynard +Rayner +Raynor +Reagan +Red +Redford +Redmond +Reece +Reed +Rees +Reese +Reg +Regan +Regen +Reggie +Reggis +Reggy +Reginald +Reginauld +Reid +Reilly +Reinhard +Reinhold +Rem +Remington +Remus +Renado +Renaldo +Renard +Renato +Renaud +Renault +Rene +Reube +Reuben +Reuven +Rex +Rey +Reynard +Reynold +Reynolds +Reza +Rhett +Ric +Ricard +Ricardo +Riccardo +Rice +Rich +Richard +Richardo +Richie +Richmond +Richy +Rick +Rickard +Rickey +Ricki +Rickie +Ricky +Rik +Rikki +Riley +Rinaldo +Ripley +Ritch +Ritchie +Roarke +Rob +Robb +Robbert +Robbie +Robert +Roberto +Robin +Robinson +Rochester +Rock +Rockwell +Rocky +Rod +Rodd +Roddie +Roddy +Roderic +Roderich +Roderick +Roderigo +Rodge +Rodger +Rodney +Rodolfo +Rodolph +Rodolphe +Rodrick +Rodrigo +Rodrique +Rog +Roger +Rogers +Roice +Roland +Rolando +Rolf +Rolfe +Rolland +Rollin +Rollins +Rollo +Rolph +Romain +Roman +Romeo +Ron +Ronald +Ronen +Roni +Ronnie +Ronny +Roosevelt +Rory +Roscoe +Ross +Roth +Rourke +Rowland +Roy +Royal +Royce +Rube +Ruben +Rubin +Ruby +Rudd +Ruddie +Ruddy +Rudie +Rudiger +Rudolf +Rudolfo +Rudolph +Rudy +Rudyard +Rufe +Rufus +Rupert +Ruperto +Russ +Russel +Russell +Rustie +Rustin +Rusty +Rutger +Rutherford +Rutledge +Rutter +Ryan +Sal +Salem +Salim +Salman +Salmon +Salomo +Salomon +Salomone +Salvador +Salvatore +Salvidor +Sam +Sammie +Sammy +Sampson +Samson +Samuel +Samuele +Sancho +Sander +Sanders +Sanderson +Sandor +Sandro +Sandy +Sanford +Sanson +Sansone +Sarge +Sargent +Sascha +Sasha +Saul +Sauncho +Saunder +Saunders +Saunderson +Saundra +Saw +Sawyer +Sawyere +Sax +Saxe +Saxon +Say +Sayer +Sayers +Sayre +Sayres +Scarface +Schroeder +Schuyler +Scot +Scott +Scotti +Scottie +Scotty +Seamus +Sean +Sebastian +Sebastiano +Sebastien +See +Selby +Selig +Serge +Sergeant +Sergei +Sergent +Sergio +Seth +Seymour +Shadow +Shaine +Shalom +Shamus +Shanan +Shane +Shannan +Shannon +Shaughn +Shaun +Shaw +Shawn +Shay +Shayne +Shea +Sheff +Sheffie +Sheffield +Sheffy +Shelby +Shelden +Sheldon +Shell +Shelley +Shelton +Shem +Shep +Shepard +Shepherd +Sheppard +Shepperd +Sheridan +Sherlock +Sherlocke +Sherman +Sherwin +Sherwood +Sherwynd +Shimon +Shlomo +Sholom +Shorty +Shumeet +Shurlock +Shurlocke +Shurwood +Si +Sibyl +Sid +Siddhartha +Sidnee +Sidney +Siegfried +Siffre +Sig +Sigfrid +Sigfried +Sigmund +Silas +Silvain +Silvan +Silvano +Silvanus +Silvester +Silvio +Sim +Simeon +Simmonds +Simon +Simone +Sinclair +Sinclare +Sivert +Siward +Skell +Skelly +Skip +Skipp +Skipper +Skippie +Skippy +Skipton +Sky +Skye +Skylar +Skyler +Slade +Slim +Sloan +Sloane +Sly +Smith +Smitty +Socrates +Sol +Sollie +Solly +Solomon +Somerset +Son +Sonnie +Sonny +Sparky +Spence +Spencer +Spense +Spenser +Spike +Spiro +Spiros +Spud +Srinivas +Stacy +Staffard +Stafford +Staford +Stan +Standford +Stanfield +Stanford +Stanislaw +Stanleigh +Stanley +Stanly +Stanton +Stanwood +Stavros +Stearn +Stearne +Stefan +Stefano +Steffen +Stephan +Stephanus +Stephen +Sterling +Stern +Sterne +Steve +Steven +Stevie +Stevy +Stew +Steward +Stewart +Stig +Stillman +Stillmann +Sting +Stinky +Stirling +Stu +Stuart +Sturgis +Sullivan +Sully +Sumner +Sunny +Sutherland +Sutton +Sven +Swen +Syd +Sydney +Sylvan +Sylvester +Tab +Tabb +Tabbie +Tabby +Taber +Tabor +Tad +Tadd +Taddeo +Taddeus +Tadeas +Tailor +Tait +Taite +Talbert +Talbot +Tallie +Tally +Tam +Tamas +Tammie +Tammy +Tan +Tann +Tanner +Tanney +Tannie +Tanny +Tarrance +Tarrant +Tarzan +Tate +Taylor +Teador +Ted +Tedd +Teddie +Teddy +Tedie +Tedman +Tedmund +Tedrick +Temp +Temple +Templeton +Teodoor +Teodor +Teodorico +Teodoro +Terence +Terencio +Terrance +Terrel +Terrell +Terrence +Terri +Terrill +Terry +Thacher +Thad +Thaddeus +Thaddius +Thaddus +Thadeus +Thain +Thaine +Thane +Tharen +Thatch +Thatcher +Thaxter +Thayne +Thebault +Thedric +Thedrick +Theo +Theobald +Theodor +Theodore +Theodoric +Theophyllus +Thibaud +Thibaut +Thom +Thomas +Thor +Thorn +Thorndike +Thornie +Thornton +Thorny +Thorpe +Thorstein +Thorsten +Thorvald +Thurstan +Thurston +Tibold +Tiebold +Tiebout +Tiler +Tim +Timmie +Timmy +Timothee +Timotheus +Timothy +Tirrell +Tito +Titos +Titus +Tobe +Tobiah +Tobias +Tobie +Tobin +Tobit +Toby +Tod +Todd +Toddie +Toddy +Tom +Tomas +Tome +Tomkin +Tomlin +Tommie +Tommy +Tonnie +Tony +Tore +Torey +Torin +Torr +Torrance +Torre +Torrence +Torrey +Torrin +Torry +Town +Towney +Townie +Townsend +Towny +Trace +Tracey +Tracie +Tracy +Traver +Travers +Travis +Tray +Tre +Tremain +Tremaine +Tremayne +Trent +Trenton +Trev +Trevar +Trever +Trevor +Trey +Trip +Tristan +Troy +Truman +Tuck +Tucker +Tuckie +Tucky +Tudor +Tull +Tulley +Tully +Turner +Ty +Tybalt +Tye +Tyler +Tymon +Tymothy +Tynan +Tyrone +Tyrus +Tyson +Udale +Udall +Udell +Ugo +Ulberto +Uli +Ulick +Ulises +Ulric +Ulrich +Ulrick +Ulysses +Umberto +Upton +Urbain +Urban +Urbano +Urbanus +Uri +Uriah +Uriel +Urson +Vachel +Vaclav +Vail +Val +Valdemar +Vale +Valentin +Valentine +Van +Vance +Vasili +Vasilis +Vasily +Vassili +Vassily +Vaughan +Vaughn +Venkat +Verge +Vergil +Vern +Verne +Vernen +Verney +Vernon +Vernor +Vibhu +Vic +Vick +Victor +Vijay +Vilhelm +Vin +Vince +Vincent +Vincents +Vinnie +Vinny +Vinod +Virge +Virgie +Virgil +Virgilio +Vite +Vito +Vlad +Vladamir +Vladimir +Voltaire +Von +Wade +Wadsworth +Wain +Waine +Wainwright +Wait +Waite +Waiter +Wake +Wakefield +Wald +Waldemar +Walden +Waldo +Waldon +Waleed +Walker +Wallace +Wallache +Wallas +Wallie +Wallis +Wally +Walsh +Walt +Walter +Walther +Walton +Wang +Ward +Warde +Warden +Ware +Waring +Warner +Warren +Wash +Washington +Wat +Waverley +Waverly +Way +Waylan +Wayland +Waylen +Waylin +Waylon +Wayne +Web +Webb +Weber +Webster +Weidar +Weider +Welbie +Welby +Welch +Wells +Welsh +Wendall +Wendel +Wendell +Werner +Wes +Wesley +Weslie +West +Westbrook +Westbrooke +Westleigh +Westley +Weston +Weylin +Wheeler +Whit +Whitaker +Whitby +Whitman +Whitney +Whittaker +Wiatt +Wilber +Wilbert +Wilbur +Wilburn +Wilburt +Wilden +Wildon +Wilek +Wiley +Wilfred +Wilfrid +Wilhelm +Will +Willard +Willdon +Willem +Willey +Willi +William +Willie +Willis +Willmott +Willy +Wilmar +Wilmer +Wilson +Wilt +Wilton +Win +Windham +Winfield +Winford +Winfred +Winifield +Winn +Winnie +Winny +Winslow +Winston +Winthrop +Winton +Wit +Witold +Wittie +Witty +Wojciech +Wolf +Wolfgang +Wolfie +Wolfram +Wolfy +Woochang +Wood +Woodie +Woodman +Woodrow +Woody +Worden +Worth +Worthington +Worthy +Wright +Wyatan +Wyatt +Wye +Wylie +Wyn +Wyndham +Wynn +Wynton +Xavier +Xenos +Xerxes +Xever +Ximenes +Ximenez +Xymenes +Yaakov +Yacov +Yale +Yanaton +Yance +Yancey +Yancy +Yank +Yankee +Yard +Yardley +Yehudi +Yigal +Yule +Yuri +Yves +Zach +Zacharia +Zachariah +Zacharias +Zacharie +Zachary +Zacherie +Zachery +Zack +Zackariah +Zak +Zalman +Zane +Zared +Zary +Zeb +Zebadiah +Zebedee +Zebulen +Zebulon +Zechariah +Zed +Zedekiah +Zeke +Zelig +Zerk +Zeus +Zippy +Zollie +Zolly +Zorro diff --git a/exercises/02450Toolbox_Python/Data/messy_data/README.txt b/exercises/02450Toolbox_Python/Data/messy_data/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5e842207f409b4e9e16496eaaf9ff590964932c --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/messy_data/README.txt @@ -0,0 +1,70 @@ +*************************************************************************** +*************************************************************************** +*** messy_data *** +*************************************************************************** +*************************************************************************** +This dataset is an adaption of an existing dataset to highlight some common +issues (or variants of them) that one might face across various datasets. +This is not real data, but is based on values from the Auto-Mpg Data. +The original data was obtained from: + https://archive.ics.uci.edu/ml/datasets/auto+mpg +but was modified to include some formatting issues as well as removing some +values. +Missing values in the original dataset were sometimes denoted +with a question mark. Some missing values were introduced, too. +Specifically zeroes in the attributes mpg and displacement can be +considered missing values. + +For reference, the description of the original dataset is provided below. + +*************************************************************************** +*************************************************************************** +*** Original dataset description *** +*************************************************************************** +*************************************************************************** +1. Title: Auto-Mpg Data + +2. Sources: + (a) Origin: This dataset was taken from the StatLib library which is + maintained at Carnegie Mellon University. The dataset was + used in the 1983 American Statistical Association Exposition. + (c) Date: July 7, 1993 + +3. Past Usage: + - See 2b (above) + - Quinlan,R. (1993). Combining Instance-Based and Model-Based Learning. + In Proceedings on the Tenth International Conference of Machine + Learning, 236-243, University of Massachusetts, Amherst. Morgan + Kaufmann. + +4. Relevant Information: + + This dataset is a slightly modified version of the dataset provided in + the StatLib library. In line with the use by Ross Quinlan (1993) in + predicting the attribute "mpg", 8 of the original instances were removed + because they had unknown values for the "mpg" attribute. The original + dataset is available in the file "auto-mpg.data-original". + + "The data concerns city-cycle fuel consumption in miles per gallon, + to be predicted in terms of 3 multivalued discrete and 5 continuous + attributes." (Quinlan, 1993) + +5. Number of Instances: 398 + +6. Number of Attributes: 9 including the class attribute + +7. Attribute Information: + + 1. mpg: continuous + 2. cylinders: multi-valued discrete + 3. displacement: continuous + 4. horsepower: continuous + 5. weight: continuous + 6. acceleration: continuous + 7. model year: multi-valued discrete + 8. origin: multi-valued discrete + 9. car name: string (unique for each instance) + +8. Missing Attribute Values: horsepower has 6 missing values + + diff --git a/exercises/02450Toolbox_Python/Data/messy_data/messy_data.data b/exercises/02450Toolbox_Python/Data/messy_data/messy_data.data new file mode 100644 index 0000000000000000000000000000000000000000..f62d8f48d5f6682e03b68e209c73ce99b0b4bf13 --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/messy_data/messy_data.data @@ -0,0 +1,33 @@ +messy_data +mpg cylinders displacement horsepower weight acceleration modelyear origin carname +mpg cyl disp hp w acc yr org name +18 8 ? 130 3'504 12.0 70 1 chevrolet chevelle malibu +15 8 350 165 3'693 11,5 70 1 buick skylark 320 +18 8 ? 150 3'436 11.0 70 1 plymouth satellite +16 8 ? 150 3'433 12.0 70 1 amc rebel sst +17 8 0 140 3'449 10,5 70 1 ford torino +15 8 429 198 4'341 10.0 70 1 ford galaxie 500 +14 8 454 220 4'354 9.0 70 1 chevrolet impala +14 8 ? 215 4312 8,5 70 1 plymouth fury iii +14 8 455 225 4425 10.0 70 1 pontiac catalina +15 8 390 190 3'850 8,5 70 1 amc ambassador dpl +15 8 0 170 3'563 10.0 70 1 dodge challenger se +14 8 ? 160 3'609 8.0 70 1 plymouth 'cuda 340 +99 8 ? 150 3'761 9,5 70 1 chevrolet monte carlo +14 8 ? 225 3'086 10.0 70 1 buick estate wagon (sw) +24 4 113 95 2'372 15.0 70 3 toyota corona mark ii +22 6 95 2'833 15,5 70 1 plymouth duster +0 6 199 97 2'774 15,5 70 1 amc hornet +21 6 ? 85 2'587 16.0 70 1 ford maverick +27 4 97 88 2'130 14,5 70 3 datsun pl510 +26 4 46 1'835 20,5 70 2 volkswagen 1131 deluxe sedan +33 4 105 74 2190 14.2 81 2 volkswagen jetta +33.7 4 107 75 2210 14.4 81 3 honda prelude +32.4 4 108 75 2350 16.8 81 3 toyota corolla +32.9 4 119 100 2615 14.8 81 3 datsun 200sx +31.6 4 120 74 2635 18.3 81 3 mazda 626 +28.1 4 141 80 3'230 20.4 81 2 peugeot 505s turbo diesel +30.7 6 145 76 3'160 19.6 81 2 volvo diesel +0 6 168 116 2'900 12.6 81 3 toyota cressida +24.2 6 146 120 2'930 13.8 81 3 datsun 810 maxima + diff --git a/exercises/02450Toolbox_Python/Data/nanonose.xls b/exercises/02450Toolbox_Python/Data/nanonose.xls new file mode 100644 index 0000000000000000000000000000000000000000..e13e95be533adaa8792bd648f8b1e020f8684e9e Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/nanonose.xls differ diff --git a/exercises/02450Toolbox_Python/Data/readme_male_female_data.txt b/exercises/02450Toolbox_Python/Data/readme_male_female_data.txt new file mode 100644 index 0000000000000000000000000000000000000000..19518acc6c787f993164f4e4254069f90c1cd637 --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/readme_male_female_data.txt @@ -0,0 +1,12 @@ +You may use the lists of names for any purpose, so long as credit is given +in any published work. You may also redistribute the list if you +provide the recipients with a copy of this README file. The lists are +not in the public domain (I retain the copyright on the lists) but are +freely redistributable. + +If you have any additions to the lists of names, I would appreciate +receiving them. + +My email address is mkant+@cs.cmu.edu. + +Mark Kantrowitz diff --git a/exercises/02450Toolbox_Python/Data/stopWords.txt b/exercises/02450Toolbox_Python/Data/stopWords.txt new file mode 100644 index 0000000000000000000000000000000000000000..2d40fc0238119eaf8c9d2b86c3e7cb9f5e920c1e --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/stopWords.txt @@ -0,0 +1,439 @@ +a +about +above +accordingly +across +after +afterwards +again +against +all +allows +almost +alone +along +already +also +although +always +am +among +amongst +an +and +another +any +anybody +anyhow +anyone +anything +anywhere +apart +appear +appropriate +are +around +as +aside +associated +at +available +away +awfully +b +back +be +became +because +become +becomes +becoming +been +before +beforehand +behind +being +below +beside +besides +best +better +between +beyond +both +brief +but +by +c +came +can +cannot +cant +cause +causes +certain +changes +co +come +consequently +contain +containing +contains +corresponding +could +currently +d +day +described +did +different +do +does +doing +done +down +downwards +during +e +each +eg +eight +either +else +elsewhere +enough +et +etc +even +ever +every +everybody +everyone +everything +everywhere +ex +example +except +f +far +few +fifth +first +five +followed +following +for +former +formerly +forth +four +from +further +furthermore +g +get +gets +given +gives +go +gone +good +got +great +h +had +hardly +has +have +having +he +hence +her +here +hereafter +hereby +herein +hereupon +hers +herself +him +himself +his +hither +how +howbeit +however +i +ie +if +ignored +immediate +in +inasmuch +inc +indeed +indicate +indicated +indicates +inner +insofar +instead +into +inward +is +it +its +itself +j +just +k +keep +kept +know +l +last +latter +latterly +least +less +lest +life +like +little +long +ltd +m +made +make +man +many +may +me +meanwhile +men +might +more +moreover +most +mostly +mr +much +must +my +myself +n +name +namely +near +necessary +neither +never +nevertheless +new +next +nine +no +nobody +none +noone +nor +normally +not +nothing +novel +now +nowhere +o +of +off +often +oh +old +on +once +one +ones +only +onto +or +other +others +otherwise +ought +our +ours +ourselves +out +outside +over +overall +own +p +particular +particularly +people +per +perhaps +placed +please +plus +possible +probably +provides +q +que +quite +r +rather +really +relatively +respectively +right +s +said +same +second +secondly +see +seem +seemed +seeming +seems +self +selves +sensible +sent +serious +seven +several +shall +she +should +since +six +so +some +somebody +somehow +someone +something +sometime +sometimes +somewhat +somewhere +specified +specify +specifying +state +still +sub +such +sup +t +take +taken +than +that +the +their +theirs +them +themselves +then +thence +there +thereafter +thereby +therefore +therein +thereupon +these +they +third +this +thorough +thoroughly +those +though +three +through +throughout +thru +thus +time +to +together +too +toward +towards +twice +two +u +under +unless +until +unto +up +upon +us +use +used +useful +uses +using +usually +v +value +various +very +via +viz +vs +w +was +way +we +well +went +were +what +whatever +when +whence +whenever +where +whereafter +whereas +whereby +wherein +whereupon +wherever +whether +which +while +whither +who +whoever +whole +whom +whose +why +will +with +within +without +work +world +would +x +y +year +years +yet +you +your +yours +yourself +yourselves +z +zero \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Data/synth1.mat b/exercises/02450Toolbox_Python/Data/synth1.mat new file mode 100644 index 0000000000000000000000000000000000000000..4eb623f831660cf7dbb0a655fc03ebb023b11442 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/synth1.mat differ diff --git a/exercises/02450Toolbox_Python/Data/synth2.mat b/exercises/02450Toolbox_Python/Data/synth2.mat new file mode 100644 index 0000000000000000000000000000000000000000..99838d2eb7e3a60799dbb54dfc5a98db5b6fc8aa Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/synth2.mat differ diff --git a/exercises/02450Toolbox_Python/Data/synth3.mat b/exercises/02450Toolbox_Python/Data/synth3.mat new file mode 100644 index 0000000000000000000000000000000000000000..adefbcfc4075497a710c1e90fa65e4933fc02f9e Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/synth3.mat differ diff --git a/exercises/02450Toolbox_Python/Data/synth4.mat b/exercises/02450Toolbox_Python/Data/synth4.mat new file mode 100644 index 0000000000000000000000000000000000000000..8a445f9c8fe5bb16f82b4312d2cb5e8051022c29 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/synth4.mat differ diff --git a/exercises/02450Toolbox_Python/Data/synth5.mat b/exercises/02450Toolbox_Python/Data/synth5.mat new file mode 100644 index 0000000000000000000000000000000000000000..e36f9391ba3707db3773a38ee5057fbaf3807424 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/synth5.mat differ diff --git a/exercises/02450Toolbox_Python/Data/synth6.mat b/exercises/02450Toolbox_Python/Data/synth6.mat new file mode 100644 index 0000000000000000000000000000000000000000..3857ca1a9eff1a851e14746d63ea0b6522d961c6 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/synth6.mat differ diff --git a/exercises/02450Toolbox_Python/Data/synth7.mat b/exercises/02450Toolbox_Python/Data/synth7.mat new file mode 100644 index 0000000000000000000000000000000000000000..1b421f60e9099fa77dcb3b9431f91a0587af016e Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/synth7.mat differ diff --git a/exercises/02450Toolbox_Python/Data/textDocs.txt b/exercises/02450Toolbox_Python/Data/textDocs.txt new file mode 100644 index 0000000000000000000000000000000000000000..774880a8da78e7101ff3aaef5f76bd9487b34771 --- /dev/null +++ b/exercises/02450Toolbox_Python/Data/textDocs.txt @@ -0,0 +1,13 @@ +The Google matrix P is a model of the internet + + +P_ij is nonzero if there is a link from webpage i to j + + +The Google matrix is used to rank all Web pages + + +The ranking is done by solving a matrix eigenvalue problem + + +England dropped out of the top 10 in the FIFA ranking \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Data/wildfaces.mat b/exercises/02450Toolbox_Python/Data/wildfaces.mat new file mode 100644 index 0000000000000000000000000000000000000000..1f5894a43da3a0b7c7549d8937968a6488f8ca92 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/wildfaces.mat differ diff --git a/exercises/02450Toolbox_Python/Data/wildfaces_grayscale.mat b/exercises/02450Toolbox_Python/Data/wildfaces_grayscale.mat new file mode 100644 index 0000000000000000000000000000000000000000..bcab41e4da0ed2d6b988ed73eff4eb15b6408c2f Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/wildfaces_grayscale.mat differ diff --git a/exercises/02450Toolbox_Python/Data/wine.mat b/exercises/02450Toolbox_Python/Data/wine.mat new file mode 100644 index 0000000000000000000000000000000000000000..3951017853d00623d8e761b42ae6dee9f222b05b Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/wine.mat differ diff --git a/exercises/02450Toolbox_Python/Data/wine2.mat b/exercises/02450Toolbox_Python/Data/wine2.mat new file mode 100644 index 0000000000000000000000000000000000000000..c6851a61390f2cdc3c694654aededa5761d78cd2 Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/wine2.mat differ diff --git a/exercises/02450Toolbox_Python/Data/xor.mat b/exercises/02450Toolbox_Python/Data/xor.mat new file mode 100644 index 0000000000000000000000000000000000000000..ffef7df14ee096007810041e7efa42ea0f7f98da Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/xor.mat differ diff --git a/exercises/02450Toolbox_Python/Data/zipdata.mat b/exercises/02450Toolbox_Python/Data/zipdata.mat new file mode 100644 index 0000000000000000000000000000000000000000..a98e79614d23893b45b1bb554f82db03b59a98ad Binary files /dev/null and b/exercises/02450Toolbox_Python/Data/zipdata.mat differ diff --git a/exercises/02450Toolbox_Python/LICENSE b/exercises/02450Toolbox_Python/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..c02458dc86c93dc5fa81414b87288ab6d41cec60 --- /dev/null +++ b/exercises/02450Toolbox_Python/LICENSE @@ -0,0 +1,20 @@ +LICENSE + +This repository contains code for the course 02450 Introduction to Machine Learning and Data Mining at the Technical +University of Denmark (DTU). + +Some of the code, data and functions used in this repository comes from other sources and the licensing terms are as +indicated in the relevant files or referenced packages. + +All material including software are intended for research and educational purpose. Any sale or commercial distribution +is strictly forbidden, unless the Department of Applied Mathematics and Computer Science, the Technical University of D +enmark (DTU Compute) has given explicit written permission. + +The material including software is provided "as-is". Support is generally not available. No warranties of any kind, +express or implied, are made as to it or any medium it may be on. No remedy will be provided for indirect, +consequential, punitive or incidental damages arising from it, including such from negligence, strict liability, +or breach of warranty or contract, even after notice of the possibility of such damages. + +Inquiries about licensing can be made to the Cognitive System Section, DTU Compute, http://cogsys.compute.dtu.dk + +The material is not for redistribution. diff --git a/exercises/02450Toolbox_Python/README.md b/exercises/02450Toolbox_Python/README.md new file mode 100644 index 0000000000000000000000000000000000000000..319d3b2fbfff3dd6a00d1cb3cffe158579645c5b --- /dev/null +++ b/exercises/02450Toolbox_Python/README.md @@ -0,0 +1,62 @@ +# 02450 Toolbox - Python + +## Installation +The exercise scriprs foudn depend on a + +TODO: To be completed +TODO: Virtual envs + +pip install 02450toolbox +import toolbox_02450 + + +## Dataset +Description of the datasets in the Data folder: + +body.mat +This is a subset of the dataset on body dimenstions available at http://www.sci.usq.edu.au/courses/STA3301/resources/Data/ +and described in +G. Heinz, L. J. Peterson, R. W. Johnson, and C. J. Kerk, “Exploring relationships in body dimensions,” Journal of Statistics Education, vol. 11, no. 2, 2003. + +faithful.mat and faithful.txt +Dataset on eruption of the Old Faithful geyser described in +A. Azzalini and A. Bowman, “A look at some data on the old faithful geyser,” Applied Statistics, pp. 357–365, 1990. +W. Härdle, Smoothing techniques: with implementation in S. Springer, 1991 + +female.txt and male.txt +Data is taken from http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/areas/nlp/corpora/names/, +Please consult the accompanying readme_male_female.txt file in the Data folder. + +iris.xls +Fisher's Iris data, for a description see also http://en.wikipedia.org/wiki/Iris_flower_data_set. The data has been downloaded from http://archive.ics.uci.edu/ml/datasets/Iris. + +nanonose.xls +This data has been taken from the nanonose project, see also http://www.nanonose.dk, it is described in +T. S. Alstrøm, J. Larsen, C. H. Nielsen, and N. B. Larsen, “Data-driven modeling of nano-nose gas sensor arrays,” in SPIE Defense, Security, and Sensing. International Society for Optics and Photonics, 2010, pp. 76 970U–76 970U. + +StopWords +A txt file of list of common words provided in the TMG toolbox. + +textDocs.txt +This example of documents for a term-document matrix is taken from +L. Eldén, Matrix Methods in Data Mining and Pattern Recognition. Philadelphia, PA, USA: Society for Industrial and Applied Mathematics, 2007. + +Wine.mat and Wine2.mat +P. Cortez, A. Cerdeira, F. Almeida, T. Matos, and J. Reis. Modeling wine preferences by data mining from physicochemical properties. In Decision Support Systems, Elsevier, 47(4):547–553, 2009. +downloaded from http://archive.ics.uci.edu/ml/datasets/Wine+Quality +Wine2 is same as Wine but with some outliers removed. + +zipdata.mat and digits.mat +USPS handwritten digits availabe at http://www.cad.zju.edu.cn/home/dengcai/Data/MLData.html, see also +J. J. Hull, “A database for handwritten text recognition research,” Pattern Analysis and Machine Intelligence, IEEE Transactions on, vol. 16, no. 5, pp. 550–554, +1994. + +wildfaces.mat and wildfaces_grayscale.mat +Taken from http://tamaraberg.com/faceDataset/ and described in Tamara L. Berg, Alexander C. Berg, Jaety Edwards, David A. Forsyth +Neural Information Processing Systems (NIPS), 2004. +The wildfaces.mat is an extract with 1000 examples of the original dataset and wildfaces_grayscale a gray scale converted version of these 1000 examples taken from the original data. + +messy_data.data +This dataset is an excerpt of the Auto MPG Data Set which has been heavily formatted to introduce comming data preprocessing isusues. +Revised from CMU StatLib library, data concerns city-cycle fuel consumption https://archive.ics.uci.edu/ml/datasets/auto+mpg +This dataset was taken from the StatLib library which is maintained at Carnegie Mellon University. The dataset was used in the 1983 American Statistical Association Exposition. diff --git a/exercises/02450Toolbox_Python/Scripts/ex0_4_3.py b/exercises/02450Toolbox_Python/Scripts/ex0_4_3.py new file mode 100644 index 0000000000000000000000000000000000000000..65524d527ee0bff742ff847d7193b6079c586045 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex0_4_3.py @@ -0,0 +1,24 @@ +## exercise 0.4.3 + +# In Python you need to 'import' packages and external functions before you can +# use them. We can import NumPy (which enables us to work with matrices, among +# other things) by writing 'import numpy as np'. +# We load the package into the ``namespace'' np to reference it easily, +# now we can write 'np.sum(X)' instead of 'numpy.sum(X)'. +import numpy as np + +# Remember you can mark a part of the code and press +# F9 to run that part alone. + +# define variable a with numbers in the range from 0 to 7 (not inclusive) +a = np.arange(start=0,stop=7) + +# define variable b with numbers in the range from 2 to 17 in steps of 4 +b = np.arange(start=2,stop=17,step=4) + +# similar to b but without explicit decleration of the input arguments names +c = np.arange(100, 95, -1) + +d = np.arange(1.2, 1.9, 0.1) + +e = np.pi*np.arange(0,2.5,.5) diff --git a/exercises/02450Toolbox_Python/Scripts/ex0_4_4.py b/exercises/02450Toolbox_Python/Scripts/ex0_4_4.py new file mode 100644 index 0000000000000000000000000000000000000000..937e0e0ef0a53eba23ee4b9b274f09c1a5b315b9 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex0_4_4.py @@ -0,0 +1,29 @@ +## exercise 0.4.4 +import numpy as np +# Extracting the elements from vectors is easy. Consider the +# following definition of x and the echoed results +x = np.concatenate([np.zeros(2), np.arange(0, 3.6, 0.6), np.ones(3)]) +x[1:5] # take out elements 2 through 5 (notice 6 is not included) +np.size(x) # return the size of x (equivalent to len(x) since x is an array) +len(x) # return the length of x + + +# Try writing help(len) and help(np.size) + +x[-1] # take the last element of x +x[1::2] # return every other element of x starting from the 2nd + +# The length of x is 11; what is x[11] - and why? + +# Inserting numbers into vectors is also easy. Using the same +# definition of x and observe the results when typing +y = x; +y[1::2] = np.pi +# Notice that we're inserting the same scalar value "pi" into all elements +# that we index y with + +# You can also try: +#y[1::2] = np.arange(2,12,2) + +# Observe the results when indexing the vector y with +# y[1] and y[0]. Is y[0] defined? \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex0_4_5.py b/exercises/02450Toolbox_Python/Scripts/ex0_4_5.py new file mode 100644 index 0000000000000000000000000000000000000000..3b9ff06c71fb2e14620494fe7bbfae1a24812f62 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex0_4_5.py @@ -0,0 +1,98 @@ +## exercise 0.4.5 +import numpy as np + +# Setup two ararys +x = np.arange(1,6) +y = np.arange(2,12,2) +# Have a look at them by typing 'x' and 'y' in the console + +# There's a difference between matrix multiplication and elementwise +# multiplication, and specifically in Python its also important if you +# are using the multiply operator "*" on an array object or a matrix object! + +# Use the * operator to multiply the two arrays: +x*y + +# Now, convert the arrays into matrices - +x = np.asmatrix(np.arange(1,6)) +y = np.asmatrix(np.arange(2,12,2)) +# Again, have a look at them by typing 'x' and 'y' in the console + +# Try using the * operator just as before now: +x*y +# You should now get an error - try to explain why. + +# array and matrix are two data structures added by NumPy package to the list of +# basic data structures in Python (lists, tuples, sets). We shall use both +# array and matrix structures extensively throughout this course, therefore +# make sure that you understand differences between them +# (multiplication, dimensionality) and that you are able to convert them one +# to another (asmatrix(), asarray() functions). +# Generally speaking, array objects are used to represent scientific, numerical, +# N-dimensional data. matrix objects can be very handy when it comes to +# algebraic operations on 2-dimensional matrices. + +# The ambiguity can be circumvented by using explicit function calls: +np.transpose(y) # transposition/transpose of y +y.transpose() # also transpose +y.T # also transpose + +np.multiply(x,y) # element-wise multiplication + +np.dot(x,y.T) # matrix multiplication +x @ y.T # also matrix multiplication + + +# There are various ways to make certain type of matrices. +a1 = np.array([[1, 2, 3], [4, 5, 6]]) # define explicitly +a2 = np.arange(1,7).reshape(2,3) # reshape range of numbers +a3 = np.zeros([3,3]) # zeros array +a4 = np.eye(3) # diagonal array +a5 = np.random.rand(2,3) # random array +a6 = a1.copy() # copy +a7 = a1 # alias +m1 = np.matrix('1 2 3; 4 5 6; 7 8 9') # define matrix by string +m2 = np.asmatrix(a1.copy()) # copy array into matrix +m3 = np.mat(np.array([1, 2, 3])) # map array onto matrix +a8 = np.asarray(m1) # map matrix onto array + +# It is easy to extract and/or modify selected items from arrays/matrices. +# Here is how you can index matrix elements: +m = np.matrix('1 2 3; 4 5 6; 7 8 9') +m[0,0] # first element +m[-1,-1] # last element +m[0,:] # first row +m[:,1] # second column +m[1:3,-1] # view on selected rows&columns + +# Similarly, you can selectively assign values to matrix elements or columns: +m[-1,-1] = 10000 +m[0:2,-1] = np.matrix('100; 1000') +m[:,0] = 0 + +# Logical indexing can be used to change or take only elements that +# fulfil a certain constraint, e.g. +m2[m2>0.5] # display values in m2 that are larger than 0.5 +m2[m2<0.5] = 0 # set all elements that are less than 0.5 to 0 + +#Below, several examples of common matrix operations, +# most of which we will use in the following weeks. +# First, define two matrices: +m1 = 10 * np.mat(np.ones([3,3])) +m2 = np.mat(np.random.rand(3,3)) + +m1+m2 # matrix summation +m1*m2 # matrix product +np.multiply(m1,m2) # element-wise multiplication +m1>m2 # element-wise comparison +m3 = np.hstack((m1,m2)) # combine/concatenate matrices horizontally +# note that this is not equivalent to e.g. +# l = [m1, m2] +# in which case l is a list, and l[0] is m1 +m4 = np.vstack((m1,m2)) # combine/concatenate matrices vertically +m3.shape # shape of matrix +m3.mean() # mean value of all the elements +m3.mean(axis=0) # mean values of the columns +m3.mean(axis=1) # mean values of the rows +m3.transpose() # transpose, also: m3.T +m2.I # compute inverse matrix diff --git a/exercises/02450Toolbox_Python/Scripts/ex0_5_1.py b/exercises/02450Toolbox_Python/Scripts/ex0_5_1.py new file mode 100644 index 0000000000000000000000000000000000000000..256c3be27a47f13cd8bf86195349faec2088fab6 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex0_5_1.py @@ -0,0 +1,13 @@ +## exercise 0.5.1 +import numpy as np +import matplotlib.pyplot as plt + +x = np.arange(0, 1, 0.1) +f = np.exp(x) + +plt.figure(1) +plt.plot(x, f) +plt.xlabel('x') +plt.ylabel('f(x)=exp(x)') +plt.title('The exponential function') +plt.show() \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex0_5_2.py b/exercises/02450Toolbox_Python/Scripts/ex0_5_2.py new file mode 100644 index 0000000000000000000000000000000000000000..6da786e297ab9e858e530b37d21f759d0cd77e64 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex0_5_2.py @@ -0,0 +1,53 @@ +## exercise 0.5.2 + +import numpy as np +import matplotlib.pyplot as plt + + +# We simulate measurements every 100 ms for a period of 10 seconds +t = np.arange(0, 10, 0.1) + +# The data from the sensors are generated as either a sine or a cosine +# with some Gaussian noise added. +sensor1 = 3*np.sin(t)+0.5*np.random.normal(size=len(t)) +sensor2 = 3*np.cos(t)+0.5*np.random.normal(size=len(t)) + +# Change the font size to make axis and title readable +font_size = 15 +plt.rcParams.update({'font.size': font_size}) + +# Define the name of the curves +legend_strings = ['Sensor 1', 'Sensor 2'] + +# Start plotting the simulated measurements +plt.figure(1) +# Plot the sensor 1 output as a function of time, and +# make the curve red and fully drawn +plt.plot(t, sensor1, 'r-') + +# Plot the sensor 2 output as a function of time, and +# make the curve blue and dashed +plt.plot(t, sensor2, 'b--') + +# Ensure that the limits on the axis fit the data +plt.axis('tight') + +# Add a grid in the background +plt.grid() + +# Add a legend describing each curve, place it at the "best" location +# so as to minimize the amount of curve it covers +plt.legend(legend_strings,loc='best') + +# Add labels to the axes +plt.xlabel('Time [s]') +plt.ylabel('Voltage [mV]') + +# Add a title to the plot +plt.title('Sensor outputs') + +# Export the figure +plt.savefig('ex1_5_2.png') + +# Show the figure in the console +plt.show() diff --git a/exercises/02450Toolbox_Python/Scripts/ex10_1_1.py b/exercises/02450Toolbox_Python/Scripts/ex10_1_1.py new file mode 100644 index 0000000000000000000000000000000000000000..346b6f5efa66cdbbd97418cdfeb07b8e47f21b9b --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex10_1_1.py @@ -0,0 +1,27 @@ +# exercise 10.1.1 +from matplotlib.pyplot import figure, show +from scipy.io import loadmat +from toolbox_02450 import clusterplot +from sklearn.cluster import k_means + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth1.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + +# Number of clusters: +K = 4 + +# K-means clustering: +centroids, cls, inertia = k_means(X,K) + +# Plot results: +figure(figsize=(14,9)) +clusterplot(X, cls, centroids, y) +show() + +print('Ran Exercise 10.1.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex10_1_3.py b/exercises/02450Toolbox_Python/Scripts/ex10_1_3.py new file mode 100644 index 0000000000000000000000000000000000000000..e3ecd5d6e6364cb194af66b24e899b8ff72bd1ec --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex10_1_3.py @@ -0,0 +1,44 @@ + # exercise 10.1.3 +from matplotlib.pyplot import figure, title, plot, ylim, legend, show +import numpy as np +from scipy.io import loadmat +from toolbox_02450 import clusterval +from sklearn.cluster import k_means + + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth1.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + + +# Maximum number of clusters: +K = 10 + +# Allocate variables: +Rand = np.zeros((K-1,)) +Jaccard = np.zeros((K-1,)) +NMI = np.zeros((K-1,)) + +for k in range(K-1): + # run K-means clustering: + #cls = Pycluster.kcluster(X,k+1)[0] + centroids, cls, inertia = k_means(X,k+2) + # compute cluster validities: + Rand[k], Jaccard[k], NMI[k] = clusterval(y,cls) + +# Plot results: + +figure(1) +title('Cluster validity') +plot(np.arange(K-1)+2, Rand) +plot(np.arange(K-1)+2, Jaccard) +plot(np.arange(K-1)+2, NMI) +legend(['Rand', 'Jaccard', 'NMI'], loc=4) +show() + +print('Ran Exercise 10.1.3') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex10_1_5.py b/exercises/02450Toolbox_Python/Scripts/ex10_1_5.py new file mode 100644 index 0000000000000000000000000000000000000000..29e192a329d62b7b85cc5c821a962757a4a71b50 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex10_1_5.py @@ -0,0 +1,73 @@ +# exercise 10_1_5 +from matplotlib import pyplot as plt +import numpy as np +from scipy.io import loadmat +from sklearn.cluster import k_means + + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wildfaces.mat') +#mat_data = loadmat('../Data/digits.mat') #<-- uncomment this for using the digits dataset + +X = mat_data['X'] +N, M = X.shape +# Image resolution and number of colors +x = 40 #<-- change this for using the digits dataset +y = 40 #<-- change this for using the digits dataset +c = 3 #<-- change this for using the digits dataset + + +# Number of clusters: +K = 10 + +# Number of repetitions with different initial centroid seeds +S = 1 + +# Run k-means clustering: +centroids, cls, inertia = k_means(X, K, verbose=True, max_iter=100, n_init=S) + + +# Plot results: + +# Plot centroids +plt.figure(1) +n1 = int(np.ceil(np.sqrt(K/2))) +n2 = int(np.ceil(float(K)/n1)) + +#For black and white, cmap=plt.cm.binary, else default +cmap = plt.cm.binary if c==1 else None + +for k in range(K): + plt.subplot(n1,n2,k+1) + # Reshape centroids to fit resolution and colors + img = np.reshape(centroids[k,:],(c,x,y)).T + if c == 1: # if color is single-color/gray scale + # Squeeze out singleton dimension + # and flip the image (cancel out previos transpose) + img = np.squeeze(img).T + plt.imshow(img,interpolation='None', cmap=cmap) + plt.xticks([]); plt.yticks([]) + if k==np.floor((n2-1)/2): plt.title('Centroids') + +# Plot few randomly selected faces and their nearest centroids +L = 5 # number of images to plot +j = np.random.randint(0, N, L) +plt.figure(2) +for l in range(L): + plt.subplot(2,L,l+1) + img = np.resize(X[j[l],:],(c,x,y)).T + if c == 1: + img = np.squeeze(img).T + plt.imshow(img,interpolation='None', cmap=cmap) + plt.xticks([]); plt.yticks([]) + if l==np.floor((L-1)/2): plt.title('Randomly selected faces and their centroids') + plt.subplot(2,L,L+l+1) + img = np.resize(centroids[cls[j[l]],:],(c,x,y)).T + if c == 1: + img = np.squeeze(img).T + plt.imshow(img,interpolation='None', cmap=cmap) + plt.xticks([]); plt.yticks([]) + +plt.show() + +print('Ran Exercise 10.1.5') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex10_2_1.py b/exercises/02450Toolbox_Python/Scripts/ex10_2_1.py new file mode 100644 index 0000000000000000000000000000000000000000..4698d40dd98b3158fb26fd261081f65c404a67e3 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex10_2_1.py @@ -0,0 +1,36 @@ +# exercise 10.2.1 +from matplotlib.pyplot import figure, show +from scipy.io import loadmat +from toolbox_02450 import clusterplot +from scipy.cluster.hierarchy import linkage, fcluster, dendrogram + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth1.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + + +# Perform hierarchical/agglomerative clustering on data matrix +Method = 'single' +Metric = 'euclidean' + +Z = linkage(X, method=Method, metric=Metric) + +# Compute and display clusters by thresholding the dendrogram +Maxclust = 4 +cls = fcluster(Z, criterion='maxclust', t=Maxclust) +figure(1) +clusterplot(X, cls.reshape(cls.shape[0],1), y=y) + +# Display dendrogram +max_display_levels=6 +figure(2,figsize=(10,4)) +dendrogram(Z, truncate_mode='level', p=max_display_levels, color_threshold=Z[-Maxclust+1,2]) + +show() + +print('Ran Exercise 10.2.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex11_1_1.py b/exercises/02450Toolbox_Python/Scripts/ex11_1_1.py new file mode 100644 index 0000000000000000000000000000000000000000..fe0633ba6466113677a07700ec1301f559f1e791 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex11_1_1.py @@ -0,0 +1,61 @@ +# exercise 11.1.1 +from matplotlib.pyplot import figure, show +import numpy as np +from scipy.io import loadmat +from toolbox_02450 import clusterplot +from sklearn.mixture import GaussianMixture +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth2.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] +#X_old = X +#X = np.hstack([X,X]) +N, M = X.shape +C = len(classNames) +# Number of clusters +K = 4 +cov_type = 'full' # e.g. 'full' or 'diag' + +# define the initialization procedure (initial value of means) +initialization_method = 'random'# 'random' or 'kmeans' +# random signifies random initiation, kmeans means we run a K-means and use the +# result as the starting point. K-means might converge faster/better than +# random, but might also cause the algorithm to be stuck in a poor local minimum + +# type of covariance, you can try out 'diag' as well +reps = 1 +# number of fits with different initalizations, best result will be kept +# Fit Gaussian mixture model +gmm = GaussianMixture(n_components=K, covariance_type=cov_type, n_init=reps, + tol=1e-6, reg_covar=1e-6, init_params=initialization_method).fit(X) +cls = gmm.predict(X) +# extract cluster labels +cds = gmm.means_ +# extract cluster centroids (means of gaussians) +covs = gmm.covariances_ +# extract cluster shapes (covariances of gaussians) +if cov_type.lower() == 'diag': + new_covs = np.zeros([K,M,M]) + + count = 0 + for elem in covs: + temp_m = np.zeros([M,M]) + new_covs[count] = np.diag(elem) + count += 1 + + covs = new_covs + +# Plot results: +figure(figsize=(14,9)) +clusterplot(X, clusterid=cls, centroids=cds, y=y, covars=covs) +show() + +## In case the number of features != 2, then a subset of features most be plotted instead. +#figure(figsize=(14,9)) +#idx = [0,1] # feature index, choose two features to use as x and y axis in the plot +#clusterplot(X[:,idx], clusterid=cls, centroids=cds[:,idx], y=y, covars=covs[:,idx,:][:,:,idx]) +#show() + +print('Ran Exercise 11.1.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex11_1_5.py b/exercises/02450Toolbox_Python/Scripts/ex11_1_5.py new file mode 100644 index 0000000000000000000000000000000000000000..76ab3ef47eeff31545739ab8b230ed46fff0d233 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex11_1_5.py @@ -0,0 +1,70 @@ +# exercise 11.1.5 +from matplotlib.pyplot import figure, plot, legend, xlabel, show +import numpy as np +from scipy.io import loadmat +from sklearn.mixture import GaussianMixture +from sklearn import model_selection + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth1.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + + +# Range of K's to try +KRange = range(1,11) +T = len(KRange) + +covar_type = 'full' # you can try out 'diag' as well +reps = 3 # number of fits with different initalizations, best result will be kept +init_procedure = 'kmeans' # 'kmeans' or 'random' + +# Allocate variables +BIC = np.zeros((T,)) +AIC = np.zeros((T,)) +CVE = np.zeros((T,)) + +# K-fold crossvalidation +CV = model_selection.KFold(n_splits=10,shuffle=True) + +for t,K in enumerate(KRange): + print('Fitting model for K={0}'.format(K)) + + # Fit Gaussian mixture model + gmm = GaussianMixture(n_components=K, covariance_type=covar_type, + n_init=reps, init_params=init_procedure, + tol=1e-6, reg_covar=1e-6).fit(X) + + # Get BIC and AIC + BIC[t,] = gmm.bic(X) + AIC[t,] = gmm.aic(X) + + # For each crossvalidation fold + for train_index, test_index in CV.split(X): + + # extract training and test set for current CV fold + X_train = X[train_index] + X_test = X[test_index] + + # Fit Gaussian mixture model to X_train + gmm = GaussianMixture(n_components=K, covariance_type=covar_type, n_init=reps).fit(X_train) + + # compute negative log likelihood of X_test + CVE[t] += -gmm.score_samples(X_test).sum() + + +# Plot results + +figure(1); +plot(KRange, BIC,'-*b') +plot(KRange, AIC,'-xr') +plot(KRange, 2*CVE,'-ok') +legend(['BIC', 'AIC', 'Crossvalidation']) +xlabel('K') +show() + +print('Ran Exercise 11.1.5') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex11_2_1.py b/exercises/02450Toolbox_Python/Scripts/ex11_2_1.py new file mode 100644 index 0000000000000000000000000000000000000000..bdbde574c96d0109fc76dfe21dbebd4c71557a86 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex11_2_1.py @@ -0,0 +1,32 @@ +# exercise 11_2_1 +import numpy as np +from matplotlib.pyplot import figure, hist, show + +# Number of data objects +N = 1000 + +# Number of attributes +M = 1 + +# x-values to evaluate the histogram +x = np.linspace(-10, 10, 50) + +# Allocate variable for data +X = np.empty((N,M)) + +# Mean and covariances +m = np.array([1, 3, 6]) +s = np.array([1, .5, 2]) + +# Draw samples from mixture of gaussians +c_sizes = np.random.multinomial(N, [1./3, 1./3, 1./3]) +for c_id, c_size in enumerate(c_sizes): + X[c_sizes.cumsum()[c_id]-c_sizes[c_id]:c_sizes.cumsum()[c_id],:] = np.random.normal(m[c_id], np.sqrt(s[c_id]), (c_size,M)) + + +# Plot histogram of sampled data +figure() +hist(X,x) +show() + +print('Ran Exercise 11.2.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex11_2_2.py b/exercises/02450Toolbox_Python/Scripts/ex11_2_2.py new file mode 100644 index 0000000000000000000000000000000000000000..eaa71b38a5e9e1402d624599b6971ebc72e4bf75 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex11_2_2.py @@ -0,0 +1,32 @@ +# exercise 11.2.2 +import numpy as np +from matplotlib.pyplot import figure, subplot, hist, title, show, plot +from scipy.stats.kde import gaussian_kde + +# Draw samples from mixture of gaussians (as in exercise 11.1.1) +N = 1000; M = 1 +x = np.linspace(-10, 10, 50) +X = np.empty((N,M)) +m = np.array([1, 3, 6]); s = np.array([1, .5, 2]) +c_sizes = np.random.multinomial(N, [1./3, 1./3, 1./3]) +for c_id, c_size in enumerate(c_sizes): + X[c_sizes.cumsum()[c_id]-c_sizes[c_id]:c_sizes.cumsum()[c_id],:] = np.random.normal(m[c_id], np.sqrt(s[c_id]), (c_size,M)) + + +# x-values to evaluate the KDE +xe = np.linspace(-10, 10, 100) + +# Compute kernel density estimate +kde = gaussian_kde(X.ravel()) + +# Plot kernel density estimate +figure(figsize=(6,7)) +subplot(2,1,1) +hist(X,x) +title('Data histogram') +subplot(2,1,2) +plot(xe, kde.evaluate(xe)) +title('Kernel density estimate') +show() + +print('Ran Exercise 11.2.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex11_2_3.py b/exercises/02450Toolbox_Python/Scripts/ex11_2_3.py new file mode 100644 index 0000000000000000000000000000000000000000..d0e24d6c113629df94410bca85b7aea4b37ab576 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex11_2_3.py @@ -0,0 +1,54 @@ +# exercise 11.2.3 +import numpy as np +from matplotlib.pyplot import figure, subplot, plot, hist, title, show +from sklearn.neighbors import NearestNeighbors + +# Draw samples from mixture of gaussians (as in exercise 11.1.1) +N = 1000; M = 1 +x = np.linspace(-10, 10, 50) +X = np.empty((N,M)) +m = np.array([1, 3, 6]); s = np.array([1, .5, 2]) +c_sizes = np.random.multinomial(N, [1./3, 1./3, 1./3]) +for c_id, c_size in enumerate(c_sizes): + X[c_sizes.cumsum()[c_id]-c_sizes[c_id]:c_sizes.cumsum()[c_id],:] = np.random.normal(m[c_id], np.sqrt(s[c_id]), (c_size,M)) + + +# Number of neighbors +K = 200 + +# x-values to evaluate the KNN +xe = np.linspace(-10, 10, 100) + +# Find the k nearest neighbors +knn = NearestNeighbors(n_neighbors=K).fit(X) +D, i = knn.kneighbors(np.expand_dims(xe,axis=-1)) # note expand_dims is simple to make it (100,1) and not (100,) array + +# Compute the density +knn_density = 1./(D[:,1:].sum(axis=1)/K) + +# Compute the average relative density +DX, iX = knn.kneighbors(X) +knn_densityX = 1./(DX[:,1:].sum(axis=1)/K) +knn_avg_rel_density = knn_density/(knn_densityX[i[:,1:]].sum(axis=1)/K) + + +# Plot KNN density +figure(figsize=(6,7)) +subplot(2,1,1) +hist(X,x) +title('Data histogram') +subplot(2,1,2) +plot(xe, knn_density) +title('KNN density') +# Plot KNN average relative density +figure(figsize=(6,7)) +subplot(2,1,1) +hist(X,x) +title('Data histogram') +subplot(2,1,2) +plot(xe, knn_avg_rel_density) +title('KNN average relative density') + +show() + +print('Ran Exercise 11.2.3') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex11_3_1.py b/exercises/02450Toolbox_Python/Scripts/ex11_3_1.py new file mode 100644 index 0000000000000000000000000000000000000000..270db597c3db29557ca357b9ba1f97335f345970 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex11_3_1.py @@ -0,0 +1,33 @@ +# exercise 11.3.1 +import numpy as np +from matplotlib.pyplot import figure, bar, title, show +from scipy.stats.kde import gaussian_kde + + +# Draw samples from mixture of gaussians (as in exercise 11.1.1), add outlier +N = 1000; M = 1 +x = np.linspace(-10, 10, 50) +X = np.empty((N,M)) +m = np.array([1, 3, 6]); s = np.array([1, .5, 2]) +c_sizes = np.random.multinomial(N, [1./3, 1./3, 1./3]) +for c_id, c_size in enumerate(c_sizes): + X[c_sizes.cumsum()[c_id]-c_sizes[c_id]:c_sizes.cumsum()[c_id],:] = np.random.normal(m[c_id], np.sqrt(s[c_id]), (c_size,M)) +X[-1,0]=-10 # added outlier + + +# Compute kernel density estimate +kde = gaussian_kde(X.ravel()) + +scores = kde.evaluate(X.ravel()) +idx = scores.argsort() +scores.sort() + +print('The index of the lowest density object: {0}'.format(idx[0])) + +# Plot kernel density estimate +figure() +bar(range(20),scores[:20]) +title('Outlier score') +show() + +print('Ran Exercise 11.3.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex11_3_2.py b/exercises/02450Toolbox_Python/Scripts/ex11_3_2.py new file mode 100644 index 0000000000000000000000000000000000000000..140b8c832f34b2f70e1ae1dabbc659a311907c73 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex11_3_2.py @@ -0,0 +1,50 @@ +# exercise 11.3.2 + +import numpy as np +from matplotlib.pyplot import figure, bar, title, plot, show +from toolbox_02450 import gausKernelDensity + +# Draw samples from mixture of gaussians (as in exercise 11.1.1) +N = 1000; M = 1 +x = np.linspace(-10, 10, 50) +X = np.empty((N,M)) +m = np.array([1, 3, 6]); s = np.array([1, .5, 2]) +c_sizes = np.random.multinomial(N, [1./3, 1./3, 1./3]) +for c_id, c_size in enumerate(c_sizes): + X[c_sizes.cumsum()[c_id]-c_sizes[c_id]:c_sizes.cumsum()[c_id],:] = np.random.normal(m[c_id], np.sqrt(s[c_id]), (c_size,M)) + + + +# Estimate the optimal kernel density width, by leave-one-out cross-validation +widths = 2.0**np.arange(-10,10) +logP = np.zeros(np.size(widths)) +for i,w in enumerate(widths): + f, log_f = gausKernelDensity(X, w) + logP[i] = log_f.sum() +val = logP.max() +ind = logP.argmax() + +width=widths[ind] +print('Optimal estimated width is: {0}'.format(width)) + +# Estimate density for each observation not including the observation +# itself in the density estimate +density, log_density = gausKernelDensity(X, width) + +# Sort the densities +i = (density.argsort(axis=0)).ravel() +density = density[i] + +# Display the index of the lowest density data object +print('Lowest density: {0} for data object: {1}'.format(density[0],i[0])) + +# Plot density estimate of outlier score +figure(1) +bar(range(20),density[:20].reshape(-1,)) +title('Density estimate') +figure(2) +plot(logP) +title('Optimal width') +show() + +print('Ran Exercise 11.3.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex11_4_1.py b/exercises/02450Toolbox_Python/Scripts/ex11_4_1.py new file mode 100644 index 0000000000000000000000000000000000000000..c59b61fd8e79916fbce159ddba4a0be957c682e5 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex11_4_1.py @@ -0,0 +1,149 @@ +# exercise 11.4.1 +import numpy as np +from matplotlib.pyplot import (figure, imshow, bar, title, xticks, yticks, cm, + subplot, show) +from scipy.io import loadmat +from toolbox_02450 import gausKernelDensity +from sklearn.neighbors import NearestNeighbors + +# load data from Matlab data file +matdata = loadmat('../Data/digits.mat') +X = np.array(matdata['X']) +y = np.array(matdata['y']) +N, M = np.shape(X) + +# Restrict the data to images of "2" +X = X[y.ravel()==2,:] +N, M = np.shape(X) + +### Gausian Kernel density estimator +# cross-validate kernel width by leave-one-out-cross-validation +# (efficient implementation in gausKernelDensity function) +# evaluate for range of kernel widths +widths = X.var(axis=0).max() * (2.0**np.arange(-10,3)) +logP = np.zeros(np.size(widths)) +for i,w in enumerate(widths): + print('Fold {:2d}, w={:f}'.format(i,w)) + density, log_density = gausKernelDensity(X,w) + logP[i] = log_density.sum() + +val = logP.max() +ind = logP.argmax() + +width=widths[ind] +print('Optimal estimated width is: {0}'.format(width)) + +# evaluate density for estimated width +density, log_density = gausKernelDensity(X,width) + +# Sort the densities +i = (density.argsort(axis=0)).ravel() +density = density[i].reshape(-1,) + +# Plot density estimate of outlier score +figure(1) +bar(range(20),density[:20]) +title('Density estimate') + +# Plot possible outliers +figure(2) +for k in range(1,21): + subplot(4,5,k) + imshow(np.reshape(X[i[k],:], (16,16)).T, cmap=cm.binary) + xticks([]); yticks([]) + if k==3: title('Gaussian Kernel Density: Possible outliers') + + + +### K-neighbors density estimator +# Neighbor to use: +K = 5 +knn = NearestNeighbors(n_neighbors=K+1).fit(X) +def density(X,i): + ''' + Compute density at observation i in X using LOO. + Note this code can easily be vectorized for speed + ''' + D, _ = knn.kneighbors(np.expand_dims(X[i],axis=0)) + # don't compute distance to observation itself. + density = 1. / D[:, 1:].mean(axis=1) + return density + +dens = np.concatenate([density(X,i) for i in range(N)]) +# Sort the scores +i = dens.argsort() +dens = dens[i] + +# Plot k-neighbor estimate of outlier score (distances) +figure(3) +bar(range(20),dens[:20]) +title('KNN density: Outlier score') +# Plot possible outliers +figure(4) +for k in range(1,21): + subplot(4,5,k) + imshow(np.reshape(X[i[k],:], (16,16)).T, cmap=cm.binary) + xticks([]); yticks([]) + if k==3: title('KNN density: Possible outliers') + +### K-nearest neigbor average relative density +# Compute the average relative density +def ard(X,i): + _, J = knn.kneighbors(np.expand_dims(X[i],axis=0)) + J = J[0,1:] # don't include i itself. + return density(X,i) / np.mean( [density(X, j) for j in J] ) + +avg_rel_density = np.concatenate( [ard(X,i) for i in range(N) ] ) + +# Sort the avg.rel.densities +i_avg_rel = avg_rel_density.argsort() +avg_rel_density = avg_rel_density[i_avg_rel] + +# Plot k-neighbor estimate of outlier score (distances) +figure(5) +bar(range(20),avg_rel_density[:20]) +title('KNN average relative density: Outlier score') +# Plot possible outliers +figure(6) +for k in range(1,21): + subplot(4,5,k) + imshow(np.reshape(X[i_avg_rel[k],:], (16,16)).T, cmap=cm.binary) + xticks([]); yticks([]) + if k==3: title('KNN average relative density: Possible outliers') + +### Distance to 5'th nearest neighbor outlier score +K = 5 + +# Find the k nearest neighbors +knn = NearestNeighbors(n_neighbors=K+1).fit(X) +D, i = knn.kneighbors(X) + +# Outlier score +score = D[:,K-1] +# Sort the scores +i = score.argsort() +score = score[i[::-1]] + +# Plot k-neighbor estimate of outlier score (distances) +figure(7) +bar(range(20),score[:20]) +title('5th neighbor distance: Outlier score') +# Plot possible outliers +figure(8) +for k in range(1,21): + subplot(4,5,k) + imshow(np.reshape(X[i[k],:], (16,16)).T, cmap=cm.binary); + xticks([]); yticks([]) + if k==3: title('5th neighbor distance: Possible outliers') + + +# Plot random digits (the first 20 in the data set), for comparison +figure(9) +for k in range(1,21): + subplot(4,5,k); + imshow(np.reshape(X[k,:], (16,16)).T, cmap=cm.binary); + xticks([]); yticks([]) + if k==3: title('Random digits from data set') +show() + +print('Ran Exercise 11.4.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex12_1_3.py b/exercises/02450Toolbox_Python/Scripts/ex12_1_3.py new file mode 100644 index 0000000000000000000000000000000000000000..4c2a2b5eecc5ff52dd27ecc74f0ec0e484343f2d --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex12_1_3.py @@ -0,0 +1,21 @@ +# ex12_1_3 +import numpy as np +# Load data. There is probably a library-way to parse the file but we will take the scenic route +with open('../Data/courses.txt','r') as f: + D = f.read() + print("Raw data matrix is:") + print(D) +D = [ [int(x) for x in ds.split(",")] for ds in D.split('\n') if len(ds) > 0] +N = len(D) +M = max( [max(v) for v in D]) +X = np.zeros( (N,M)) +for i in range(N): + d_m1 = [j-1 for j in D[i]] + X[i,d_m1] = 1 + +# We should now have the correct binary data matrix: +labels = ["02322", "02450", "02451", "02453", "02454", "02457", "02459", "02582"] +print("Transformed data matrix X is:") +print(labels) +print(X) +print("All-done!") \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex12_1_4.py b/exercises/02450Toolbox_Python/Scripts/ex12_1_4.py new file mode 100644 index 0000000000000000000000000000000000000000..757509330b42e4f8bb51f5fd1a24040f5e90e7b2 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex12_1_4.py @@ -0,0 +1,39 @@ +# install apyori using a standard method: conda install apyori or pip install apyori +from apyori import apriori +# Load resources from previous exercise +import numpy as np +from ex12_1_3 import X,labels +# ex12_1_4 +# This is a helper function that transforms a binary matrix into transactions. +# Note the format used for courses.txt was (nearly) in a transaction format, +# however we will need the function later which is why we first transformed +# courses.txt to our standard binary-matrix format. +def mat2transactions(X, labels=[]): + T = [] + for i in range(X.shape[0]): + l = np.nonzero(X[i, :])[0].tolist() + if labels: + l = [labels[i] for i in l] + T.append(l) + return T + +# apyori requires data to be in a transactions format, forunately we just wrote a helper function to do that. +T = mat2transactions(X,labels) +rules = apriori( T, min_support=0.8, min_confidence=1) + +# This function print the found rules and also returns a list of rules in the format: +# [(x,y), ...] +# where x -> y +def print_apriori_rules(rules): + frules = [] + for r in rules: + for o in r.ordered_statistics: + conf = o.confidence + supp = r.support + x = ", ".join( list( o.items_base ) ) + y = ", ".join( list( o.items_add ) ) + print("{%s} -> {%s} (supp: %.3f, conf: %.3f)"%(x,y, supp, conf)) + frules.append( (x,y) ) + return frules +# Print rules found in the courses file. +print_apriori_rules(rules) \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex12_1_5.py b/exercises/02450Toolbox_Python/Scripts/ex12_1_5.py new file mode 100644 index 0000000000000000000000000000000000000000..3b485fdb59ede347fd0c2a3ef70af19048c14b2c --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex12_1_5.py @@ -0,0 +1,14 @@ +# ex12_1_5 +# Load data from the wine dataset +from scipy.io import loadmat +mat_data = loadmat('../Data/wine.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0][0] for name in mat_data['attributeNames']] + +# We will now transform the wine dataset into a binary format. Notice the changed attribute names: +from toolbox_02450.similarity import binarize2 +Xbin, attributeNamesBin = binarize2(X, attributeNames) +print("X, i.e. the wine dataset, has now been transformed into:") +print(Xbin) +print(attributeNamesBin) \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex12_1_6.py b/exercises/02450Toolbox_Python/Scripts/ex12_1_6.py new file mode 100644 index 0000000000000000000000000000000000000000..ce9d3ce12747d21c8455f08b8a330dbd85c46f17 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex12_1_6.py @@ -0,0 +1,10 @@ +# ex12_1_6 +# Load resources from previous exercise +from ex12_1_4 import mat2transactions, print_apriori_rules +from ex12_1_5 import Xbin, attributeNamesBin +from apyori import apriori + +# Given the processed data in the previous exercise this becomes easy: +T = mat2transactions(Xbin,labels=attributeNamesBin) +rules = apriori(T, min_support=0.3, min_confidence=.6) +print_apriori_rules(rules) \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex1_5_1.py b/exercises/02450Toolbox_Python/Scripts/ex1_5_1.py new file mode 100644 index 0000000000000000000000000000000000000000..334a7c01e2daa85e194d3a3d251cc07ccbb5ade8 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex1_5_1.py @@ -0,0 +1,75 @@ +# exercise 1.5.1 +import numpy as np +import pandas as pd + +# Load the Iris csv data using the Pandas library +filename = '../Data/iris.csv' +df = pd.read_csv(filename) + +# Pandas returns a dataframe, (df) which could be used for handling the data. +# We will however convert the dataframe to numpy arrays for this course as +# is also described in the table in the exercise +raw_data = df.values + +# Notice that raw_data both contains the information we want to store in an array +# X (the sepal and petal dimensions) and the information that we wish to store +# in y (the class labels, that is the iris species). + +# We start by making the data matrix X by indexing into data. +# We know that the attributes are stored in the four columns from inspecting +# the file. +cols = range(0, 4) +X = raw_data[:, cols] + +# We can extract the attribute names that came from the header of the csv +attributeNames = np.asarray(df.columns[cols]) + +# Before we can store the class index, we need to convert the strings that +# specify the class of a given object to a numerical value. We start by +# extracting the strings for each sample from the raw data loaded from the csv: +classLabels = raw_data[:,-1] # -1 takes the last column +# Then determine which classes are in the data by finding the set of +# unique class labels +classNames = np.unique(classLabels) + +# We can assign each type of Iris class with a number by making a +# Python dictionary as so: + +classDict = dict(zip(classNames,range(len(classNames)))) + +# The function zip simply "zips" togetter the classNames with an integer, +# like a zipper on a jacket. +# For instance, you could zip a list ['A', 'B', 'C'] with ['D', 'E', 'F'] to +# get the pairs ('A','D'), ('B', 'E'), and ('C', 'F'). +# A Python dictionary is a data object that stores pairs of a key with a value. +# This means that when you call a dictionary with a given key, you +# get the stored corresponding value. Try highlighting classDict and press F9. +# You'll see that the first (key, value)-pair is ('Iris-setosa', 0). +# If you look up in the dictionary classDict with the value 'Iris-setosa', +# you will get the value 0. Try it with classDict['Iris-setosa'] + +# With the dictionary, we can look up each data objects class label (the string) +# in the dictionary, and determine which numerical value that object is +# assigned. This is the class index vector y: + +y = np.array([classDict[cl] for cl in classLabels]) + +# In the above, we have used the concept of "list comprehension", which +# is a compact way of performing some operations on a list or array. +# You could read the line "For each class label (cl) in the array of +# class labels (classLabels), use the class label (cl) as the key and look up +# in the class dictionary (classDict). Store the result for each class label +# as an element in a list (because of the brackets []). Finally, convert the +# list to a numpy array". +# Try running this to get a feel for the operation: +# list = [0,1,2] +# new_list = [element+10 for element in list] + +# We can determine the number of data objects and number of attributes using +# the shape of X +N, M = X.shape + +# Finally, the last variable that we need to have the dataset in the +# "standard representation" for the course, is the number of classes, C: +C = len(classNames) + diff --git a/exercises/02450Toolbox_Python/Scripts/ex1_5_2.py b/exercises/02450Toolbox_Python/Scripts/ex1_5_2.py new file mode 100644 index 0000000000000000000000000000000000000000..102ed00943dd83b92f579d154907f95055a764ef --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex1_5_2.py @@ -0,0 +1,40 @@ +# exercise 1.5.2 +import numpy as np + +# You can read data from excel spreadsheets after installing and importing xlrd +# module. In most cases, you will need only few functions to accomplish it: +# open_workbook(), col_values(), row_values() +import xlrd +# If you need more advanced reference, or if you are interested how to write +# data to excel files, see the following tutorial: +# http://www.simplistix.co.uk/presentations/python-excel.pdf} + +# Load xls sheet with data +# There's only a single sheet in the .xls, so we take out that sheet +doc = xlrd.open_workbook('../Data/iris.xls').sheet_by_index(0) + +# Extract attribute names +attributeNames = doc.row_values(rowx=0, start_colx=0, end_colx=4) +# Try calling help(doc.row_values). You'll see that the above means +# that we extract columns 0 through 4 from the first row of the document, +# which contains the header of the xls files (where the attributen names are) + +# Extract class names to python list, then encode with integers (dict) just as +# we did previously. The class labels are in the 5th column, in the rows 2 to +# and up to 151: +classLabels = doc.col_values(4,1,151) # check out help(doc.col_values) +classNames = sorted(set(classLabels)) +classDict = dict(zip(classNames,range(len(classNames)))) + +# Extract vector y, convert to NumPy array +y = np.array([classDict[value] for value in classLabels]) + +# Preallocate memory, then extract data to matrix X +X = np.empty((150,4)) +for i in range(4): + X[:,i] = np.array(doc.col_values(i,1,151)).T + +# Compute values of N, M and C. +N = len(y) +M = len(attributeNames) +C = len(classNames) diff --git a/exercises/02450Toolbox_Python/Scripts/ex1_5_3.py b/exercises/02450Toolbox_Python/Scripts/ex1_5_3.py new file mode 100644 index 0000000000000000000000000000000000000000..f91c899871c876436c10bbc2dc6c557cf3746df2 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex1_5_3.py @@ -0,0 +1,34 @@ +# exercise 1.5.3 +import numpy as np + +from scipy.io import loadmat +# You can load the matlab data (matlab's m-file) to Python environment with +# 'loadmat()' function imported from 'scipy.io' module. +# The matlab workspace is loaded as a dictionary, with keys corresponding to +# matlab variable names, and values to arrays representing matlab matrices. + +# Load Matlab data file to python dict structure +iris_mat = loadmat('../Data/iris.mat', squeeze_me=True) +# The argument squeeze_me ensures that there the variables we get from the +# MATLAB filed are not stored within "unneeded" array dimensions. + +# You can check which variables are in the loaded dict by calling +# the function keys() for the dict: +#mat_data.keys() +# this will tell you that X, y, M, N and C are stored in the dictionary, +# as well as some extra information about e.g. the used MATLAB version. + +# We'll extract the needed variables by using these keys: +X = iris_mat['X'] +y = iris_mat['y'] +M = iris_mat['M'] +N = iris_mat['N'] +C = iris_mat['C'] +attributeNames = iris_mat['attributeNames'] +classNames = iris_mat['classNames'] + +# Loading the Iris data from the .mat-file was quite easy, because all the work +# of putting it into the correct format was already done. This is of course +# likely not the case for your own data, where you'll need to do something +# similar to the two previous exercises. We will, however, sometimes in the +# course use .mat-files in the exercises. \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex1_5_4.py b/exercises/02450Toolbox_Python/Scripts/ex1_5_4.py new file mode 100644 index 0000000000000000000000000000000000000000..19bc9ad0ee2b9e08c20594d28140d84d70f8374c --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex1_5_4.py @@ -0,0 +1,95 @@ +## exercise 1.5.4 +# Start by running the exercise 1.5.3 to load the Iris data in +# "classification format": +from ex1_5_3 import * + +import numpy as np +import matplotlib.pyplot as plt + +## Classification problem +# The current variables X and y represent a classification problem, in +# which a machine learning model will use the sepal and petal dimesions +# (stored in the matrix X) to predict the class (species of Iris, stored in +# the variable y). A relevant figure for this classification problem could +# for instance be one that shows how the classes are distributed based on +# two attributes in matrix X: +X_c = X.copy(); +y_c = y.copy(); +attributeNames_c = attributeNames.copy(); +i = 1; j = 2; +color = ['r','g', 'b'] +plt.title('Iris classification problem') +for c in range(len(classNames)): + idx = y_c == c + plt.scatter(x=X_c[idx, i], + y=X_c[idx, j], + c=color[c], + s=50, alpha=0.5, + label=classNames[c]) +plt.legend() +plt.xlabel(attributeNames_c[i]) +plt.ylabel(attributeNames_c[j]) +plt.show() +# Consider, for instance, if it would be possible to make a single line in +# the plot to delineate any two groups? Can you draw a line between +# the Setosas and the Versicolors? The Versicolors and the Virginicas? + +## Regression problem +# Since the variable we wish to predict is petal length, +# petal length cannot any longer be in the data matrix X. +# The first thing we do is store all the information we have in the +# other format in one data matrix: +data = np.concatenate((X_c, np.expand_dims(y_c,axis=1)), axis=1) +# We need to do expand_dims to y_c for the dimensions of X_c and y_c to fit. + +# We know that the petal length corresponds to the third column in the data +# matrix (see attributeNames), and therefore our new y variable is: +y_r = data[:, 2] + +# Similarly, our new X matrix is all the other information but without the +# petal length (since it's now the y variable): +X_r = data[:, [0, 1, 3, 4]] + +# Since the iris class information (which is now the last column in X_r) is a +# categorical variable, we will do a one-out-of-K encoding of the variable: +species = np.array(X_r[:, -1], dtype=int).T +K = species.max()+1 +species_encoding = np.zeros((species.size, K)) +species_encoding[np.arange(species.size), species] = 1 +# The encoded information is now a 150x3 matrix. This corresponds to 150 +# observations, and 3 possible species. For each observation, the matrix +# has a row, and each row has two 0s and a single 1. The placement of the 1 +# specifies which of the three Iris species the observations was. + +# We need to replace the last column in X (which was the not encoded +# version of the species data) with the encoded version: +X_r = np.concatenate( (X_r[:, :-1], species_encoding), axis=1) + +# Now, X is of size 150x6 corresponding to the three measurements of the +# Iris that are not the petal length as well as the three variables that +# specifies whether or not a given observations is or isn't a certain type. +# We need to update the attribute names and store the petal length name +# as the name of the target variable for a regression: +targetName_r = attributeNames_c[2] +attributeNames_r = np.concatenate((attributeNames_c[[0, 1, 3]], classNames), + axis=0) + +# Lastly, we update M, since we now have more attributes: +N,M = X_r.shape + +# A relevant figure for this regression problem could +# for instance be one that shows how the target, that is the petal length, +# changes with one of the predictors in X: +i = 2 +plt.title('Iris regression problem') +plt.plot(X_r[:, i], y_r, 'o') +plt.xlabel(attributeNames_r[i]); +plt.ylabel(targetName_r); +# Consider if you see a relationship between the predictor variable on the +# x-axis (the variable from X) and the target variable on the y-axis (the +# variable y). Could you draw a straight line through the data points for +# any of the attributes (choose different i)? +# Note that, when i is 3, 4, or 5, the x-axis is based on a binary +# variable, in which case a scatter plot is not as such the best option for +# visulizing the information. + diff --git a/exercises/02450Toolbox_Python/Scripts/ex1_5_5.py b/exercises/02450Toolbox_Python/Scripts/ex1_5_5.py new file mode 100644 index 0000000000000000000000000000000000000000..0e90359b6591b44a85fbfc9287fe08c9ed0b64b5 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex1_5_5.py @@ -0,0 +1,145 @@ +## exercise 1.5.5 +import numpy as np +import matplotlib.pyplot as plt + +# In this exercise we will rely on pandas for some of the processing steps: +import pandas as pd + +# We start by defining the path to the file that we're we need to load. +# Upon inspection, we saw that the messy_data.data was infact a file in the +# format of a CSV-file with a ".data" extention instead. +file_path = '../Data/messy_data/messy_data.data' +# First of we simply read the file in using readtable, however, we need to +# tell the function that the file is tab-seperated. We also need to specify +# that the header is in the second row: +messy_data = pd.read_csv(file_path, sep='\t', header=1) +# We also need to remove the added header line in the .data file which seems +# to have included a shortend form the variables (check messy_data.head()): +messy_data = messy_data.drop(messy_data.index[0]) + +# We extract the attribute names: +attributeNames = np.asarray(messy_data.columns) +# As we progress through this script, we might change which attributes are +# stored where. For simplicity in presenting the processing steps, we wont +# keep track of those changes in attributeNames in this example script. + +# The last column is a unique string for each observation defining the +# car make and model. We decide to extract this in a variable for itself +# for now, and then remove it from messy_data: +car_names = np.array(messy_data.carname) +messy_data = messy_data.drop(['carname'], axis=1) + +# Inspect messy data by e.g.: +#print(messy_data.to_string()) + +# At this point, youll see that some of the missing values from the data +# has already been represented as NaNs (in the displacement column). +# However, these were only the places where an empty element was in the file. +# First off, we remove the question marks in displacement and replace +# them with not a number, NaN: +messy_data.displacement = messy_data.displacement.str.replace('?','NaN') + +# Similarly, we remove the formatting for a thousand seperator that is +# present for the weight attribute: +messy_data.weight = messy_data.weight.str.replace("'", '') +# And lastly, we replace all the commas that were used as decimal seperatos +# in the accceleration attribute with dots: +messy_data.acceleration = messy_data.acceleration.str.replace(",", '.') + +# the data has some zero values that the README.txt tolds us were missing +# values - this was specifically for the attributes mpg and displacement, +# so we're careful only to replace the zeros in these attributes, since a +# zero might be correct for some other variables: +messy_data.mpg = messy_data.mpg.replace({'0': np.nan}) +messy_data.displacement = messy_data.displacement.replace({'0': np.nan}) + +# We later on find out that a value of 99 for the mpg is not value that is +# within reason for the MPG of the cars in this dataset. The observations +# that has this value of MPG is therefore incorrect, and we should treat +# the value as missing. How would you add a line of code to this data +# cleanup script to account for this information? + +## X,y-format +# If the modelling problem of interest was a classification problem where +# we wanted to classify the origin attribute, we could now identify obtain +# the data in the X,y-format as so: +data = np.array(messy_data.values, dtype=np.float64) +X_c = data[:, :-1].copy() +y_c = data[:, -1].copy() + +# However, if the problem of interest was to model the MPG based on the +# other attributes (a regression problem), then the X,y-format is +# obtained as: +X_r = data[:, 1:].copy() +y_r = data[:, 0].copy() + +# Since origin is categorical variable, we can do as in previos exercises +# and do a one-out-of-K encoding: +origin = np.array(X_r[:, -1], dtype=int).T-1 +K = origin.max()+1 +origin_encoding = np.zeros((origin.size, K)) +origin_encoding[np.arange(origin.size), origin] = 1 +X_r = np.concatenate((X_r[:, :-1], origin_encoding),axis=1) +# Since the README.txt doesn't supply a lot of information about what the +# levels in the origin variable mean, you'd have to either make an educated +# guess based on the values in the context, or preferably obtain the +# information from any papers that might be references in the README. +# In this case, you can inspect origin and car_names, to see that (north) +# american makes are all value 0 (try looking at car_names[origin == 0], +# whereas origin value 1 is European, and value 2 is Asian. + +## Missing values +# In the above X,y-matrices, we still have the missing values. In the +# following we will go through how you could go about handling the missing +# values before making your X,y-matrices as above. + +# Once we have identified all the missing data, we have to handle it +# some way. Various apporaches can be used, but it is important +# to keep it mind to never do any of them blindly. Keep a record of what +# you do, and consider/discuss how it might affect your modelling. + +# The simplest way of handling missing values is to drop any records +# that display them, we do this by first determining where there are +# missing values: +missing_idx = np.isnan(data) +# Observations with missing values have a row-sum in missing_idx +# which is greater than zero: +obs_w_missing = np.sum(missing_idx, 1) > 0 +data_drop_missing_obs = data[np.logical_not(obs_w_missing), :] +# This reduces us to 15 observations of the original 29. + +# Another approach is to first investigate where the missing values are. +# A quick way to do this is to visually look at the missing_idx: +plt.title('Visual inspection of missing values') +plt.imshow(missing_idx) +plt.ylabel('Observations'); plt.xlabel('Attributes'); +plt.show() + +# From such a plot, we can see that the issue is the third column, the +# displacement attribute. This can be confirmed by e.g. doing: +#np.sum(missing_idx, 0) +# which shows that 12 observations are missing a value in the third column. +# Therefore, another way to move forward is to disregard displacement +# (for now) and remove the attribute. We then remove the few +# remaining observations with missing values: +cols = np.ones((data.shape[1]), dtype=bool) +cols[2] = 0 +data_wo_displacement = data[:, cols] +obs_w_missing_wo_displacement = np.sum(np.isnan(data_wo_displacement),1)>0 +data_drop_disp_then_missing = data[np.logical_not(obs_w_missing_wo_displacement), :] +# Now we have kept all but two of the observations. This however, doesn't +# necesarrily mean that this approach is superior to the previous one, +# since we have now also lost any and all information that we could have +# gotten from the displacement attribute. + +# One could impute the missing values - "guess them", in some +# sense - while trying to minimize the impact of the guess. +# A simply way of imputing them is to replace the missing values +# with the median of the attribute. We would have to do this for the +# missing values for attributes 1 and 3: +data_imputed = data.copy(); +for att in [0, 2]: + # We use nanmedian to ignore the nan values + impute_val = np.nanmedian(data[:, att]) + idx = missing_idx[:, att] + data_imputed[idx, att] = impute_val; diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_1_1.py b/exercises/02450Toolbox_Python/Scripts/ex2_1_1.py new file mode 100644 index 0000000000000000000000000000000000000000..7d21db17ab4cdba5bd8b92ae9c40ec9e31398d0f --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_1_1.py @@ -0,0 +1,30 @@ +# exercise 2.1.1 +import numpy as np +import xlrd + +# Load xls sheet with data +doc = xlrd.open_workbook('../Data/nanonose.xls').sheet_by_index(0) + +# Extract attribute names (1st row, column 4 to 12) +attributeNames = doc.row_values(0, 3, 11) + +# Extract class names to python list, +# then encode with integers (dict) +classLabels = doc.col_values(0, 2, 92) +classNames = sorted(set(classLabels)) +classDict = dict(zip(classNames, range(5))) + +# Extract vector y, convert to NumPy array +y = np.asarray([classDict[value] for value in classLabels]) + +# Preallocate memory, then extract excel data to matrix X +X = np.empty((90, 8)) +for i, col_id in enumerate(range(3, 11)): + X[:, i] = np.asarray(doc.col_values(col_id, 2, 92)) + +# Compute values of N, M and C. +N = len(y) +M = len(attributeNames) +C = len(classNames) + +print('Ran Exercise 2.1.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_1_2.py b/exercises/02450Toolbox_Python/Scripts/ex2_1_2.py new file mode 100644 index 0000000000000000000000000000000000000000..45429a5883e3efbab8410e44f5b412fb90d2ad8d --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_1_2.py @@ -0,0 +1,36 @@ +# exercise 2.1.2 + +# Imports the numpy and xlrd package, then runs the ex2_1_1 code +from ex2_1_1 import * +# (requires data structures from ex. 2.1.1) + +from matplotlib.pyplot import figure, plot, title, legend, xlabel, ylabel, show + +# Data attributes to be plotted +i = 0 +j = 1 + +## +# Make a simple plot of the i'th attribute against the j'th attribute +# Notice that X is of matrix type (but it will also work with a numpy array) +# X = np.array(X) #Try to uncomment this line +plot(X[:, i], X[:, j], 'o') + +# %% +# Make another more fancy plot that includes legend, class labels, +# attribute names, and a title. +f = figure() +title('NanoNose data') + +for c in range(C): + # select indices belonging to class c: + class_mask = y==c + plot(X[class_mask,i], X[class_mask,j], 'o',alpha=.3) + +legend(classNames) +xlabel(attributeNames[i]) +ylabel(attributeNames[j]) + +# Output result to screen +show() +print('Ran Exercise 2.1.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_1_3.py b/exercises/02450Toolbox_Python/Scripts/ex2_1_3.py new file mode 100644 index 0000000000000000000000000000000000000000..6853efb9c883bed33ede41c877b80f4d96d15605 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_1_3.py @@ -0,0 +1,31 @@ +# exercise 2.1.3 +# (requires data structures from ex. 2.2.1) +from ex2_1_1 import * + +import matplotlib.pyplot as plt +from scipy.linalg import svd + +# Subtract mean value from data +Y = X - np.ones((N,1))*X.mean(axis=0) + +# PCA by computing SVD of Y +U,S,V = svd(Y,full_matrices=False) + +# Compute variance explained by principal components +rho = (S*S) / (S*S).sum() + +threshold = 0.9 + +# Plot variance explained +plt.figure() +plt.plot(range(1,len(rho)+1),rho,'x-') +plt.plot(range(1,len(rho)+1),np.cumsum(rho),'o-') +plt.plot([1,len(rho)],[threshold, threshold],'k--') +plt.title('Variance explained by principal components'); +plt.xlabel('Principal component'); +plt.ylabel('Variance explained'); +plt.legend(['Individual','Cumulative','Threshold']) +plt.grid() +plt.show() + +print('Ran Exercise 2.1.3') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_1_4.py b/exercises/02450Toolbox_Python/Scripts/ex2_1_4.py new file mode 100644 index 0000000000000000000000000000000000000000..beacf3f82150ec2ed6cad78aa6c159fb3b3e41dd --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_1_4.py @@ -0,0 +1,39 @@ +# exercise 2.1.4 +# (requires data structures from ex. 2.2.1 and 2.2.3) +from ex2_1_1 import * + +from matplotlib.pyplot import figure, plot, title, xlabel, ylabel, show, legend +from scipy.linalg import svd + +# Subtract mean value from data +Y = X - np.ones((N,1))*X.mean(0) + +# PCA by computing SVD of Y +U,S,Vh = svd(Y,full_matrices=False) +# scipy.linalg.svd returns "Vh", which is the Hermitian (transpose) +# of the vector V. So, for us to obtain the correct V, we transpose: +V = Vh.T + +# Project the centered data onto principal component space +Z = Y @ V + +# Indices of the principal components to be plotted +i = 0 +j = 1 + +# Plot PCA of the data +f = figure() +title('NanoNose data: PCA') +#Z = array(Z) +for c in range(C): + # select indices belonging to class c: + class_mask = y==c + plot(Z[class_mask,i], Z[class_mask,j], 'o', alpha=.5) +legend(classNames) +xlabel('PC{0}'.format(i+1)) +ylabel('PC{0}'.format(j+1)) + +# Output result to screen +show() + +print('Ran Exercise 2.1.4') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_1_5.py b/exercises/02450Toolbox_Python/Scripts/ex2_1_5.py new file mode 100644 index 0000000000000000000000000000000000000000..322abc611d8e99cc1da99c8d88dbe46a70917ade --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_1_5.py @@ -0,0 +1,54 @@ +# exercise 2.2.4 + +# (requires data structures from ex. 2.2.1) +from ex2_1_1 import * + +import matplotlib.pyplot as plt +from scipy.linalg import svd + +Y = X - np.ones((N,1))*X.mean(0) +U,S,Vh = svd(Y,full_matrices=False) +V=Vh.T +N,M = X.shape + +# We saw in 2.1.3 that the first 3 components explaiend more than 90 +# percent of the variance. Let's look at their coefficients: +pcs = [0,1,2] +legendStrs = ['PC'+str(e+1) for e in pcs] +c = ['r','g','b'] +bw = .2 +r = np.arange(1,M+1) +for i in pcs: + plt.bar(r+i*bw, V[:,i], width=bw) +plt.xticks(r+bw, attributeNames) +plt.xlabel('Attributes') +plt.ylabel('Component coefficients') +plt.legend(legendStrs) +plt.grid() +plt.title('NanoNose: PCA Component Coefficients') +plt.show() + +# Inspecting the plot, we see that the 2nd principal component has large +# (in magnitude) coefficients for attributes A, E and H. We can confirm +# this by looking at it's numerical values directly, too: +print('PC2:') +print(V[:,1].T) + +# How does this translate to the actual data and its projections? +# Looking at the data for water: + +# Projection of water class onto the 2nd principal component. +all_water_data = Y[y==4,:] + +print('First water observation') +print(all_water_data[0,:]) + +# Based on the coefficients and the attribute values for the observation +# displayed, would you expect the projection onto PC2 to be positive or +# negative - why? Consider *both* the magnitude and sign of *both* the +# coefficient and the attribute! + +# You can determine the projection by (remove comments): +print('...and its projection onto PC2') +print(all_water_data[0,:]@V[:,1]) +# Try to explain why? \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_1_6.py b/exercises/02450Toolbox_Python/Scripts/ex2_1_6.py new file mode 100644 index 0000000000000000000000000000000000000000..02259d96766dadbb2c207ace5869da056d56b485 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_1_6.py @@ -0,0 +1,101 @@ +## exercise 2.1.6 +from ex2_1_1 import * +import matplotlib.pyplot as plt +from scipy.linalg import svd + +r = np.arange(1,X.shape[1]+1) +plt.bar(r, np.std(X,0)) +plt.xticks(r, attributeNames) +plt.ylabel('Standard deviation') +plt.xlabel('Attributes') +plt.title('NanoNose: attribute standard deviations') + +## Investigate how standardization affects PCA + +# Try this *later* (for last), and explain the effect +#X_s = X.copy() # Make a to be "scaled" version of X +#X_s[:, 2] = 100*X_s[:, 2] # Scale/multiply attribute C with a factor 100 +# Use X_s instead of X to in the script below to see the difference. +# Does it affect the two columns in the plot equally? + + +# Subtract the mean from the data +Y1 = X - np.ones((N, 1))*X.mean(0) + +# Subtract the mean from the data and divide by the attribute standard +# deviation to obtain a standardized dataset: +Y2 = X - np.ones((N, 1))*X.mean(0) +Y2 = Y2*(1/np.std(Y2,0)) +# Here were utilizing the broadcasting of a row vector to fit the dimensions +# of Y2 + +# Store the two in a cell, so we can just loop over them: +Ys = [Y1, Y2] +titles = ['Zero-mean', 'Zero-mean and unit variance'] +threshold = 0.9 +# Choose two PCs to plot (the projection) +i = 0 +j = 1 + +# Make the plot +plt.figure(figsize=(10,15)) +plt.subplots_adjust(hspace=.4) +plt.title('NanoNose: Effect of standardization') +nrows=3 +ncols=2 +for k in range(2): + # Obtain the PCA solution by calculate the SVD of either Y1 or Y2 + U,S,Vh = svd(Ys[k],full_matrices=False) + V=Vh.T # For the direction of V to fit the convention in the course we transpose + # For visualization purposes, we flip the directionality of the + # principal directions such that the directions match for Y1 and Y2. + if k==1: V = -V; U = -U; + + # Compute variance explained + rho = (S*S) / (S*S).sum() + + # Compute the projection onto the principal components + Z = U*S; + + # Plot projection + plt.subplot(nrows, ncols, 1+k) + C = len(classNames) + for c in range(C): + plt.plot(Z[y==c,i], Z[y==c,j], '.', alpha=.5) + plt.xlabel('PC'+str(i+1)) + plt.xlabel('PC'+str(j+1)) + plt.title(titles[k] + '\n' + 'Projection' ) + plt.legend(classNames) + plt.axis('equal') + + # Plot attribute coefficients in principal component space + plt.subplot(nrows, ncols, 3+k) + for att in range(V.shape[1]): + plt.arrow(0,0, V[att,i], V[att,j]) + plt.text(V[att,i], V[att,j], attributeNames[att]) + plt.xlim([-1,1]) + plt.ylim([-1,1]) + plt.xlabel('PC'+str(i+1)) + plt.ylabel('PC'+str(j+1)) + plt.grid() + # Add a unit circle + plt.plot(np.cos(np.arange(0, 2*np.pi, 0.01)), + np.sin(np.arange(0, 2*np.pi, 0.01))); + plt.title(titles[k] +'\n'+'Attribute coefficients') + plt.axis('equal') + + # Plot cumulative variance explained + plt.subplot(nrows, ncols, 5+k); + plt.plot(range(1,len(rho)+1),rho,'x-') + plt.plot(range(1,len(rho)+1),np.cumsum(rho),'o-') + plt.plot([1,len(rho)],[threshold, threshold],'k--') + plt.title('Variance explained by principal components'); + plt.xlabel('Principal component'); + plt.ylabel('Variance explained'); + plt.legend(['Individual','Cumulative','Threshold']) + plt.grid() + plt.title(titles[k]+'\n'+'Variance explained') + +plt.show() + + \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_2_1.py b/exercises/02450Toolbox_Python/Scripts/ex2_2_1.py new file mode 100644 index 0000000000000000000000000000000000000000..c7ff4f82c23371a4312b855f33406e36d4d2ab1f --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_2_1.py @@ -0,0 +1,35 @@ +from matplotlib.pyplot import (figure, subplot, imshow, xlabel, title, +yticks, show,cm) +from scipy.io import loadmat +import numpy as np + +# Index of the digit to display +i = 0 + +# Load Matlab data file to python dict structure +mat_data = loadmat('../Data/zipdata.mat') + +# Extract variables of interest +testdata = mat_data['testdata'] +traindata = mat_data['traindata'] +X = traindata[:,1:] +y = traindata[:,0] + + +# Visualize the i'th digit as a vector +f = figure() +subplot(4,1,4) +imshow(np.expand_dims(X[i,:],axis=0), extent=(0,256,0,10), cmap=cm.gray_r) +xlabel('Pixel number') +title('Digit in vector format') +yticks([]) + +# Visualize the i'th digit as an image +subplot(2,1,1) +I = np.reshape(X[i,:],(16,16)) +imshow(I, extent=(0,16,0,16), cmap=cm.gray_r) +title('Digit as an image') + +show() + +print('Ran Exercise 2.2.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_2_2.py b/exercises/02450Toolbox_Python/Scripts/ex2_2_2.py new file mode 100644 index 0000000000000000000000000000000000000000..123c0780513c140d24e19a64b3c5f6f1a59b461e --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_2_2.py @@ -0,0 +1,103 @@ +# exercise 2.2.2 + +from matplotlib.pyplot import (figure, subplot, plot, xlabel, ylabel, title, +yticks, show,legend,imshow, cm) +from scipy.io import loadmat +import scipy.linalg as linalg +import numpy as np + +# Digits to include in analysis (to include all, n = range(10) ) +n = [0,1] +# Number of principal components for reconstruction +K = 16 +# Digits to visualize +nD = range(6) + + +# Load Matlab data file to python dict structure +# and extract variables of interest +traindata = loadmat('../Data/zipdata.mat')['traindata'] +X = traindata[:,1:] +y = traindata[:,0] + +N,M = X.shape +C = len(n) + +classValues = n +classNames = [str(num) for num in n] +classDict = dict(zip(classNames,classValues)) + + +# Select subset of digits classes to be inspected +class_mask = np.zeros(N).astype(bool) +for v in n: + cmsk = (y == v) + class_mask = class_mask | cmsk +X = X[class_mask,:] +y = y[class_mask] +N=X.shape[0] + +# Center the data (subtract mean column values) +Xc = X - np.ones((N,1))*X.mean(0) + +# PCA by computing SVD of Y +U,S,V = linalg.svd(Xc,full_matrices=False) +#U = mat(U) +V = V.T + +# Compute variance explained by principal components +rho = (S*S) / (S*S).sum() + +# Project data onto principal component space +Z = Xc @ V + +# Plot variance explained +figure() +plot(rho,'o-') +title('Variance explained by principal components') +xlabel('Principal component') +ylabel('Variance explained value') + + +# Plot PCA of the data +f = figure() +title('pixel vectors of handwr. digits projected on PCs') +for c in n: + # select indices belonging to class c: + class_mask = (y == c) + plot(Z[class_mask,0], Z[class_mask,1], 'o') +legend(classNames) +xlabel('PC1') +ylabel('PC2') + + +# Visualize the reconstructed data from the first K principal components +# Select randomly D digits. +figure(figsize=(10,3)) +W = Z[:,range(K)] @ V[:,range(K)].T +D = len(nD) +for d in range(D): + digit_ix = np.random.randint(0,N) + subplot(2, D, int(d+1)) + I = np.reshape(X[digit_ix,:], (16,16)) + imshow(I, cmap=cm.gray_r) + title('Original') + subplot(2, D, D+d+1) + I = np.reshape(W[digit_ix,:]+X.mean(0), (16,16)) + imshow(I, cmap=cm.gray_r) + title('Reconstr.') + + +# Visualize the pricipal components +figure(figsize=(8,6)) +for k in range(K): + N1 = int(np.ceil(np.sqrt(K))); N2 = int(np.ceil(K/N1)) + subplot(N2, N1, int(k+1)) + I = np.reshape(V[:,k], (16,16)) + imshow(I, cmap=cm.hot) + title('PC{0}'.format(k+1)) + +# output to screen +show() + +print('Ran Exercise 2.2.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex2_3_1.py b/exercises/02450Toolbox_Python/Scripts/ex2_3_1.py new file mode 100644 index 0000000000000000000000000000000000000000..f54d26f253f96103d8c832194f10adac1e16fa23 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex2_3_1.py @@ -0,0 +1,56 @@ +# exercise 2.3.1 + +from matplotlib.pyplot import figure, plot, xlabel, ylabel, show +from scipy.io import loadmat +from sklearn.neighbors import KNeighborsClassifier +import scipy.linalg as linalg +import numpy as np + +# Number of principal components to use for classification, +# i.e. the reduced dimensionality +K = [8,10,15,20,30,40,50,60,100,150] + +# Load Matlab data file and extract training set and test set +mat_data = loadmat('../Data/zipdata.mat') +X = mat_data['traindata'][:,1:] +y = mat_data['traindata'][:,0] +Xtest = mat_data['testdata'][:,1:] +ytest = mat_data['testdata'][:,0] +N,M = X.shape +Ntest = Xtest.shape[0] # or Xtest[:,0].shape + +# Subtract the mean from the data +Y = X - np.ones((N,1))*X.mean(0) +Ytest = Xtest - np.ones((Ntest,1))*X.mean(0) + +# Obtain the PCA solution by calculate the SVD of Y +U,S,V = linalg.svd(Y,full_matrices=False) +V = V.T + + +# Repeat classification for different values of K +error_rates = [] +for k in K: + # Project data onto principal component space, + Z = Y @ V[:,:k] + Ztest = Ytest @ V[:,:k] + + # Classify data with knn classifier + knn_classifier = KNeighborsClassifier(n_neighbors=1) + knn_classifier.fit(Z,y.ravel()) + y_estimated = knn_classifier.predict(Ztest) + + # Compute classification error rates + y_estimated = y_estimated.T + er = (sum(ytest!=y_estimated)/float(len(ytest)))*100 + error_rates.append(er) + print('K={0}: Error rate: {1:.1f}%'.format(k, er)) + +# Visualize error rates vs. number of principal components considered +figure() +plot(K,error_rates,'o-') +xlabel('Number of principal components K') +ylabel('Error rate [%]') +show() + +print('Ran Exercise 2.3.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex3_1_2.py b/exercises/02450Toolbox_Python/Scripts/ex3_1_2.py new file mode 100644 index 0000000000000000000000000000000000000000..661759e4ea700063225bc588e580457ea479d76a --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex3_1_2.py @@ -0,0 +1,52 @@ +# exercise 3.1.4 +import numpy as np +from sklearn.feature_extraction.text import CountVectorizer + +# Load the textDocs.txt as a long string into raw_file: +with open('../Data/textDocs.txt', 'r') as f: + raw_file = f.read() +# raw_file contains sentences seperated by newline characters, +# so we split by '\n': +corpus = raw_file.split('\n') +# corpus is now list of "documents" (sentences), but some of them are empty, +# because textDocs.txt has a lot of empty lines, we filter/remove them: +corpus = list(filter(None, corpus)) + +# Display the result +print('Document-term matrix analysis') +print() +print('Corpus (5 documents/sentences):') +print(np.asmatrix(corpus)) +print() + + +# To automatically obtain the bag of words representation, we use sklearn's +# feature_extraction.text module, which has a function CountVectorizer. +# We make a CounterVectorizer: +vectorizer = CountVectorizer(token_pattern=r'\b[^\d\W]+\b') +# The token pattern is a regular expression (marked by the r), which ensures +# that the vectorizer ignores digit/non-word tokens - in this case, it ensures +# the 10 in the last document is not recognized as a token. It's not important +# that you should understand it the regexp. + +# The object vectorizer can now be used to first 'fit' the vectorizer to the +# corpus, and the subsequently transform the data. We start by fitting: +vectorizer.fit(corpus) +# The vectorizer has now determined the unique terms (or tokens) in the corpus +# and we can extract them using: +attributeNames = vectorizer.get_feature_names() +print('Found terms:') +print(attributeNames) +print() + +# The next step is to count how many times each term is found in each document, +# which we do using the transform function: +X = vectorizer.transform(corpus) +N,M = X.shape +print('Number of documents (data objects, N):\t %i' % N) +print('Number of terms (attributes, M):\t %i' % M ) +print() +print('Document-term matrix:') +print(X.toarray()) +print() +print('Ran Exercise 3.1.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex3_1_3.py b/exercises/02450Toolbox_Python/Scripts/ex3_1_3.py new file mode 100644 index 0000000000000000000000000000000000000000..cfe6f69ab241a98b4f37fc1413f9e338175e5a0c --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex3_1_3.py @@ -0,0 +1,37 @@ +# exercise 3.1.4 +from sklearn.feature_extraction.text import CountVectorizer + +# As before, load the corpus and preprocess: +with open('../Data/textDocs.txt', 'r') as f: + raw_file = f.read() +corpus = raw_file.split('\n') +corpus = list(filter(None, corpus)) + +# Load and process the stop words in a similar manner: +with open('../Data/stopWords.txt', 'r') as f: + raw_file = f.read() +stopwords = raw_file.split('\n') + +# When making the CountVectorizer, we now input the stop words: +vectorizer = CountVectorizer(token_pattern=r'\b[^\d\W]+\b', + stop_words=stopwords) +# Determine the terms in the corpus +vectorizer.fit(corpus) +# ... and count the frequency of each term within a document: +X = vectorizer.transform(corpus) +attributeNames = vectorizer.get_feature_names() +N,M = X.shape + +# Display the result +print('Document-term matrix analysis (using stop words)') +print() +print('Number of documents (data objects, N):\t %i' % N) +print('Number of terms (attributes, M):\t %i' % M ) +print() +print('Found terms (no stop words):') +print(attributeNames) +print() +print('Document-term matrix:') +print(X.toarray()) +print() +print('Ran Exercise 3.1.3') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex3_1_4.py b/exercises/02450Toolbox_Python/Scripts/ex3_1_4.py new file mode 100644 index 0000000000000000000000000000000000000000..53ba9863e5bd7ec0723b8cc1b07e68844543f812 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex3_1_4.py @@ -0,0 +1,55 @@ +# exercise 3.1.4 +from sklearn.feature_extraction.text import CountVectorizer + +# We'll use a widely used stemmer based: +# Porter, M. “An algorithm for suffix stripping.” Program 14.3 (1980): 130-137. +# The stemmer is implemented in the most used natural language processing +# package in Python, "Natural Langauge Toolkit" (NLTK): +from nltk.stem import PorterStemmer + +# Load and process the corpus and stop words: +with open('../Data/textDocs.txt', 'r') as f: + raw_file = f.read() +corpus = raw_file.split('\n') +corpus = list(filter(None, corpus)) + +with open('../Data/stopWords.txt', 'r') as f: + raw_file = f.read() +stopwords = raw_file.split('\n') + +# To enable stemming when using the sklearn-module, we need to parse an +# "analyzer" to the vectorizer we've been using. +# First, we make an object based on the PorterStemmer class, and we also make +# an analyzer object: +stemmer = PorterStemmer() +analyzer = CountVectorizer(token_pattern=r'\b[^\d\W]+\b', + stop_words=stopwords).build_analyzer() +# Using these we'll make a function that can stem words: +def stemmed_words(doc): + return (stemmer.stem(w) for w in analyzer(doc)) +# ... and finally, we make a vectorizer just like we've done before: +vectorizer = CountVectorizer(analyzer=stemmed_words) + +# Determine the terms: +vectorizer.fit(corpus) +attributeNames = vectorizer.get_feature_names() + +# ... and count the occurences: +X = vectorizer.transform(corpus) +N,M = X.shape +X = X.toarray() + +# Display the result +print('Document-term matrix analysis (using stop words and stemming)') +print() +print('Number of documents (data objects, N):\t %i' % N) +print('Number of terms (attributes, M):\t %i' % M ) +print() +print('Found terms (no stop words, stemmed):') +print(attributeNames) +print() +print('Document-term matrix:') +print(X) +print() +print('Ran Exercise 3.1.4') +print() \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex3_1_5.py b/exercises/02450Toolbox_Python/Scripts/ex3_1_5.py new file mode 100644 index 0000000000000000000000000000000000000000..9be9bd0b2aaf6f010dddbff279e038c575aaf8c8 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex3_1_5.py @@ -0,0 +1,35 @@ +# exercise 3.1.5 +import numpy as np +import scipy.linalg as linalg +from toolbox_02450.similarity import similarity + +from ex3_1_4 import * + +# Query vector +q = np.array([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0]) +# notice, that you could get the query vector using the vectorizer, too: +#q = vectorizer.transform(['matrix rank solv']) +#q = np.asarray(q.toarray()) +# or use any other string: +#q = vectorizer.transform(['Can I Google how to fix my problem?']) +#q = np.asarray(q.toarray()) + +# Method 1 ('for' loop - slow) +N = np.shape(X)[0]; # get the number of data objects +sim = np.zeros((N,1)) # allocate a vector for the similarity +for i in range(N): + x = X[i,:] # Get the i'th data object (here: document) + sim[i] = q/linalg.norm(q) @ x.T/linalg.norm(x) # Compute cosine similarity + +# Method 2 (one line of code with no iterations - faster) +sim = (q @ X.T).T / (np.sqrt(np.power(X,2).sum(axis=1)) * np.sqrt(np.power(q,2).sum())) + +# Method 3 (use the "similarity" function) +sim = similarity(X, q, 'cos'); + + +# Display the result +print('Query vector:\n {0}\n'.format(q)) +print('Similarity results:\n {0}'.format(sim)) + +print('Ran Exercise 3.1.5') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex3_2_1.py b/exercises/02450Toolbox_Python/Scripts/ex3_2_1.py new file mode 100644 index 0000000000000000000000000000000000000000..aef67d775b93f363ea3d4ad0cf6ae177e939d19a --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex3_2_1.py @@ -0,0 +1,19 @@ +# exercise 3.2.1 +import numpy as np + +x = np.array([-0.68, -2.11, 2.39, 0.26, 1.46, 1.33, 1.03, -0.41, -0.33, 0.47]) + +# Compute values +mean_x = x.mean() +std_x = x.std(ddof=1) +median_x = np.median(x) +range_x = x.max()-x.min() + +# Display results +print('Vector:',x) +print('Mean:',mean_x) +print('Standard Deviation:',std_x) +print('Median:',median_x) +print('Range:',range_x) + +print('Ran Exercise 3.2.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex3_3_1.py b/exercises/02450Toolbox_Python/Scripts/ex3_3_1.py new file mode 100644 index 0000000000000000000000000000000000000000..5ed8dd5aae0919ecc1b2a799beee4bb62710fab0 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex3_3_1.py @@ -0,0 +1,74 @@ +# exercise 3.3.1 + +import matplotlib.pyplot as plt +import numpy as np +from scipy.io import loadmat +from toolbox_02450.similarity import similarity + +# Image to use as query +i = 1 + +# Similarity: 'SMC', 'Jaccard', 'ExtendedJaccard', 'Cosine', 'Correlation' +similarity_measure = 'SMC' + +# Load the digits +# Load Matlab data file to python dict structure +X = loadmat('../Data/digits.mat')['X'] +# You can also try the CBCL faces dataset (remember to change 'transpose') +#X = loadmat('../Data/wildfaces_grayscale.mat')['X'] +N, M = X.shape +transpose = False # should the plotted images be transposed? + + +# Search the face database for similar faces +# Index of all other images than i +noti = list(range(0,i)) + list(range(i+1,N)) +# Compute similarity between image i and all others +sim = similarity(X[i,:], X[noti,:], similarity_measure) +sim = sim.tolist()[0] +# Tuples of sorted similarities and their indices +sim_to_index = sorted(zip(sim,noti)) + + +# Visualize query image and 5 most/least similar images +plt.figure(figsize=(12,8)) +plt.subplot(3,1,1) + +img_hw = int(np.sqrt(len(X[0]))) +img = np.reshape(X[i], (img_hw,img_hw)) +if transpose: img = img.T +plt.imshow(img, cmap=plt.cm.gray) +plt.xticks([]); plt.yticks([]) +plt.title('Query image') +plt.ylabel('image #{0}'.format(i)) + + +for ms in range(5): + + # 5 most similar images found + plt.subplot(3,5,6+ms) + im_id = sim_to_index[-ms-1][1] + im_sim = sim_to_index[-ms-1][0] + img = np.reshape(X[im_id],(img_hw,img_hw)) + if transpose: img = img.T + plt.imshow(img, cmap=plt.cm.gray) + plt.xlabel('sim={0:.3f}'.format(im_sim)) + plt.ylabel('image #{0}'.format(im_id)) + plt.xticks([]); plt.yticks([]) + if ms==2: plt.title('Most similar images') + + # 5 least similar images found + plt.subplot(3,5,11+ms) + im_id = sim_to_index[ms][1] + im_sim = sim_to_index[ms][0] + img = np.reshape(X[im_id],(img_hw,img_hw)) + if transpose: img = img.T + plt.imshow(img, cmap=plt.cm.gray) + plt.xlabel('sim={0:.3f}'.format(im_sim)) + plt.ylabel('image #{0}'.format(im_id)) + plt.xticks([]); plt.yticks([]) + if ms==2: plt.title('Least similar images') + +plt.show() + +print('Ran Exercise 3.3.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex3_3_2.py b/exercises/02450Toolbox_Python/Scripts/ex3_3_2.py new file mode 100644 index 0000000000000000000000000000000000000000..889a14d4199496a9823fa34fa59afd3147239702 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex3_3_2.py @@ -0,0 +1,23 @@ +# exercise 3.2.2 + +import numpy as np +from toolbox_02450.similarity import similarity + +# Generate two data objects with M random attributes +M = 5; +x = np.random.rand(1,M) +y = np.random.rand(1,M) + +# Two constants +a = 1.5 +b = 1.5 + +# Check the statements in the exercise +print("Cosine scaling: %.4f " % (similarity(x,y,'cos') - similarity(a*x,y,'cos'))[0,0]) +print("ExtendedJaccard scaling: %.4f " % (similarity(x,y,'ext') - similarity(a*x,y,'ext'))[0,0]) +print("Correlation scaling: %.4f " % (similarity(x,y,'cor') - similarity(a*x,y,'cor'))[0,0]) +print("Cosine translation: %.4f " % (similarity(x,y,'cos') - similarity(b+x,y,'cos'))[0,0]) +print("ExtendedJaccard translation: %.4f " % (similarity(x,y,'ext') - similarity(b+x,y,'ext'))[0,0]) +print("Correlation translation: %.4f " % (similarity(x,y,'cor') - similarity(b+x,y,'cor'))[0,0]) + +print('Ran Exercise 3.2.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_1_1.py b/exercises/02450Toolbox_Python/Scripts/ex4_1_1.py new file mode 100644 index 0000000000000000000000000000000000000000..94d8b0bbf55bc290343e3319fdff71ca947470ac --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_1_1.py @@ -0,0 +1,33 @@ +# exercise 4.1.1 + +from matplotlib.pyplot import (figure, title, subplot, plot, hist, show) +import numpy as np + + +# Number of samples +N = 200 + +# Mean +mu = 17 + +# Standard deviation +s = 2 + +# Number of bins in histogram +nbins = 20 + +# Generate samples from the Normal distribution +X = np.random.normal(mu,s,N).T +# or equally: +X = np.random.randn(N).T * s + mu + +# Plot the samples and histogram +figure(figsize=(12,4)) +title('Normal distribution') +subplot(1,2,1) +plot(X,'.') +subplot(1,3,3) +hist(X, bins=nbins) +show() + +print('Ran Exercise 4.1.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_1_2.py b/exercises/02450Toolbox_Python/Scripts/ex4_1_2.py new file mode 100644 index 0000000000000000000000000000000000000000..77949b22e164ab3557c00b3493a8ac0c02e8a52e --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_1_2.py @@ -0,0 +1,41 @@ +# exercise 4.1.2 + +from matplotlib.pyplot import (figure, title, subplot, plot, hist, show) +import numpy as np +# Number of samples +N = 200 + +# Mean +mu = 17 + +# Standard deviation +s = 2 + +# Number of bins in histogram +nbins = 20 + +# Generate samples from the Normal distribution +X = np.random.normal(mu,s,N).T +# or equally: +X = np.random.randn(N).T * s + mu + +# Plot the samples and histogram +figure() +title('Normal distribution') +subplot(1,2,1) +plot(X,'x') +subplot(1,2,2) +hist(X, bins=nbins) + +# Compute empirical mean and standard deviation +mu_ = X.mean() +s_ = X.std(ddof=1) + +print("Theoretical mean: ", mu) +print("Theoretical std.dev.: ", s) +print("Empirical mean: ", mu_) +print("Empirical std.dev.: ", s_) + +show() + +print('Ran Exercise 4.1.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_1_3.py b/exercises/02450Toolbox_Python/Scripts/ex4_1_3.py new file mode 100644 index 0000000000000000000000000000000000000000..719dfc02e815303cfb6caa270bf2d69e42859c6a --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_1_3.py @@ -0,0 +1,45 @@ +# exercise 4.1.3 + +from matplotlib.pyplot import (figure, title, subplot, plot, hist, show) +import numpy as np +from scipy import stats + +# Number of samples +N = 500 + +# Mean +mu = 17 + +# Standard deviation +s = 2 + +# Number of bins in histogram +nbins = 20 + +# Generate samples from the Normal distribution +X = np.random.normal(mu,s,N).T +# or equally: +X = np.random.randn(N).T * s + mu + +# Plot the histogram +f = figure() +title('Normal distribution') +hist(X, bins=nbins, density=True) + +# Over the histogram, plot the theoretical probability distribution function: +x = np.linspace(X.min(), X.max(), 1000) +pdf = stats.norm.pdf(x,loc=17,scale=2) +plot(x,pdf,'.',color='red') + +# Compute empirical mean and standard deviation +mu_ = X.mean() +s_ = X.std(ddof=1) + +print("Theoretical mean: ", mu) +print("Theoretical std.dev.: ", s) +print("Empirical mean: ", mu_) +print("Empirical std.dev.: ", s_) + +show() + +print('Ran Exercise 4.1.3') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_1_4.py b/exercises/02450Toolbox_Python/Scripts/ex4_1_4.py new file mode 100644 index 0000000000000000000000000000000000000000..b451960a83613178f34266885c8ae840287405a7 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_1_4.py @@ -0,0 +1,17 @@ +# exercise 4.1.4 + +import numpy as np + +# Number of samples +N = 1000 + +# Mean +mu = np.array([13, 17]) + +# Covariance matrix +S = np.array([[4,3],[3,9]]) + +# Generate samples from the Normal distribution +X = np.random.multivariate_normal(mu, S, N) + +print('Ran Exercise 4.1.4') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_1_5.py b/exercises/02450Toolbox_Python/Scripts/ex4_1_5.py new file mode 100644 index 0000000000000000000000000000000000000000..06e5d131cc0d53506392d06a225da63d32181c88 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_1_5.py @@ -0,0 +1,51 @@ +# exercise 4.1.5 + +from matplotlib.pyplot import (figure, title, subplot, plot, hist, show, + xlabel, ylabel, xticks, yticks, colorbar, cm, + imshow, suptitle) +import numpy as np + +# Number of samples +N = 1000 + +# Standard deviation of x1 +s1 = 2 + +# Standard deviation of x2 +s2 = 3 + +# Correlation between x1 and x2 +corr = 0.5 + +# Covariance matrix +S = np.matrix([[s1*s1, corr*s1*s2], [corr*s1*s2, s2*s2]]) + +# Mean +mu = np.array([13, 17]) + +# Number of bins in histogram +nbins = 20 + +# Generate samples from multivariate normal distribution +X = np.random.multivariate_normal(mu, S, N) + + +# Plot scatter plot of data +figure(figsize=(12,8)) +suptitle('2-D Normal distribution') + +subplot(1,2,1) +plot(X[:,0], X[:,1], 'x') +xlabel('x1'); ylabel('x2') +title('Scatter plot of data') + +subplot(1,2,2) +x = np.histogram2d(X[:,0], X[:,1], nbins) +imshow(x[0], cmap=cm.gray_r, interpolation='None', origin='lower') +colorbar() +xlabel('x1'); ylabel('x2'); xticks([]); yticks([]); +title('2D histogram') + +show() + +print('Ran Exercise 4.1.5') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_1_6.py b/exercises/02450Toolbox_Python/Scripts/ex4_1_6.py new file mode 100644 index 0000000000000000000000000000000000000000..8504cb22f59367cec86792aa4c4600543a9a30fc --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_1_6.py @@ -0,0 +1,47 @@ +# exercise 4.1.6 + +from matplotlib.pyplot import (figure, subplot, title, imshow, xticks, yticks, + show, cm) +import scipy.linalg as linalg +from scipy.io import loadmat +import numpy as np + +# Digits to include in analysis (to include all: n = range(10)) +n = [0] + +# Load Matlab data file to python dict structure +# and extract variables of interest +traindata = loadmat('../Data/zipdata.mat')['traindata'] +X = traindata[:,1:] +y = traindata[:,0] +N, M = X.shape +C = len(n) + +# Remove digits that are not to be inspected +class_mask = np.zeros(N).astype(bool) +for v in n: + cmsk = (y==v) + class_mask = class_mask | cmsk +X = X[class_mask,:] +y = y[class_mask] +N = np.shape(X)[0] + +mu = X.mean(axis=0) +s = X.std(ddof=1, axis=0) +S = np.cov(X, rowvar=0, ddof=1) + +figure() +subplot(1,2,1) +I = np.reshape(mu, (16,16)) +imshow(I, cmap=cm.gray_r) +title('Mean') +xticks([]); yticks([]) +subplot(1,2,2) +I = np.reshape(s, (16,16)) +imshow(I, cmap=cm.gray_r) +title('Standard deviation') +xticks([]); yticks([]) + +show() + +print('Ran Exercise 4.1.6') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_1_7.py b/exercises/02450Toolbox_Python/Scripts/ex4_1_7.py new file mode 100644 index 0000000000000000000000000000000000000000..93d8df180412679e3e7f91a3a73ec40e67a9c244 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_1_7.py @@ -0,0 +1,68 @@ +# exercise 4.1.7 + +from matplotlib.pyplot import (figure, subplot, imshow, xticks, yticks, title, + cm, show) +import numpy as np +from scipy.io import loadmat + +# Digits to include in analysis (to include all, n = range(10) ) +n = [1] + +# Number of digits to generate from normal distributions +ngen = 10 + +# Load Matlab data file to python dict structure +# and extract variables of interest +traindata = loadmat('../Data/zipdata.mat')['traindata'] +X = traindata[:,1:] +y = traindata[:,0] +N, M = np.shape(X) #or X.shape +C = len(n) + +# Remove digits that are not to be inspected +class_mask = np.zeros(N).astype(bool) +for v in n: + cmsk = (y==v) + class_mask = class_mask | cmsk +X = X[class_mask,:] +y = y[class_mask] +N = np.shape(X)[0] # or X.shape[0] + +mu = X.mean(axis=0) +s = X.std(ddof=1, axis=0) +S = np.cov(X, rowvar=0, ddof=1) + +# Generate 10 samples from 1-D normal distribution +Xgen = np.random.randn(ngen,256) +for i in range(ngen): + Xgen[i] = np.multiply(Xgen[i],s) + mu + +# Plot images +figure() +for k in range(ngen): + subplot(2, int(np.ceil(ngen/2.)), k+1) + I = np.reshape(Xgen[k,:], (16,16)) + imshow(I, cmap=cm.gray_r); + xticks([]); yticks([]) + if k==1: title('Digits: 1-D Normal') + + +# Generate 10 samples from multivariate normal distribution +Xmvgen = np.random.multivariate_normal(mu, S, ngen) +# Note if you are investigating a single class, then you may get: +# """RuntimeWarning: covariance is not positive-semidefinite.""" +# Which in general is troublesome, but here is due to numerical imprecission + + +# Plot images +figure() +for k in range(ngen): + subplot(2, int(np.ceil(ngen/2.)), k+1) + I = np.reshape(Xmvgen[k,:], (16,16)) + imshow(I, cmap=cm.gray_r); + xticks([]); yticks([]) + if k==1: title('Digits: Multivariate Normal') + +show() + +print('Ran Exercise 4.1.7') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_2_1.py b/exercises/02450Toolbox_Python/Scripts/ex4_2_1.py new file mode 100644 index 0000000000000000000000000000000000000000..24238d46eb0b98157b07aa38d3f75a190e019f54 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_2_1.py @@ -0,0 +1,31 @@ +# exercise 4.2.1 + +import numpy as np +import xlrd + +# Load xls sheet with data +doc = xlrd.open_workbook('../Data/iris.xls').sheet_by_index(0) + +# Extract attribute names +attributeNames = doc.row_values(0,0,4) + +# Extract class names to python list, +# then encode with integers (dict) +classLabels = doc.col_values(4,1,151) +classNames = sorted(set(classLabels)) +classDict = dict(zip(classNames,range(len(classNames)))) + +# Extract vector y, convert to NumPy matrix and transpose +y = np.array([classDict[value] for value in classLabels]) + +# Preallocate memory, then extract data to matrix X +X = np.empty((150,4)) +for i in range(4): + X[:,i] = np.array(doc.col_values(i,1,151)).T + +# Compute values of N, M and C. +N = len(y) +M = len(attributeNames) +C = len(classNames) + +print('Ran Exercise 4.2.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_2_2.py b/exercises/02450Toolbox_Python/Scripts/ex4_2_2.py new file mode 100644 index 0000000000000000000000000000000000000000..03eec5a109de704f29c8673f735441b23799df47 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_2_2.py @@ -0,0 +1,18 @@ +# Exercise 4.2.2 + +from matplotlib.pyplot import figure, subplot, hist, xlabel, ylim, show +import numpy as np +# requires data from exercise 4.2.1 +from ex4_2_1 import * + +figure(figsize=(8,7)) +u = np.floor(np.sqrt(M)); v = np.ceil(float(M)/u) +for i in range(M): + subplot(int(u),int(v),i+1) + hist(X[:,i], color=(0.2, 0.8-i*0.2, 0.4)) + xlabel(attributeNames[i]) + ylim(0,N/2) + +show() + +print('Ran Exercise 4.2.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_2_3.py b/exercises/02450Toolbox_Python/Scripts/ex4_2_3.py new file mode 100644 index 0000000000000000000000000000000000000000..57e41b0930448c48dcacd153e0ea095898b34cdd --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_2_3.py @@ -0,0 +1,14 @@ +# Exercise 4.2.3 + +from matplotlib.pyplot import boxplot, xticks, ylabel, title, show + +# requires data from exercise 4.2.1 +from ex4_2_1 import * + +boxplot(X) +xticks(range(1,5),attributeNames) +ylabel('cm') +title('Fisher\'s Iris data set - boxplot') +show() + +print('Ran Exercise 4.2.3') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_2_4.py b/exercises/02450Toolbox_Python/Scripts/ex4_2_4.py new file mode 100644 index 0000000000000000000000000000000000000000..ca8ee0613ce58fff7c5ece139da6618174d53dbc --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_2_4.py @@ -0,0 +1,22 @@ +# Exercise 4.2.4 +from matplotlib.pyplot import (figure, subplot, boxplot, title, xticks, ylim, + show) +# requires data from exercise 4.1.1 +from ex4_2_1 import * + +figure(figsize=(14,7)) +for c in range(C): + subplot(1,C,c+1) + class_mask = (y==c) # binary mask to extract elements of class c + # or: class_mask = nonzero(y==c)[0].tolist()[0] # indices of class c + + boxplot(X[class_mask,:]) + #title('Class: {0}'.format(classNames[c])) + title('Class: '+classNames[c]) + xticks(range(1,len(attributeNames)+1), [a[:7] for a in attributeNames], rotation=45) + y_up = X.max()+(X.max()-X.min())*0.1; y_down = X.min()-(X.max()-X.min())*0.1 + ylim(y_down, y_up) + +show() + +print('Ran Exercise 4.2.4') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_2_5.py b/exercises/02450Toolbox_Python/Scripts/ex4_2_5.py new file mode 100644 index 0000000000000000000000000000000000000000..29cffb402f7c629c11fdf2dc9d1fc48b20b198cf --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_2_5.py @@ -0,0 +1,30 @@ +# Exercise 4.2.5 + +from matplotlib.pyplot import (figure, subplot, plot, xlabel, ylabel, + xticks, yticks,legend,show) + +# requires data from exercise 4.2.1 +from ex4_2_1 import * + +figure(figsize=(12,10)) +for m1 in range(M): + for m2 in range(M): + subplot(M, M, m1*M + m2 + 1) + for c in range(C): + class_mask = (y==c) + plot(np.array(X[class_mask,m2]), np.array(X[class_mask,m1]), '.') + if m1==M-1: + xlabel(attributeNames[m2]) + else: + xticks([]) + if m2==0: + ylabel(attributeNames[m1]) + else: + yticks([]) + #ylim(0,X.max()*1.1) + #xlim(0,X.max()*1.1) +legend(classNames) + +show() + +print('Ran Exercise 4.2.5') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_2_6.py b/exercises/02450Toolbox_Python/Scripts/ex4_2_6.py new file mode 100644 index 0000000000000000000000000000000000000000..387e81ee6891e3e32f8464563525d93da516ba70 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_2_6.py @@ -0,0 +1,26 @@ +# Exercise 4.2.6 + +from matplotlib.pyplot import figure, show +from mpl_toolkits.mplot3d import Axes3D + +# requires data from exercise 4.1.1 +from ex4_2_1 import * + +# Indices of the variables to plot +ind = [0, 1, 2] +colors = ['blue', 'green', 'red'] + +f = figure() +ax = f.add_subplot(111, projection='3d') #Here the mpl_toolkits is used +for c in range(C): + class_mask = (y==c) + s = ax.scatter(X[class_mask,ind[0]], X[class_mask,ind[1]], X[class_mask,ind[2]], c=colors[c]) + +ax.view_init(30, 220) +ax.set_xlabel(attributeNames[ind[0]]) +ax.set_ylabel(attributeNames[ind[1]]) +ax.set_zlabel(attributeNames[ind[2]]) + +show() + +print('Ran Exercise 4.2.6') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_2_7.py b/exercises/02450Toolbox_Python/Scripts/ex4_2_7.py new file mode 100644 index 0000000000000000000000000000000000000000..747e04aa5ca85646cca76e267cbe7cc3f7295173 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_2_7.py @@ -0,0 +1,22 @@ +# Exercise 4.2.7 + +from matplotlib.pyplot import (figure, imshow, xticks, xlabel, ylabel, title, + colorbar, cm, show) +from scipy.stats import zscore + +# requires data from exercise 4.2.1 +from ex4_2_1 import * + +X_standarized = zscore(X, ddof=1) + +figure(figsize=(12,6)) +imshow(X_standarized, interpolation='none', aspect=(4./N), cmap=cm.gray); +xticks(range(4), attributeNames) +xlabel('Attributes') +ylabel('Data objects') +title('Fisher\'s Iris data matrix') +colorbar() + +show() + +print('Ran Exercise 4.2.7') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_3_1.py b/exercises/02450Toolbox_Python/Scripts/ex4_3_1.py new file mode 100644 index 0000000000000000000000000000000000000000..b165c2aa749a37b8add8ed961575c45688c4866c --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_3_1.py @@ -0,0 +1,98 @@ +# exercise 4.3.1 + +from matplotlib.pyplot import (figure, title, boxplot, xticks, subplot, hist, + xlabel, ylim, yticks, show) +import numpy as np +from scipy.io import loadmat +from scipy.stats import zscore + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wine.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +C = mat_data['C'][0,0] +M = mat_data['M'][0,0] +N = mat_data['N'][0,0] +attributeNames = [name[0][0] for name in mat_data['attributeNames']] +classNames = [cls[0][0] for cls in mat_data['classNames']] + +# We start with a box plot of each attribute +figure() +title('Wine: Boxplot') +boxplot(X) +xticks(range(1,M+1), attributeNames, rotation=45) + +# From this it is clear that there are some outliers in the Alcohol +# attribute (10x10^14 is clearly not a proper value for alcohol content) +# However, it is impossible to see the distribution of the data, because +# the axis is dominated by these extreme outliers. To avoid this, we plot a +# box plot of standardized data (using the zscore function). +figure(figsize=(12,6)) +title('Wine: Boxplot (standarized)') +boxplot(zscore(X, ddof=1), attributeNames) +xticks(range(1,M+1), attributeNames, rotation=45) + +# This plot reveals that there are clearly some outliers in the Volatile +# acidity, Density, and Alcohol attributes, i.e. attribute number 2, 8, +# and 11. + +# Next, we plot histograms of all attributes. +figure(figsize=(14,9)) +u = np.floor(np.sqrt(M)); v = np.ceil(float(M)/u) +for i in range(M): + subplot(int(u),int(v),i+1) + hist(X[:,i]) + xlabel(attributeNames[i]) + ylim(0, N) # Make the y-axes equal for improved readability + if i%v!=0: yticks([]) + if i==0: title('Wine: Histogram') + + +# This confirms our belief about outliers in attributes 2, 8, and 11. +# To take a closer look at this, we next plot histograms of the +# attributes we suspect contains outliers +figure(figsize=(14,9)) +m = [1, 7, 10] +for i in range(len(m)): + subplot(1,len(m),i+1) + hist(X[:,m[i]],50) + xlabel(attributeNames[m[i]]) + ylim(0, N) # Make the y-axes equal for improved readability + if i>0: yticks([]) + if i==0: title('Wine: Histogram (selected attributes)') + + +# The histograms show that there are a few very extreme values in these +# three attributes. To identify these values as outliers, we must use our +# knowledge about the data set and the attributes. Say we expect volatide +# acidity to be around 0-2 g/dm^3, density to be close to 1 g/cm^3, and +# alcohol percentage to be somewhere between 5-20 % vol. Then we can safely +# identify the following outliers, which are a factor of 10 greater than +# the largest we expect. +outlier_mask = (X[:,1]>20) | (X[:,7]>10) | (X[:,10]>200) +valid_mask = np.logical_not(outlier_mask) + +# Finally we will remove these from the data set +X = X[valid_mask,:] +y = y[valid_mask] +N = len(y) + + +# Now, we can repeat the process to see if there are any more outliers +# present in the data. We take a look at a histogram of all attributes: +figure(figsize=(14,9)) +u = np.floor(np.sqrt(M)); v = np.ceil(float(M)/u) +for i in range(M): + subplot(int(u),int(v),i+1) + hist(X[:,i]) + xlabel(attributeNames[i]) + ylim(0, N) # Make the y-axes equal for improved readability + if i%v!=0: yticks([]) + if i==0: title('Wine: Histogram (after outlier detection)') + +# This reveals no further outliers, and we conclude that all outliers have +# been detected and removed. + +show() + +print('Ran Exercise 4.3.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex4_3_2.py b/exercises/02450Toolbox_Python/Scripts/ex4_3_2.py new file mode 100644 index 0000000000000000000000000000000000000000..495cd7c53069dbf57e58136bd1f904d8f1403d05 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex4_3_2.py @@ -0,0 +1,59 @@ +# exercise 4.3.2 + +from matplotlib.pyplot import figure, subplot, plot, legend, show, xlabel, ylabel, xticks, yticks +import numpy as np +from scipy.io import loadmat +from scipy.stats import zscore + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wine.mat') +X = mat_data['X'] +y = np.squeeze(mat_data['y']) +C = mat_data['C'][0,0] +M = mat_data['M'][0,0] +N = mat_data['N'][0,0] + +attributeNames = [name[0][0] for name in mat_data['attributeNames']] +classNames = [cls[0] for cls in mat_data['classNames'][0]] + +# The histograms show that there are a few very extreme values in these +# three attributes. To identify these values as outliers, we must use our +# knowledge about the data set and the attributes. Say we expect volatide +# acidity to be around 0-2 g/dm^3, density to be close to 1 g/cm^3, and +# alcohol percentage to be somewhere between 5-20 % vol. Then we can safely +# identify the following outliers, which are a factor of 10 greater than +# the largest we expect. +outlier_mask = (X[:,1]>20) | (X[:,7]>10) | (X[:,10]>200) +valid_mask = np.logical_not(outlier_mask) + +# Finally we will remove these from the data set +X = X[valid_mask,:] +y = y[valid_mask] +N = len(y) +Xnorm = zscore(X, ddof=1) + +## Next we plot a number of atttributes +Attributes = [1,4,5,6] +NumAtr = len(Attributes) + +figure(figsize=(12,12)) +for m1 in range(NumAtr): + for m2 in range(NumAtr): + subplot(NumAtr, NumAtr, m1*NumAtr + m2 + 1) + for c in range(C): + class_mask = (y==c) + plot(X[class_mask,Attributes[m2]], X[class_mask,Attributes[m1]], '.') + if m1==NumAtr-1: + xlabel(attributeNames[Attributes[m2]]) + else: + xticks([]) + if m2==0: + ylabel(attributeNames[Attributes[m1]]) + else: + yticks([]) + #ylim(0,X.max()*1.1) + #xlim(0,X.max()*1.1) +legend(classNames) +show() + +print('Ran Exercise 4.3.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_1_1.py b/exercises/02450Toolbox_Python/Scripts/ex5_1_1.py new file mode 100644 index 0000000000000000000000000000000000000000..ef120313b2a4750ccb46e315364d941f11323457 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_1_1.py @@ -0,0 +1,63 @@ +# exercise 5.1.1 + +import numpy as np + +# Names of data objects +dataobjectNames = [ + 'Human', + 'Python', + 'Salmon', + 'Whale', + 'Frog', + 'Komodo dragon', + 'Bat', + 'Pigeon', + 'Cat', + 'Leopard shark', + 'Turtle', + 'Penguin', + 'Porcupine', + 'Eel', + 'Salamander', + ] + +# Attribute names +attributeNames = [ + 'Body temperature', + 'Skin cover', + 'Gives birth', + 'Aquatic creature', + 'Aerial creature', + 'Has legs', + 'Hibernates' + ] + +# Attribute values +X = np.asarray(np.mat(''' + 1 1 1 0 0 1 0; + 0 2 0 0 0 0 1; + 0 2 0 1 0 0 0; + 1 1 1 1 0 0 0; + 0 0 0 2 0 1 1; + 0 2 0 0 0 1 0; + 1 1 1 0 1 1 1; + 1 3 0 0 1 1 0; + 1 4 1 0 0 1 0; + 0 2 1 1 0 0 0; + 0 2 0 2 0 1 0; + 1 3 0 2 0 1 0; + 1 5 1 0 0 1 1; + 0 2 0 1 0 0 0; + 0 0 0 2 0 1 1 ''')) + +# Class indices +y = np.asarray(np.mat('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'] + +# Number data objects, attributes, and classes +N, M = X.shape +C = len(classNames) + +print('Ran Exercise 5.1.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_1_2.py b/exercises/02450Toolbox_Python/Scripts/ex5_1_2.py new file mode 100644 index 0000000000000000000000000000000000000000..d4f7fbdbe6673b559b98246caba98c892bf7edb0 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_1_2.py @@ -0,0 +1,27 @@ +# exercise 5.1.2 +import numpy as np +from sklearn import tree +from platform import system +from os import getcwd +import matplotlib.pyplot as plt +from matplotlib.image import imread + +# requires data from exercise 5.1.1 +from ex5_1_1 import * + +# Fit regression tree classifier, Gini split criterion, no pruning +criterion = 'gini' +dtc = tree.DecisionTreeClassifier(criterion=criterion, min_samples_split=2) +dtc = dtc.fit(X, y) + +# Visualize the graph (you can also inspect the generated image file in an external program) +# NOTE: depending on your setup you may need to decrease or increase the figsize and DPI setting +# to get a readable plot. Hint: Try to maximize the figure after it displays. +fname='tree_ex512_' + criterion + '.png' + +fig = plt.figure(figsize=(4,4),dpi=100) +_ = tree.plot_tree(dtc, filled=False,feature_names=attributeNames) +plt.savefig(fname) +plt.show() + +print('Ran Exercise 5.1.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_1_3.py b/exercises/02450Toolbox_Python/Scripts/ex5_1_3.py new file mode 100644 index 0000000000000000000000000000000000000000..bd3700d2a01532e48e28ea7f4c8556298ba5bde3 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_1_3.py @@ -0,0 +1,33 @@ +# exercise 5.1.3 +import os +import numpy as np +from sklearn import tree +from platform import system +from os import getcwd +import matplotlib.pyplot as plt +from matplotlib.image import imread +#import graphviz +#import pydotplus + +# requires data from exercise 5.1.1 +from ex5_1_1 import * + +# Fit regression tree classifier, Gini split criterion, no pruning +criterion='gini' +# dtc = tree.DecisionTreeClassifier(criterion=criterion, min_samples_split=2) +dtc = tree.DecisionTreeClassifier(criterion=criterion, min_samples_split=1.0/N) +dtc = dtc.fit(X,y) + +# convert the tree into a png file using the Graphviz toolset +fname='tree_ex513_' + criterion + '.png' + +# Visualize the graph (you can also inspect the generated image file in an external program) +# NOTE: depending on your setup you may need to decrease or increase the figsize and DPI setting +# to get a useful plot. Hint: Try to maximize the figure after it displays. +fig = plt.figure(figsize=(4,4),dpi=100) +_ = tree.plot_tree(dtc, filled=False,feature_names=attributeNames) +plt.savefig(fname) +plt.show() + +print('Ran Exercise 5.1.3') + diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_1_4.py b/exercises/02450Toolbox_Python/Scripts/ex5_1_4.py new file mode 100644 index 0000000000000000000000000000000000000000..a4424aa7158da8eefd25e4cb45674afc79dfb95d --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_1_4.py @@ -0,0 +1,17 @@ +# exercise 5.1.4 +# requires Tree model from exercise 5.1.2 +from ex5_1_2 import * + +# Define a new data object (a dragon) with the attributes given in the text +x = np.array([0, 2, 1, 2, 1, 1, 1]).reshape(1,-1) + +# Evaluate the classification tree for the new data object +x_class = dtc.predict(x)[0] + +# Print results +print('\nNew object attributes:') +print(dict(zip(attributeNames,x[0]))) +print('\nClassification result:') +print(classNames[x_class]) + +print('Ran Exercise 5.1.4') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_1_5.py b/exercises/02450Toolbox_Python/Scripts/ex5_1_5.py new file mode 100644 index 0000000000000000000000000000000000000000..fa75dd5b94175176cc7192581913aea31a6bd21a --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_1_5.py @@ -0,0 +1,32 @@ +# exercise 5.1.5 +import numpy as np +import os +from scipy.io import loadmat + +# Load Matlab data file and extract variables of interest +workingDir = os.getcwd() +print("Running from: " + workingDir) + +mat_data = loadmat('../Data/wine.mat') +X = mat_data['X'] +y = mat_data['y'].astype(int).squeeze() +C = mat_data['C'][0,0] +M = mat_data['M'][0,0] +N = mat_data['N'][0,0] + +attributeNames = [i[0][0] for i in mat_data['attributeNames']] +classNames = [j[0] for i in mat_data['classNames'] for j in i] + + +# Remove outliers +outlier_mask = (X[:,1]>20) | (X[:,7]>10) | (X[:,10]>200) +valid_mask = np.logical_not(outlier_mask) +X = X[valid_mask,:] +y = y[valid_mask] +# Remove attribute 12 (Quality score) +X = X[:,0:11] +attributeNames = attributeNames[0:11] +# Update N and M +N, M = X.shape + +print('Ran Exercise 5.1.5') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_1_6.py b/exercises/02450Toolbox_Python/Scripts/ex5_1_6.py new file mode 100644 index 0000000000000000000000000000000000000000..f25d9d07a14c2eb6fb417dcb3b7195b455615d6e --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_1_6.py @@ -0,0 +1,35 @@ +# exercise 5.1.6 +import numpy as np +from sklearn import tree +from platform import system +from os import getcwd +import matplotlib.pyplot as plt +from matplotlib.image import imread + +# requires data from exercise 5.1.5 +from ex5_1_5 import * + +# Fit classification tree using, Gini split criterion, no pruning +criterion='gini' +dtc = tree.DecisionTreeClassifier(criterion=criterion, min_samples_split=100) +dtc = dtc.fit(X,y) + +# Visualize the graph (you can also inspect the generated image file in an external program) +# NOTE: depending on your screen resolution and setup you may need to decrease or increase +# the figsize and DPI setting to get a useful plot. +# Hint: Try to open the generated png file in an external image editor as it can be easier +# to inspect outside matplotlib's figure environment. +fname='tree_ex516_' + criterion + '_wine_data.png' +fig = plt.figure(figsize=(12,12),dpi=300) +_ = tree.plot_tree(dtc, filled=False,feature_names=attributeNames) +plt.savefig(fname) +plt.close() + +fig = plt.figure() +plt.imshow(imread(fname)) +plt.axis('off') +plt.box('off') +plt.show() + +print('Ran Exercise 5.1.6') + diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_1_7.py b/exercises/02450Toolbox_Python/Scripts/ex5_1_7.py new file mode 100644 index 0000000000000000000000000000000000000000..df69b8ab71233bf78471e829650763ea40f31f7f --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_1_7.py @@ -0,0 +1,18 @@ +# exercise 5.1.7 +# requires Tree model from exercise 5.1.5 +from ex5_1_6 import * + +# Define a new data object (new type of wine) with the attributes given in the text +x = np.array([6.9, 1.09, .06, 2.1, .0061, 12, 31, .99, 3.5, .44, 12]).reshape(1,-1) + +# Evaluate the classification tree for the new data object +x_class = dtc.predict(x)[0] + +# Print results +print('\nNew object attributes:') +for i in range(len(attributeNames)): + print('{0}: {1}'.format(attributeNames[i],x[0][i])) +print('\nClassification result:') +print(classNames[x_class]) + +print('Ran Exercise 5.1.7') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_2_1.py b/exercises/02450Toolbox_Python/Scripts/ex5_2_1.py new file mode 100644 index 0000000000000000000000000000000000000000..92968f336927449d473582abaf25ca8c1dc511b4 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_2_1.py @@ -0,0 +1,31 @@ +# exercise 5.2.1 + +from matplotlib.pyplot import figure, plot, xlabel, ylabel, title, show +import numpy as np + +# Number of data objects +N = 100 + +# Attribute values +X = np.array(range(N)) + +# Noise +eps_mean, eps_std = 0, 0.1 +eps = np.array(eps_std*np.random.randn(N) + eps_mean) + +# Model parameters +w0 = -0.5 +w1 = 0.01 + +# Outputs +y = w0 + w1*X + eps + +# Make a scatter plot +figure() +plot(X,y,'o') +xlabel('X'); ylabel('y') +title('Illustration of a linear relation with noise') + +show() + +print('Ran Exercise 5.2.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_2_2.py b/exercises/02450Toolbox_Python/Scripts/ex5_2_2.py new file mode 100644 index 0000000000000000000000000000000000000000..fc557f814b337c27c1f1ddfc9ee79ee78c9d3676 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_2_2.py @@ -0,0 +1,37 @@ +# exercise 5.2.2 + +from matplotlib.pyplot import figure, plot, xlabel, ylabel, legend, show +import sklearn.linear_model as lm +import numpy as np + +# Use dataset as in the previous exercise +N = 100 +X = np.array(range(N)).reshape(-1,1) +eps_mean, eps_std = 0, 0.1 +eps = np.array(eps_std*np.random.randn(N) + eps_mean).reshape(-1,1) +w0 = -0.5 +w1 = 0.01 +y = w0 + w1*X + eps +y_true = y - eps + +# Fit ordinary least squares regression model +model = lm.LinearRegression(fit_intercept=True) +model = model.fit(X,y) +# Compute model output: +y_est = model.predict(X) +# Or equivalently: +#y_est = model.intercept_ + X @ model.coef_ + + +# Plot original data and the model output +f = figure() + +plot(X,y,'.') +plot(X,y_true,'-') +plot(X,y_est,'-') +xlabel('X'); ylabel('y') +legend(['Training data', 'Data generator', 'Regression fit (model)']) + +show() + +print('Ran Exercise 5.2.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_2_3.py b/exercises/02450Toolbox_Python/Scripts/ex5_2_3.py new file mode 100644 index 0000000000000000000000000000000000000000..86e82a29af80179cbf4e5ec4a9b0c8f76bcf8c4c --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_2_3.py @@ -0,0 +1,47 @@ +# exercise 5.2.3 + +from matplotlib.pyplot import figure, plot, xlabel, ylabel, legend, show, ylim +import numpy as np +import sklearn.linear_model as lm + +# Parameters +Kd = 5 # no of terms for data generator +Km = 3 # no of terms for regression model +N = 50 # no of data objects to train a model +Xe = np.linspace(-2,2,1000).reshape(-1,1) # X values to visualize true data and model +eps_mean, eps_std = 0, 0.5 # noise parameters + +# Generate dataset (with noise) +X = np.linspace(-2,2,N).reshape(-1,1) +Xd = np.power(X, range(1,Kd+1)) +eps = (eps_std*np.random.randn(N) + eps_mean) +w = -np.power(-.9, range(1,Kd+2)) +y = w[0] + Xd @ w[1:] + eps + + +# True data generator (assuming no noise) +Xde = np.power(Xe, range(1,Kd+1)) +y_true = w[0] + Xde @ w[1:] + + + +# Fit ordinary least squares regression model +Xm = np.power(X, range(1,Km+1)) +model = lm.LinearRegression() +model = model.fit(Xm,y) + +# Predict values +Xme = np.power(Xe, range(1,Km+1)) +y_est = model.predict(Xme) + +# Plot original data and the model output +f = figure() +plot(X,y,'.') +plot(Xe,y_true,'-') +plot(Xe,y_est,'-') +xlabel('X'); ylabel('y'); ylim(-2,8) +legend(['Training data', 'Data generator K={0}'.format(Kd), 'Regression fit (model) K={0}'.format(Km)]) + +show() + +print('Ran Exercise 5.2.3') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_2_4.py b/exercises/02450Toolbox_Python/Scripts/ex5_2_4.py new file mode 100644 index 0000000000000000000000000000000000000000..6d4243e7144fb03d52dd3edbd65809bc877b0ae2 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_2_4.py @@ -0,0 +1,33 @@ +# exercise 5.2.4 +from matplotlib.pylab import figure, subplot, plot, xlabel, ylabel, hist, show +import sklearn.linear_model as lm + +# requires wine data from exercise 5.1.5 +from ex5_1_5 import * + +# Split dataset into features and target vector +alcohol_idx = attributeNames.index('Alcohol') +y = X[:,alcohol_idx] + +X_cols = list(range(0,alcohol_idx)) + list(range(alcohol_idx+1,len(attributeNames))) +X = X[:,X_cols] + +# Fit ordinary least squares regression model +model = lm.LinearRegression() +model.fit(X,y) + +# Predict alcohol content +y_est = model.predict(X) +residual = y_est-y + +# Display scatter plot +figure() +subplot(2,1,1) +plot(y, y_est, '.') +xlabel('Alcohol content (true)'); ylabel('Alcohol content (estimated)'); +subplot(2,1,2) +hist(residual,40) + +show() + +print('Ran Exercise 5.2.4') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_2_5.py b/exercises/02450Toolbox_Python/Scripts/ex5_2_5.py new file mode 100644 index 0000000000000000000000000000000000000000..e877d321e5e132801774d9531b6cf7bf199a45b7 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_2_5.py @@ -0,0 +1,56 @@ +# exercise 5.2.5 +from matplotlib.pylab import figure, plot, subplot, xlabel, ylabel, hist, show +import sklearn.linear_model as lm + +# requires data from exercise 5.1.4 +from ex5_1_5 import * + + +# Split dataset into features and target vector +alcohol_idx = attributeNames.index('Alcohol') +y = X[:,alcohol_idx] + +X_cols = list(range(0,alcohol_idx)) + list(range(alcohol_idx+1,len(attributeNames))) +X = X[:,X_cols] + +# Additional nonlinear attributes +fa_idx = attributeNames.index('Fixed acidity') +va_idx = attributeNames.index('Volatile acidity') +Xfa2 = np.power(X[:,fa_idx],2).reshape(-1,1) +Xva2 = np.power(X[:,va_idx],2).reshape(-1,1) +Xfava = (X[:,fa_idx]*X[:,va_idx]).reshape(-1,1) +X = np.asarray(np.bmat('X, Xfa2, Xva2, Xfava')) + +# Fit ordinary least squares regression model +model = lm.LinearRegression() +model.fit(X,y) + +# Predict alcohol content +y_est = model.predict(X) +residual = y_est-y + +# Display plots +figure(figsize=(12,8)) + +subplot(2,1,1) +plot(y, y_est, '.g') +xlabel('Alcohol content (true)'); ylabel('Alcohol content (estimated)') + +subplot(4,1,3) +hist(residual,40) + +subplot(4,3,10) +plot(Xfa2, residual, '.r') +xlabel('Fixed Acidity ^2'); ylabel('Residual') + +subplot(4,3,11) +plot(Xva2, residual, '.r') +xlabel('Volatile Acidity ^2'); ylabel('Residual') + +subplot(4,3,12) +plot(Xfava, residual, '.r') +xlabel('Fixed*Volatile Acidity'); ylabel('Residual') + +show() + +print('Ran Exercise 5.2.5') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex5_2_6.py b/exercises/02450Toolbox_Python/Scripts/ex5_2_6.py new file mode 100644 index 0000000000000000000000000000000000000000..ae4c5560eff6b241bf345ac759517da181c34ae9 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex5_2_6.py @@ -0,0 +1,40 @@ +# exercise 5.2.6 +from matplotlib.pylab import figure, plot, xlabel, ylabel, legend, ylim, show +import sklearn.linear_model as lm + +# requires data from exercise 5.1.4 +from ex5_1_5 import * + +# Fit logistic regression model + +model = lm.LogisticRegression() +model = model.fit(X,y) + +# Classify wine as White/Red (0/1) and assess probabilities +y_est = model.predict(X) +y_est_white_prob = model.predict_proba(X)[:, 0] + +# Define a new data object (new type of wine), as in exercise 5.1.7 +x = np.array([6.9, 1.09, .06, 2.1, .0061, 12, 31, .99, 3.5, .44, 12]).reshape(1,-1) +# Evaluate the probability of x being a white wine (class=0) +x_class = model.predict_proba(x)[0,0] + +# Evaluate classifier's misclassification rate over entire training data +misclass_rate = np.sum(y_est != y) / float(len(y_est)) + +# Display classification results +print('\nProbability of given sample being a white wine: {0:.4f}'.format(x_class)) +print('\nOverall misclassification rate: {0:.3f}'.format(misclass_rate)) + +f = figure(); +class0_ids = np.nonzero(y==0)[0].tolist() +plot(class0_ids, y_est_white_prob[class0_ids], '.y') +class1_ids = np.nonzero(y==1)[0].tolist() +plot(class1_ids, y_est_white_prob[class1_ids], '.r') +xlabel('Data object (wine sample)'); ylabel('Predicted prob. of class White'); +legend(['White', 'Red']) +ylim(-0.01,1.5) + +show() + +print('Ran Exercise 5.2.6') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex6_1_1.py b/exercises/02450Toolbox_Python/Scripts/ex6_1_1.py new file mode 100644 index 0000000000000000000000000000000000000000..8915ac6a25802e073a83c8a5f537fdd00a1adaf1 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex6_1_1.py @@ -0,0 +1,49 @@ +# exercise 6.1.1 + +from matplotlib.pylab import figure, plot, xlabel, ylabel, legend, show +from scipy.io import loadmat +from sklearn import model_selection, tree +import numpy as np + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wine2.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'][0]] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + +# Tree complexity parameter - constraint on maximum depth +tc = np.arange(2, 21, 1) + +# Simple holdout-set crossvalidation +test_proportion = 0.5 +X_train, X_test, y_train, y_test = model_selection.train_test_split(X,y,test_size=test_proportion) + +# Initialize variables +Error_train = np.empty((len(tc),1)) +Error_test = np.empty((len(tc),1)) + +for i, t in enumerate(tc): + # Fit decision tree classifier, Gini split criterion, different pruning levels + dtc = tree.DecisionTreeClassifier(criterion='gini', max_depth=t) + dtc = dtc.fit(X_train,y_train) + + # Evaluate classifier's misclassification rate over train/test data + y_est_test = np.asarray(dtc.predict(X_test),dtype=int) + y_est_train = np.asarray(dtc.predict(X_train), dtype=int) + misclass_rate_test = sum(y_est_test != y_test) / float(len(y_est_test)) + misclass_rate_train = sum(y_est_train != y_train) / float(len(y_est_train)) + Error_test[i], Error_train[i] = misclass_rate_test, misclass_rate_train + +f = figure() +plot(tc, Error_train*100) +plot(tc, Error_test*100) +xlabel('Model complexity (max tree depth)') +ylabel('Error (%)') +legend(['Error_train','Error_test']) + +show() + +print('Ran Exercise 6.1.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex6_1_2.py b/exercises/02450Toolbox_Python/Scripts/ex6_1_2.py new file mode 100644 index 0000000000000000000000000000000000000000..68ae488ab49ccceb0c86a4c85724d0b6401c99cb --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex6_1_2.py @@ -0,0 +1,63 @@ +# exercise 6.1.2 + +from matplotlib.pyplot import figure, plot, xlabel, ylabel, legend, show, boxplot +from scipy.io import loadmat +from sklearn import model_selection, tree +import numpy as np + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wine2.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'][0]] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + +# Tree complexity parameter - constraint on maximum depth +tc = np.arange(2, 21, 1) + +# K-fold crossvalidation +K = 10 +CV = model_selection.KFold(n_splits=K,shuffle=True) + +# Initialize variable +Error_train = np.empty((len(tc),K)) +Error_test = np.empty((len(tc),K)) + +k=0 +for train_index, test_index in CV.split(X): + print('Computing CV fold: {0}/{1}..'.format(k+1,K)) + + # extract training and test set for current CV fold + X_train, y_train = X[train_index,:], y[train_index] + X_test, y_test = X[test_index,:], y[test_index] + + for i, t in enumerate(tc): + # Fit decision tree classifier, Gini split criterion, different pruning levels + dtc = tree.DecisionTreeClassifier(criterion='gini', max_depth=t) + dtc = dtc.fit(X_train,y_train.ravel()) + y_est_test = dtc.predict(X_test) + y_est_train = dtc.predict(X_train) + # Evaluate misclassification rate over train/test data (in this CV fold) + misclass_rate_test = np.sum(y_est_test != y_test) / float(len(y_est_test)) + misclass_rate_train = np.sum(y_est_train != y_train) / float(len(y_est_train)) + Error_test[i,k], Error_train[i,k] = misclass_rate_test, misclass_rate_train + k+=1 + + +f = figure() +boxplot(Error_test.T) +xlabel('Model complexity (max tree depth)') +ylabel('Test error across CV folds, K={0})'.format(K)) + +f = figure() +plot(tc, Error_train.mean(1)) +plot(tc, Error_test.mean(1)) +xlabel('Model complexity (max tree depth)') +ylabel('Error (misclassification rate, CV K={0})'.format(K)) +legend(['Error_train','Error_test']) + +show() + +print('Ran Exercise 6.1.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex6_2_1.py b/exercises/02450Toolbox_Python/Scripts/ex6_2_1.py new file mode 100644 index 0000000000000000000000000000000000000000..680cc65b6a4b8bb52f1b443a05d2b80f14045fdd --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex6_2_1.py @@ -0,0 +1,128 @@ +# exercise 6.2.1 +from matplotlib.pyplot import figure, plot, subplot, title, xlabel, ylabel, show, clim +from scipy.io import loadmat +import sklearn.linear_model as lm +from sklearn import model_selection +from toolbox_02450 import feature_selector_lr, bmplot +import numpy as np + +# Load data from matlab file +mat_data = loadmat('../Data/body.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'][0]] +N, M = X.shape + + +## Crossvalidation +# Create crossvalidation partition for evaluation +K = 5 +CV = model_selection.KFold(n_splits=K,shuffle=True) + +# Initialize variables +Features = np.zeros((M,K)) +Error_train = np.empty((K,1)) +Error_test = np.empty((K,1)) +Error_train_fs = np.empty((K,1)) +Error_test_fs = np.empty((K,1)) +Error_train_nofeatures = np.empty((K,1)) +Error_test_nofeatures = np.empty((K,1)) + +k=0 +for train_index, test_index in CV.split(X): + + # extract training and test set for current CV fold + X_train = X[train_index,:] + y_train = y[train_index] + X_test = X[test_index,:] + y_test = y[test_index] + internal_cross_validation = 10 + + # Compute squared error without using the input data at all + Error_train_nofeatures[k] = np.square(y_train-y_train.mean()).sum()/y_train.shape[0] + Error_test_nofeatures[k] = np.square(y_test-y_test.mean()).sum()/y_test.shape[0] + + # Compute squared error with all features selected (no feature selection) + m = lm.LinearRegression(fit_intercept=True).fit(X_train, y_train) + Error_train[k] = np.square(y_train-m.predict(X_train)).sum()/y_train.shape[0] + Error_test[k] = np.square(y_test-m.predict(X_test)).sum()/y_test.shape[0] + + # Compute squared error with feature subset selection + textout = '' + selected_features, features_record, loss_record = feature_selector_lr(X_train, y_train, internal_cross_validation,display=textout) + + Features[selected_features,k] = 1 + # .. alternatively you could use module sklearn.feature_selection + if len(selected_features) == 0: + print('No features were selected, i.e. the data (X) in the fold cannot describe the outcomes (y).' ) + else: + m = lm.LinearRegression(fit_intercept=True).fit(X_train[:,selected_features], y_train) + Error_train_fs[k] = np.square(y_train-m.predict(X_train[:,selected_features])).sum()/y_train.shape[0] + Error_test_fs[k] = np.square(y_test-m.predict(X_test[:,selected_features])).sum()/y_test.shape[0] + + figure(k) + subplot(1,2,1) + plot(range(1,len(loss_record)), loss_record[1:]) + xlabel('Iteration') + ylabel('Squared error (crossvalidation)') + + subplot(1,3,3) + bmplot(attributeNames, range(1,features_record.shape[1]), -features_record[:,1:]) + clim(-1.5,0) + xlabel('Iteration') + + print('Cross validation fold {0}/{1}'.format(k+1,K)) + print('Train indices: {0}'.format(train_index)) + print('Test indices: {0}'.format(test_index)) + print('Features no: {0}\n'.format(selected_features.size)) + + k+=1 + + +# Display results +print('\n') +print('Linear regression without feature selection:\n') +print('- Training error: {0}'.format(Error_train.mean())) +print('- Test error: {0}'.format(Error_test.mean())) +print('- R^2 train: {0}'.format((Error_train_nofeatures.sum()-Error_train.sum())/Error_train_nofeatures.sum())) +print('- R^2 test: {0}'.format((Error_test_nofeatures.sum()-Error_test.sum())/Error_test_nofeatures.sum())) +print('Linear regression with feature selection:\n') +print('- Training error: {0}'.format(Error_train_fs.mean())) +print('- Test error: {0}'.format(Error_test_fs.mean())) +print('- R^2 train: {0}'.format((Error_train_nofeatures.sum()-Error_train_fs.sum())/Error_train_nofeatures.sum())) +print('- R^2 test: {0}'.format((Error_test_nofeatures.sum()-Error_test_fs.sum())/Error_test_nofeatures.sum())) + +figure(k) +subplot(1,3,2) +bmplot(attributeNames, range(1,Features.shape[1]+1), -Features) +clim(-1.5,0) +xlabel('Crossvalidation fold') +ylabel('Attribute') + + +# Inspect selected feature coefficients effect on the entire dataset and +# plot the fitted model residual error as function of each attribute to +# inspect for systematic structure in the residual + +f=2 # cross-validation fold to inspect +ff=Features[:,f-1].nonzero()[0] +if len(ff) == 0: + print('\nNo features were selected, i.e. the data (X) in the fold cannot describe the outcomes (y).' ) +else: + m = lm.LinearRegression(fit_intercept=True).fit(X[:,ff], y) + + y_est= m.predict(X[:,ff]) + residual=y-y_est + + figure(k+1, figsize=(12,6)) + title('Residual error vs. Attributes for features selected in cross-validation fold {0}'.format(f)) + for i in range(0,len(ff)): + subplot(2, int( np.ceil(len(ff)/2)), i+1) + plot(X[:,ff[i]],residual,'.') + xlabel(attributeNames[ff[i]]) + ylabel('residual error') + + +show() + +print('Ran Exercise 6.2.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex6_3_1.py b/exercises/02450Toolbox_Python/Scripts/ex6_3_1.py new file mode 100644 index 0000000000000000000000000000000000000000..1f5bc97af4cabea37373697ba9779623d3e08831 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex6_3_1.py @@ -0,0 +1,78 @@ +# exercise 6.3.1 + +from matplotlib.pyplot import (figure, plot, title, xlabel, ylabel, + colorbar, imshow, xticks, yticks, show) +from scipy.io import loadmat +from sklearn.neighbors import KNeighborsClassifier, DistanceMetric +from sklearn.metrics import confusion_matrix +from numpy import cov +import scipy + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth3.mat') # <-- change the number to change dataset) +X = mat_data['X'] +X_train = mat_data['X_train'] +X_test = mat_data['X_test'] +y = mat_data['y'].squeeze() +y_train = mat_data['y_train'].squeeze() +y_test = mat_data['y_test'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + + +# Plot the training data points (color-coded) and test data points. +figure(1) +styles = ['.b', '.r', '.g', '.y'] +for c in range(C): + class_mask = (y_train==c) + plot(X_train[class_mask,0], X_train[class_mask,1], styles[c]) + + +# K-nearest neighbors +K=5 + +# Distance metric (corresponds to 2nd norm, euclidean distance). +# You can set dist=1 to obtain manhattan distance (cityblock distance). +dist=2 +metric = 'minkowski' +metric_params = {} # no parameters needed for minkowski + +# You can set the metric argument to 'cosine' to determine the cosine distance +#metric = 'cosine' +#metric_params = {} # no parameters needed for cosine + +# To use a mahalonobis distance, we need to input the covariance matrix, too: +#metric='mahalanobis' +#metric_params={'V': cov(X_train, rowvar=False)} + +# Fit classifier and classify the test points +knclassifier = KNeighborsClassifier(n_neighbors=K, p=dist, + metric=metric, + metric_params=metric_params) +knclassifier.fit(X_train, y_train) +y_est = knclassifier.predict(X_test) + + +# Plot the classfication results +styles = ['ob', 'or', 'og', 'oy'] +for c in range(C): + class_mask = (y_est==c) + plot(X_test[class_mask,0], X_test[class_mask,1], styles[c], markersize=10) + plot(X_test[class_mask,0], X_test[class_mask,1], 'kx', markersize=8) +title('Synthetic data classification - KNN'); + +# Compute and plot confusion matrix +cm = confusion_matrix(y_test, y_est); +accuracy = 100*cm.diagonal().sum()/cm.sum(); error_rate = 100-accuracy; +figure(2); +imshow(cm, cmap='binary', interpolation='None'); +colorbar() +xticks(range(C)); yticks(range(C)); +xlabel('Predicted class'); ylabel('Actual class'); +title('Confusion matrix (Accuracy: {0}%, Error Rate: {1}%)'.format(accuracy, error_rate)); + +show() + +print('Ran Exercise 6.3.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex6_3_2.py b/exercises/02450Toolbox_Python/Scripts/ex6_3_2.py new file mode 100644 index 0000000000000000000000000000000000000000..c86ae1a2d55a0dbd3d54bb5d9a96e89757e9e928 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex6_3_2.py @@ -0,0 +1,43 @@ +# exercise 6.3.2 + +from matplotlib.pyplot import figure, plot, xlabel, ylabel, show +import numpy as np +from scipy.io import loadmat +from sklearn.neighbors import KNeighborsClassifier +from sklearn import model_selection + +# requires data from exercise 1.5.1 +from ex1_5_1 import * + +# Maximum number of neighbors +L=40 + +CV = model_selection.LeaveOneOut() +errors = np.zeros((N,L)) +i=0 +for train_index, test_index in CV.split(X, y): + print('Crossvalidation fold: {0}/{1}'.format(i+1,N)) + + # extract training and test set for current CV fold + X_train = X[train_index,:] + y_train = y[train_index] + X_test = X[test_index,:] + y_test = y[test_index] + + # Fit classifier and classify the test points (consider 1 to 40 neighbors) + for l in range(1,L+1): + knclassifier = KNeighborsClassifier(n_neighbors=l); + knclassifier.fit(X_train, y_train); + y_est = knclassifier.predict(X_test); + errors[i,l-1] = np.sum(y_est[0]!=y_test[0]) + + i+=1 + +# Plot the classification error rate +figure() +plot(100*sum(errors,0)/N) +xlabel('Number of neighbors') +ylabel('Classification error rate (%)') +show() + +print('Ran Exercise 6.3.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex7_1_1.py b/exercises/02450Toolbox_Python/Scripts/ex7_1_1.py new file mode 100644 index 0000000000000000000000000000000000000000..f17d8655fa4a2371194d68ab46fc0f0648929244 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex7_1_1.py @@ -0,0 +1,47 @@ +from matplotlib.pyplot import figure, plot, xlabel, ylabel, show +import numpy as np +from scipy.io import loadmat +from sklearn.neighbors import KNeighborsClassifier +from sklearn import model_selection + +# requires data from exercise 1.5.1 +from ex1_5_1 import * + +# This script crates predictions from three KNN classifiers using cross-validation + +# Maximum number of neighbors +L=[1, 20, 80] + +CV = model_selection.LeaveOneOut() +i=0 + +# store predictions. +yhat = [] +y_true = [] +for train_index, test_index in CV.split(X, y): + print('Crossvalidation fold: {0}/{1}'.format(i+1,N)) + + # extract training and test set for current CV fold + X_train = X[train_index,:] + y_train = y[train_index] + X_test = X[test_index,:] + y_test = y[test_index] + + # Fit classifier and classify the test points (consider 1 to 40 neighbors) + dy = [] + for l in L: + knclassifier = KNeighborsClassifier(n_neighbors=l) + knclassifier.fit(X_train, y_train) + y_est = knclassifier.predict(X_test) + + dy.append( y_est ) + # errors[i,l-1] = np.sum(y_est[0]!=y_test[0]) + dy = np.stack(dy, axis=1) + yhat.append(dy) + y_true.append(y_test) + i+=1 + +yhat = np.concatenate(yhat) +y_true = np.concatenate(y_true) +yhat[:,0] # predictions made by first classifier. +# Compute accuracy here. diff --git a/exercises/02450Toolbox_Python/Scripts/ex7_1_2.py b/exercises/02450Toolbox_Python/Scripts/ex7_1_2.py new file mode 100644 index 0000000000000000000000000000000000000000..acab68070859d7157fdd48ea8bb11b805f09951e --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex7_1_2.py @@ -0,0 +1,8 @@ +from toolbox_02450 import jeffrey_interval +from ex7_1_1 import * + +# Compute the Jeffreys interval +alpha = 0.05 +[thetahatA, CIA] = jeffrey_interval(y_true, yhat[:,0], alpha=alpha) + +print("Theta point estimate", thetahatA, " CI: ", CIA) diff --git a/exercises/02450Toolbox_Python/Scripts/ex7_1_4.py b/exercises/02450Toolbox_Python/Scripts/ex7_1_4.py new file mode 100644 index 0000000000000000000000000000000000000000..a045b98b7ddc90ab6a9408abb495121a866577cd --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex7_1_4.py @@ -0,0 +1,8 @@ +from toolbox_02450 import mcnemar +from ex7_1_1 import * + +# Compute the Jeffreys interval +alpha = 0.05 +[thetahat, CI, p] = mcnemar(y_true, yhat[:,0], yhat[:,1], alpha=alpha) + +print("theta = theta_A-theta_B point estimate", thetahat, " CI: ", CI, "p-value", p) diff --git a/exercises/02450Toolbox_Python/Scripts/ex7_2_1.py b/exercises/02450Toolbox_Python/Scripts/ex7_2_1.py new file mode 100644 index 0000000000000000000000000000000000000000..7fe4cd1fc8c1b05870c4e7409c2f8437edcf4d49 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex7_2_1.py @@ -0,0 +1,37 @@ +from matplotlib.pyplot import figure, plot, xlabel, ylabel, show +import numpy as np +from sklearn.neighbors import KNeighborsClassifier +from sklearn import model_selection +import sklearn.tree +import scipy.stats +import numpy as np, scipy.stats as st + +# requires data from exercise 1.5.1 +from ex5_1_5 import * + +X,y = X[:,:10], X[:,10:] +# This script crates predictions from three KNN classifiers using cross-validation + +test_proportion = 0.2 + +X_train, X_test, y_train, y_test = model_selection.train_test_split(X,y,test_size=test_proportion) + +mA = sklearn.linear_model.LinearRegression().fit(X_train,y_train) +mB = sklearn.tree.DecisionTreeRegressor().fit(X_train, y_train) + +yhatA = mA.predict(X_test) +yhatB = mB.predict(X_test)[:,np.newaxis] # justsklearnthings + +# perform statistical comparison of the models +# compute z with squared error. +zA = np.abs(y_test - yhatA ) ** 2 + +# compute confidence interval of model A +alpha = 0.05 +CIA = st.t.interval(1-alpha, df=len(zA)-1, loc=np.mean(zA), scale=st.sem(zA)) # Confidence interval + +# Compute confidence interval of z = zA-zB and p-value of Null hypothesis +zB = np.abs(y_test - yhatB ) ** 2 +z = zA - zB +CI = st.t.interval(1-alpha, len(z)-1, loc=np.mean(z), scale=st.sem(z)) # Confidence interval +p = 2*st.t.cdf( -np.abs( np.mean(z) )/st.sem(z), df=len(z)-1) # p-value diff --git a/exercises/02450Toolbox_Python/Scripts/ex7_3_1.py b/exercises/02450Toolbox_Python/Scripts/ex7_3_1.py new file mode 100644 index 0000000000000000000000000000000000000000..befd6439f3e510f5f0d4eabd16a4197fedb2812f --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex7_3_1.py @@ -0,0 +1,53 @@ +import sklearn.tree +import sklearn.linear_model + +from toolbox_02450 import * +# requires data from exercise 1.5.1 +from ex5_1_5 import * + +loss = 2 +X,y = X[:,:10], X[:,10:] +# This script crates predictions from three KNN classifiers using cross-validation + +K = 10 # We presently set J=K +m = 1 +r = [] +kf = model_selection.KFold(n_splits=K) + +for dm in range(m): + y_true = [] + yhat = [] + + for train_index, test_index in kf.split(X): + X_train, y_train = X[train_index,:], y[train_index] + X_test, y_test = X[test_index, :], y[test_index] + + mA = sklearn.linear_model.LinearRegression().fit(X_train, y_train) + mB = sklearn.tree.DecisionTreeRegressor().fit(X_train, y_train) + + yhatA = mA.predict(X_test) + yhatB = mB.predict(X_test)[:, np.newaxis] # justsklearnthings + y_true.append(y_test) + yhat.append( np.concatenate([yhatA, yhatB], axis=1) ) + + r.append( np.mean( np.abs( yhatA-y_test ) ** loss - np.abs( yhatB-y_test) ** loss ) ) + +# Initialize parameters and run test appropriate for setup II +alpha = 0.05 +rho = 1/K +p_setupII, CI_setupII = correlated_ttest(r, rho, alpha=alpha) + +if m == 1: + y_true = np.concatenate(y_true)[:,0] + yhat = np.concatenate(yhat) + + # note our usual setup I ttest only makes sense if m=1. + zA = np.abs(y_true - yhat[:,0] ) ** loss + zB = np.abs(y_true - yhat[:,1] ) ** loss + z = zA - zB + + CI_setupI = st.t.interval(1 - alpha, len(z) - 1, loc=np.mean(z), scale=st.sem(z)) # Confidence interval + p_setupI = st.t.cdf(-np.abs(np.mean(z)) / st.sem(z), df=len(z) - 1) # p-value + + print( [p_setupII, p_setupI] ) + print(CI_setupII, CI_setupI ) diff --git a/exercises/02450Toolbox_Python/Scripts/ex7_4_3.py b/exercises/02450Toolbox_Python/Scripts/ex7_4_3.py new file mode 100644 index 0000000000000000000000000000000000000000..2f7da933c0f8a0c457543f49733230bde21b1dc6 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex7_4_3.py @@ -0,0 +1,28 @@ +# exercise 7.4.3 +import numpy as np + +# Load list of names from files +fmale = open('../Data/male.txt','r') +ffemale = open('../Data/female.txt','r') +mnames = fmale.readlines(); fnames = ffemale.readlines(); +names = mnames + fnames +gender = [0]*len(mnames) + [1]*len(fnames) +fmale.close(); ffemale.close(); + +# Extract X, y and the rest of variables. Include only names of >4 characters. +X = np.zeros((len(names),4)) +y = np.zeros((len(names),1)) +n=0 +for i in range(0,len(names)): + name = names[i].strip().lower() + if len(name)>3: + X[n,:] = [ord(name[0])-ord('a')+1, ord(name[1])-ord('a')+1, ord(name[-2])-ord('a')+1, ord(name[-1])-ord('a')+1] + y[n,0] = gender[i] + n+=1 +X = X[0:n,:]; y = y[0:n,:]; + +N, M = X.shape; C = 2 +attributeNames = ['1st letter', '2nd letter', 'Next-to-last letter', 'Last letter'] +classNames = ['Female', 'Male']; + +print('Ran Exercise 7.2.3') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex7_4_4.py b/exercises/02450Toolbox_Python/Scripts/ex7_4_4.py new file mode 100644 index 0000000000000000000000000000000000000000..82d903db6eb6b109cf0419359fea60c50c1c4288 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex7_4_4.py @@ -0,0 +1,55 @@ +# exercise 7.4.4 +from sklearn.naive_bayes import MultinomialNB +from sklearn import model_selection +from sklearn.preprocessing import OneHotEncoder + +from ex7_4_3 import * +np.random.seed(2450) +y = y.squeeze() +0 +# Naive Bayes classifier parameters +alpha = 1.0 # pseudo-count, additive parameter (Laplace correction if 1.0 or Lidtstone smoothing otherwise) +fit_prior = True # uniform prior (change to True to estimate prior from data) + +# K-fold crossvalidation +K = 10 +CV = model_selection.KFold(n_splits=K,shuffle=True) + +X = X[:,0:4] # using all 4 letters, +# for using e.g. only third letter or first and last try X[:,[2]] and X[:, [0,3]] + +# We need to specify that the data is categorical. +# MultinomialNB does not have this functionality, but we can achieve similar +# results by doing a one-hot-encoding - the intermediate steps in in training +# the classifier are off, but the final result is corrent. +# If we didn't do the converstion MultinomialNB assumes that the numbers are +# e.g. discrete counts of tokens. Without the encoding, the value 26 wouldn't +# mean "the token 'z'", but it would mean 26 counts of some token, +# resulting in 1 and 2 meaning a difference in one count of a given token as +# opposed to the desired 'a' versus 'b'. +X = OneHotEncoder().fit_transform(X=X) + +errors = np.zeros(K) +k=0 +for train_index, test_index in CV.split(X): + #print('Crossvalidation fold: {0}/{1}'.format(k+1,K)) + + # extract training and test set for current CV fold + X_train = X[train_index,:] + y_train = y[train_index] + X_test = X[test_index,:] + y_test = y[test_index] + + nb_classifier = MultinomialNB(alpha=alpha, + fit_prior=fit_prior) + nb_classifier.fit(X_train, y_train) + y_est_prob = nb_classifier.predict_proba(X_test) + y_est = np.argmax(y_est_prob,1) + + errors[k] = np.sum(y_est!=y_test,dtype=float)/y_test.shape[0] + k+=1 + +# Plot the classification error rate +print('Error rate: {0}%'.format(100*np.mean(errors))) + +print('Ran Exercise 7.2.4') diff --git a/exercises/02450Toolbox_Python/Scripts/ex8_1_1.py b/exercises/02450Toolbox_Python/Scripts/ex8_1_1.py new file mode 100644 index 0000000000000000000000000000000000000000..30326f56a49472db96d7a79511068764d56bb4db --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex8_1_1.py @@ -0,0 +1,134 @@ +# exercise 8.1.1 + +from matplotlib.pylab import (figure, semilogx, loglog, xlabel, ylabel, legend, + title, subplot, show, grid) +import numpy as np +from scipy.io import loadmat +import sklearn.linear_model as lm +from sklearn import model_selection +from toolbox_02450 import rlr_validate + +mat_data = loadmat('../Data/body.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'][0]] +N, M = X.shape + +# Add offset attribute +X = np.concatenate((np.ones((X.shape[0],1)),X),1) +attributeNames = [u'Offset']+attributeNames +M = M+1 + +## Crossvalidation +# Create crossvalidation partition for evaluation +K = 5 +CV = model_selection.KFold(K, shuffle=True) +#CV = model_selection.KFold(K, shuffle=False) + +# Values of lambda +lambdas = np.power(10.,range(-5,9)) + +# Initialize variables +#T = len(lambdas) +Error_train = np.empty((K,1)) +Error_test = np.empty((K,1)) +Error_train_rlr = np.empty((K,1)) +Error_test_rlr = np.empty((K,1)) +Error_train_nofeatures = np.empty((K,1)) +Error_test_nofeatures = np.empty((K,1)) +w_rlr = np.empty((M,K)) +mu = np.empty((K, M-1)) +sigma = np.empty((K, M-1)) +w_noreg = np.empty((M,K)) + +k=0 +for train_index, test_index in CV.split(X,y): + + # extract training and test set for current CV fold + X_train = X[train_index] + y_train = y[train_index] + X_test = X[test_index] + y_test = y[test_index] + internal_cross_validation = 10 + + opt_val_err, opt_lambda, mean_w_vs_lambda, train_err_vs_lambda, test_err_vs_lambda = rlr_validate(X_train, y_train, lambdas, internal_cross_validation) + + # Standardize outer fold based on training set, and save the mean and standard + # deviations since they're part of the model (they would be needed for + # making new predictions) - for brevity we won't always store these in the scripts + mu[k, :] = np.mean(X_train[:, 1:], 0) + sigma[k, :] = np.std(X_train[:, 1:], 0) + + X_train[:, 1:] = (X_train[:, 1:] - mu[k, :] ) / sigma[k, :] + X_test[:, 1:] = (X_test[:, 1:] - mu[k, :] ) / sigma[k, :] + + Xty = X_train.T @ y_train + XtX = X_train.T @ X_train + + # Compute mean squared error without using the input data at all + Error_train_nofeatures[k] = np.square(y_train-y_train.mean()).sum(axis=0)/y_train.shape[0] + Error_test_nofeatures[k] = np.square(y_test-y_test.mean()).sum(axis=0)/y_test.shape[0] + + # Estimate weights for the optimal value of lambda, on entire training set + lambdaI = opt_lambda * np.eye(M) + lambdaI[0,0] = 0 # Do no regularize the bias term + w_rlr[:,k] = np.linalg.solve(XtX+lambdaI,Xty).squeeze() + # Compute mean squared error with regularization with optimal lambda + Error_train_rlr[k] = np.square(y_train-X_train @ w_rlr[:,k]).sum(axis=0)/y_train.shape[0] + Error_test_rlr[k] = np.square(y_test-X_test @ w_rlr[:,k]).sum(axis=0)/y_test.shape[0] + + # Estimate weights for unregularized linear regression, on entire training set + w_noreg[:,k] = np.linalg.solve(XtX,Xty).squeeze() + # Compute mean squared error without regularization + Error_train[k] = np.square(y_train-X_train @ w_noreg[:,k]).sum(axis=0)/y_train.shape[0] + Error_test[k] = np.square(y_test-X_test @ w_noreg[:,k]).sum(axis=0)/y_test.shape[0] + # OR ALTERNATIVELY: you can use sklearn.linear_model module for linear regression: + #m = lm.LinearRegression().fit(X_train, y_train) + #Error_train[k] = np.square(y_train-m.predict(X_train)).sum()/y_train.shape[0] + #Error_test[k] = np.square(y_test-m.predict(X_test)).sum()/y_test.shape[0] + + # Display the results for the last cross-validation fold + if k == K-1: + figure(k, figsize=(12,8)) + subplot(1,2,1) + semilogx(lambdas,mean_w_vs_lambda.T[:,1:],'.-') # Don't plot the bias term + xlabel('Regularization factor') + ylabel('Mean Coefficient Values') + grid() + # You can choose to display the legend, but it's omitted for a cleaner + # plot, since there are many attributes + #legend(attributeNames[1:], loc='best') + + subplot(1,2,2) + title('Optimal lambda: 1e{0}'.format(np.log10(opt_lambda))) + loglog(lambdas,train_err_vs_lambda.T,'b.-',lambdas,test_err_vs_lambda.T,'r.-') + xlabel('Regularization factor') + ylabel('Squared error (crossvalidation)') + legend(['Train error','Validation error']) + grid() + + # To inspect the used indices, use these print statements + #print('Cross validation fold {0}/{1}:'.format(k+1,K)) + #print('Train indices: {0}'.format(train_index)) + #print('Test indices: {0}\n'.format(test_index)) + + k+=1 + +show() +# Display results +print('Linear regression without feature selection:') +print('- Training error: {0}'.format(Error_train.mean())) +print('- Test error: {0}'.format(Error_test.mean())) +print('- R^2 train: {0}'.format((Error_train_nofeatures.sum()-Error_train.sum())/Error_train_nofeatures.sum())) +print('- R^2 test: {0}\n'.format((Error_test_nofeatures.sum()-Error_test.sum())/Error_test_nofeatures.sum())) +print('Regularized linear regression:') +print('- Training error: {0}'.format(Error_train_rlr.mean())) +print('- Test error: {0}'.format(Error_test_rlr.mean())) +print('- R^2 train: {0}'.format((Error_train_nofeatures.sum()-Error_train_rlr.sum())/Error_train_nofeatures.sum())) +print('- R^2 test: {0}\n'.format((Error_test_nofeatures.sum()-Error_test_rlr.sum())/Error_test_nofeatures.sum())) + +print('Weights in last fold:') +for m in range(M): + print('{:>15} {:>15}'.format(attributeNames[m], np.round(w_rlr[m,-1],2))) + +print('Ran Exercise 8.1.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex8_1_2.py b/exercises/02450Toolbox_Python/Scripts/ex8_1_2.py new file mode 100644 index 0000000000000000000000000000000000000000..5240f058aadb675ebf9c2c66247249f0300d169c --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex8_1_2.py @@ -0,0 +1,87 @@ +# exercise 8.1.2 + +import matplotlib.pyplot as plt +import numpy as np +from scipy.io import loadmat +from sklearn.model_selection import train_test_split +from sklearn.linear_model import LogisticRegression +from toolbox_02450 import rocplot, confmatplot + + +font_size = 15 +plt.rcParams.update({'font.size': font_size}) + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wine2.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'][0]] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + + +# Create crossvalidation partition for evaluation +# using stratification and 95 pct. split between training and test +K = 20 +X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.95, stratify=y) +# Try to change the test_size to e.g. 50 % and 99 % - how does that change the +# effect of regularization? How does differetn runs of test_size=.99 compare +# to eachother? + +# Standardize the training and set set based on training set mean and std +mu = np.mean(X_train, 0) +sigma = np.std(X_train, 0) + +X_train = (X_train - mu) / sigma +X_test = (X_test - mu) / sigma + +# Fit regularized logistic regression model to training data to predict +# the type of wine +lambda_interval = np.logspace(-8, 2, 50) +train_error_rate = np.zeros(len(lambda_interval)) +test_error_rate = np.zeros(len(lambda_interval)) +coefficient_norm = np.zeros(len(lambda_interval)) +for k in range(0, len(lambda_interval)): + mdl = LogisticRegression(penalty='l2', C=1/lambda_interval[k] ) + + mdl.fit(X_train, y_train) + + y_train_est = mdl.predict(X_train).T + y_test_est = mdl.predict(X_test).T + + train_error_rate[k] = np.sum(y_train_est != y_train) / len(y_train) + test_error_rate[k] = np.sum(y_test_est != y_test) / len(y_test) + + w_est = mdl.coef_[0] + coefficient_norm[k] = np.sqrt(np.sum(w_est**2)) + +min_error = np.min(test_error_rate) +opt_lambda_idx = np.argmin(test_error_rate) +opt_lambda = lambda_interval[opt_lambda_idx] + +plt.figure(figsize=(8,8)) +#plt.plot(np.log10(lambda_interval), train_error_rate*100) +#plt.plot(np.log10(lambda_interval), test_error_rate*100) +#plt.plot(np.log10(opt_lambda), min_error*100, 'o') +plt.semilogx(lambda_interval, train_error_rate*100) +plt.semilogx(lambda_interval, test_error_rate*100) +plt.semilogx(opt_lambda, min_error*100, 'o') +plt.text(1e-8, 3, "Minimum test error: " + str(np.round(min_error*100,2)) + ' % at 1e' + str(np.round(np.log10(opt_lambda),2))) +plt.xlabel('Regularization strength, $\log_{10}(\lambda)$') +plt.ylabel('Error rate (%)') +plt.title('Classification error') +plt.legend(['Training error','Test error','Test minimum'],loc='upper right') +plt.ylim([0, 4]) +plt.grid() +plt.show() + +plt.figure(figsize=(8,8)) +plt.semilogx(lambda_interval, coefficient_norm,'k') +plt.ylabel('L2 Norm') +plt.xlabel('Regularization strength, $\log_{10}(\lambda)$') +plt.title('Parameter vector L2 norm') +plt.grid() +plt.show() + +print('Ran Exercise 9.1.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex8_2_2.py b/exercises/02450Toolbox_Python/Scripts/ex8_2_2.py new file mode 100644 index 0000000000000000000000000000000000000000..00ef20fd2a6df145b866b5d6b6f9b2371c36b010 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex8_2_2.py @@ -0,0 +1,142 @@ +# exercise 8.2.2 +import matplotlib.pyplot as plt +import numpy as np +from scipy.io import loadmat +from sklearn import model_selection +from toolbox_02450 import train_neural_net, draw_neural_net, visualize_decision_boundary +import torch +plt.rcParams.update({'font.size': 12}) + +# read XOR DATA from matlab datafile +mat_data = loadmat('../Data/xor.mat') +X = mat_data['X'] +y = mat_data['y'] + +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0] for name in mat_data['classNames'].squeeze()] +N, M = X.shape +C = len(classNames) + +# K-fold CrossValidation (4 folds here to speed up this example) +K = 4 +CV = model_selection.KFold(K,shuffle=True) + +# Setup figure for display of the decision boundary for the several crossvalidation folds. +decision_boundaries = plt.figure(1, figsize=(10,10)) +# Determine a size of a plot grid that fits visualizations for the chosen number +# of cross-validation splits, if K=4, this is simply a 2-by-2 grid. +subplot_size_1 = int(np.floor(np.sqrt(K))) +subplot_size_2 = int(np.ceil(K/subplot_size_1)) +# Set overall title for all of the subplots +plt.suptitle('Data and model decision boundaries', fontsize=20) +# Change spacing of subplots +plt.subplots_adjust(left=0, bottom=0, right=1, top=.9, wspace=.5, hspace=0.25) + +# Setup figure for display of learning curves and error rates in fold +summaries, summaries_axes = plt.subplots(1, 2, figsize=(10,5)) +# Make a list for storing assigned color of learning curve for up to K=10 +color_list = ['tab:orange', 'tab:green', 'tab:purple', 'tab:brown', 'tab:pink', + 'tab:gray', 'tab:olive', 'tab:cyan', 'tab:red', 'tab:blue'] + +# Define the model structure +n_hidden_units = 1 # number of hidden units in the signle hidden layer +# The lambda-syntax defines an anonymous function, which is used here to +# make it easy to make new networks within each cross validation fold +model = lambda: torch.nn.Sequential( + torch.nn.Linear(M, n_hidden_units), #M features to H hiden units + # 1st transfer function, either Tanh or ReLU: + torch.nn.Tanh(), #torch.nn.ReLU(), + torch.nn.Linear(n_hidden_units, 1), # H hidden units to 1 output neuron + torch.nn.Sigmoid() # final tranfer function + ) +# Since we're training a neural network for binary classification, we use a +# binary cross entropy loss (see the help(train_neural_net) for more on +# the loss_fn input to the function) +loss_fn = torch.nn.BCELoss() +# Train for a maximum of 10000 steps, or until convergence (see help for the +# function train_neural_net() for more on the tolerance/convergence)) +max_iter = 10000 +print('Training model of type:\n{}\n'.format(str(model()))) + +# Do cross-validation: +errors = [] # make a list for storing generalizaition error in each loop +# Loop over each cross-validation split. The CV.split-method returns the +# indices to be used for training and testing in each split, and calling +# the enumerate-method with this simply returns this indices along with +# a counter k: +for k, (train_index, test_index) in enumerate(CV.split(X,y)): + print('\nCrossvalidation fold: {0}/{1}'.format(k+1,K)) + + # Extract training and test set for current CV fold, + # and convert them to PyTorch tensors + X_train = torch.Tensor(X[train_index,:] ) + y_train = torch.Tensor(y[train_index] ) + X_test = torch.Tensor(X[test_index,:] ) + y_test = torch.Tensor(y[test_index] ) + + # Go to the file 'toolbox_02450.py' in the Tools sub-folder of the toolbox + # and see how the network is trained (search for 'def train_neural_net', + # which is the place the function below is defined) + net, final_loss, learning_curve = train_neural_net(model, + loss_fn, + X=X_train, + y=y_train, + n_replicates=3, + max_iter=max_iter) + + print('\n\tBest loss: {}\n'.format(final_loss)) + + # Determine estimated class labels for test set + y_sigmoid = net(X_test) # activation of final note, i.e. prediction of network + y_test_est = (y_sigmoid > .5).type(dtype=torch.uint8) # threshold output of sigmoidal function + y_test = y_test.type(dtype=torch.uint8) + # Determine errors and error rate + e = (y_test_est != y_test) + error_rate = (sum(e).type(torch.float)/len(y_test)).data.numpy() + errors.append(error_rate) # store error rate for current CV fold + + # Make a subplot for current cross validation fold that displays the + # decision boundary over the original data, "background color" corresponds + # to the output of the sigmoidal transfer function (i.e. before threshold), + # white areas are areas of uncertainty, and a deaper red/blue means + # that the network "is more sure" of a given class. + plt.figure(decision_boundaries.number) + plt.subplot(subplot_size_1,subplot_size_2,k+1) + plt.title('CV fold {0}'.format(k+1),color=color_list[k]) + predict = lambda x: net(torch.tensor(x, dtype=torch.float)).data.numpy() + visualize_decision_boundary(predict, X, y, # provide data, along with function for prediction + attributeNames, classNames, # provide information on attribute and class names + train=train_index, test=test_index, # provide information on partioning + show_legend=k==(K-1)) # only display legend for last plot + + # Display the learning curve for the best net in the current fold + h, = summaries_axes[0].plot(learning_curve, color=color_list[k]) + h.set_label('CV fold {0}'.format(k+1)) + summaries_axes[0].set_xlabel('Iterations') + summaries_axes[0].set_xlim((0, max_iter)) + summaries_axes[0].set_ylabel('Loss') + summaries_axes[0].set_title('Learning curves') + +# Display the error rate across folds +summaries_axes[1].bar(np.arange(1, K+1), np.squeeze(np.asarray(errors)), color=color_list) +summaries_axes[1].set_xlabel('Fold'); +summaries_axes[1].set_xticks(np.arange(1, K+1)) +summaries_axes[1].set_ylabel('Error rate'); +summaries_axes[1].set_title('Test misclassification rates') + +# Show the plots +# plt.show(decision_boundaries.number) # try these lines if the following code fails (depends on package versions) +# plt.show(summaries.number) +plt.show() + +# Display a diagram of the best network in last fold +print('Diagram of best neural net in last fold:') +weights = [net[i].weight.data.numpy().T for i in [0,2]] +biases = [net[i].bias.data.numpy() for i in [0,2]] +tf = [str(net[i]) for i in [1,3]] +draw_neural_net(weights, biases, tf) + +# Print the average classification error rate +print('\nGeneralization error/average error rate: {0}%'.format(round(100*np.mean(errors),4))) + +print('Ran exercise 8.2.2.') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex8_2_5.py b/exercises/02450Toolbox_Python/Scripts/ex8_2_5.py new file mode 100644 index 0000000000000000000000000000000000000000..363b4b6c7d645f9bc169bed8076a1b790285583e --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex8_2_5.py @@ -0,0 +1,102 @@ +# exercise 8.2.5 +import matplotlib.pyplot as plt +import numpy as np +from scipy.io import loadmat +import torch +from sklearn import model_selection +from toolbox_02450 import train_neural_net, draw_neural_net +from scipy import stats + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wine2.mat') +attributeNames = [name[0] for name in mat_data['attributeNames'][0]] +X = mat_data['X'] +y = mat_data['y'] + +#Downsample: X = X[1:20,:] y = y[1:20,:] +N, M = X.shape +C = 2 + +# Normalize data +X = stats.zscore(X); + +# Parameters for neural network classifier +n_hidden_units = 2 # number of hidden units +n_replicates = 2 # number of networks trained in each k-fold +max_iter = 10000 # stop criterion 2 (max epochs in training) + +# K-fold crossvalidation +K = 3 # only five folds to speed up this example +CV = model_selection.KFold(K, shuffle=True) +# Make figure for holding summaries (errors and learning curves) +summaries, summaries_axes = plt.subplots(1,2, figsize=(10,5)) +# Make a list for storing assigned color of learning curve for up to K=10 +color_list = ['tab:orange', 'tab:green', 'tab:purple', 'tab:brown', 'tab:pink', + 'tab:gray', 'tab:olive', 'tab:cyan', 'tab:red', 'tab:blue'] + +# Define the model, see also Exercise 8.2.2-script for more information. +model = lambda: torch.nn.Sequential( + torch.nn.Linear(M, n_hidden_units), #M features to H hiden units + torch.nn.Tanh(), # 1st transfer function, + torch.nn.Linear(n_hidden_units, 1), # H hidden units to 1 output neuron + torch.nn.Sigmoid() # final tranfer function + ) +loss_fn = torch.nn.BCELoss() + +print('Training model of type:\n\n{}\n'.format(str(model()))) +errors = [] # make a list for storing generalizaition error in each loop +for k, (train_index, test_index) in enumerate(CV.split(X,y)): + print('\nCrossvalidation fold: {0}/{1}'.format(k+1,K)) + + # Extract training and test set for current CV fold, convert to tensors + X_train = torch.Tensor(X[train_index,:]) + y_train = torch.Tensor(y[train_index]) + X_test = torch.Tensor(X[test_index,:]) + y_test = torch.Tensor(y[test_index]) + + # Train the net on training data + net, final_loss, learning_curve = train_neural_net(model, + loss_fn, + X=X_train, + y=y_train, + n_replicates=n_replicates, + max_iter=max_iter) + + print('\n\tBest loss: {}\n'.format(final_loss)) + + # Determine estimated class labels for test set + y_sigmoid = net(X_test) + y_test_est = (y_sigmoid>.5).type(dtype=torch.uint8) + + # Determine errors and errors + y_test = y_test.type(dtype=torch.uint8) + + e = y_test_est != y_test + error_rate = (sum(e).type(torch.float)/len(y_test)).data.numpy() + errors.append(error_rate) # store error rate for current CV fold + + # Display the learning curve for the best net in the current fold + h, = summaries_axes[0].plot(learning_curve, color=color_list[k]) + h.set_label('CV fold {0}'.format(k+1)) + summaries_axes[0].set_xlabel('Iterations') + summaries_axes[0].set_xlim((0, max_iter)) + summaries_axes[0].set_ylabel('Loss') + summaries_axes[0].set_title('Learning curves') + +# Display the error rate across folds +summaries_axes[1].bar(np.arange(1, K+1), np.squeeze(np.asarray(errors)), color=color_list) +summaries_axes[1].set_xlabel('Fold'); +summaries_axes[1].set_xticks(np.arange(1, K+1)) +summaries_axes[1].set_ylabel('Error rate'); +summaries_axes[1].set_title('Test misclassification rates') + +print('Diagram of best neural net in last fold:') +weights = [net[i].weight.data.numpy().T for i in [0,2]] +biases = [net[i].bias.data.numpy() for i in [0,2]] +tf = [str(net[i]) for i in [1,3]] +draw_neural_net(weights, biases, tf, attribute_names=attributeNames) + +# Print the average classification error rate +print('\nGeneralization error/average error rate: {0}%'.format(round(100*np.mean(errors),4))) + +print('Ran Exercise 8.2.5') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex8_2_6.py b/exercises/02450Toolbox_Python/Scripts/ex8_2_6.py new file mode 100644 index 0000000000000000000000000000000000000000..19c86cb86aadc57e4b6ec8b7b944e993b3d1f71f --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex8_2_6.py @@ -0,0 +1,129 @@ +# exercise 8.2.6 +import matplotlib.pyplot as plt +import numpy as np +from scipy.io import loadmat +import torch +from sklearn import model_selection +from toolbox_02450 import train_neural_net, draw_neural_net +from scipy import stats + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wine2.mat') +attributeNames = [name[0] for name in mat_data['attributeNames'][0]] +X = mat_data['X'] +y = X[:,[10]] # alcohol contents (target) +X = X[:,:10] # the rest of features +N, M = X.shape +C = 2 + +# Normalize data +X = stats.zscore(X) + +## Normalize and compute PCA (change to True to experiment with PCA preprocessing) +do_pca_preprocessing = False +if do_pca_preprocessing: + Y = stats.zscore(X,0) + U,S,V = np.linalg.svd(Y,full_matrices=False) + V = V.T + #Components to be included as features + k_pca = 3 + X = X @ V[:,:k_pca] + N, M = X.shape + + +# Parameters for neural network classifier +n_hidden_units = 2 # number of hidden units +n_replicates = 1 # number of networks trained in each k-fold +max_iter = 10000 + +# K-fold crossvalidation +K = 3 # only three folds to speed up this example +CV = model_selection.KFold(K, shuffle=True) + +# Setup figure for display of learning curves and error rates in fold +summaries, summaries_axes = plt.subplots(1,2, figsize=(10,5)) +# Make a list for storing assigned color of learning curve for up to K=10 +color_list = ['tab:orange', 'tab:green', 'tab:purple', 'tab:brown', 'tab:pink', + 'tab:gray', 'tab:olive', 'tab:cyan', 'tab:red', 'tab:blue'] +# Define the model +model = lambda: torch.nn.Sequential( + torch.nn.Linear(M, n_hidden_units), #M features to n_hidden_units + torch.nn.Tanh(), # 1st transfer function, + torch.nn.Linear(n_hidden_units, 1), # n_hidden_units to 1 output neuron + # no final tranfer function, i.e. "linear output" + ) +loss_fn = torch.nn.MSELoss() # notice how this is now a mean-squared-error loss + +print('Training model of type:\n\n{}\n'.format(str(model()))) +errors = [] # make a list for storing generalizaition error in each loop +for (k, (train_index, test_index)) in enumerate(CV.split(X,y)): + print('\nCrossvalidation fold: {0}/{1}'.format(k+1,K)) + + # Extract training and test set for current CV fold, convert to tensors + X_train = torch.Tensor(X[train_index,:]) + y_train = torch.Tensor(y[train_index]) + X_test = torch.Tensor(X[test_index,:]) + y_test = torch.Tensor(y[test_index]) + + # Train the net on training data + net, final_loss, learning_curve = train_neural_net(model, + loss_fn, + X=X_train, + y=y_train, + n_replicates=n_replicates, + max_iter=max_iter) + + print('\n\tBest loss: {}\n'.format(final_loss)) + + # Determine estimated class labels for test set + y_test_est = net(X_test) + + # Determine errors and errors + se = (y_test_est.float()-y_test.float())**2 # squared error + mse = (sum(se).type(torch.float)/len(y_test)).data.numpy() #mean + errors.append(mse) # store error rate for current CV fold + + # Display the learning curve for the best net in the current fold + h, = summaries_axes[0].plot(learning_curve, color=color_list[k]) + h.set_label('CV fold {0}'.format(k+1)) + summaries_axes[0].set_xlabel('Iterations') + summaries_axes[0].set_xlim((0, max_iter)) + summaries_axes[0].set_ylabel('Loss') + summaries_axes[0].set_title('Learning curves') + +# Display the MSE across folds +summaries_axes[1].bar(np.arange(1, K+1), np.squeeze(np.asarray(errors)), color=color_list) +summaries_axes[1].set_xlabel('Fold') +summaries_axes[1].set_xticks(np.arange(1, K+1)) +summaries_axes[1].set_ylabel('MSE') +summaries_axes[1].set_title('Test mean-squared-error') + +print('Diagram of best neural net in last fold:') +weights = [net[i].weight.data.numpy().T for i in [0,2]] +biases = [net[i].bias.data.numpy() for i in [0,2]] +tf = [str(net[i]) for i in [1,2]] +draw_neural_net(weights, biases, tf, attribute_names=attributeNames) + +# Print the average classification error rate +print('\nEstimated generalization error, RMSE: {0}'.format(round(np.sqrt(np.mean(errors)), 4))) + +# When dealing with regression outputs, a simple way of looking at the quality +# of predictions visually is by plotting the estimated value as a function of +# the true/known value - these values should all be along a straight line "y=x", +# and if the points are above the line, the model overestimates, whereas if the +# points are below the y=x line, then the model underestimates the value +plt.figure(figsize=(10,10)) +y_est = y_test_est.data.numpy(); y_true = y_test.data.numpy() +axis_range = [np.min([y_est, y_true])-1,np.max([y_est, y_true])+1] +plt.plot(axis_range,axis_range,'k--') +plt.plot(y_true, y_est,'ob',alpha=.25) +plt.legend(['Perfect estimation','Model estimations']) +plt.title('Alcohol content: estimated versus true value (for last CV-fold)') +plt.ylim(axis_range); plt.xlim(axis_range) +plt.xlabel('True value') +plt.ylabel('Estimated value') +plt.grid() + +plt.show() + +print('Ran Exercise 8.2.5') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex8_3_1.py b/exercises/02450Toolbox_Python/Scripts/ex8_3_1.py new file mode 100644 index 0000000000000000000000000000000000000000..6645fd66eff4f587a1f61967d03419975afb91a9 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex8_3_1.py @@ -0,0 +1,63 @@ +# exercise 8.3.1 Fit neural network classifiers using softmax output weighting +from matplotlib.pyplot import figure, show, title +from scipy.io import loadmat +from toolbox_02450 import dbplotf, train_neural_net, visualize_decision_boundary +import numpy as np +import torch +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth1.mat') +X = mat_data['X'] +X = X - np.ones((X.shape[0],1)) * np.mean(X,0) +X_train = mat_data['X_train'] +X_test = mat_data['X_test'] +y = mat_data['y'].squeeze() +y_train = mat_data['y_train'].squeeze() +y_test = mat_data['y_test'].squeeze() + +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] + +N, M = X.shape +C = len(classNames) +#%% Model fitting and prediction + +# Define the model structure +n_hidden_units = 5 # number of hidden units in the signle hidden layer +model = lambda: torch.nn.Sequential( + torch.nn.Linear(M, n_hidden_units), #M features to H hiden units + torch.nn.ReLU(), # 1st transfer function + # Output layer: + # H hidden units to C classes + # the nodes and their activation before the transfer + # function is often referred to as logits/logit output + torch.nn.Linear(n_hidden_units, C), # C logits + # To obtain normalised "probabilities" of each class + # we use the softmax-funtion along the "class" dimension + # (i.e. not the dimension describing observations) + torch.nn.Softmax(dim=1) # final tranfer function, normalisation of logit output + ) +# Since we're training a multiclass problem, we cannot use binary cross entropy, +# but instead use the general cross entropy loss: +loss_fn = torch.nn.CrossEntropyLoss() +# Train the network: +net, _, _ = train_neural_net(model, loss_fn, + X=torch.tensor(X_train, dtype=torch.float), + y=torch.tensor(y_train, dtype=torch.long), + n_replicates=3, + max_iter=10000) +# Determine probability of each class using trained network +softmax_logits = net(torch.tensor(X_test, dtype=torch.float)) +# Get the estimated class as the class with highest probability (argmax on softmax_logits) +y_test_est = (torch.max(softmax_logits, dim=1)[1]).data.numpy() +# Determine errors +e = (y_test_est != y_test) +print('Number of miss-classifications for ANN:\n\t {0} out of {1}'.format(sum(e),len(e))) + +predict = lambda x: (torch.max(net(torch.tensor(x, dtype=torch.float)), dim=1)[1]).data.numpy() +figure(1,figsize=(9,9)) +visualize_decision_boundary(predict, [X_train, X_test], [y_train, y_test], attributeNames, classNames) +title('ANN decision boundaries') + +show() + +print('Ran Exercise 8.3.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex8_3_2.py b/exercises/02450Toolbox_Python/Scripts/ex8_3_2.py new file mode 100644 index 0000000000000000000000000000000000000000..7d57d05c2e82c524c255e5318a442c6c0e3dc112 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex8_3_2.py @@ -0,0 +1,42 @@ +# exercise 8.3.2 Fit multinomial regression +from matplotlib.pyplot import figure, show, title +from scipy.io import loadmat +from toolbox_02450 import dbplotf, train_neural_net, visualize_decision_boundary +import numpy as np +import sklearn.linear_model as lm + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth1.mat') +X = mat_data['X'] +X = X - np.ones((X.shape[0],1)) * np.mean(X,0) +X_train = mat_data['X_train'] +X_test = mat_data['X_test'] +y = mat_data['y'].squeeze() +y_train = mat_data['y_train'].squeeze() +y_test = mat_data['y_test'].squeeze() + +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] + +N, M = X.shape +C = len(classNames) +#%% Model fitting and prediction + +# Multinomial logistic regression +logreg = lm.LogisticRegression(solver='lbfgs', multi_class='multinomial', tol=1e-4, random_state=1) +logreg.fit(X_train,y_train) + +# To display coefficients use print(logreg.coef_). For a 4 class problem with a +# feature space, these weights will have shape (4, 2). + +# Number of miss-classifications +print('Number of miss-classifications for Multinormal regression:\n\t {0} out of {1}'.format(np.sum(logreg.predict(X_test)!=y_test),len(y_test))) + +predict = lambda x: np.argmax(logreg.predict_proba(x),1) +figure(2,figsize=(9,9)) +visualize_decision_boundary(predict, [X_train, X_test], [y_train, y_test], attributeNames, classNames) +title('LogReg decision boundaries') + +show() + +print('Ran Exercise 8.3.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex8_3_3.py b/exercises/02450Toolbox_Python/Scripts/ex8_3_3.py new file mode 100644 index 0000000000000000000000000000000000000000..9cbbaa6fd95affa0d3d3d938cad47525b3947c08 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex8_3_3.py @@ -0,0 +1,57 @@ +# exercise 8.3.3 Fit regularized multinomial regression +import matplotlib.pyplot as plt +from scipy.io import loadmat +from toolbox_02450 import dbplotf, train_neural_net, visualize_decision_boundary +import numpy as np +import sklearn.linear_model as lm + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth2.mat') +X = mat_data['X'] +X_train = mat_data['X_train'] +X_test = mat_data['X_test'] +y = mat_data['y'].squeeze() +y_train = mat_data['y_train'].squeeze() +y_test = mat_data['y_test'].squeeze() + +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] + +N, M = X.shape +C = len(classNames) + +#%% Model fitting and prediction +# Standardize data based on training set +mu = np.mean(X_train, 0) +sigma = np.std(X_train, 0) +X_train = (X_train - mu) / sigma +X_test = (X_test - mu) / sigma + +# Fit multinomial logistic regression model +regularization_strength = 1e-3 +#Try a high strength, e.g. 1e5, especially for synth2, synth3 and synth4 +mdl = lm.LogisticRegression(solver='lbfgs', multi_class='multinomial', + tol=1e-4, random_state=1, + penalty='l2', C=1/regularization_strength) +mdl.fit(X_train,y_train) +y_test_est = mdl.predict(X_test) + +test_error_rate = np.sum(y_test_est!=y_test) / len(y_test) + +predict = lambda x: np.argmax(mdl.predict_proba(x),1) +plt.figure(2,figsize=(9,9)) +visualize_decision_boundary(predict, [X_train, X_test], [y_train, y_test], attributeNames, classNames) +plt.title('LogReg decision boundaries') +plt.show() + + +# Number of miss-classifications +print('Error rate: \n\t {0} % out of {1}'.format(test_error_rate*100,len(y_test))) +# %% + +plt.figure(2, figsize=(9,9)) +plt.hist([y_train, y_test, y_test_est], color=['red','green','blue'], density=True) +plt.legend(['Training labels','Test labels','Estimated test labels']) + + +print('Ran Exercise 8.3.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex9_1_1.py b/exercises/02450Toolbox_Python/Scripts/ex9_1_1.py new file mode 100644 index 0000000000000000000000000000000000000000..b49435a986f7a02bd664bc37680df036d361dd30 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex9_1_1.py @@ -0,0 +1,61 @@ +# exercise 9.1.1 + + +from matplotlib.pyplot import figure, show +import numpy as np +from scipy.io import loadmat +from toolbox_02450 import dbplot, dbprobplot, bootstrap +from toolbox_02450.bin_classifier_ensemble import BinClassifierEnsemble +from sklearn.linear_model import LogisticRegression + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth5.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + +# Fit model using bootstrap aggregation (bagging): + +# Number of rounds of bagging +L = 100 + +# Weights for selecting samples in each bootstrap +weights = np.ones((N,1),dtype=float)/N + +# Storage of trained log.reg. classifiers fitted in each bootstrap +logits = [0]*L +votes = np.zeros((N,)) + +# For each round of bagging +for l in range(L): + + # Extract training set by random sampling with replacement from X and y + X_train, y_train = bootstrap(X, y, N, weights) + + # Fit logistic regression model to training data and save result + logit_classifier = LogisticRegression() + logit_classifier.fit(X_train, y_train) + logits[l] = logit_classifier + y_est = logit_classifier.predict(X).T + votes = votes + y_est + + ErrorRate = (y!=y_est).sum(dtype=float)/N + print('Error rate: {:2.2f}%'.format(ErrorRate*100)) + +# Estimated value of class labels (using 0.5 as threshold) by majority voting +y_est_ensemble = votes>(L/2) + +# Compute error rate +ErrorRate = (y!=y_est_ensemble).sum(dtype=float)/N +print('Error rate: {:3.2f}%'.format(ErrorRate*100)) + +ce = BinClassifierEnsemble(logits) +figure(1); dbprobplot(ce, X, y, 'auto', resolution=200) +figure(2); dbplot(ce, X, y, 'auto', resolution=200) + +show() + +print('Ran Exercise 9.1.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex9_1_2.py b/exercises/02450Toolbox_Python/Scripts/ex9_1_2.py new file mode 100644 index 0000000000000000000000000000000000000000..0ba86f12470fe76ee9129b27a11c3a01e2114f8d --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex9_1_2.py @@ -0,0 +1,100 @@ +# exercise 9.1.2 + + +import matplotlib.pyplot as plt +import numpy as np +from scipy.io import loadmat +from toolbox_02450 import dbplot, dbprobplot, bootstrap +from toolbox_02450.bin_classifier_ensemble import BinClassifierEnsemble +from sklearn.linear_model import LogisticRegression + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth5.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + +# Fit model using bootstrap aggregation (boosting, AdaBoost): + +# Number of rounds of boosting +L = 100 + +# Weights for selecting samples in each bootstrap +weights = np.ones((N,),dtype=float)/N + +# Storage of trained log.reg. classifiers fitted in each bootstrap +logits = [0]*L +alpha = np.ones( (L,) ) +votes = np.zeros((N,1)) +epsi = 0 +y_all = np.zeros((N,L)) +y = y > 0.5 +# For each round of boosting +for l in range(L): + + # Extract training set by random sampling with replacement from X and y + while True : + # not a thing of beauty, however log.reg. fails if presented with less than two classes. + X_train, y_train = bootstrap(X, y, N, weights) + if not (all(y_train==0) or all(y_train == 1)) : break + + # Fit logistic regression model to training data and save result + # turn off regularization with C. + logit_classifier = LogisticRegression(C=1000) + + logit_classifier.fit(X_train, y_train ) + logits[l] = logit_classifier + y_est = logit_classifier.predict(X).T > 0.5 + + y_all[:,l] = 1.0 * y_est + v = (y_est != y).T + ErrorRate = np.multiply(weights,v).sum() + epsi = ErrorRate + + alphai = 0.5 * np.log( (1-epsi)/epsi) + + weights[y_est == y] = weights[y_est == y] * np.exp( -alphai ) + weights[y_est != y] = weights[y_est != y] * np.exp( alphai ) + + weights = weights / sum(weights) + + votes = votes + y_est + alpha[l] = alphai + print('Error rate: {:2.2f}%'.format(ErrorRate*100)) + + +# Estimated value of class labels (using 0.5 as threshold) by majority voting +alpha = alpha/sum(alpha) +y_est_ensemble = y_all @ alpha > 0.5 + +#y_est_ensemble = votes > (L/2) +#y_est_ensemble = mat(y_all) * mat(alpha) - (1-mat(y_all)) * mat(alpha) > 0 +ErrorRateEnsemble = sum(y_est_ensemble != y)/N + +# Compute error rate +#ErrorRate = (y!=y_est_ensemble).sum(dtype=float)/N +print('Error rate for ensemble classifier: {:.1f}%'.format(ErrorRateEnsemble*100)) + +ce = BinClassifierEnsemble(logits,alpha) +#ce = BinClassifierEnsemble(logits) # What happens if alpha is not included? +plt.figure(1); dbprobplot(ce, X, y, 'auto', resolution=200) +plt.figure(2); dbplot(ce, X, y, 'auto', resolution=200) +#plt.figure(3); plt.plot(alpha); + +#%% +plt.figure(4,figsize=(8,8)) +for i in range(2): + plt.plot(X[ (y_est_ensemble==i),0],X[ (y_est_ensemble==i),1],'br'[i] + 'o') + +## Incomment the below lines to investigate miss-classifications +#for i in range(2): +# plt.plot(X[ (y==i),0],X[ (y==i),1],'br'[i] + '.') + +plt.xlabel('Feature 1') +plt.ylabel('Feature 2') +plt.show() + +print('Ran Exercise 9.1.2') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex9_1_3.py b/exercises/02450Toolbox_Python/Scripts/ex9_1_3.py new file mode 100644 index 0000000000000000000000000000000000000000..3acfd65261d2e90d53dfeef97d9142441f679921 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex9_1_3.py @@ -0,0 +1,37 @@ +# exercise 9.1.3 + +from matplotlib.pyplot import figure, show +from scipy.io import loadmat +from toolbox_02450 import dbplot, dbprobplot +from sklearn.ensemble import RandomForestClassifier + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/synth7.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'].squeeze()] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + + +# Number of rounds of bagging +L = 10 + +# Fit model using random tree classifier: +rf_classifier = RandomForestClassifier(L) +rf_classifier.fit(X, y) +y_est = rf_classifier.predict(X).T +y_est_prob = rf_classifier.predict_proba(X).T + +# Compute classification error +ErrorRate = (y!=y_est).sum(dtype=float)/N +print('Error rate: {:.2f}%'.format(ErrorRate*100)) + +# Plot decision boundaries +figure(1); dbprobplot(rf_classifier, X, y, 'auto', resolution=400) +figure(2); dbplot(rf_classifier, X, y, 'auto', resolution=400) + +show() + +print('Ran Exercise 9.1.3') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex9_2_1.py b/exercises/02450Toolbox_Python/Scripts/ex9_2_1.py new file mode 100644 index 0000000000000000000000000000000000000000..f323eb78af82c6ac40e73693f7dd6639097fc2a5 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex9_2_1.py @@ -0,0 +1,46 @@ +# exercise 9.2.1 + +from matplotlib.pyplot import figure, show +#import numpy as np +from scipy.io import loadmat +from sklearn.model_selection import StratifiedKFold +from sklearn.linear_model import LogisticRegression +from toolbox_02450 import rocplot, confmatplot + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wine2.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'][0]] +classNames = [name[0][0] for name in mat_data['classNames']] +N, M = X.shape +C = len(classNames) + +# K-fold crossvalidation with stratified folds +K = 2 +CV = StratifiedKFold(K, shuffle=True) + +k=0 +for train_index, test_index in CV.split(X,y): + print(train_index) + # extract training and test set for current CV fold + X_train, y_train = X[train_index,:], y[train_index] + X_test, y_test = X[test_index,:], y[test_index] + + logit_classifier = LogisticRegression() + logit_classifier.fit(X_train, y_train) + + y_test_est = logit_classifier.predict(X_test).T + p = logit_classifier.predict_proba(X_test)[:,1].T + + figure(k) + rocplot(p, y_test) + + figure(k+1) + confmatplot(y_test,y_test_est) + + k+=2 + +show() + +print('Ran Exercise 9.2.1') \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/ex9_2_2.py b/exercises/02450Toolbox_Python/Scripts/ex9_2_2.py new file mode 100644 index 0000000000000000000000000000000000000000..2c4c075432105e307c9b6be1f9d89702cb1f242e --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/ex9_2_2.py @@ -0,0 +1,48 @@ +# exercise 9.2.2 + +from matplotlib.pyplot import figure, show +#import numpy as np +from scipy.io import loadmat +from sklearn.model_selection import StratifiedKFold +from sklearn.linear_model import LogisticRegression +from toolbox_02450 import rocplot, confmatplot + +# Load Matlab data file and extract variables of interest +mat_data = loadmat('../Data/wine2.mat') +X = mat_data['X'] +y = mat_data['y'].squeeze() +attributeNames = [name[0] for name in mat_data['attributeNames'][0]] +classNames = [name[0][0] for name in mat_data['classNames']] + +attribute_included = 10 # alcohol contents +X = X[:,attribute_included].reshape(-1,1) +attributeNames = attributeNames[attribute_included] +N, M = X.shape +C = len(classNames) + +# K-fold crossvalidation +K = 2 +CV = StratifiedKFold(K, shuffle=True) + +k=0 +for train_index, test_index in CV.split(X,y): + print(train_index) + # extract training and test set for current CV fold + X_train, y_train = X[train_index,:], y[train_index] + X_test, y_test = X[test_index,:], y[test_index] + + logit_classifier = LogisticRegression() + logit_classifier.fit(X_train, y_train) + + y_test_est = logit_classifier.predict(X_test).T + p = logit_classifier.predict_proba(X_test)[:,1].T + + figure(k) + rocplot(p,y_test) + + figure(k+1) + confmatplot(y_test,y_test_est) + + k+=2 + +show() \ No newline at end of file diff --git a/exercises/02450Toolbox_Python/Scripts/run_apriori.py b/exercises/02450Toolbox_Python/Scripts/run_apriori.py new file mode 100644 index 0000000000000000000000000000000000000000..827d5663722b92df945c109cf0b600b1a62a6730 --- /dev/null +++ b/exercises/02450Toolbox_Python/Scripts/run_apriori.py @@ -0,0 +1,86 @@ +import numpy as np +from subprocess import run +import re +import os +import time +from sys import platform +import sys + +if platform.startswith('linux'): #== "linux" or platform == "linux2": + ext = '' # Linux + dir_sep = '/' +elif platform.startswith('darwin'): #== "darwin": + ext = 'MAC' # OS X + dir_sep = '/' +elif platform.startswith('win'): #== "win32": + ext = '.exe' # Windows + dir_sep = '\\' +else: + raise NotImplementedError() + +filename = '..{0}Data{0}courses.txt'.format(dir_sep) +minSup = 80 +minConf = 100 +maxRule = 4 + +# Run Apriori Algorithm +print('Mining for frequent itemsets by the Apriori algorithm') +status1 = run('..{0}Tools{0}apriori{1} -f"," -s{2} -v"[Sup. %S]" {3} apriori_temp1.txt' + .format(dir_sep, ext, minSup, filename ), shell=True) + +if status1.returncode != 0: + print('An error occurred while calling apriori, a likely cause is that minSup was set to high such that no ' + 'frequent itemsets were generated or spaces are included in the path to the apriori files.') + sys.exit() +if minConf > 0: + print('Mining for associations by the Apriori algorithm') + status2 = run('..{0}Tools{0}apriori{1} -tr -f"," -o -n{2} -c{3} -s{4} -v"[Conf. %C,Sup. %S]" {5} apriori_temp2.txt' + .format(dir_sep, ext, maxRule, minConf, minSup, filename ), shell=True) + + if status2.returncode != 0: + print('An error occurred while calling apriori') + sys.exit() +print('Apriori analysis done, extracting results') + +# Extract information from stored files apriori_temp1.txt and apriori_temp2.txt +f = open('apriori_temp1.txt', 'r') +lines = f.readlines() +f.close() +# Extract Frequent Itemsets +FrequentItemsets = [''] * len(lines) +sup = np.zeros((len(lines), 1)) +for i, line in enumerate(lines): + FrequentItemsets[i] = line[0:-1] + sup[i] = re.findall(' [-+]?\d*\.\d+|\d+]', line)[0][1:-1] +os.remove('apriori_temp1.txt') + +# Read the file +f = open('apriori_temp2.txt', 'r') +lines = f.readlines() +f.close() +# Extract Association rules +AssocRules = [''] * len(lines) +conf = np.zeros((len(lines), 1)) +for i, line in enumerate(lines): + AssocRules[i] = line[0:-1] + conf[i] = re.findall(' [-+]?\d*\.\d+|\d+,', line)[0][1:-1] +os.remove('apriori_temp2.txt') + +# sort (FrequentItemsets by support value, AssocRules by confidence value) +AssocRulesSorted = [AssocRules[item] for item in np.argsort(conf, axis=0).ravel()] +AssocRulesSorted.reverse() +FrequentItemsetsSorted = [FrequentItemsets[item] for item in np.argsort(sup, axis=0).ravel()] +FrequentItemsetsSorted.reverse() + +# Print the results +time.sleep(.5) +print('\n') +print('RESULTS:\n') +print('Frequent itemsets:') +for i, item in enumerate(FrequentItemsetsSorted): + print('Item: {0}'.format(item)) +print('\n') +print('Association rules:') +for i, item in enumerate(AssocRulesSorted): + print('Rule: {0}'.format(item)) + diff --git a/exercises/02450Toolbox_R/Data/body.mat b/exercises/02450Toolbox_R/Data/body.mat new file mode 100644 index 0000000000000000000000000000000000000000..813ae289c6d502ff0a9241334017cbc43ee29bab Binary files /dev/null and b/exercises/02450Toolbox_R/Data/body.mat differ diff --git a/exercises/02450Toolbox_R/Data/courses.txt b/exercises/02450Toolbox_R/Data/courses.txt new file mode 100644 index 0000000000000000000000000000000000000000..da22d2b8fb121647f4dbeda6edc3a3f4cae2f366 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/courses.txt @@ -0,0 +1,6 @@ +2,5,6,7,8 +1,2,3,6,7,8 +2,4,6,8 +3,6,7 +2,6,7 +2,3,6,7,8 diff --git a/exercises/02450Toolbox_R/Data/digits.mat b/exercises/02450Toolbox_R/Data/digits.mat new file mode 100644 index 0000000000000000000000000000000000000000..c3555c53ce852f44b7b9f872be63f8c9aa81359c Binary files /dev/null and b/exercises/02450Toolbox_R/Data/digits.mat differ diff --git a/exercises/02450Toolbox_R/Data/faithful.mat b/exercises/02450Toolbox_R/Data/faithful.mat new file mode 100644 index 0000000000000000000000000000000000000000..e41906ed4794d8c6991c6985ebaa69f4dc45f2b5 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/faithful.mat differ diff --git a/exercises/02450Toolbox_R/Data/faithful.txt b/exercises/02450Toolbox_R/Data/faithful.txt new file mode 100644 index 0000000000000000000000000000000000000000..d31bbd2a0c0dfeda95ca878b54fb502db0d9aa57 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/faithful.txt @@ -0,0 +1,272 @@ +3.600000 79.000000 +1.800000 54.000000 +3.333000 74.000000 +2.283000 62.000000 +4.533000 85.000000 +2.883000 55.000000 +4.700000 88.000000 +3.600000 85.000000 +1.950000 51.000000 +4.350000 85.000000 +1.833000 54.000000 +3.917000 84.000000 +4.200000 78.000000 +1.750000 47.000000 +4.700000 83.000000 +2.167000 52.000000 +1.750000 62.000000 +4.800000 84.000000 +1.600000 52.000000 +4.250000 79.000000 +1.800000 51.000000 +1.750000 47.000000 +3.450000 78.000000 +3.067000 69.000000 +4.533000 74.000000 +3.600000 83.000000 +1.967000 55.000000 +4.083000 76.000000 +3.850000 78.000000 +4.433000 79.000000 +4.300000 73.000000 +4.467000 77.000000 +3.367000 66.000000 +4.033000 80.000000 +3.833000 74.000000 +2.017000 52.000000 +1.867000 48.000000 +4.833000 80.000000 +1.833000 59.000000 +4.783000 90.000000 +4.350000 80.000000 +1.883000 58.000000 +4.567000 84.000000 +1.750000 58.000000 +4.533000 73.000000 +3.317000 83.000000 +3.833000 64.000000 +2.100000 53.000000 +4.633000 82.000000 +2.000000 59.000000 +4.800000 75.000000 +4.716000 90.000000 +1.833000 54.000000 +4.833000 80.000000 +1.733000 54.000000 +4.883000 83.000000 +3.717000 71.000000 +1.667000 64.000000 +4.567000 77.000000 +4.317000 81.000000 +2.233000 59.000000 +4.500000 84.000000 +1.750000 48.000000 +4.800000 82.000000 +1.817000 60.000000 +4.400000 92.000000 +4.167000 78.000000 +4.700000 78.000000 +2.067000 65.000000 +4.700000 73.000000 +4.033000 82.000000 +1.967000 56.000000 +4.500000 79.000000 +4.000000 71.000000 +1.983000 62.000000 +5.067000 76.000000 +2.017000 60.000000 +4.567000 78.000000 +3.883000 76.000000 +3.600000 83.000000 +4.133000 75.000000 +4.333000 82.000000 +4.100000 70.000000 +2.633000 65.000000 +4.067000 73.000000 +4.933000 88.000000 +3.950000 76.000000 +4.517000 80.000000 +2.167000 48.000000 +4.000000 86.000000 +2.200000 60.000000 +4.333000 90.000000 +1.867000 50.000000 +4.817000 78.000000 +1.833000 63.000000 +4.300000 72.000000 +4.667000 84.000000 +3.750000 75.000000 +1.867000 51.000000 +4.900000 82.000000 +2.483000 62.000000 +4.367000 88.000000 +2.100000 49.000000 +4.500000 83.000000 +4.050000 81.000000 +1.867000 47.000000 +4.700000 84.000000 +1.783000 52.000000 +4.850000 86.000000 +3.683000 81.000000 +4.733000 75.000000 +2.300000 59.000000 +4.900000 89.000000 +4.417000 79.000000 +1.700000 59.000000 +4.633000 81.000000 +2.317000 50.000000 +4.600000 85.000000 +1.817000 59.000000 +4.417000 87.000000 +2.617000 53.000000 +4.067000 69.000000 +4.250000 77.000000 +1.967000 56.000000 +4.600000 88.000000 +3.767000 81.000000 +1.917000 45.000000 +4.500000 82.000000 +2.267000 55.000000 +4.650000 90.000000 +1.867000 45.000000 +4.167000 83.000000 +2.800000 56.000000 +4.333000 89.000000 +1.833000 46.000000 +4.383000 82.000000 +1.883000 51.000000 +4.933000 86.000000 +2.033000 53.000000 +3.733000 79.000000 +4.233000 81.000000 +2.233000 60.000000 +4.533000 82.000000 +4.817000 77.000000 +4.333000 76.000000 +1.983000 59.000000 +4.633000 80.000000 +2.017000 49.000000 +5.100000 96.000000 +1.800000 53.000000 +5.033000 77.000000 +4.000000 77.000000 +2.400000 65.000000 +4.600000 81.000000 +3.567000 71.000000 +4.000000 70.000000 +4.500000 81.000000 +4.083000 93.000000 +1.800000 53.000000 +3.967000 89.000000 +2.200000 45.000000 +4.150000 86.000000 +2.000000 58.000000 +3.833000 78.000000 +3.500000 66.000000 +4.583000 76.000000 +2.367000 63.000000 +5.000000 88.000000 +1.933000 52.000000 +4.617000 93.000000 +1.917000 49.000000 +2.083000 57.000000 +4.583000 77.000000 +3.333000 68.000000 +4.167000 81.000000 +4.333000 81.000000 +4.500000 73.000000 +2.417000 50.000000 +4.000000 85.000000 +4.167000 74.000000 +1.883000 55.000000 +4.583000 77.000000 +4.250000 83.000000 +3.767000 83.000000 +2.033000 51.000000 +4.433000 78.000000 +4.083000 84.000000 +1.833000 46.000000 +4.417000 83.000000 +2.183000 55.000000 +4.800000 81.000000 +1.833000 57.000000 +4.800000 76.000000 +4.100000 84.000000 +3.966000 77.000000 +4.233000 81.000000 +3.500000 87.000000 +4.366000 77.000000 +2.250000 51.000000 +4.667000 78.000000 +2.100000 60.000000 +4.350000 82.000000 +4.133000 91.000000 +1.867000 53.000000 +4.600000 78.000000 +1.783000 46.000000 +4.367000 77.000000 +3.850000 84.000000 +1.933000 49.000000 +4.500000 83.000000 +2.383000 71.000000 +4.700000 80.000000 +1.867000 49.000000 +3.833000 75.000000 +3.417000 64.000000 +4.233000 76.000000 +2.400000 53.000000 +4.800000 94.000000 +2.000000 55.000000 +4.150000 76.000000 +1.867000 50.000000 +4.267000 82.000000 +1.750000 54.000000 +4.483000 75.000000 +4.000000 78.000000 +4.117000 79.000000 +4.083000 78.000000 +4.267000 78.000000 +3.917000 70.000000 +4.550000 79.000000 +4.083000 70.000000 +2.417000 54.000000 +4.183000 86.000000 +2.217000 50.000000 +4.450000 90.000000 +1.883000 54.000000 +1.850000 54.000000 +4.283000 77.000000 +3.950000 79.000000 +2.333000 64.000000 +4.150000 75.000000 +2.350000 47.000000 +4.933000 86.000000 +2.900000 63.000000 +4.583000 85.000000 +3.833000 82.000000 +2.083000 57.000000 +4.367000 82.000000 +2.133000 67.000000 +4.350000 74.000000 +2.200000 54.000000 +4.450000 83.000000 +3.567000 73.000000 +4.500000 73.000000 +4.150000 88.000000 +3.817000 80.000000 +3.917000 71.000000 +4.450000 83.000000 +2.000000 56.000000 +4.283000 79.000000 +4.767000 78.000000 +4.533000 84.000000 +1.850000 58.000000 +4.250000 83.000000 +1.983000 43.000000 +2.250000 60.000000 +4.750000 75.000000 +4.117000 81.000000 +2.150000 46.000000 +4.417000 90.000000 +1.817000 46.000000 +4.467000 74.000000 diff --git a/exercises/02450Toolbox_R/Data/female.txt b/exercises/02450Toolbox_R/Data/female.txt new file mode 100644 index 0000000000000000000000000000000000000000..03a0f10d30373cd4d5d1ac1613028885c23dce77 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/female.txt @@ -0,0 +1,4999 @@ +Abagael +Abagail +Abbe +Abbey +Abbi +Abbie +Abby +Abigael +Abigail +Abigale +Abra +Acacia +Ada +Adah +Adaline +Adara +Addie +Addis +Adel +Adela +Adelaide +Adele +Adelice +Adelina +Adelind +Adeline +Adella +Adelle +Adena +Adey +Adi +Adiana +Adina +Adora +Adore +Adoree +Adorne +Adrea +Adria +Adriaens +Adrian +Adriana +Adriane +Adrianna +Adrianne +Adrien +Adriena +Adrienne +Aeriel +Aeriela +Aeriell +Ag +Agace +Agata +Agatha +Agathe +Aggi +Aggie +Aggy +Agna +Agnella +Agnes +Agnese +Agnesse +Agneta +Agnola +Agretha +Aida +Aidan +Aigneis +Aila +Aile +Ailee +Aileen +Ailene +Ailey +Aili +Ailina +Ailyn +Aime +Aimee +Aimil +Aina +Aindrea +Ainslee +Ainsley +Ainslie +Ajay +Alaine +Alameda +Alana +Alanah +Alane +Alanna +Alayne +Alberta +Albertina +Albertine +Albina +Alecia +Aleda +Aleece +Aleecia +Aleen +Alejandra +Alejandrina +Alena +Alene +Alessandra +Aleta +Alethea +Alex +Alexa +Alexandra +Alexandrina +Alexi +Alexia +Alexina +Alexine +Alexis +Alfie +Alfreda +Ali +Alia +Alica +Alice +Alicea +Alicia +Alida +Alidia +Alina +Aline +Alis +Alisa +Alisha +Alison +Alissa +Alisun +Alix +Aliza +Alla +Alleen +Allegra +Allene +Alli +Allianora +Allie +Allina +Allis +Allison +Allissa +Allsun +Ally +Allyce +Allyn +Allys +Allyson +Alma +Almeda +Almeria +Almeta +Almira +Almire +Aloise +Aloisia +Aloysia +Alpa +Alta +Althea +Alvera +Alvina +Alvinia +Alvira +Alyce +Alyda +Alys +Alysa +Alyse +Alysia +Alyson +Alyss +Alyssa +Amabel +Amabelle +Amalea +Amalee +Amaleta +Amalia +Amalie +Amalita +Amalle +Amanda +Amandi +Amandie +Amandy +Amara +Amargo +Amata +Amber +Amberly +Ambrosia +Ambur +Ame +Amelia +Amelie +Amelina +Ameline +Amelita +Ami +Amie +Amity +Ammamaria +Amy +Ana +Anabel +Anabella +Anabelle +Anais +Analiese +Analise +Anallese +Anallise +Anastasia +Anastasie +Anastassia +Anatola +Andee +Andi +Andie +Andra +Andrea +Andreana +Andree +Andrei +Andria +Andriana +Andriette +Andromache +Andromeda +Andy +Anestassia +Anet +Anett +Anetta +Anette +Ange +Angel +Angela +Angele +Angelia +Angelica +Angelika +Angelina +Angeline +Angelique +Angelita +Angelle +Angie +Angil +Angy +Ania +Anica +Anissa +Anita +Anitra +Anja +Anjanette +Anjela +Ann +Ann-Mari +Ann-Marie +Anna +Anna-Diana +Anna-Diane +Anna-Maria +Annabal +Annabel +Annabela +Annabell +Annabella +Annabelle +Annadiana +Annadiane +Annalee +Annalena +Annaliese +Annalisa +Annalise +Annalyse +Annamari +Annamaria +Annamarie +Anne +Anne-Corinne +Anne-Mar +Anne-Marie +Annecorinne +Anneliese +Annelise +Annemarie +Annetta +Annette +Anni +Annice +Annie +Annissa +Annmaria +Annmarie +Annnora +Annora +Anny +Anselma +Ansley +Anstice +Anthe +Anthea +Anthia +Antoinette +Antonella +Antonetta +Antonia +Antonie +Antonietta +Antonina +Anya +Aphrodite +Appolonia +April +Aprilette +Ara +Arabel +Arabela +Arabele +Arabella +Arabelle +Arda +Ardath +Ardeen +Ardelia +Ardelis +Ardella +Ardelle +Arden +Ardene +Ardenia +Ardine +Ardis +Ardith +Ardra +Ardyce +Ardys +Ardyth +Aretha +Ariadne +Ariana +Arianne +Aridatha +Ariel +Ariela +Ariella +Arielle +Arlana +Arlee +Arleen +Arlen +Arlena +Arlene +Arleta +Arlette +Arleyne +Arlie +Arliene +Arlina +Arlinda +Arline +Arly +Arlyn +Arlyne +Aryn +Ashely +Ashlee +Ashleigh +Ashlen +Ashley +Ashli +Ashlie +Ashly +Asia +Astra +Astrid +Astrix +Atalanta +Athena +Athene +Atlanta +Atlante +Auberta +Aubine +Aubree +Aubrette +Aubrey +Aubrie +Aubry +Audi +Audie +Audra +Audre +Audrey +Audrie +Audry +Audrye +Audy +Augusta +Auguste +Augustina +Augustine +Aura +Aurea +Aurel +Aurelea +Aurelia +Aurelie +Auria +Aurie +Aurilia +Aurlie +Auroora +Aurora +Aurore +Austin +Austina +Austine +Ava +Aveline +Averil +Averyl +Avie +Avis +Aviva +Avivah +Avril +Avrit +Ayn +Bab +Babara +Babette +Babita +Babs +Bambi +Bambie +Bamby +Barb +Barbabra +Barbara +Barbara-Anne +Barbaraanne +Barbe +Barbee +Barbette +Barbey +Barbi +Barbie +Barbra +Barby +Bari +Barrie +Barry +Basia +Bathsheba +Batsheva +Bea +Beatrice +Beatrisa +Beatrix +Beatriz +Beau +Bebe +Becca +Becka +Becki +Beckie +Becky +Bee +Beilul +Beitris +Bekki +Bel +Belia +Belicia +Belinda +Belita +Bell +Bella +Bellamy +Bellanca +Belle +Bellina +Belva +Belvia +Bendite +Benedetta +Benedicta +Benedikta +Benetta +Benita +Benni +Bennie +Benny +Benoite +Berenice +Beret +Berget +Berna +Bernadene +Bernadette +Bernadina +Bernadine +Bernardina +Bernardine +Bernelle +Bernete +Bernetta +Bernette +Berni +Bernice +Bernie +Bernita +Berny +Berri +Berrie +Berry +Bert +Berta +Berte +Bertha +Berthe +Berti +Bertie +Bertina +Bertine +Berty +Beryl +Beryle +Bess +Bessie +Bessy +Beth +Bethanne +Bethany +Bethena +Bethina +Betsey +Betsy +Betta +Bette +Bette-Ann +Betteann +Betteanne +Betti +Bettie +Bettina +Bettine +Betty +Bettye +Beulah +Bev +Beverie +Beverlee +Beverlie +Beverly +Bevvy +Bianca +Bianka +Biddy +Bidget +Bill +Billi +Billie +Billy +Binni +Binnie +Binny +Bird +Birdie +Birgit +Birgitta +Blair +Blaire +Blake +Blakelee +Blakeley +Blanca +Blanch +Blancha +Blanche +Blinni +Blinnie +Blinny +Bliss +Blisse +Blithe +Blondell +Blondelle +Blondie +Blondy +Blythe +Bo +Bobbette +Bobbi +Bobbie +Bobby +Bobette +Bobina +Bobine +Bobinette +Bonita +Bonnee +Bonni +Bonnie +Bonny +Brana +Brandais +Brande +Brandea +Brandi +Brandice +Brandie +Brandise +Brandy +Brea +Breanne +Brear +Bree +Breena +Bren +Brena +Brenda +Brenn +Brenna +Brett +Bria +Briana +Brianna +Brianne +Bride +Bridget +Bridgett +Bridgette +Bridie +Brier +Brietta +Brigid +Brigida +Brigit +Brigitta +Brigitte +Brina +Briney +Briny +Brit +Brita +Britaney +Britani +Briteny +Britney +Britni +Britt +Britta +Brittan +Brittany +Britte +Brittney +Brook +Brooke +Brooks +Brunella +Brunhilda +Brunhilde +Bryana +Bryn +Bryna +Brynn +Brynna +Brynne +Buffy +Bunni +Bunnie +Bunny +Burta +Cabrina +Cacilia +Cacilie +Caitlin +Caitrin +Cal +Calida +Calla +Calley +Calli +Callida +Callie +Cally +Calypso +Cam +Camala +Camel +Camella +Camellia +Cameo +Cami +Camila +Camile +Camilla +Camille +Cammi +Cammie +Cammy +Canada +Candace +Candi +Candice +Candida +Candide +Candie +Candis +Candra +Candy +Cappella +Caprice +Cara +Caralie +Caren +Carena +Caresa +Caressa +Caresse +Carey +Cari +Caria +Carie +Caril +Carilyn +Carin +Carina +Carine +Cariotta +Carissa +Carita +Caritta +Carla +Carlee +Carleen +Carlen +Carlena +Carlene +Carley +Carli +Carlie +Carlin +Carlina +Carline +Carlisle +Carlita +Carlota +Carlotta +Carly +Carlye +Carlyn +Carlynn +Carlynne +Carma +Carmel +Carmela +Carmelia +Carmelina +Carmelita +Carmella +Carmelle +Carmen +Carmina +Carmine +Carmita +Carmon +Caro +Carol +Carol-Jean +Carola +Carolan +Carolann +Carole +Carolee +Caroleen +Carolie +Carolin +Carolina +Caroline +Caroljean +Carolyn +Carolyne +Carolynn +Caron +Carree +Carri +Carrie +Carrissa +Carrol +Carroll +Carry +Cary +Caryl +Caryn +Casandra +Casey +Casi +Casia +Casie +Cass +Cassandra +Cassandre +Cassandry +Cassaundra +Cassey +Cassi +Cassie +Cassondra +Cassy +Cat +Catarina +Cate +Caterina +Catha +Catharina +Catharine +Cathe +Cathee +Catherin +Catherina +Catherine +Cathi +Cathie +Cathleen +Cathlene +Cathrin +Cathrine +Cathryn +Cathy +Cathyleen +Cati +Catie +Catina +Catlaina +Catlee +Catlin +Catrina +Catriona +Caty +Cayla +Cecelia +Cecil +Cecile +Ceciley +Cecilia +Cecilla +Cecily +Ceil +Cele +Celene +Celesta +Celeste +Celestia +Celestina +Celestine +Celestyn +Celestyna +Celia +Celie +Celina +Celinda +Celine +Celinka +Celisse +Celle +Cesya +Chad +Chanda +Chandal +Chandra +Channa +Chantal +Chantalle +Charil +Charin +Charis +Charissa +Charisse +Charita +Charity +Charla +Charlean +Charleen +Charlena +Charlene +Charline +Charlot +Charlott +Charlotta +Charlotte +Charmain +Charmaine +Charmane +Charmian +Charmine +Charmion +Charo +Charyl +Chastity +Chelsae +Chelsea +Chelsey +Chelsie +Chelsy +Cher +Chere +Cherey +Cheri +Cherianne +Cherice +Cherida +Cherie +Cherilyn +Cherilynn +Cherin +Cherise +Cherish +Cherlyn +Cherri +Cherrita +Cherry +Chery +Cherye +Cheryl +Cheslie +Chiarra +Chickie +Chicky +Chiquita +Chloe +Chloette +Chloris +Chris +Chriss +Chrissa +Chrissie +Chrissy +Christa +Christabel +Christabella +Christabelle +Christal +Christalle +Christan +Christean +Christel +Christen +Christi +Christian +Christiana +Christiane +Christie +Christin +Christina +Christine +Christy +Christyna +Chrysa +Chrysler +Chrystal +Chryste +Chrystel +Ciara +Cicely +Cicily +Ciel +Cilka +Cinda +Cindee +Cindelyn +Cinderella +Cindi +Cindie +Cindra +Cindy +Cinnamon +Cissie +Cissy +Clair +Claire +Clara +Clarabelle +Clare +Claresta +Clareta +Claretta +Clarette +Clarey +Clari +Claribel +Clarice +Clarie +Clarinda +Clarine +Clarisa +Clarissa +Clarisse +Clarita +Clary +Claude +Claudelle +Claudetta +Claudette +Claudia +Claudie +Claudina +Claudine +Clea +Clem +Clemence +Clementia +Clementina +Clementine +Clemmie +Clemmy +Cleo +Cleopatra +Clerissa +Cleva +Clio +Clo +Cloe +Cloris +Clotilda +Clovis +Codee +Codi +Codie +Cody +Coleen +Colene +Coletta +Colette +Colleen +Collete +Collette +Collie +Colline +Colly +Con +Concettina +Conchita +Concordia +Conney +Conni +Connie +Conny +Consolata +Constance +Constancia +Constancy +Constanta +Constantia +Constantina +Constantine +Consuela +Consuelo +Cookie +Cora +Corabel +Corabella +Corabelle +Coral +Coralie +Coraline +Coralyn +Cordelia +Cordelie +Cordey +Cordie +Cordula +Cordy +Coreen +Corella +Corena +Corenda +Corene +Coretta +Corette +Corey +Cori +Corie +Corilla +Corina +Corine +Corinna +Corinne +Coriss +Corissa +Corliss +Corly +Cornela +Cornelia +Cornelle +Cornie +Corny +Correna +Correy +Corri +Corrianne +Corrie +Corrina +Corrine +Corrinne +Corry +Cortney +Cory +Cosetta +Cosette +Courtenay +Courtney +Cresa +Cris +Crissie +Crissy +Crista +Cristabel +Cristal +Cristen +Cristi +Cristie +Cristin +Cristina +Cristine +Cristionna +Cristy +Crysta +Crystal +Crystie +Cyb +Cybal +Cybel +Cybelle +Cybil +Cybill +Cyndi +Cyndy +Cynthea +Cynthia +Cynthie +Cynthy +Dacey +Dacia +Dacie +Dacy +Dael +Daffi +Daffie +Daffy +Dafna +Dagmar +Dahlia +Daile +Daisey +Daisi +Daisie +Daisy +Dale +Dalenna +Dalia +Dalila +Dallas +Daloris +Damara +Damaris +Damita +Dana +Danell +Danella +Danelle +Danette +Dani +Dania +Danica +Danice +Daniel +Daniela +Daniele +Daniella +Danielle +Danika +Danila +Danit +Danita +Danna +Danni +Dannie +Danny +Dannye +Danya +Danyelle +Danyette +Daphene +Daphna +Daphne +Dara +Darb +Darbie +Darby +Darcee +Darcey +Darci +Darcie +Darcy +Darda +Dareen +Darell +Darelle +Dari +Daria +Darice +Darla +Darleen +Darlene +Darline +Darryl +Darsey +Darsie +Darya +Daryl +Daryn +Dasha +Dasi +Dasie +Dasya +Datha +Daune +Daveen +Daveta +Davida +Davina +Davine +Davita +Dawn +Dawna +Dayle +Dayna +Dea +Deana +Deane +Deanna +Deanne +Deb +Debbi +Debbie +Debbra +Debby +Debee +Debera +Debi +Debor +Debora +Deborah +Debra +Dede +Dedie +Dedra +Dee +Dee Dee +Deeann +Deeanne +Deedee +Deena +Deerdre +Dehlia +Deidre +Deina +Deirdre +Del +Dela +Delaney +Delcina +Delcine +Delia +Delila +Delilah +Delinda +Dell +Della +Delly +Delora +Delores +Deloria +Deloris +Delphina +Delphine +Delphinia +Demeter +Demetra +Demetria +Demetris +Dena +Deni +Denice +Denise +Denna +Denni +Dennie +Denny +Deny +Denys +Denyse +Deonne +Desaree +Desdemona +Desirae +Desiree +Desiri +Deva +Devan +Devi +Devin +Devina +Devinne +Devon +Devondra +Devonna +Devonne +Devora +Dew +Di +Diahann +Diamond +Dian +Diana +Diandra +Diane +Diane-Marie +Dianemarie +Diann +Dianna +Dianne +Diannne +Didi +Dido +Diena +Dierdre +Dina +Dinah +Dinnie +Dinny +Dion +Dione +Dionis +Dionne +Dita +Dix +Dixie +Dode +Dodi +Dodie +Dody +Doe +Doll +Dolley +Dolli +Dollie +Dolly +Dolora +Dolores +Dolorita +Doloritas +Dominica +Dominique +Dona +Donella +Donelle +Donetta +Donia +Donica +Donielle +Donna +Donnajean +Donnamarie +Donni +Donnie +Donny +Dora +Doralia +Doralin +Doralyn +Doralynn +Doralynne +Dorcas +Dore +Doreen +Dorelia +Dorella +Dorelle +Dorena +Dorene +Doretta +Dorette +Dorey +Dori +Doria +Dorian +Dorice +Dorie +Dorine +Doris +Dorisa +Dorise +Dorit +Dorita +Doro +Dorolice +Dorolisa +Dorotea +Doroteya +Dorothea +Dorothee +Dorothy +Dorree +Dorri +Dorrie +Dorris +Dorry +Dorthea +Dorthy +Dory +Dosi +Dot +Doti +Dotti +Dottie +Dotty +Dove +Drea +Drew +Dulce +Dulcea +Dulci +Dulcia +Dulciana +Dulcie +Dulcine +Dulcinea +Dulcy +Dulsea +Dusty +Dyan +Dyana +Dyane +Dyann +Dyanna +Dyanne +Dyna +Dynah +Eada +Eadie +Eadith +Ealasaid +Eartha +Easter +Eba +Ebba +Ebonee +Ebony +Eda +Eddi +Eddie +Eddy +Ede +Edee +Edeline +Eden +Edi +Edie +Edin +Edita +Edith +Editha +Edithe +Ediva +Edna +Edwina +Edy +Edyth +Edythe +Effie +Eileen +Eilis +Eimile +Eirena +Ekaterina +Elaina +Elaine +Elana +Elane +Elayne +Elberta +Elbertina +Elbertine +Eleanor +Eleanora +Eleanore +Electra +Elena +Elene +Eleni +Elenore +Eleonora +Eleonore +Elfie +Elfreda +Elfrida +Elfrieda +Elga +Elianora +Elianore +Elicia +Elie +Elinor +Elinore +Elisa +Elisabet +Elisabeth +Elisabetta +Elise +Elisha +Elissa +Elita +Eliza +Elizabet +Elizabeth +Elka +Elke +Ella +Elladine +Elle +Ellen +Ellene +Ellette +Elli +Ellie +Ellissa +Elly +Ellyn +Ellynn +Elmira +Elna +Elnora +Elnore +Eloisa +Eloise +Elonore +Elora +Elsa +Elsbeth +Else +Elsey +Elsi +Elsie +Elsinore +Elspeth +Elsy +Elva +Elvera +Elvina +Elvira +Elwina +Elwira +Elyn +Elyse +Elysee +Elysha +Elysia +Elyssa +Em +Ema +Emalee +Emalia +Emanuela +Emelda +Emelia +Emelina +Emeline +Emelita +Emelyne +Emera +Emilee +Emili +Emilia +Emilie +Emiline +Emily +Emlyn +Emlynn +Emlynne +Emma +Emmalee +Emmaline +Emmalyn +Emmalynn +Emmalynne +Emmeline +Emmey +Emmi +Emmie +Emmy +Emmye +Emogene +Emyle +Emylee +Endora +Engracia +Enid +Enrica +Enrichetta +Enrika +Enriqueta +Enya +Eolanda +Eolande +Eran +Erda +Erena +Erica +Ericha +Ericka +Erika +Erin +Erina +Erinn +Erinna +Erma +Ermengarde +Ermentrude +Ermina +Erminia +Erminie +Erna +Ernaline +Ernesta +Ernestine +Ertha +Eryn +Esma +Esmaria +Esme +Esmeralda +Esmerelda +Essa +Essie +Essy +Esta +Estel +Estele +Estell +Estella +Estelle +Ester +Esther +Estrella +Estrellita +Ethel +Ethelda +Ethelin +Ethelind +Etheline +Ethelyn +Ethyl +Etta +Etti +Ettie +Etty +Eudora +Eugenia +Eugenie +Eugine +Eula +Eulalie +Eunice +Euphemia +Eustacia +Eva +Evaleen +Evangelia +Evangelin +Evangelina +Evangeline +Evania +Evanne +Eve +Eveleen +Evelina +Eveline +Evelyn +Evette +Evey +Evie +Evita +Evonne +Evvie +Evvy +Evy +Eyde +Eydie +Fabrianne +Fabrice +Fae +Faina +Faith +Fallon +Fan +Fanchette +Fanchon +Fancie +Fancy +Fanechka +Fania +Fanni +Fannie +Fanny +Fanya +Fara +Farah +Farand +Farica +Farra +Farrah +Farrand +Fatima +Faun +Faunie +Faustina +Faustine +Fawn +Fawna +Fawne +Fawnia +Fay +Faydra +Faye +Fayette +Fayina +Fayre +Fayth +Faythe +Federica +Fedora +Felecia +Felicdad +Felice +Felicia +Felicity +Felicle +Felipa +Felisha +Felita +Feliza +Fenelia +Feodora +Ferdinanda +Ferdinande +Fern +Fernanda +Fernande +Fernandina +Ferne +Fey +Fiann +Fianna +Fidela +Fidelia +Fidelity +Fifi +Fifine +Filia +Filide +Filippa +Fina +Fiona +Fionna +Fionnula +Fiorenze +Fleur +Fleurette +Flo +Flor +Flora +Florance +Flore +Florella +Florence +Florencia +Florentia +Florenza +Florette +Flori +Floria +Florice +Florida +Florie +Florina +Florinda +Floris +Florri +Florrie +Florry +Flory +Flossi +Flossie +Flossy +Flower +Fortuna +Fortune +Fran +France +Francene +Frances +Francesca +Francesmary +Francine +Francis +Francisca +Franciska +Francoise +Francyne +Frank +Frankie +Franky +Franni +Frannie +Franny +Frayda +Fred +Freda +Freddi +Freddie +Freddy +Fredelia +Frederica +Fredericka +Fredi +Fredia +Fredra +Fredrika +Freida +Frieda +Friederike +Fulvia +Gabbey +Gabbi +Gabbie +Gabey +Gabi +Gabie +Gabriel +Gabriela +Gabriell +Gabriella +Gabrielle +Gabriellia +Gabrila +Gaby +Gae +Gael +Gail +Gale +Galina +Garland +Garnet +Garnette +Gates +Gavra +Gavrielle +Gay +Gayla +Gayle +Gayleen +Gaylene +Gaynor +Geeta +Gelya +Gen +Gena +Gene +Geneva +Genevieve +Genevra +Genia +Genna +Genni +Gennie +Gennifer +Genny +Genovera +Genvieve +George +Georgeanna +Georgeanne +Georgena +Georgeta +Georgetta +Georgette +Georgia +Georgiamay +Georgiana +Georgianna +Georgianne +Georgie +Georgina +Georgine +Gera +Geralda +Geraldina +Geraldine +Gerda +Gerhardine +Geri +Gerianna +Gerianne +Gerladina +Germain +Germaine +Germana +Gerri +Gerrie +Gerrilee +Gerry +Gert +Gerta +Gerti +Gertie +Gertrud +Gertruda +Gertrude +Gertrudis +Gerty +Giacinta +Giana +Gianina +Gianna +Gigi +Gilberta +Gilberte +Gilbertina +Gilbertine +Gilda +Gill +Gillan +Gilli +Gillian +Gillie +Gilligan +Gilly +Gina +Ginelle +Ginevra +Ginger +Ginni +Ginnie +Ginnifer +Ginny +Giorgia +Giovanna +Gipsy +Giralda +Gisela +Gisele +Gisella +Giselle +Gita +Gizela +Glad +Gladi +Gladis +Gladys +Gleda +Glen +Glenda +Glenine +Glenn +Glenna +Glennie +Glennis +Glori +Gloria +Gloriana +Gloriane +Glorianna +Glory +Glyn +Glynda +Glynis +Glynnis +Godiva +Golda +Goldarina +Goldi +Goldia +Goldie +Goldina +Goldy +Grace +Gracia +Gracie +Grata +Gratia +Gratiana +Gray +Grayce +Grazia +Gredel +Greer +Greta +Gretal +Gretchen +Grete +Gretel +Grethel +Gretna +Gretta +Grier +Griselda +Grissel +Guendolen +Guenevere +Guenna +Guglielma +Gui +Guillema +Guillemette +Guinevere +Guinna +Gunilla +Gunvor +Gus +Gusella +Gussi +Gussie +Gussy +Gusta +Gusti +Gustie +Gusty +Gwen +Gwendolen +Gwendolin +Gwendolyn +Gweneth +Gwenette +Gwenn +Gwenneth +Gwenni +Gwennie +Gwenny +Gwenora +Gwenore +Gwyn +Gwyneth +Gwynne +Gypsy +Hadria +Hailee +Haily +Haleigh +Halette +Haley +Hali +Halie +Halimeda +Halley +Halli +Hallie +Hally +Hana +Hanna +Hannah +Hanni +Hannibal +Hannie +Hannis +Hanny +Happy +Harlene +Harley +Harli +Harlie +Harmonia +Harmonie +Harmony +Harri +Harrie +Harriet +Harriett +Harrietta +Harriette +Harriot +Harriott +Hatti +Hattie +Hatty +Havivah +Hayley +Hazel +Heath +Heather +Heda +Hedda +Heddi +Heddie +Hedi +Hedvig +Hedwig +Hedy +Heida +Heide +Heidi +Heidie +Helaina +Helaine +Helen +Helen-Elizabeth +Helena +Helene +Helga +Helge +Helise +Hellene +Helli +Heloise +Helsa +Helyn +Hendrika +Henka +Henrie +Henrieta +Henrietta +Henriette +Henryetta +Hephzibah +Hermia +Hermina +Hermine +Herminia +Hermione +Herta +Hertha +Hester +Hesther +Hestia +Hetti +Hettie +Hetty +Hilarie +Hilary +Hilda +Hildagard +Hildagarde +Hilde +Hildegaard +Hildegarde +Hildy +Hillary +Hilliary +Hinda +Holley +Holli +Hollie +Holly +Holly-Anne +Hollyanne +Honey +Honor +Honoria +Hope +Horatia +Hortense +Hortensia +Hulda +Hyacinth +Hyacintha +Hyacinthe +Hyacinthia +Hyacinthie +Hynda +Ianthe +Ibbie +Ibby +Ida +Idalia +Idalina +Idaline +Idell +Idelle +Idette +Ike +Ikey +Ilana +Ileana +Ileane +Ilene +Ilise +Ilka +Illa +Ilona +Ilsa +Ilse +Ilysa +Ilyse +Ilyssa +Imelda +Imogen +Imogene +Imojean +Ina +Inci +Indira +Ines +Inesita +Inessa +Inez +Inga +Ingaberg +Ingaborg +Inge +Ingeberg +Ingeborg +Inger +Ingrid +Ingunna +Inna +Ioana +Iolande +Iolanthe +Iona +Iormina +Ira +Irena +Irene +Irina +Iris +Irita +Irma +Isa +Isabeau +Isabel +Isabelita +Isabella +Isabelle +Isador +Isadora +Isadore +Isahella +Iseabal +Isidora +Isis +Isobel +Issi +Issie +Issy +Ivett +Ivette +Ivie +Ivonne +Ivory +Ivy +Izabel +Izzi +Jacenta +Jacinda +Jacinta +Jacintha +Jacinthe +Jackelyn +Jacki +Jackie +Jacklin +Jacklyn +Jackquelin +Jackqueline +Jacky +Jaclin +Jaclyn +Jacquelin +Jacqueline +Jacquelyn +Jacquelynn +Jacquenetta +Jacquenette +Jacquetta +Jacquette +Jacqui +Jacquie +Jacynth +Jada +Jade +Jaime +Jaimie +Jaine +Jaleh +Jami +Jamie +Jamima +Jammie +Jan +Jana +Janaya +Janaye +Jandy +Jane +Janean +Janeczka +Janeen +Janel +Janela +Janella +Janelle +Janene +Janenna +Janessa +Janet +Janeta +Janetta +Janette +Janeva +Janey +Jania +Janice +Janie +Janifer +Janina +Janine +Janis +Janith +Janka +Janna +Jannel +Jannelle +Janot +Jany +Jaquelin +Jaquelyn +Jaquenetta +Jaquenette +Jaquith +Jasmin +Jasmina +Jasmine +Jayme +Jaymee +Jayne +Jaynell +Jazmin +Jean +Jeana +Jeane +Jeanelle +Jeanette +Jeanie +Jeanine +Jeanna +Jeanne +Jeannette +Jeannie +Jeannine +Jehanna +Jelene +Jemie +Jemima +Jemimah +Jemmie +Jemmy +Jen +Jena +Jenda +Jenelle +Jenette +Jeni +Jenica +Jeniece +Jenifer +Jeniffer +Jenilee +Jenine +Jenn +Jenna +Jennee +Jennette +Jenni +Jennica +Jennie +Jennifer +Jennilee +Jennine +Jenny +Jeraldine +Jeralee +Jere +Jeri +Jermaine +Jerrie +Jerrilee +Jerrilyn +Jerrine +Jerry +Jerrylee +Jess +Jessa +Jessalin +Jessalyn +Jessamine +Jessamyn +Jesse +Jesselyn +Jessi +Jessica +Jessie +Jessika +Jessy +Jewel +Jewell +Jewelle +Jill +Jillana +Jillane +Jillayne +Jilleen +Jillene +Jilli +Jillian +Jillie +Jilly +Jinny +Jo +Jo Ann +Jo-Ann +JoAnn +Jo-Anne +JoAnne +Joan +Joana +Joane +Joanie +Joann +Joanna +Joanne +Joannes +Jobey +Jobi +Jobie +Jobina +Joby +Jobye +Jobyna +Jocelin +Joceline +Jocelyn +Jocelyne +Jodee +Jodi +Jodie +Jody +Joela +Joelie +Joell +Joella +Joelle +Joellen +Joelly +Joellyn +Joelynn +Joete +Joey +Johanna +Johannah +Johnette +Johnna +Joice +Jojo +Jolee +Joleen +Jolene +Joletta +Joli +Jolie +Joline +Joly +Jolyn +Jolynn +Jonell +Joni +Jonie +Jonis +Jordain +Jordan +Jordana +Jordanna +Jorey +Jori +Jorie +Jorrie +Jorry +Joscelin +Josee +Josefa +Josefina +Joselyn +Josepha +Josephina +Josephine +Josey +Josi +Josie +Joslyn +Josselyn +Josy +Jourdan +Joy +Joya +Joyan +Joyann +Joyce +Joycelin +Joye +Joyous +Juana +Juanita +Jude +Judi +Judie +Judith +Juditha +Judy +Judye +Julee +Juli +Julia +Juliana +Juliane +Juliann +Julianna +Julianne +Julie +Julienne +Juliet +Julieta +Julietta +Juliette +Julina +Juline +Julissa +Julita +June +Junette +Junia +Junie +Junina +Justin +Justina +Justine +Jyoti +Kaari +Kacey +Kacie +Kacy +Kai +Kaia +Kaila +Kaile +Kailey +Kaitlin +Kaitlyn +Kaitlynn +Kaja +Kakalina +Kala +Kaleena +Kali +Kalie +Kalila +Kalina +Kalinda +Kalindi +Kalli +Kally +Kameko +Kamila +Kamilah +Kamillah +Kandace +Kandy +Kania +Kanya +Kara +Kara-Lynn +Karalee +Karalynn +Kare +Karee +Karel +Karen +Karena +Kari +Karia +Karie +Karil +Karilynn +Karin +Karina +Karine +Kariotta +Karisa +Karissa +Karita +Karla +Karlee +Karleen +Karlen +Karlene +Karlie +Karlotta +Karlotte +Karly +Karlyn +Karmen +Karna +Karol +Karola +Karole +Karolina +Karoline +Karoly +Karon +Karrah +Karrie +Karry +Kary +Karyl +Karylin +Karyn +Kasey +Kass +Kassandra +Kassey +Kassi +Kassia +Kassie +Kaster +Kat +Kata +Katalin +Kate +Katee +Katerina +Katerine +Katey +Kath +Katha +Katharina +Katharine +Katharyn +Kathe +Katheleen +Katherina +Katherine +Katheryn +Kathi +Kathie +Kathleen +Kathlene +Kathlin +Kathrine +Kathryn +Kathryne +Kathy +Kathye +Kati +Katie +Katina +Katine +Katinka +Katleen +Katlin +Katrina +Katrine +Katrinka +Katti +Kattie +Katuscha +Katusha +Katy +Katya +Kay +Kaycee +Kaye +Kayla +Kayle +Kaylee +Kayley +Kaylil +Kaylyn +Kee +Keeley +Keelia +Keely +Kelcey +Kelci +Kelcie +Kelcy +Kelila +Kellen +Kelley +Kelli +Kellia +Kellie +Kellina +Kellsie +Kelly +Kellyann +Kelsey +Kelsi +Kelsy +Kendra +Kendre +Kenna +Keren +Keri +Keriann +Kerianne +Kerri +Kerrie +Kerrill +Kerrin +Kerry +Kerstin +Kesley +Keslie +Kessia +Kessiah +Ketti +Kettie +Ketty +Kevina +Kevyn +Ki +Kia +Kiah +Kial +Kiele +Kiersten +Kikelia +Kiley +Kim +Kimberlee +Kimberley +Kimberli +Kimberly +Kimberlyn +Kimbra +Kimmi +Kimmie +Kimmy +Kinna +Kip +Kipp +Kippie +Kippy +Kira +Kirbee +Kirbie +Kirby +Kiri +Kirsten +Kirsteni +Kirsti +Kirstie +Kirstin +Kirstyn +Kissee +Kissiah +Kissie +Kit +Kitti +Kittie +Kitty +Kizzee +Kizzie +Klara +Klarika +Klarrisa +Konstance +Konstanze +Koo +Kora +Koral +Koralle +Kordula +Kore +Korella +Koren +Koressa +Kori +Korie +Korney +Korrie +Korry +Kourtney +Kris +Krissie +Krissy +Krista +Kristal +Kristan +Kriste +Kristel +Kristen +Kristi +Kristien +Kristin +Kristina +Kristine +Kristy +Kristyn +Krysta +Krystal +Krystalle +Krystle +Krystyna +Kyla +Kyle +Kylen +Kylie +Kylila +Kylynn +Kym +Kynthia +Kyrstin +La +Lacee +Lacey +Lacie +Lacy +Ladonna +Laetitia +Laila +Laina +Lainey +Lamb +Lana +Lane +Lanette +Laney +Lani +Lanie +Lanita +Lanna +Lanni +Lanny +Lara +Laraine +Lari +Larina +Larine +Larisa +Larissa +Lark +Laryssa +Latashia +Latia +Latisha +Latrena +Latrina +Laura +Lauraine +Laural +Lauralee +Laure +Lauree +Laureen +Laurel +Laurella +Lauren +Laurena +Laurene +Lauretta +Laurette +Lauri +Laurianne +Laurice +Laurie +Lauryn +Lavena +Laverna +Laverne +Lavina +Lavinia +Lavinie +Layla +Layne +Layney +Lea +Leah +Leandra +Leann +Leanna +Leanne +Leanor +Leanora +Lebbie +Leda +Lee +LeeAnn +Leeann +Leeanne +Leela +Leelah +Leena +Leesa +Leese +Legra +Leia +Leiah +Leigh +Leigha +Leila +Leilah +Leisha +Lela +Lelah +Leland +Lelia +Lena +Lenee +Lenette +Lenka +Lenna +Lenora +Lenore +Leodora +Leoine +Leola +Leoline +Leona +Leonanie +Leone +Leonelle +Leonie +Leonora +Leonore +Leontine +Leontyne +Leora +Leorah +Leshia +Lesley +Lesli +Leslie +Lesly +Lesya +Leta +Lethia +Leticia +Letisha +Letitia +Letta +Letti +Lettie +Letty +Leyla +Lezlie +Lia +Lian +Liana +Liane +Lianna +Lianne +Lib +Libbey +Libbi +Libbie +Libby +Licha +Lida +Lidia +Lil +Lila +Lilah +Lilas +Lilia +Lilian +Liliane +Lilias +Lilith +Lilla +Lilli +Lillian +Lillis +Lilllie +Lilly +Lily +Lilyan +Lin +Lina +Lind +Linda +Lindi +Lindie +Lindsay +Lindsey +Lindsy +Lindy +Linea +Linell +Linet +Linette +Linn +Linnea +Linnell +Linnet +Linnie +Linzy +Liora +Liorah +Lira +Lisa +Lisabeth +Lisandra +Lisbeth +Lise +Lisetta +Lisette +Lisha +Lishe +Lissa +Lissi +Lissie +Lissy +Lita +Liuka +Livia +Liz +Liza +Lizabeth +Lizbeth +Lizette +Lizzie +Lizzy +Loella +Lois +Loise +Lola +Lolande +Loleta +Lolita +Lolly +Lona +Lonee +Loni +Lonna +Lonni +Lonnie +Lora +Lorain +Loraine +Loralee +Loralie +Loralyn +Loree +Loreen +Lorelei +Lorelle +Loren +Lorena +Lorene +Lorenza +Loretta +Lorettalorna +Lorette +Lori +Loria +Lorianna +Lorianne +Lorie +Lorilee +Lorilyn +Lorinda +Lorine +Lorita +Lorna +Lorne +Lorraine +Lorrayne +Lorri +Lorrie +Lorrin +Lorry +Lory +Lotta +Lotte +Lotti +Lottie +Lotty +Lou +Louella +Louisa +Louise +Louisette +Love +Luana +Luanna +Luce +Luci +Lucia +Luciana +Lucie +Lucienne +Lucila +Lucilia +Lucille +Lucina +Lucinda +Lucine +Lucita +Lucky +Lucretia +Lucy +Luella +Luelle +Luisa +Luise +Lula +Lulita +Lulu +Luna +Lura +Lurette +Lurleen +Lurlene +Lurline +Lusa +Lust +Lyda +Lydia +Lydie +Lyn +Lynda +Lynde +Lyndel +Lyndell +Lyndsay +Lyndsey +Lyndsie +Lyndy +Lynea +Lynelle +Lynett +Lynette +Lynn +Lynna +Lynne +Lynnea +Lynnell +Lynnelle +Lynnet +Lynnett +Lynnette +Lynsey +Lysandra +Lyssa +Mab +Mabel +Mabelle +Mable +Mada +Madalena +Madalyn +Maddalena +Maddi +Maddie +Maddy +Madel +Madelaine +Madeleine +Madelena +Madelene +Madelin +Madelina +Madeline +Madella +Madelle +Madelon +Madelyn +Madge +Madlen +Madlin +Madona +Madonna +Mady +Mae +Maegan +Mag +Magda +Magdaia +Magdalen +Magdalena +Magdalene +Maggee +Maggi +Maggie +Maggy +Magna +Mahala +Mahalia +Maia +Maible +Maiga +Mair +Maire +Mairead +Maisey +Maisie +Mala +Malanie +Malcah +Malena +Malia +Malina +Malinda +Malinde +Malissa +Malissia +Malka +Malkah +Mallissa +Mallorie +Mallory +Malorie +Malory +Malva +Malvina +Malynda +Mame +Mamie +Manda +Mandi +Mandie +Mandy +Manon +Manya +Mara +Marabel +Marcela +Marcelia +Marcella +Marcelle +Marcellina +Marcelline +Marchelle +Marci +Marcia +Marcie +Marcile +Marcille +Marcy +Mareah +Maren +Marena +Maressa +Marga +Margalit +Margalo +Margaret +Margareta +Margarete +Margaretha +Margarethe +Margaretta +Margarette +Margarita +Margaux +Marge +Margeaux +Margery +Marget +Margette +Margi +Margie +Margit +Marglerite +Margo +Margot +Margret +Marguerite +Margurite +Margy +Mari +Maria +Mariam +Marian +Mariana +Mariann +Marianna +Marianne +Maribel +Maribelle +Maribeth +Marice +Maridel +Marie +Marie-Ann +Marie-Jeanne +Marieann +Mariejeanne +Mariel +Mariele +Marielle +Mariellen +Marietta +Mariette +Marigold +Marijo +Marika +Marilee +Marilin +Marillin +Marilyn +Marin +Marina +Marinna +Marion +Mariquilla +Maris +Marisa +Mariska +Marissa +Marit +Marita +Maritsa +Mariya +Marj +Marja +Marje +Marji +Marjie +Marjorie +Marjory +Marjy +Marketa +Marla +Marlane +Marleah +Marlee +Marleen +Marlena +Marlene +Marley +Marlie +Marline +Marlo +Marlyn +Marna +Marne +Marney +Marni +Marnia +Marnie +Marquita +Marrilee +Marris +Marrissa +Marry +Marsha +Marsiella +Marta +Martelle +Martguerita +Martha +Marthe +Marthena +Marti +Martica +Martie +Martina +Martita +Marty +Martynne +Mary +Marya +Maryangelyn +Maryann +Maryanna +Maryanne +Marybelle +Marybeth +Maryellen +Maryjane +Maryjo +Maryl +Marylee +Marylin +Marylinda +Marylou +Marylynne +Maryrose +Marys +Marysa +Masha +Matelda +Mathilda +Mathilde +Matilda +Matilde +Matti +Mattie +Matty +Maud +Maude +Maudie +Maura +Maure +Maureen +Maureene +Maurene +Maurine +Maurise +Maurita +Mavis +Mavra +Max +Maxi +Maxie +Maxine +Maxy +May +Maya +Maybelle +Mayda +Maye +Mead +Meade +Meagan +Meaghan +Meara +Mechelle +Meg +Megan +Megen +Meggan +Meggi +Meggie +Meggy +Meghan +Meghann +Mehetabel +Mei +Meira +Mel +Mela +Melamie +Melania +Melanie +Melantha +Melany +Melba +Melesa +Melessa +Melicent +Melina +Melinda +Melinde +Melisa +Melisande +Melisandra +Melisenda +Melisent +Melissa +Melisse +Melita +Melitta +Mella +Melli +Mellicent +Mellie +Mellisa +Mellisent +Mellissa +Melloney +Melly +Melodee +Melodie +Melody +Melonie +Melony +Melosa +Melva +Mercedes +Merci +Mercie +Mercy +Meredith +Meredithe +Meridel +Meridith +Meriel +Merilee +Merilyn +Meris +Merissa +Merl +Merla +Merle +Merlina +Merline +Merna +Merola +Merralee +Merridie +Merrie +Merrielle +Merrile +Merrilee +Merrili +Merrill +Merrily +Merry +Mersey +Meryl +Meta +Mia +Micaela +Michaela +Michaelina +Michaeline +Michaella +Michal +Michel +Michele +Michelina +Micheline +Michell +Michelle +Micki +Mickie +Micky +Midge +Mignon +Mignonne +Miguela +Miguelita +Mikako +Mildred +Mildrid +Milena +Milicent +Milissent +Milka +Milli +Millicent +Millie +Millisent +Milly +Milzie +Mimi +Min +Mina +Minda +Mindy +Minerva +Minetta +Minette +Minna +Minni +Minnie +Minny +Minta +Miquela +Mira +Mirabel +Mirabella +Mirabelle +Miran +Miranda +Mireielle +Mireille +Mirella +Mirelle +Miriam +Mirilla +Mirna +Misha +Missie +Missy +Misti +Misty +Mitra +Mitzi +Mmarianne +Modesta +Modestia +Modestine +Modesty +Moina +Moira +Moll +Mollee +Molli +Mollie +Molly +Mommy +Mona +Monah +Monica +Monika +Monique +Mora +Moreen +Morena +Morgan +Morgana +Morganica +Morganne +Morgen +Moria +Morissa +Morlee +Morna +Moselle +Moya +Moyna +Moyra +Mozelle +Muffin +Mufi +Mufinella +Muire +Mureil +Murial +Muriel +Murielle +Myna +Myra +Myrah +Myranda +Myriam +Myrilla +Myrle +Myrlene +Myrna +Myrta +Myrtia +Myrtice +Myrtie +Myrtle +Nada +Nadean +Nadeen +Nadia +Nadine +Nadiya +Nady +Nadya +Nalani +Nan +Nana +Nananne +Nance +Nancee +Nancey +Nanci +Nancie +Nancy +Nanete +Nanette +Nani +Nanice +Nanine +Nannette +Nanni +Nannie +Nanny +Nanon +Naoma +Naomi +Nara +Nari +Nariko +Nat +Nata +Natala +Natalee +Natalia +Natalie +Natalina +Nataline +Natalya +Natasha +Natassia +Nathalia +Nathalie +Natka +Natty +Neala +Neda +Nedda +Nedi +Neely +Neila +Neile +Neilla +Neille +Nela +Nelia +Nelie +Nell +Nelle +Nelli +Nellie +Nelly +Nena +Nerissa +Nerita +Nert +Nerta +Nerte +Nerti +Nertie +Nerty +Nessa +Nessi +Nessie +Nessy +Nesta +Netta +Netti +Nettie +Nettle +Netty +Nevsa +Neysa +Nichol +Nichole +Nicholle +Nicki +Nickie +Nicky +Nicol +Nicola +Nicole +Nicolea +Nicolette +Nicoli +Nicolina +Nicoline +Nicolle +Nidia +Nike +Niki +Nikki +Nikkie +Nikoletta +Nikolia +Nil +Nina +Ninetta +Ninette +Ninnetta +Ninnette +Ninon +Nisa +Nissa +Nisse +Nissie +Nissy +Nita +Nitin +Nixie +Noami +Noel +Noelani +Noell +Noella +Noelle +Noellyn +Noelyn +Noemi +Nola +Nolana +Nolie +Nollie +Nomi +Nona +Nonah +Noni +Nonie +Nonna +Nonnah +Nora +Norah +Norean +Noreen +Norene +Norina +Norine +Norma +Norri +Norrie +Norry +Nova +Novelia +Nydia +Nyssa +Octavia +Odele +Odelia +Odelinda +Odella +Odelle +Odessa +Odetta +Odette +Odilia +Odille +Ofelia +Ofella +Ofilia +Ola +Olenka +Olga +Olia +Olimpia +Olive +Olivette +Olivia +Olivie +Oliy +Ollie +Olly +Olva +Olwen +Olympe +Olympia +Olympie +Ondrea +Oneida +Onida +Onlea +Oona +Opal +Opalina +Opaline +Ophelia +Ophelie +Oprah +Ora +Oralee +Oralia +Oralie +Oralla +Oralle +Orel +Orelee +Orelia +Orelie +Orella +Orelle +Oreste +Oriana +Orly +Orsa +Orsola +Ortensia +Otha +Othelia +Othella +Othilia +Othilie +Ottilie +Pacifica +Page +Paige +Paloma +Pam +Pamela +Pamelina +Pamella +Pammi +Pammie +Pammy +Pandora +Pansie +Pansy +Paola +Paolina +Parwane +Pat +Patience +Patrica +Patrice +Patricia +Patrizia +Patsy +Patti +Pattie +Patty +Paula +Paula-Grace +Paule +Pauletta +Paulette +Pauli +Paulie +Paulina +Pauline +Paulita +Pauly +Pavia +Pavla +Pearl +Pearla +Pearle +Pearline +Peg +Pegeen +Peggi +Peggie +Peggy +Pen +Penelopa +Penelope +Penni +Pennie +Penny +Pepi +Pepita +Peri +Peria +Perl +Perla +Perle +Perri +Perrine +Perry +Persis +Pet +Peta +Petra +Petrina +Petronella +Petronia +Petronilla +Petronille +Petunia +Phaedra +Phaidra +Phebe +Phedra +Phelia +Phil +Philipa +Philippa +Philippe +Philippine +Philis +Phillida +Phillie +Phillis +Philly +Philomena +Phoebe +Phylis +Phyllida +Phyllis +Phyllys +Phylys +Pia +Pier +Pierette +Pierrette +Pietra +Piper +Pippa +Pippy +Polly +Pollyanna +Pooh +Poppy +Portia +Pris +Prisca +Priscella +Priscilla +Prissie +Pru +Prudence +Prudi +Prudy +Prue +Prunella +Queada +Queenie +Quentin +Querida +Quinn +Quinta +Quintana +Quintilla +Quintina +Rachael +Rachel +Rachele +Rachelle +Rae +Raf +Rafa +Rafaela +Rafaelia +Rafaelita +Ragnhild +Rahal +Rahel +Raina +Raine +Rakel +Ralina +Ramona +Ramonda +Rana +Randa +Randee +Randene +Randi +Randie +Randy +Ranee +Rani +Rania +Ranice +Ranique +Ranna +Raphaela +Raquel +Raquela +Rasia +Rasla +Raven +Ray +Raychel +Raye +Rayna +Raynell +Rayshell +Rea +Reba +Rebbecca +Rebe +Rebeca +Rebecca +Rebecka +Rebeka +Rebekah +Rebekkah +Ree +Reeba +Reena +Reeta +Reeva +Regan +Reggi +Reggie +Regina +Regine +Reiko +Reina +Reine +Remy +Rena +Renae +Renata +Renate +Rene +Renee +Renel +Renell +Renelle +Renie +Rennie +Reta +Retha +Revkah +Rey +Reyna +Rhea +Rheba +Rheta +Rhetta +Rhiamon +Rhianna +Rhianon +Rhoda +Rhodia +Rhodie +Rhody +Rhona +Rhonda +Riane +Riannon +Rianon +Rica +Ricca +Rici +Ricki +Rickie +Ricky +Riki +Rikki +Rina +Risa +Rissa +Rita +Riva +Rivalee +Rivi +Rivkah +Rivy +Roana +Roanna +Roanne +Robbi +Robbie +Robbin +Robby +Robbyn +Robena +Robenia +Roberta +Robin +Robina +Robinet +Robinett +Robinetta +Robinette +Robinia +Roby +Robyn +Roch +Rochell +Rochella +Rochelle +Rochette +Roda +Rodi +Rodie +Rodina +Romola +Romona +Romonda +Romy +Rona +Ronalda +Ronda +Ronica +Ronna +Ronni +Ronnica +Ronnie +Ronny +Roobbie +Rora +Rori +Rorie +Rory +Ros +Rosa +Rosabel +Rosabella +Rosabelle +Rosaleen +Rosalia +Rosalie +Rosalind +Rosalinda +Rosalinde +Rosaline +Rosalyn +Rosalynd +Rosamond +Rosamund +Rosana +Rosanna +Rosanne +Rosario +Rose +Roseann +Roseanna +Roseanne +Roselia +Roselin +Roseline +Rosella +Roselle +Roselyn +Rosemaria +Rosemarie +Rosemary +Rosemonde +Rosene +Rosetta +Rosette +Roshelle +Rosie +Rosina +Rosita +Roslyn +Rosmunda +Rosy +Row +Rowe +Rowena +Roxana +Roxane +Roxanna +Roxanne +Roxi +Roxie +Roxine +Roxy +Roz +Rozalie +Rozalin +Rozamond +Rozanna +Rozanne +Roze +Rozele +Rozella +Rozelle +Rozina +Rubetta +Rubi +Rubia +Rubie +Rubina +Ruby +Ruella +Ruperta +Ruth +Ruthann +Ruthanne +Ruthe +Ruthi +Ruthie +Ruthy +Ryann +Rycca +Saba +Sabina +Sabine +Sabra +Sabrina +Sacha +Sada +Sadella +Sadie +Sal +Sallee +Salli +Sallie +Sally +Sallyann +Sallyanne +Salome +Sam +Samantha +Samara +Samaria +Sammy +Samuela +Samuella +Sande +Sandi +Sandie +Sandra +Sandy +Sandye +Sapphira +Sapphire +Sara +Sara-Ann +Saraann +Sarah +Sarajane +Saree +Sarena +Sarene +Sarette +Sari +Sarina +Sarine +Sarita +Sascha +Sasha +Sashenka +Saudra +Saundra +Savina +Sayre +Scarlet +Scarlett +Scotty +Sean +Seana +Secunda +Seka +Sela +Selena +Selene +Selestina +Selia +Selie +Selina +Selinda +Seline +Sella +Selle +Selma +Sena +Sephira +Serena +Serene +Shaina +Shaine +Shalna +Shalne +Shamit +Shana +Shanda +Shandee +Shandie +Shandra +Shandy +Shane +Shani +Shanie +Shanna +Shannah +Shannen +Shannon +Shanon +Shanta +Shantee +Shara +Sharai +Shari +Sharia +Sharie +Sharity +Sharl +Sharla +Sharleen +Sharlene +Sharline +Sharna +Sharon +Sharona +Sharra +Sharron +Sharyl +Shaun +Shauna +Shawn +Shawna +Shawnee +Shay +Shayla +Shaylah +Shaylyn +Shaylynn +Shayna +Shayne +Shea +Sheba +Sheela +Sheelagh +Sheelah +Sheena +Sheeree +Sheila +Sheila-Kathryn +Sheilah +Sheilakathryn +Shel +Shela +Shelagh +Shelba +Shelbi +Shelby +Shelia +Shell +Shelley +Shelli +Shellie +Shelly +Shena +Sher +Sheree +Sheri +Sherie +Sheril +Sherill +Sherilyn +Sherline +Sherri +Sherrie +Sherry +Sherye +Sheryl +Shilpa +Shina +Shir +Shira +Shirah +Shirl +Shirlee +Shirleen +Shirlene +Shirley +Shirline +Shoshana +Shoshanna +Shoshie +Siana +Sianna +Sib +Sibbie +Sibby +Sibeal +Sibel +Sibella +Sibelle +Sibilla +Sibley +Sibyl +Sibylla +Sibylle +Sidoney +Sidonia +Sidonnie +Sigrid +Sile +Sileas +Silva +Silvana +Silvia +Silvie +Simona +Simone +Simonette +Simonne +Sindee +Sinead +Siobhan +Sioux +Siouxie +Sisely +Sisile +Sissie +Sissy +Sofia +Sofie +Solange +Sondra +Sonia +Sonja +Sonni +Sonnie +Sonnnie +Sonny +Sonya +Sophey +Sophi +Sophia +Sophie +Sophronia +Sorcha +Sosanna +Stace +Stacee +Stacey +Staci +Stacia +Stacie +Stacy +Stafani +Star +Starla +Starlene +Starlin +Starr +Stefa +Stefania +Stefanie +Steffane +Steffi +Steffie +Stella +Stepha +Stephana +Stephani +Stephanie +Stephannie +Stephenie +Stephi +Stephie +Stephine +Stesha +Stevana +Stevena +Stoddard +Storey +Storm +Stormi +Stormie +Stormy +Sue +Sue-elle +Suellen +Sukey +Suki +Sula +Sunny +Sunshine +Susan +Susana +Susanetta +Susann +Susanna +Susannah +Susanne +Susette +Susi +Susie +Sussi +Susy +Suzan +Suzann +Suzanna +Suzanne +Suzetta +Suzette +Suzi +Suzie +Suzy +Suzzy +Sybil +Sybila +Sybilla +Sybille +Sybyl +Sydel +Sydelle +Sydney +Sylvia +Sylvie +Tabatha +Tabbatha +Tabbi +Tabbie +Tabbitha +Tabby +Tabina +Tabitha +Taffy +Talia +Tallia +Tallie +Tally +Talya +Talyah +Tamar +Tamara +Tamarah +Tamarra +Tamera +Tami +Tamiko +Tamma +Tammara +Tammi +Tammie +Tammy +Tamra +Tana +Tandi +Tandie +Tandy +Tani +Tania +Tansy +Tanya +Tara +Tarah +Tarra +Tarrah +Taryn +Tasha +Tasia +Tate +Tatiana +Tatiania +Tatum +Tawnya +Tawsha +Teane +Ted +Tedda +Teddi +Teddie +Teddy +Tedi +Tedra +Teena +Tella +Teodora +Tera +Teresa +TeresaAnne +Terese +Teresina +Teresita +Teressa +Teri +Teriann +Terina +Terra +Terri +Terri-Jo +Terrianne +Terrie +Terry +Terrye +Tersina +Teryl +Terza +Tess +Tessa +Tessi +Tessie +Tessy +Thalia +Thea +Theada +Theadora +Theda +Thekla +Thelma +Theo +Theodora +Theodosia +Theresa +Theresa-Marie +Therese +Theresina +Theresita +Theressa +Therine +Thia +Thomasa +Thomasin +Thomasina +Thomasine +Tia +Tiana +Tiena +Tierney +Tiertza +Tiff +Tiffani +Tiffanie +Tiffany +Tiffi +Tiffie +Tiffy +Tilda +Tildi +Tildie +Tildy +Tillie +Tilly +Tim +Timi +Timmi +Timmie +Timmy +Timothea +Tina +Tine +Tiphani +Tiphanie +Tiphany +Tish +Tisha +Tobe +Tobey +Tobi +Tobie +Toby +Tobye +Toinette +Toma +Tomasina +Tomasine +Tomi +Tomiko +Tommi +Tommie +Tommy +Toni +Tonia +Tonie +Tony +Tonya +Tootsie +Torey +Tori +Torie +Torrie +Tory +Tova +Tove +Trace +Tracee +Tracey +Traci +Tracie +Tracy +Trenna +Tresa +Trescha +Tressa +Tricia +Trina +Trish +Trisha +Trista +Trix +Trixi +Trixie +Trixy +Truda +Trude +Trudey +Trudi +Trudie +Trudy +Trula +Tuesday +Twila +Twyla +Tybi +Tybie +Tyne +Ula +Ulla +Ulrica +Ulrika +Ulrike +Umeko +Una +Ursa +Ursala +Ursola +Ursula +Ursulina +Ursuline +Uta +Val +Valaree +Valaria +Vale +Valeda +Valencia +Valene +Valenka +Valentia +Valentina +Valentine +Valera +Valeria +Valerie +Valery +Valerye +Valida +Valina +Valli +Vallie +Vally +Valma +Valry +Van +Vanda +Vanessa +Vania +Vanna +Vanni +Vannie +Vanny +Vanya +Veda +Velma +Velvet +Vena +Venita +Ventura +Venus +Vera +Veradis +Vere +Verena +Verene +Veriee +Verile +Verina +Verine +Verla +Verna +Vernice +Veronica +Veronika +Veronike +Veronique +Vi +Vicki +Vickie +Vicky +Victoria +Vida +Viki +Vikki +Vikkie +Vikky +Vilhelmina +Vilma +Vin +Vina +Vinita +Vinni +Vinnie +Vinny +Viola +Violante +Viole +Violet +Violetta +Violette +Virgie +Virgina +Virginia +Virginie +Vita +Vitia +Vitoria +Vittoria +Viv +Viva +Vivi +Vivia +Vivian +Viviana +Vivianna +Vivianne +Vivie +Vivien +Viviene +Vivienne +Viviyan +Vivyan +Vivyanne +Vonni +Vonnie +Vonny +Wallie +Wallis +Wally +Waly +Wanda +Wandie +Wandis +Waneta +Wenda +Wendeline +Wendi +Wendie +Wendy +Wenona +Wenonah +Whitney +Wileen +Wilhelmina +Wilhelmine +Wilie +Willa +Willabella +Willamina +Willetta +Willette +Willi +Willie +Willow +Willy +Willyt +Wilma +Wilmette +Wilona +Wilone +Wilow +Windy +Wini +Winifred +Winna +Winnah +Winne +Winni +Winnie +Winnifred +Winny +Winona +Winonah +Wren +Wrennie +Wylma +Wynn +Wynne +Wynnie +Wynny +Xaviera +Xena +Xenia +Xylia +Xylina +Yalonda +Yehudit +Yelena +Yetta +Yettie +Yetty +Yevette +Yoko +Yolanda +Yolande +Yolane +Yolanthe +Yonina +Yoshi +Yoshiko +Yovonnda +Yvette +Yvonne +Zabrina +Zahara +Zandra +Zaneta +Zara +Zarah +Zaria +Zarla +Zea +Zelda +Zelma +Zena +Zenia +Zia +Zilvia +Zita +Zitella +Zoe +Zola +Zonda +Zondra +Zonnya +Zora +Zorah +Zorana +Zorina +Zorine +Zsa Zsa +Zsazsa +Zulema +Zuzana diff --git a/exercises/02450Toolbox_R/Data/iris.csv b/exercises/02450Toolbox_R/Data/iris.csv new file mode 100644 index 0000000000000000000000000000000000000000..f984b2bf7779ea99e49697b02ae92f533c448ba6 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/iris.csv @@ -0,0 +1,151 @@ +"Sepal Length","Sepal Width","Petal Length","Petal Width","Type" +5.1,3.5,1.4,0.2,"Iris-setosa" +4.9,3,1.4,0.2,"Iris-setosa" +4.7,3.2,1.3,0.2,"Iris-setosa" +4.6,3.1,1.5,0.2,"Iris-setosa" +5,3.6,1.4,0.2,"Iris-setosa" +5.4,3.9,1.7,0.4,"Iris-setosa" +4.6,3.4,1.4,0.3,"Iris-setosa" +5,3.4,1.5,0.2,"Iris-setosa" +4.4,2.9,1.4,0.2,"Iris-setosa" +4.9,3.1,1.5,0.1,"Iris-setosa" +5.4,3.7,1.5,0.2,"Iris-setosa" +4.8,3.4,1.6,0.2,"Iris-setosa" +4.8,3,1.4,0.1,"Iris-setosa" +4.3,3,1.1,0.1,"Iris-setosa" +5.8,4,1.2,0.2,"Iris-setosa" +5.7,4.4,1.5,0.4,"Iris-setosa" +5.4,3.9,1.3,0.4,"Iris-setosa" +5.1,3.5,1.4,0.3,"Iris-setosa" +5.7,3.8,1.7,0.3,"Iris-setosa" +5.1,3.8,1.5,0.3,"Iris-setosa" +5.4,3.4,1.7,0.2,"Iris-setosa" +5.1,3.7,1.5,0.4,"Iris-setosa" +4.6,3.6,1,0.2,"Iris-setosa" +5.1,3.3,1.7,0.5,"Iris-setosa" +4.8,3.4,1.9,0.2,"Iris-setosa" +5,3,1.6,0.2,"Iris-setosa" +5,3.4,1.6,0.4,"Iris-setosa" +5.2,3.5,1.5,0.2,"Iris-setosa" +5.2,3.4,1.4,0.2,"Iris-setosa" +4.7,3.2,1.6,0.2,"Iris-setosa" +4.8,3.1,1.6,0.2,"Iris-setosa" +5.4,3.4,1.5,0.4,"Iris-setosa" +5.2,4.1,1.5,0.1,"Iris-setosa" +5.5,4.2,1.4,0.2,"Iris-setosa" +4.9,3.1,1.5,0.1,"Iris-setosa" +5,3.2,1.2,0.2,"Iris-setosa" +5.5,3.5,1.3,0.2,"Iris-setosa" +4.9,3.1,1.5,0.1,"Iris-setosa" +4.4,3,1.3,0.2,"Iris-setosa" +5.1,3.4,1.5,0.2,"Iris-setosa" +5,3.5,1.3,0.3,"Iris-setosa" +4.5,2.3,1.3,0.3,"Iris-setosa" +4.4,3.2,1.3,0.2,"Iris-setosa" +5,3.5,1.6,0.6,"Iris-setosa" +5.1,3.8,1.9,0.4,"Iris-setosa" +4.8,3,1.4,0.3,"Iris-setosa" +5.1,3.8,1.6,0.2,"Iris-setosa" +4.6,3.2,1.4,0.2,"Iris-setosa" +5.3,3.7,1.5,0.2,"Iris-setosa" +5,3.3,1.4,0.2,"Iris-setosa" +7,3.2,4.7,1.4,"Iris-versicolor" +6.4,3.2,4.5,1.5,"Iris-versicolor" +6.9,3.1,4.9,1.5,"Iris-versicolor" +5.5,2.3,4,1.3,"Iris-versicolor" +6.5,2.8,4.6,1.5,"Iris-versicolor" +5.7,2.8,4.5,1.3,"Iris-versicolor" +6.3,3.3,4.7,1.6,"Iris-versicolor" +4.9,2.4,3.3,1,"Iris-versicolor" +6.6,2.9,4.6,1.3,"Iris-versicolor" +5.2,2.7,3.9,1.4,"Iris-versicolor" +5,2,3.5,1,"Iris-versicolor" +5.9,3,4.2,1.5,"Iris-versicolor" +6,2.2,4,1,"Iris-versicolor" +6.1,2.9,4.7,1.4,"Iris-versicolor" +5.6,2.9,3.6,1.3,"Iris-versicolor" +6.7,3.1,4.4,1.4,"Iris-versicolor" +5.6,3,4.5,1.5,"Iris-versicolor" +5.8,2.7,4.1,1,"Iris-versicolor" +6.2,2.2,4.5,1.5,"Iris-versicolor" +5.6,2.5,3.9,1.1,"Iris-versicolor" +5.9,3.2,4.8,1.8,"Iris-versicolor" +6.1,2.8,4,1.3,"Iris-versicolor" +6.3,2.5,4.9,1.5,"Iris-versicolor" +6.1,2.8,4.7,1.2,"Iris-versicolor" +6.4,2.9,4.3,1.3,"Iris-versicolor" +6.6,3,4.4,1.4,"Iris-versicolor" +6.8,2.8,4.8,1.4,"Iris-versicolor" +6.7,3,5,1.7,"Iris-versicolor" +6,2.9,4.5,1.5,"Iris-versicolor" +5.7,2.6,3.5,1,"Iris-versicolor" +5.5,2.4,3.8,1.1,"Iris-versicolor" +5.5,2.4,3.7,1,"Iris-versicolor" +5.8,2.7,3.9,1.2,"Iris-versicolor" +6,2.7,5.1,1.6,"Iris-versicolor" +5.4,3,4.5,1.5,"Iris-versicolor" +6,3.4,4.5,1.6,"Iris-versicolor" +6.7,3.1,4.7,1.5,"Iris-versicolor" +6.3,2.3,4.4,1.3,"Iris-versicolor" +5.6,3,4.1,1.3,"Iris-versicolor" +5.5,2.5,4,1.3,"Iris-versicolor" +5.5,2.6,4.4,1.2,"Iris-versicolor" +6.1,3,4.6,1.4,"Iris-versicolor" +5.8,2.6,4,1.2,"Iris-versicolor" +5,2.3,3.3,1,"Iris-versicolor" +5.6,2.7,4.2,1.3,"Iris-versicolor" +5.7,3,4.2,1.2,"Iris-versicolor" +5.7,2.9,4.2,1.3,"Iris-versicolor" +6.2,2.9,4.3,1.3,"Iris-versicolor" +5.1,2.5,3,1.1,"Iris-versicolor" +5.7,2.8,4.1,1.3,"Iris-versicolor" +6.3,3.3,6,2.5,"Iris-virginica" +5.8,2.7,5.1,1.9,"Iris-virginica" +7.1,3,5.9,2.1,"Iris-virginica" +6.3,2.9,5.6,1.8,"Iris-virginica" +6.5,3,5.8,2.2,"Iris-virginica" +7.6,3,6.6,2.1,"Iris-virginica" +4.9,2.5,4.5,1.7,"Iris-virginica" +7.3,2.9,6.3,1.8,"Iris-virginica" +6.7,2.5,5.8,1.8,"Iris-virginica" +7.2,3.6,6.1,2.5,"Iris-virginica" +6.5,3.2,5.1,2,"Iris-virginica" +6.4,2.7,5.3,1.9,"Iris-virginica" +6.8,3,5.5,2.1,"Iris-virginica" +5.7,2.5,5,2,"Iris-virginica" +5.8,2.8,5.1,2.4,"Iris-virginica" +6.4,3.2,5.3,2.3,"Iris-virginica" +6.5,3,5.5,1.8,"Iris-virginica" +7.7,3.8,6.7,2.2,"Iris-virginica" +7.7,2.6,6.9,2.3,"Iris-virginica" +6,2.2,5,1.5,"Iris-virginica" +6.9,3.2,5.7,2.3,"Iris-virginica" +5.6,2.8,4.9,2,"Iris-virginica" +7.7,2.8,6.7,2,"Iris-virginica" +6.3,2.7,4.9,1.8,"Iris-virginica" +6.7,3.3,5.7,2.1,"Iris-virginica" +7.2,3.2,6,1.8,"Iris-virginica" +6.2,2.8,4.8,1.8,"Iris-virginica" +6.1,3,4.9,1.8,"Iris-virginica" +6.4,2.8,5.6,2.1,"Iris-virginica" +7.2,3,5.8,1.6,"Iris-virginica" +7.4,2.8,6.1,1.9,"Iris-virginica" +7.9,3.8,6.4,2,"Iris-virginica" +6.4,2.8,5.6,2.2,"Iris-virginica" +6.3,2.8,5.1,1.5,"Iris-virginica" +6.1,2.6,5.6,1.4,"Iris-virginica" +7.7,3,6.1,2.3,"Iris-virginica" +6.3,3.4,5.6,2.4,"Iris-virginica" +6.4,3.1,5.5,1.8,"Iris-virginica" +6,3,4.8,1.8,"Iris-virginica" +6.9,3.1,5.4,2.1,"Iris-virginica" +6.7,3.1,5.6,2.4,"Iris-virginica" +6.9,3.1,5.1,2.3,"Iris-virginica" +5.8,2.7,5.1,1.9,"Iris-virginica" +6.8,3.2,5.9,2.3,"Iris-virginica" +6.7,3.3,5.7,2.5,"Iris-virginica" +6.7,3,5.2,2.3,"Iris-virginica" +6.3,2.5,5,1.9,"Iris-virginica" +6.5,3,5.2,2,"Iris-virginica" +6.2,3.4,5.4,2.3,"Iris-virginica" +5.9,3,5.1,1.8,"Iris-virginica" diff --git a/exercises/02450Toolbox_R/Data/iris.mat b/exercises/02450Toolbox_R/Data/iris.mat new file mode 100644 index 0000000000000000000000000000000000000000..df9348acff144a45cf7a7dd899395741201c3829 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/iris.mat differ diff --git a/exercises/02450Toolbox_R/Data/iris.xls b/exercises/02450Toolbox_R/Data/iris.xls new file mode 100644 index 0000000000000000000000000000000000000000..def1175c3c5070f783efc02dad640dd2f0e98d63 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/iris.xls differ diff --git a/exercises/02450Toolbox_R/Data/male.txt b/exercises/02450Toolbox_R/Data/male.txt new file mode 100644 index 0000000000000000000000000000000000000000..bacce977f4f80fe6df231891486daa62acaeded5 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/male.txt @@ -0,0 +1,2943 @@ +Aamir +Aaron +Abbey +Abbie +Abbot +Abbott +Abby +Abdel +Abdul +Abdulkarim +Abdullah +Abe +Abel +Abelard +Abner +Abraham +Abram +Ace +Adair +Adam +Adams +Addie +Adger +Aditya +Adlai +Adnan +Adolf +Adolfo +Adolph +Adolphe +Adolpho +Adolphus +Adrian +Adrick +Adrien +Agamemnon +Aguinaldo +Aguste +Agustin +Aharon +Ahmad +Ahmed +Ahmet +Ajai +Ajay +Al +Alaa +Alain +Alan +Alasdair +Alastair +Albatros +Albert +Alberto +Albrecht +Alden +Aldis +Aldo +Aldric +Aldrich +Aldus +Aldwin +Alec +Aleck +Alejandro +Aleks +Aleksandrs +Alessandro +Alex +Alexander +Alexei +Alexis +Alf +Alfie +Alfonse +Alfonso +Alfonzo +Alford +Alfred +Alfredo +Algernon +Ali +Alic +Alister +Alix +Allah +Allan +Allen +Alley +Allie +Allin +Allyn +Alonso +Alonzo +Aloysius +Alphonse +Alphonso +Alston +Alton +Alvin +Alwin +Amadeus +Ambros +Ambrose +Ambrosi +Ambrosio +Ambrosius +Amery +Amory +Amos +Anatol +Anatole +Anatollo +Anatoly +Anders +Andie +Andonis +Andre +Andrea +Andreas +Andrej +Andres +Andrew +Andrey +Andri +Andros +Andrus +Andrzej +Andy +Angel +Angelico +Angelo +Angie +Angus +Ansel +Ansell +Anselm +Anson +Anthony +Antin +Antoine +Anton +Antone +Antoni +Antonin +Antonino +Antonio +Antonius +Antony +Anurag +Apollo +Apostolos +Aram +Archibald +Archibold +Archie +Archon +Archy +Arel +Ari +Arie +Ariel +Aristotle +Arlo +Armand +Armando +Armond +Armstrong +Arne +Arnie +Arnold +Arnoldo +Aron +Arron +Art +Arther +Arthur +Artie +Artur +Arturo +Arvie +Arvin +Arvind +Arvy +Ash +Ashby +Ashish +Ashley +Ashton +Aub +Aube +Aubert +Aubrey +Augie +August +Augustin +Augustine +Augusto +Augustus +Austen +Austin +Ave +Averell +Averil +Averill +Avery +Avi +Avraham +Avram +Avrom +Axel +Aylmer +Aziz +Bailey +Bailie +Baillie +Baily +Baird +Baldwin +Bancroft +Barbabas +Barclay +Bard +Barde +Barn +Barnabas +Barnabe +Barnaby +Barnard +Barnebas +Barnett +Barney +Barnie +Barny +Baron +Barr +Barret +Barrett +Barri +Barrie +Barris +Barron +Barry +Bart +Bartel +Barth +Barthel +Bartholemy +Bartholomeo +Bartholomeus +Bartholomew +Bartie +Bartlet +Bartlett +Bartolemo +Bartolomei +Bartolomeo +Barton +Barty +Bary +Basil +Batholomew +Baxter +Bay +Bayard +Beale +Bealle +Bear +Bearnard +Beau +Beaufort +Beauregard +Beck +Bela +Ben +Benedict +Bengt +Benito +Benjamen +Benjamin +Benji +Benjie +Benjy +Benn +Bennet +Bennett +Bennie +Benny +Benson +Bentley +Benton +Beowulf +Berchtold +Berk +Berke +Berkeley +Berkie +Berkley +Bernard +Bernardo +Bernd +Bernhard +Bernie +Bert +Bertie +Bertram +Bertrand +Bharat +Biff +Bill +Billie +Billy +Bing +Binky +Bishop +Bjorn +Bjorne +Blaine +Blair +Blake +Blare +Blayne +Bo +Bob +Bobbie +Bobby +Bogart +Bogdan +Boniface +Boris +Boyce +Boyd +Brad +Braden +Bradford +Bradley +Bradly +Brady +Brandon +Brandy +Brant +Brendan +Brent +Bret +Brett +Brewer +Brewster +Brian +Brice +Briggs +Brinkley +Britt +Brock +Broddie +Broddy +Broderic +Broderick +Brodie +Brody +Bronson +Brook +Brooke +Brooks +Bruce +Bruno +Bryan +Bryant +Bryce +Bryn +Bryon +Bubba +Buck +Bucky +Bud +Buddy +Burgess +Burke +Burl +Burnaby +Burt +Burton +Buster +Butch +Butler +Byram +Byron +Caesar +Cain +Cal +Caldwell +Caleb +Calhoun +Calvin +Cam +Cameron +Cammy +Carey +Carl +Carleigh +Carlie +Carlin +Carlo +Carlos +Carlton +Carlyle +Carmine +Carroll +Carson +Carsten +Carter +Cary +Caryl +Case +Casey +Caspar +Casper +Cass +Cat +Cecil +Cesar +Chad +Chadd +Chaddie +Chaddy +Chadwick +Chaim +Chalmers +Chan +Chance +Chancey +Chanderjit +Chandler +Chane +Chariot +Charles +Charleton +Charley +Charlie +Charlton +Chas +Chase +Chaunce +Chauncey +Che +Chelton +Chen +Chester +Cheston +Chet +Chev +Chevalier +Chevy +Chip +Chris +Chrissy +Christ +Christian +Christiano +Christie +Christof +Christofer +Christoph +Christophe +Christopher +Christorpher +Christos +Christy +Chrisy +Chuck +Churchill +Clair +Claire +Clancy +Clarance +Clare +Clarence +Clark +Clarke +Claude +Claudio +Claudius +Claus +Clay +Clayborn +Clayborne +Claybourne +Clayton +Cleland +Clem +Clemens +Clement +Clemente +Clemmie +Cletus +Cleveland +Cliff +Clifford +Clifton +Clint +Clinten +Clinton +Clive +Clyde +Cob +Cobb +Cobbie +Cobby +Cody +Colbert +Cole +Coleman +Colin +Collin +Collins +Conan +Connie +Connolly +Connor +Conrad +Conroy +Constantin +Constantine +Constantinos +Conway +Cooper +Corbin +Corby +Corey +Corky +Cornelius +Cornellis +Corrie +Cortese +Corwin +Cory +Cosmo +Costa +Courtney +Craig +Crawford +Creighton +Cris +Cristopher +Curt +Curtice +Curtis +Cy +Cyril +Cyrill +Cyrille +Cyrillus +Cyrus +Dabney +Daffy +Dale +Dallas +Dalton +Damian +Damien +Damon +Dan +Dana +Dane +Dani +Danie +Daniel +Dannie +Danny +Dante +Darby +Darcy +Daren +Darian +Darien +Darin +Dario +Darius +Darrel +Darrell +Darren +Darrick +Darrin +Darryl +Darth +Darwin +Daryl +Daryle +Dave +Davey +David +Davidde +Davide +Davidson +Davie +Davin +Davis +Davon +Davoud +Davy +Dawson +Dean +Deane +Del +Delbert +Dell +Delmar +Demetre +Demetri +Demetris +Demetrius +Demosthenis +Denis +Dennie +Dennis +Denny +Derby +Derek +Derick +Derk +Derrek +Derrick +Derrin +Derrol +Derron +Deryl +Desmond +Desmund +Devin +Devon +Dewey +Dewitt +Dexter +Dick +Dickey +Dickie +Diego +Dieter +Dietrich +Dillon +Dimitri +Dimitrios +Dimitris +Dimitrou +Dimitry +Dino +Dion +Dionis +Dionysus +Dirk +Dmitri +Dom +Domenic +Domenico +Dominic +Dominick +Dominique +Don +Donal +Donald +Donn +Donnie +Donny +Donovan +Dorian +Dory +Doug +Douggie +Dougie +Douglas +Douglass +Douglis +Dov +Doyle +Drake +Drew +Dru +Dryke +Duane +Dudley +Duffie +Duffy +Dugan +Duke +Dunc +Duncan +Dunstan +Durand +Durant +Durante +Durward +Dustin +Dwain +Dwaine +Dwane +Dwayne +Dwight +Dylan +Dyson +Earl +Earle +Easton +Eben +Ebeneser +Ebenezer +Eberhard +Ed +Eddie +Eddy +Edgar +Edgardo +Edie +Edmond +Edmund +Edouard +Edsel +Eduard +Eduardo +Edward +Edwin +Efram +Egbert +Ehud +Elbert +Elden +Eldon +Eli +Elias +Elihu +Elijah +Eliot +Eliott +Elisha +Elliot +Elliott +Ellis +Ellsworth +Ellwood +Elmer +Elmore +Elnar +Elric +Elroy +Elton +Elvin +Elvis +Elwin +Elwood +Elwyn +Ely +Emanuel +Emerson +Emery +Emil +Emile +Emilio +Emmanuel +Emmery +Emmet +Emmett +Emmit +Emmott +Emmy +Emory +Ender +Engelbart +Engelbert +Englebart +Englebert +Enoch +Enrico +Enrique +Ephraim +Ephram +Ephrayim +Ephrem +Er +Erasmus +Erastus +Erek +Erhard +Erhart +Eric +Erich +Erick +Erik +Erin +Erl +Ernest +Ernesto +Ernie +Ernst +Erny +Errol +Ervin +Erwin +Esau +Esme +Esteban +Ethan +Ethelbert +Ethelred +Etienne +Euclid +Eugen +Eugene +Eustace +Ev +Evan +Evelyn +Everard +Everett +Ewan +Ewart +Ez +Ezechiel +Ezekiel +Ezra +Fabian +Fabio +Fairfax +Farley +Fazeel +Federico +Felice +Felicio +Felipe +Felix +Ferd +Ferdie +Ferdinand +Ferdy +Fergus +Ferguson +Ferinand +Fernando +Fidel +Filbert +Filip +Filipe +Filmore +Finley +Finn +Fitz +Fitzgerald +Flem +Fleming +Flemming +Fletch +Fletcher +Flin +Flinn +Flint +Flipper +Florian +Floyd +Flynn +Fons +Fonsie +Fonz +Fonzie +Forbes +Ford +Forest +Forester +Forrest +Forrester +Forster +Foster +Fowler +Fox +Fran +Francesco +Francis +Francisco +Francois +Frank +Frankie +Franklin +Franklyn +Franky +Frans +Franz +Fraser +Frazier +Fred +Freddie +Freddy +Frederic +Frederich +Frederick +Frederico +Frederik +Fredric +Fredrick +Freeman +Freemon +Fremont +French +Friedric +Friedrich +Friedrick +Fritz +Fulton +Fyodor +Gabe +Gabriel +Gabriele +Gabriell +Gabriello +Gail +Gale +Galen +Gallagher +Gamaliel +Garcia +Garcon +Gardener +Gardiner +Gardner +Garey +Garfield +Garfinkel +Garold +Garp +Garret +Garrett +Garrot +Garrott +Garry +Garth +Garv +Garvey +Garvin +Garvy +Garwin +Garwood +Gary +Gaspar +Gasper +Gaston +Gav +Gaven +Gavin +Gavriel +Gay +Gayle +Gearard +Gene +Geo +Geof +Geoff +Geoffrey +Geoffry +Georg +George +Georges +Georgia +Georgie +Georgy +Gerald +Geraldo +Gerard +Gere +Gerhard +Gerhardt +Geri +Germaine +Gerold +Gerome +Gerrard +Gerri +Gerrit +Gerry +Gershom +Gershon +Giacomo +Gian +Giancarlo +Giavani +Gibb +Gideon +Giff +Giffard +Giffer +Giffie +Gifford +Giffy +Gil +Gilbert +Gilberto +Gilburt +Giles +Gill +Gilles +Ginger +Gino +Giordano +Giorgi +Giorgio +Giovanne +Giovanni +Giraldo +Giraud +Giuseppe +Glen +Glenn +Glynn +Godard +Godart +Goddard +Goddart +Godfree +Godfrey +Godfry +Godwin +Gomer +Gonzales +Gonzalo +Goober +Goose +Gordan +Gordie +Gordon +Grace +Grady +Graehme +Graeme +Graham +Graig +Grant +Granville +Greg +Gregg +Greggory +Gregor +Gregorio +Gregory +Gretchen +Griff +Griffin +Griffith +Griswold +Grove +Grover +Guido +Guillaume +Guillermo +Gunner +Gunter +Gunther +Gus +Gustaf +Gustav +Gustave +Gustavo +Gustavus +Guthrey +Guthrie +Guthry +Guy +Hadleigh +Hadley +Hadrian +Hagan +Hagen +Hailey +Hakeem +Hakim +Hal +Hale +Haleigh +Haley +Hall +Hallam +Halvard +Ham +Hamel +Hamid +Hamil +Hamilton +Hamish +Hamlen +Hamlet +Hamlin +Hammad +Hamnet +Han +Hanan +Hanford +Hank +Hannibal +Hans +Hans-Peter +Hansel +Hanson +Harald +Harcourt +Hari +Harlan +Harland +Harley +Harlin +Harman +Harmon +Harold +Harris +Harrison +Harrold +Harry +Hart +Hartley +Hartwell +Harv +Harvard +Harvey +Harvie +Harwell +Hasheem +Hashim +Haskel +Haskell +Hassan +Hastings +Hasty +Haven +Hayden +Haydon +Hayes +Hayward +Haywood +Hazel +Heath +Heathcliff +Hebert +Hector +Heinrich +Heinz +Helmuth +Henderson +Hendrick +Hendrik +Henri +Henrie +Henrik +Henrique +Henry +Herb +Herbert +Herbie +Herby +Hercule +Hercules +Herculie +Herman +Hermann +Hermon +Hermy +Hernando +Herold +Herrick +Herrmann +Hersch +Herschel +Hersh +Hershel +Herve +Hervey +Hew +Hewe +Hewet +Hewett +Hewie +Hewitt +Heywood +Hezekiah +Higgins +Hilary +Hilbert +Hill +Hillard +Hillary +Hillel +Hillery +Hilliard +Hilton +Hiralal +Hiram +Hiro +Hirsch +Hobart +Hodge +Hogan +Hollis +Holly +Homer +Horace +Horacio +Horatio +Horatius +Horst +Howard +Howie +Hoyt +Hubert +Hudson +Huey +Hugh +Hugo +Humbert +Humphrey +Hunt +Hunter +Huntington +Huntlee +Huntley +Hurley +Husain +Husein +Hussein +Hy +Hyatt +Hyman +Hymie +Iago +Iain +Ian +Ibrahim +Ichabod +Iggie +Iggy +Ignace +Ignacio +Ignacius +Ignatius +Ignaz +Ignazio +Igor +Ike +Ikey +Immanuel +Ingamar +Ingelbert +Ingemar +Inglebert +Ingmar +Ingram +Inigo +Ira +Irvin +Irvine +Irving +Irwin +Isa +Isaac +Isaak +Isador +Isadore +Isaiah +Ishmael +Isidore +Ismail +Israel +Istvan +Ivan +Ivor +Izaak +Izak +Izzy +Jabez +Jack +Jackie +Jackson +Jacob +Jacques +Jae +Jaime +Jake +Jakob +James +Jameson +Jamey +Jamie +Jan +Janos +Janus +Jared +Jarrett +Jarvis +Jason +Jasper +Javier +Jay +Jean +Jean-Christophe +Jean-Francois +Jean-Lou +Jean-Luc +Jean-Marc +Jean-Paul +Jean-Pierre +Jeb +Jed +Jedediah +Jef +Jeff +Jefferey +Jefferson +Jeffery +Jeffie +Jeffrey +Jeffry +Jefry +Jehu +Jennings +Jens +Jephthah +Jerald +Jeramie +Jere +Jereme +Jeremiah +Jeremias +Jeremie +Jeremy +Jermain +Jermaine +Jermayne +Jerold +Jerome +Jeromy +Jerri +Jerrie +Jerrold +Jerrome +Jerry +Jervis +Jerzy +Jess +Jesse +Jessee +Jessey +Jessie +Jesus +Jeth +Jethro +Jim +Jimbo +Jimmie +Jimmy +Jo +Joab +Joachim +Joao +Joaquin +Job +Jock +Jodi +Jodie +Jody +Joe +Joel +Joey +Johan +Johann +Johannes +John +John-David +John-Patrick +Johnathan +Johnathon +Johnnie +Johnny +Johny +Jon +Jonah +Jonas +Jonathan +Jonathon +Jonny +Jordan +Jordon +Jordy +Jorge +Jory +Jose +Josef +Joseph +Josephus +Josh +Joshua +Joshuah +Josiah +Jotham +Juan +Juanita +Jud +Judah +Judas +Judd +Jude +Judith +Judson +Judy +Juergen +Jule +Jules +Julian +Julie +Julio +Julius +Justin +Justis +Kaiser +Kaleb +Kalil +Kalle +Kalman +Kalvin +Kam +Kane +Kareem +Karel +Karim +Karl +Karsten +Kaspar +Keefe +Keenan +Keene +Keil +Keith +Kellen +Kelley +Kelly +Kelsey +Kelvin +Kelwin +Ken +Kendal +Kendall +Kendrick +Kenn +Kennedy +Kenneth +Kenny +Kent +Kenton +Kenyon +Kermie +Kermit +Kerry +Kevan +Kevin +Kim +Kimball +Kimmo +Kin +Kincaid +King +Kingsley +Kingsly +Kingston +Kip +Kirby +Kirk +Kit +Klaus +Klee +Knox +Konrad +Konstantin +Kory +Kostas +Kraig +Kris +Krishna +Kristian +Kristopher +Kristos +Kurt +Kurtis +Kyle +Laird +Lamar +Lambert +Lamont +Lance +Lancelot +Lane +Langston +Lanny +Larry +Lars +Laurance +Lauren +Laurence +Laurens +Laurent +Laurie +Lawerence +Lawrence +Lawson +Lawton +Lay +Layton +Lazar +Lazare +Lazaro +Lazarus +Lazlo +Lee +Lefty +Leif +Leigh +Leighton +Leland +Lem +Lemar +Lemmie +Lemmy +Lemuel +Len +Lenard +Lennie +Lenny +Leo +Leon +Leonard +Leonardo +Leonerd +Leonhard +Leonid +Leonidas +Leopold +Leroy +Les +Lesley +Leslie +Lester +Lev +Levi +Levin +Levon +Levy +Lew +Lewis +Lex +Liam +Lin +Lincoln +Lind +Lindsay +Lindsey +Lindy +Linoel +Linus +Lion +Lionel +Lionello +Llewellyn +Lloyd +Locke +Lockwood +Logan +Lon +Lonnie +Lonny +Loren +Lorenzo +Lorne +Lorrie +Lothar +Lou +Louie +Louis +Lovell +Lowell +Lucas +Luce +Lucian +Luciano +Lucien +Lucio +Lucius +Ludvig +Ludwig +Luigi +Luis +Lukas +Luke +Luther +Lyle +Lyn +Lyndon +Lynn +Mac +Mace +Mack +Mackenzie +Maddie +Maddy +Madison +Magnum +Magnus +Mahesh +Mahmoud +Mahmud +Maison +Major +Malcolm +Manfred +Manish +Manny +Manuel +Marc +Marcel +Marcello +Marcellus +Marcelo +Marchall +Marcio +Marco +Marcos +Marcus +Marietta +Marilu +Mario +Marion +Marius +Mark +Marko +Markos +Markus +Marlin +Marlo +Marlon +Marlow +Marlowe +Marmaduke +Marsh +Marshal +Marshall +Mart +Martainn +Marten +Martie +Martin +Martino +Marty +Martyn +Marv +Marve +Marven +Marvin +Marwin +Mason +Mateo +Mathew +Mathias +Matias +Matt +Matteo +Matthaeus +Mattheus +Matthew +Matthias +Matthieu +Matthiew +Matthus +Mattias +Mattie +Matty +Maurice +Mauricio +Maurie +Maurise +Maurits +Mauritz +Maury +Max +Maxfield +Maxie +Maxim +Maximilian +Maximilien +Maxwell +Mayer +Maynard +Maynord +Mayor +Mead +Meade +Meier +Meir +Mel +Melvin +Melvyn +Menard +Mendel +Mendie +Meredeth +Meredith +Merell +Merill +Merle +Merlin +Merrel +Merrick +Merril +Merrill +Merry +Merv +Mervin +Merwin +Meryl +Meyer +Mic +Micah +Michael +Michail +Michal +Michale +Micheal +Micheil +Michel +Michele +Mick +Mickey +Mickie +Micky +Miguel +Mika +Mikael +Mike +Mikel +Mikey +Mikhail +Miles +Millicent +Milo +Milt +Milton +Mischa +Mitch +Mitchael +Mitchel +Mitchell +Moe +Mohamad +Mohamed +Mohammad +Mohammed +Mohan +Moise +Moises +Moishe +Monroe +Montague +Monte +Montgomery +Monty +Moore +Mordecai +Morgan +Morlee +Morley +Morly +Morrie +Morris +Morry +Morse +Mort +Morten +Mortie +Mortimer +Morton +Morty +Mose +Moses +Moshe +Moss +Muffin +Mugsy +Muhammad +Munmro +Munroe +Murdoch +Murdock +Murphy +Murray +Mustafa +Myke +Myles +Mylo +Myron +Nahum +Napoleon +Nat +Natale +Nate +Nathan +Nathanael +Nathanial +Nathaniel +Nathanil +Neal +Neale +Neall +Nealon +Nealson +Nealy +Ned +Neddie +Neddy +Neel +Neil +Nels +Nelsen +Nelson +Nero +Neron +Nester +Nestor +Nev +Nevil +Nevile +Neville +Nevin +Nevins +Newton +Niall +Niccolo +Nicholas +Nichole +Nichols +Nick +Nickey +Nickie +Nickolas +Nicky +Nico +Nicolas +Niels +Nigel +Niki +Nikita +Nikki +Nikolai +Nikos +Niles +Nils +Nilson +Niven +Noach +Noah +Noam +Noble +Noe +Noel +Nolan +Noland +Norbert +Norm +Norman +Normand +Normie +Norris +Northrop +Northrup +Norton +Norwood +Nunzio +Obadiah +Obadias +Oberon +Obie +Octavius +Odell +Odie +Odin +Odysseus +Olaf +Olag +Ole +Oleg +Olin +Oliver +Olivier +Olle +Ollie +Omar +Oral +Oran +Orazio +Orbadiah +Oren +Orin +Orion +Orlando +Orren +Orrin +Orson +Orton +Orville +Osbert +Osborn +Osborne +Osbourn +Osbourne +Oscar +Osgood +Osmond +Osmund +Ossie +Oswald +Oswell +Otes +Othello +Otho +Otis +Otto +Owen +Ozzie +Ozzy +Pablo +Pace +Paco +Paddie +Paddy +Padraig +Page +Paige +Pail +Palmer +Paolo +Park +Parke +Parker +Parnell +Parrnell +Parry +Parsifal +Partha +Pascal +Pascale +Pasquale +Pat +Pate +Patel +Paten +Patin +Paton +Patric +Patrice +Patricio +Patrick +Patrik +Patsy +Pattie +Patty +Paul +Paulo +Pavel +Pearce +Pedro +Peirce +Pembroke +Pen +Penn +Pennie +Penny +Penrod +Pepe +Pepillo +Pepito +Perceval +Percival +Percy +Perry +Pete +Peter +Petey +Petr +Peyter +Peyton +Phil +Philbert +Philip +Phillip +Phillipe +Phillipp +Phineas +Phip +Pierce +Pierre +Pierson +Piet +Pieter +Pietro +Piggy +Pincas +Pinchas +Pincus +Piotr +Pip +Plato +Pooh +Porter +Poul +Powell +Praneetf +Prasad +Prasun +Prent +Prentice +Prentiss +Prescott +Preston +Price +Prince +Pryce +Puff +Purcell +Putnam +Pyotr +Quent +Quentin +Quiggly +Quigly +Quigman +Quill +Quillan +Quincey +Quincy +Quinlan +Quinn +Quint +Quintin +Quinton +Quintus +Rab +Rabbi +Rabi +Rad +Radcliffe +Rafael +Rafe +Ragnar +Rahul +Raimund +Rainer +Raj +Rajeev +Raleigh +Ralf +Ralph +Ram +Ramesh +Ramon +Ramsay +Ramsey +Rand +Randal +Randall +Randell +Randi +Randie +Randolf +Randolph +Randy +Ransell +Ransom +Raoul +Raphael +Raul +Ravi +Ravil +Rawley +Ray +Raymond +Raymund +Raymundo +Raynard +Rayner +Raynor +Reagan +Red +Redford +Redmond +Reece +Reed +Rees +Reese +Reg +Regan +Regen +Reggie +Reggis +Reggy +Reginald +Reginauld +Reid +Reilly +Reinhard +Reinhold +Rem +Remington +Remus +Renado +Renaldo +Renard +Renato +Renaud +Renault +Rene +Reube +Reuben +Reuven +Rex +Rey +Reynard +Reynold +Reynolds +Reza +Rhett +Ric +Ricard +Ricardo +Riccardo +Rice +Rich +Richard +Richardo +Richie +Richmond +Richy +Rick +Rickard +Rickey +Ricki +Rickie +Ricky +Rik +Rikki +Riley +Rinaldo +Ripley +Ritch +Ritchie +Roarke +Rob +Robb +Robbert +Robbie +Robert +Roberto +Robin +Robinson +Rochester +Rock +Rockwell +Rocky +Rod +Rodd +Roddie +Roddy +Roderic +Roderich +Roderick +Roderigo +Rodge +Rodger +Rodney +Rodolfo +Rodolph +Rodolphe +Rodrick +Rodrigo +Rodrique +Rog +Roger +Rogers +Roice +Roland +Rolando +Rolf +Rolfe +Rolland +Rollin +Rollins +Rollo +Rolph +Romain +Roman +Romeo +Ron +Ronald +Ronen +Roni +Ronnie +Ronny +Roosevelt +Rory +Roscoe +Ross +Roth +Rourke +Rowland +Roy +Royal +Royce +Rube +Ruben +Rubin +Ruby +Rudd +Ruddie +Ruddy +Rudie +Rudiger +Rudolf +Rudolfo +Rudolph +Rudy +Rudyard +Rufe +Rufus +Rupert +Ruperto +Russ +Russel +Russell +Rustie +Rustin +Rusty +Rutger +Rutherford +Rutledge +Rutter +Ryan +Sal +Salem +Salim +Salman +Salmon +Salomo +Salomon +Salomone +Salvador +Salvatore +Salvidor +Sam +Sammie +Sammy +Sampson +Samson +Samuel +Samuele +Sancho +Sander +Sanders +Sanderson +Sandor +Sandro +Sandy +Sanford +Sanson +Sansone +Sarge +Sargent +Sascha +Sasha +Saul +Sauncho +Saunder +Saunders +Saunderson +Saundra +Saw +Sawyer +Sawyere +Sax +Saxe +Saxon +Say +Sayer +Sayers +Sayre +Sayres +Scarface +Schroeder +Schuyler +Scot +Scott +Scotti +Scottie +Scotty +Seamus +Sean +Sebastian +Sebastiano +Sebastien +See +Selby +Selig +Serge +Sergeant +Sergei +Sergent +Sergio +Seth +Seymour +Shadow +Shaine +Shalom +Shamus +Shanan +Shane +Shannan +Shannon +Shaughn +Shaun +Shaw +Shawn +Shay +Shayne +Shea +Sheff +Sheffie +Sheffield +Sheffy +Shelby +Shelden +Sheldon +Shell +Shelley +Shelton +Shem +Shep +Shepard +Shepherd +Sheppard +Shepperd +Sheridan +Sherlock +Sherlocke +Sherman +Sherwin +Sherwood +Sherwynd +Shimon +Shlomo +Sholom +Shorty +Shumeet +Shurlock +Shurlocke +Shurwood +Si +Sibyl +Sid +Siddhartha +Sidnee +Sidney +Siegfried +Siffre +Sig +Sigfrid +Sigfried +Sigmund +Silas +Silvain +Silvan +Silvano +Silvanus +Silvester +Silvio +Sim +Simeon +Simmonds +Simon +Simone +Sinclair +Sinclare +Sivert +Siward +Skell +Skelly +Skip +Skipp +Skipper +Skippie +Skippy +Skipton +Sky +Skye +Skylar +Skyler +Slade +Slim +Sloan +Sloane +Sly +Smith +Smitty +Socrates +Sol +Sollie +Solly +Solomon +Somerset +Son +Sonnie +Sonny +Sparky +Spence +Spencer +Spense +Spenser +Spike +Spiro +Spiros +Spud +Srinivas +Stacy +Staffard +Stafford +Staford +Stan +Standford +Stanfield +Stanford +Stanislaw +Stanleigh +Stanley +Stanly +Stanton +Stanwood +Stavros +Stearn +Stearne +Stefan +Stefano +Steffen +Stephan +Stephanus +Stephen +Sterling +Stern +Sterne +Steve +Steven +Stevie +Stevy +Stew +Steward +Stewart +Stig +Stillman +Stillmann +Sting +Stinky +Stirling +Stu +Stuart +Sturgis +Sullivan +Sully +Sumner +Sunny +Sutherland +Sutton +Sven +Swen +Syd +Sydney +Sylvan +Sylvester +Tab +Tabb +Tabbie +Tabby +Taber +Tabor +Tad +Tadd +Taddeo +Taddeus +Tadeas +Tailor +Tait +Taite +Talbert +Talbot +Tallie +Tally +Tam +Tamas +Tammie +Tammy +Tan +Tann +Tanner +Tanney +Tannie +Tanny +Tarrance +Tarrant +Tarzan +Tate +Taylor +Teador +Ted +Tedd +Teddie +Teddy +Tedie +Tedman +Tedmund +Tedrick +Temp +Temple +Templeton +Teodoor +Teodor +Teodorico +Teodoro +Terence +Terencio +Terrance +Terrel +Terrell +Terrence +Terri +Terrill +Terry +Thacher +Thad +Thaddeus +Thaddius +Thaddus +Thadeus +Thain +Thaine +Thane +Tharen +Thatch +Thatcher +Thaxter +Thayne +Thebault +Thedric +Thedrick +Theo +Theobald +Theodor +Theodore +Theodoric +Theophyllus +Thibaud +Thibaut +Thom +Thomas +Thor +Thorn +Thorndike +Thornie +Thornton +Thorny +Thorpe +Thorstein +Thorsten +Thorvald +Thurstan +Thurston +Tibold +Tiebold +Tiebout +Tiler +Tim +Timmie +Timmy +Timothee +Timotheus +Timothy +Tirrell +Tito +Titos +Titus +Tobe +Tobiah +Tobias +Tobie +Tobin +Tobit +Toby +Tod +Todd +Toddie +Toddy +Tom +Tomas +Tome +Tomkin +Tomlin +Tommie +Tommy +Tonnie +Tony +Tore +Torey +Torin +Torr +Torrance +Torre +Torrence +Torrey +Torrin +Torry +Town +Towney +Townie +Townsend +Towny +Trace +Tracey +Tracie +Tracy +Traver +Travers +Travis +Tray +Tre +Tremain +Tremaine +Tremayne +Trent +Trenton +Trev +Trevar +Trever +Trevor +Trey +Trip +Tristan +Troy +Truman +Tuck +Tucker +Tuckie +Tucky +Tudor +Tull +Tulley +Tully +Turner +Ty +Tybalt +Tye +Tyler +Tymon +Tymothy +Tynan +Tyrone +Tyrus +Tyson +Udale +Udall +Udell +Ugo +Ulberto +Uli +Ulick +Ulises +Ulric +Ulrich +Ulrick +Ulysses +Umberto +Upton +Urbain +Urban +Urbano +Urbanus +Uri +Uriah +Uriel +Urson +Vachel +Vaclav +Vail +Val +Valdemar +Vale +Valentin +Valentine +Van +Vance +Vasili +Vasilis +Vasily +Vassili +Vassily +Vaughan +Vaughn +Venkat +Verge +Vergil +Vern +Verne +Vernen +Verney +Vernon +Vernor +Vibhu +Vic +Vick +Victor +Vijay +Vilhelm +Vin +Vince +Vincent +Vincents +Vinnie +Vinny +Vinod +Virge +Virgie +Virgil +Virgilio +Vite +Vito +Vlad +Vladamir +Vladimir +Voltaire +Von +Wade +Wadsworth +Wain +Waine +Wainwright +Wait +Waite +Waiter +Wake +Wakefield +Wald +Waldemar +Walden +Waldo +Waldon +Waleed +Walker +Wallace +Wallache +Wallas +Wallie +Wallis +Wally +Walsh +Walt +Walter +Walther +Walton +Wang +Ward +Warde +Warden +Ware +Waring +Warner +Warren +Wash +Washington +Wat +Waverley +Waverly +Way +Waylan +Wayland +Waylen +Waylin +Waylon +Wayne +Web +Webb +Weber +Webster +Weidar +Weider +Welbie +Welby +Welch +Wells +Welsh +Wendall +Wendel +Wendell +Werner +Wes +Wesley +Weslie +West +Westbrook +Westbrooke +Westleigh +Westley +Weston +Weylin +Wheeler +Whit +Whitaker +Whitby +Whitman +Whitney +Whittaker +Wiatt +Wilber +Wilbert +Wilbur +Wilburn +Wilburt +Wilden +Wildon +Wilek +Wiley +Wilfred +Wilfrid +Wilhelm +Will +Willard +Willdon +Willem +Willey +Willi +William +Willie +Willis +Willmott +Willy +Wilmar +Wilmer +Wilson +Wilt +Wilton +Win +Windham +Winfield +Winford +Winfred +Winifield +Winn +Winnie +Winny +Winslow +Winston +Winthrop +Winton +Wit +Witold +Wittie +Witty +Wojciech +Wolf +Wolfgang +Wolfie +Wolfram +Wolfy +Woochang +Wood +Woodie +Woodman +Woodrow +Woody +Worden +Worth +Worthington +Worthy +Wright +Wyatan +Wyatt +Wye +Wylie +Wyn +Wyndham +Wynn +Wynton +Xavier +Xenos +Xerxes +Xever +Ximenes +Ximenez +Xymenes +Yaakov +Yacov +Yale +Yanaton +Yance +Yancey +Yancy +Yank +Yankee +Yard +Yardley +Yehudi +Yigal +Yule +Yuri +Yves +Zach +Zacharia +Zachariah +Zacharias +Zacharie +Zachary +Zacherie +Zachery +Zack +Zackariah +Zak +Zalman +Zane +Zared +Zary +Zeb +Zebadiah +Zebedee +Zebulen +Zebulon +Zechariah +Zed +Zedekiah +Zeke +Zelig +Zerk +Zeus +Zippy +Zollie +Zolly +Zorro diff --git a/exercises/02450Toolbox_R/Data/messy_data/README.txt b/exercises/02450Toolbox_R/Data/messy_data/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..c5e842207f409b4e9e16496eaaf9ff590964932c --- /dev/null +++ b/exercises/02450Toolbox_R/Data/messy_data/README.txt @@ -0,0 +1,70 @@ +*************************************************************************** +*************************************************************************** +*** messy_data *** +*************************************************************************** +*************************************************************************** +This dataset is an adaption of an existing dataset to highlight some common +issues (or variants of them) that one might face across various datasets. +This is not real data, but is based on values from the Auto-Mpg Data. +The original data was obtained from: + https://archive.ics.uci.edu/ml/datasets/auto+mpg +but was modified to include some formatting issues as well as removing some +values. +Missing values in the original dataset were sometimes denoted +with a question mark. Some missing values were introduced, too. +Specifically zeroes in the attributes mpg and displacement can be +considered missing values. + +For reference, the description of the original dataset is provided below. + +*************************************************************************** +*************************************************************************** +*** Original dataset description *** +*************************************************************************** +*************************************************************************** +1. Title: Auto-Mpg Data + +2. Sources: + (a) Origin: This dataset was taken from the StatLib library which is + maintained at Carnegie Mellon University. The dataset was + used in the 1983 American Statistical Association Exposition. + (c) Date: July 7, 1993 + +3. Past Usage: + - See 2b (above) + - Quinlan,R. (1993). Combining Instance-Based and Model-Based Learning. + In Proceedings on the Tenth International Conference of Machine + Learning, 236-243, University of Massachusetts, Amherst. Morgan + Kaufmann. + +4. Relevant Information: + + This dataset is a slightly modified version of the dataset provided in + the StatLib library. In line with the use by Ross Quinlan (1993) in + predicting the attribute "mpg", 8 of the original instances were removed + because they had unknown values for the "mpg" attribute. The original + dataset is available in the file "auto-mpg.data-original". + + "The data concerns city-cycle fuel consumption in miles per gallon, + to be predicted in terms of 3 multivalued discrete and 5 continuous + attributes." (Quinlan, 1993) + +5. Number of Instances: 398 + +6. Number of Attributes: 9 including the class attribute + +7. Attribute Information: + + 1. mpg: continuous + 2. cylinders: multi-valued discrete + 3. displacement: continuous + 4. horsepower: continuous + 5. weight: continuous + 6. acceleration: continuous + 7. model year: multi-valued discrete + 8. origin: multi-valued discrete + 9. car name: string (unique for each instance) + +8. Missing Attribute Values: horsepower has 6 missing values + + diff --git a/exercises/02450Toolbox_R/Data/messy_data/messy_data.data b/exercises/02450Toolbox_R/Data/messy_data/messy_data.data new file mode 100644 index 0000000000000000000000000000000000000000..f62d8f48d5f6682e03b68e209c73ce99b0b4bf13 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/messy_data/messy_data.data @@ -0,0 +1,33 @@ +messy_data +mpg cylinders displacement horsepower weight acceleration modelyear origin carname +mpg cyl disp hp w acc yr org name +18 8 ? 130 3'504 12.0 70 1 chevrolet chevelle malibu +15 8 350 165 3'693 11,5 70 1 buick skylark 320 +18 8 ? 150 3'436 11.0 70 1 plymouth satellite +16 8 ? 150 3'433 12.0 70 1 amc rebel sst +17 8 0 140 3'449 10,5 70 1 ford torino +15 8 429 198 4'341 10.0 70 1 ford galaxie 500 +14 8 454 220 4'354 9.0 70 1 chevrolet impala +14 8 ? 215 4312 8,5 70 1 plymouth fury iii +14 8 455 225 4425 10.0 70 1 pontiac catalina +15 8 390 190 3'850 8,5 70 1 amc ambassador dpl +15 8 0 170 3'563 10.0 70 1 dodge challenger se +14 8 ? 160 3'609 8.0 70 1 plymouth 'cuda 340 +99 8 ? 150 3'761 9,5 70 1 chevrolet monte carlo +14 8 ? 225 3'086 10.0 70 1 buick estate wagon (sw) +24 4 113 95 2'372 15.0 70 3 toyota corona mark ii +22 6 95 2'833 15,5 70 1 plymouth duster +0 6 199 97 2'774 15,5 70 1 amc hornet +21 6 ? 85 2'587 16.0 70 1 ford maverick +27 4 97 88 2'130 14,5 70 3 datsun pl510 +26 4 46 1'835 20,5 70 2 volkswagen 1131 deluxe sedan +33 4 105 74 2190 14.2 81 2 volkswagen jetta +33.7 4 107 75 2210 14.4 81 3 honda prelude +32.4 4 108 75 2350 16.8 81 3 toyota corolla +32.9 4 119 100 2615 14.8 81 3 datsun 200sx +31.6 4 120 74 2635 18.3 81 3 mazda 626 +28.1 4 141 80 3'230 20.4 81 2 peugeot 505s turbo diesel +30.7 6 145 76 3'160 19.6 81 2 volvo diesel +0 6 168 116 2'900 12.6 81 3 toyota cressida +24.2 6 146 120 2'930 13.8 81 3 datsun 810 maxima + diff --git a/exercises/02450Toolbox_R/Data/nanonose.csv b/exercises/02450Toolbox_R/Data/nanonose.csv new file mode 100644 index 0000000000000000000000000000000000000000..f6200a759b2d3e898817a1ce2f7a37a219e6d543 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/nanonose.csv @@ -0,0 +1,11 @@ +,"Sample type","Water","Water","Water","Water","Water","Water","Water","Water","Water","Water","Water","Water","Water","Water","Water","Water","Water","Water","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Ethanol","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Acetone","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Heptane","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol","Pentanol" +,"Concentration",9200,9200,9200,4600,4600,4600,2300,2300,2300,1150,1150,1150,575,575,575,288,288,288,28800,28800,28800,14400,14400,14400,7200,7200,7200,3600,3600,3600,1800,1800,1800,900,900,900,72800,72800,72800,36400,36400,36400,18200,18200,18200,8500,8500,8500,4250,4250,4250,2125,2125,2125,20100,20100,20100,10050,10050,10050,5025,5025,5025,2512,2512,2512,1526,1526,1526,628,628,628,1400,1400,1400,600,600,600,300,300,300,416,416,416,192,192,192,103,103,103 +"Nanonose",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +"A",,95.5,94.5,92,53,51,50,27.5,27.5,27,13.5,13,13.25,4.5,4,3.7,1.5,1.5,1.5,23,23.5,22,12.5,12.5,12,6,6,7.5,5,5.5,5.25,0.5,1,1,0,0,0,15.5,14,16,6,7,7,3,3,4,2,1.75,1.5,0,1,1,0,0,0,8.5,8.5,3,2.5,1,2.5,0.5,0.75,1.5,1,1.5,1,0.5,0.5,0.5,0,0,0,3.2,2.7,2.2,1.85,1.3,2,1.1,0.8,0.7,0.4,0.4,0.4,0.2,0.2,0.2,0.0,0.0,0.0 +"B",,21,17,16,7.5,7.5,8,4,4.5,4,1.5,2,2.5,0.8,0.8,0.5,0,0,0,51,61,63.5,50.5,51,50,33.5,32,31.5,23.5,24,23.75,11.8,12.3,11.4,5.5,5.7,5.5,84.5,110,128,91,87.5,80,68,63,64,49,51.5,47.5,29,27,26,14,13,14,8.5,8.5,4,5.5,-0.5,0.5,0.5,1.25,1.5,0.5,1,0,0,0,0,0,0,0,16,16.5,14.4,6.05,6.2,6,3.45,3.4,3.85,7.9,5.6,5.4,1.7,3.1,2.5,1.3,1.1,1.7 +"C",,6,5,3,2.5,2.5,2.5,1.5,1.5,1.5,0,0.5,0.25,0,0,0,0,0,0,25,30.2,30.5,20,20.5,18,12.5,11.5,11.5,8.2,9,8.6,3.5,3.3,3.5,1.5,1.5,1.8,42.5,44,51,33,30,30,21,20,20,13,15.5,13,8,8,8,4,4,4,12.5,12.5,13,9.5,8,9.5,5.5,5.75,6,4,4.5,3.8,2,2,2,0.5,1,1.5,20.5,20.2,20.4,14.5,14.2,13.7,9.8,9.3,9.6,18.5,15.8,15.0,8.6,9.1,8.7,5.6,4.9,6.4 +"D",,11.9,5.5,11.1,3.5,4.9,4.0,2.2,2.2,3.1,1.8,2.7,2.7,0.4,0.9,1.3,0.0,0.0,0.0,96,129,149,60,52,50,26,28,25,10.7,10.7,10.7,3.4,3.4,3.2,1.7,1.7,2.3,235.5,191.0,141.3,89.4,114.5,116.3,66.6,83.5,85.4,36.1,36.1,36.1,16.7,23.3,15.0,8.7,8.7,8.7,16,13.25,10.5,8,7,10,7,7,7,3,3,2,0,0,0,0,0,0,-3,-3,-3,-1.5,-1.5,-1.5,-0.75,-1,-1,-0.5,-0.5,-0.5,-0.25,-0.25,-0.25,0,0,0 +"E",,64.1,63.2,62.6,35.2,34.1,33.6,18.4,17.3,17.5,9.7,10.6,8.8,2.4,3.7,3.8,1.1,1.3,1.5,142.5,142,140.5,94.5,93.5,89.5,65.5,63,61,38.0,37.7,38.5,22.8,23.1,22.8,12.1,12.4,12.7,122.9,117.8,110.5,77.8,78.3,72.0,53.0,59.1,55.8,33.5,34.1,33.6,17.3,17.9,17.3,7.8,8.2,7.4,1.5,2,2,1.5,1.25,1.25,1.75,1.5,1.75,1,1,1,0.5,0.5,0,0,0,0,9.75,7,6.625,3.125,3.125,3.25,1.75,1.75,1.875,2.65,1.625,2.3,1.3,1.3,1.125,0.65,0.8,0.8 +"F",,21.50,19.66,19.81,6.88,6.76,6.77,2.80,2.63,2.65,1.11,1.08,0.42,0.65,0.41,0.33,0.13,-0.06,0.35,69.5,65.6,64.3,30.2,30.5,28.3,13.8,14.0,14.1,6.0,6.2,5.5,2.8,2.5,2.6,0.9,1.5,1.2,74.3,70.5,69.7,31.8,31.5,31.5,14.8,15.4,15.6,6.0,6.1,5.9,2.3,2.4,2.5,0.6,0.8,1.1,8.66,7.16,7.93,3.80,3.54,3.63,1.46,1.86,1.72,0.52,0.56,0.45,0.09,0.16,0.28,0.10,0.15,0.07,67.9,62.3,62.1,45.0,44.2,44.2,20.8,21.5,21.9,28.9,29.8,30.4,5.8,4.8,5.1,1.8,2.3,1.9 +"G",,5.57,4.97,5.19,1.64,1.61,1.78,0.56,0.85,0.62,0.50,0.45,0.12,0.53,0.35,0.25,0.14,0.05,0.55,39.0,39.3,39.4,31.7,31.5,30.9,22.0,22.2,21.8,14.9,14.6,13.8,10.1,9.9,9.9,5.7,5.9,5.7,55.1,53.9,54.1,40.8,40.5,40.4,29.3,29.6,29.2,17.3,17.5,17.2,12.0,11.9,11.9,6.5,6.9,6.6,14.79,13.48,13.26,7.34,7.11,7.06,3.39,4.07,3.86,1.74,1.62,1.72,0.85,0.91,1.03,0.08,0.36,0.37,36.6,29.4,29.4,38.0,37.7,37.9,30.0,30.9,30.1,41.6,42.9,41.7,14.2,11.2,12.0,6.7,7.0,7.1 +"H",,1.17,1.88,0.56,0.14,0.06,0.08,0.03,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,35.4,35.5,36.2,18.2,18.2,18.3,10.0,10.3,9.6,5.6,4.6,5.2,3.3,3.4,3.4,1.7,1.5,1.9,201.3,207.8,206.7,88.6,90.0,90.3,44.3,43.9,44.1,20.3,18.9,18.0,9.6,8.7,8.9,3.9,3.8,4.2,100.55,86.57,116.00,11.95,12.57,11.84,1.74,2.81,3.03,1.41,1.48,1.30,0.65,0.55,0.69,0.30,0.33,0.28,33.1,30.3,25.1,5.4,6.1,6.3,0.0,0.0,0.0,2.1,4.6,1.8,0.0,0.0,0.0,0.0,0.0,0.0 diff --git a/exercises/02450Toolbox_R/Data/nanonose.xls b/exercises/02450Toolbox_R/Data/nanonose.xls new file mode 100644 index 0000000000000000000000000000000000000000..19eff1adcb0d473f904d6f562bf94e57dcff0d17 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/nanonose.xls differ diff --git a/exercises/02450Toolbox_R/Data/readme_male_female_data.txt b/exercises/02450Toolbox_R/Data/readme_male_female_data.txt new file mode 100644 index 0000000000000000000000000000000000000000..19518acc6c787f993164f4e4254069f90c1cd637 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/readme_male_female_data.txt @@ -0,0 +1,12 @@ +You may use the lists of names for any purpose, so long as credit is given +in any published work. You may also redistribute the list if you +provide the recipients with a copy of this README file. The lists are +not in the public domain (I retain the copyright on the lists) but are +freely redistributable. + +If you have any additions to the lists of names, I would appreciate +receiving them. + +My email address is mkant+@cs.cmu.edu. + +Mark Kantrowitz diff --git a/exercises/02450Toolbox_R/Data/stopWords.txt b/exercises/02450Toolbox_R/Data/stopWords.txt new file mode 100644 index 0000000000000000000000000000000000000000..5fa136bea0d5477f2eac1e29900a5bff33aa1973 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/stopWords.txt @@ -0,0 +1,440 @@ +a +about +above +accordingly +across +after +afterwards +again +against +all +allows +almost +alone +along +already +also +although +always +am +among +amongst +an +and +another +any +anybody +anyhow +anyone +anything +anywhere +apart +appear +appropriate +are +around +as +aside +associated +at +available +away +awfully +b +back +be +became +because +become +becomes +becoming +been +before +beforehand +behind +being +below +beside +besides +best +better +between +beyond +both +brief +but +by +c +came +can +cannot +cant +cause +causes +certain +changes +co +come +consequently +contain +containing +contains +corresponding +could +currently +d +day +described +did +different +do +does +doing +done +down +downwards +during +e +each +eg +eight +either +else +elsewhere +enough +et +etc +even +ever +every +everybody +everyone +everything +everywhere +ex +example +except +f +far +few +fifth +first +five +followed +following +for +former +formerly +forth +four +from +further +furthermore +g +get +gets +given +gives +go +gone +good +got +great +h +had +hardly +has +have +having +he +hence +her +here +hereafter +hereby +herein +hereupon +hers +herself +him +himself +his +hither +how +howbeit +however +i +ie +if +ignored +immediate +in +inasmuch +inc +indeed +indicate +indicated +indicates +inner +insofar +instead +into +inward +is +it +its +itself +j +just +k +keep +kept +know +l +last +latter +latterly +least +less +lest +life +like +little +long +ltd +m +made +make +man +many +may +me +meanwhile +men +might +more +moreover +most +mostly +mr +much +must +my +myself +n +name +namely +near +necessary +neither +never +nevertheless +new +next +nine +no +nobody +none +noone +nor +normally +not +nothing +novel +now +nowhere +o +of +off +often +oh +old +on +once +one +ones +only +onto +or +other +others +otherwise +ought +our +ours +ourselves +out +outside +over +overall +own +p +particular +particularly +people +per +perhaps +placed +please +plus +possible +probably +provides +Pij +q +que +quite +r +rather +really +relatively +respectively +right +s +said +same +second +secondly +see +seem +seemed +seeming +seems +self +selves +sensible +sent +serious +seven +several +shall +she +should +since +six +so +some +somebody +somehow +someone +something +sometime +sometimes +somewhat +somewhere +specified +specify +specifying +state +still +sub +such +sup +t +take +taken +than +that +the +their +theirs +them +themselves +then +thence +there +thereafter +thereby +therefore +therein +thereupon +these +they +third +this +thorough +thoroughly +those +though +three +through +throughout +thru +thus +time +to +together +too +toward +towards +twice +two +u +under +unless +until +unto +up +upon +us +use +used +useful +uses +using +usually +v +value +various +very +via +viz +vs +w +was +way +we +well +went +were +what +whatever +when +whence +whenever +where +whereafter +whereas +whereby +wherein +whereupon +wherever +whether +which +while +whither +who +whoever +whole +whom +whose +why +will +with +within +without +work +world +would +x +y +year +years +yet +you +your +yours +yourself +yourselves +z +zero \ No newline at end of file diff --git a/exercises/02450Toolbox_R/Data/synth1.mat b/exercises/02450Toolbox_R/Data/synth1.mat new file mode 100644 index 0000000000000000000000000000000000000000..4eb623f831660cf7dbb0a655fc03ebb023b11442 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/synth1.mat differ diff --git a/exercises/02450Toolbox_R/Data/synth2.mat b/exercises/02450Toolbox_R/Data/synth2.mat new file mode 100644 index 0000000000000000000000000000000000000000..99838d2eb7e3a60799dbb54dfc5a98db5b6fc8aa Binary files /dev/null and b/exercises/02450Toolbox_R/Data/synth2.mat differ diff --git a/exercises/02450Toolbox_R/Data/synth3.mat b/exercises/02450Toolbox_R/Data/synth3.mat new file mode 100644 index 0000000000000000000000000000000000000000..adefbcfc4075497a710c1e90fa65e4933fc02f9e Binary files /dev/null and b/exercises/02450Toolbox_R/Data/synth3.mat differ diff --git a/exercises/02450Toolbox_R/Data/synth4.mat b/exercises/02450Toolbox_R/Data/synth4.mat new file mode 100644 index 0000000000000000000000000000000000000000..8a445f9c8fe5bb16f82b4312d2cb5e8051022c29 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/synth4.mat differ diff --git a/exercises/02450Toolbox_R/Data/synth5.mat b/exercises/02450Toolbox_R/Data/synth5.mat new file mode 100644 index 0000000000000000000000000000000000000000..e36f9391ba3707db3773a38ee5057fbaf3807424 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/synth5.mat differ diff --git a/exercises/02450Toolbox_R/Data/synth6.mat b/exercises/02450Toolbox_R/Data/synth6.mat new file mode 100644 index 0000000000000000000000000000000000000000..3857ca1a9eff1a851e14746d63ea0b6522d961c6 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/synth6.mat differ diff --git a/exercises/02450Toolbox_R/Data/synth7.mat b/exercises/02450Toolbox_R/Data/synth7.mat new file mode 100644 index 0000000000000000000000000000000000000000..1b421f60e9099fa77dcb3b9431f91a0587af016e Binary files /dev/null and b/exercises/02450Toolbox_R/Data/synth7.mat differ diff --git a/exercises/02450Toolbox_R/Data/textDocs.txt b/exercises/02450Toolbox_R/Data/textDocs.txt new file mode 100644 index 0000000000000000000000000000000000000000..21cc2920b6b7259dda2ddc402858d510060e2398 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/textDocs.txt @@ -0,0 +1,10 @@ +The Google matrix P is a model of the internet. + +P_ij is nonzero if there is a link from webpage i to j. + +The Google matrix is used to rank all Web pages. + +The ranking is done by solving a matrix eigenvalue problem. + +England dropped out of the top 10 in the FIFA ranking. + diff --git a/exercises/02450Toolbox_R/Data/textDocs1.txt b/exercises/02450Toolbox_R/Data/textDocs1.txt new file mode 100644 index 0000000000000000000000000000000000000000..788008cfe0d88207a4cb7618b10fb5acfec17fbe --- /dev/null +++ b/exercises/02450Toolbox_R/Data/textDocs1.txt @@ -0,0 +1,2 @@ +The Google matrix P is a model of the internet. + diff --git a/exercises/02450Toolbox_R/Data/textDocs2.txt b/exercises/02450Toolbox_R/Data/textDocs2.txt new file mode 100644 index 0000000000000000000000000000000000000000..58bedb8afe62f9ebb2b59707bf482313ecc2a818 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/textDocs2.txt @@ -0,0 +1 @@ +P_ij is nonzero if there is a link from webpage i to j. diff --git a/exercises/02450Toolbox_R/Data/textDocs3.txt b/exercises/02450Toolbox_R/Data/textDocs3.txt new file mode 100644 index 0000000000000000000000000000000000000000..fde0e38cd165a15fccc2d7d1379d64b043b34e76 --- /dev/null +++ b/exercises/02450Toolbox_R/Data/textDocs3.txt @@ -0,0 +1,2 @@ +The Google matrix is used to rank all Web pages. + diff --git a/exercises/02450Toolbox_R/Data/textDocs4.txt b/exercises/02450Toolbox_R/Data/textDocs4.txt new file mode 100644 index 0000000000000000000000000000000000000000..ec6eb1d4fc2c520e4bfa92d70705aa35ec66f32b --- /dev/null +++ b/exercises/02450Toolbox_R/Data/textDocs4.txt @@ -0,0 +1,2 @@ +The ranking is done by solving a matrix eigenvalue problem. + diff --git a/exercises/02450Toolbox_R/Data/textDocs5.txt b/exercises/02450Toolbox_R/Data/textDocs5.txt new file mode 100644 index 0000000000000000000000000000000000000000..6ac2934171972bc3dda54e38fea40b1e9747409b --- /dev/null +++ b/exercises/02450Toolbox_R/Data/textDocs5.txt @@ -0,0 +1,2 @@ +England dropped out of the top 10 in the FIFA ranking. + diff --git a/exercises/02450Toolbox_R/Data/wildfaces.mat b/exercises/02450Toolbox_R/Data/wildfaces.mat new file mode 100644 index 0000000000000000000000000000000000000000..1f5894a43da3a0b7c7549d8937968a6488f8ca92 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/wildfaces.mat differ diff --git a/exercises/02450Toolbox_R/Data/wildfaces_grayscale.mat b/exercises/02450Toolbox_R/Data/wildfaces_grayscale.mat new file mode 100644 index 0000000000000000000000000000000000000000..bcab41e4da0ed2d6b988ed73eff4eb15b6408c2f Binary files /dev/null and b/exercises/02450Toolbox_R/Data/wildfaces_grayscale.mat differ diff --git a/exercises/02450Toolbox_R/Data/wine.mat b/exercises/02450Toolbox_R/Data/wine.mat new file mode 100644 index 0000000000000000000000000000000000000000..c684ae249f7c9d5154c5b7112f12f927490c5878 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/wine.mat differ diff --git a/exercises/02450Toolbox_R/Data/wine2.mat b/exercises/02450Toolbox_R/Data/wine2.mat new file mode 100644 index 0000000000000000000000000000000000000000..c6851a61390f2cdc3c694654aededa5761d78cd2 Binary files /dev/null and b/exercises/02450Toolbox_R/Data/wine2.mat differ diff --git a/exercises/02450Toolbox_R/Data/xor.mat b/exercises/02450Toolbox_R/Data/xor.mat new file mode 100644 index 0000000000000000000000000000000000000000..ffef7df14ee096007810041e7efa42ea0f7f98da Binary files /dev/null and b/exercises/02450Toolbox_R/Data/xor.mat differ diff --git a/exercises/02450Toolbox_R/Data/zipdata.mat b/exercises/02450Toolbox_R/Data/zipdata.mat new file mode 100644 index 0000000000000000000000000000000000000000..a98e79614d23893b45b1bb554f82db03b59a98ad Binary files /dev/null and b/exercises/02450Toolbox_R/Data/zipdata.mat differ diff --git a/exercises/02450Toolbox_R/LICENSE b/exercises/02450Toolbox_R/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..541b6ff48a6ee683c5d5cf3f93a478430c63405e --- /dev/null +++ b/exercises/02450Toolbox_R/LICENSE @@ -0,0 +1,16 @@ +LICENCE + +This repository contains code for the course 02450 Introduction to Machine Learning and Data Mining at the Technical University of Denmark (DTU). + +Some of the code, data and functions used in this repository comes from other sources and the licensing terms are as indicated in the relevant files or referenced packages. + +All material including software are intended for research and educational purpose. Any sale or commercial distribution is strictly forbidden, +unless the Department of Applied Mathematics and Computer Science, the Technical University of Denmark (DTU Compute) has given explicit written permission. + +The material including software is provided "as-is". Support is generally not available. No warranties of any kind, express or implied, +are made as to it or any medium it may be on. No remedy will be provided for indirect, consequential, punitive or incidental damages arising from it, +including such from negligence, strict liability, or breach of warranty or contract, even after notice of the possibility of such damages. + +Inquiries about licensing can be made to the Cognitive System Section, DTU Compute, http://cogsys.compute.dtu.dk + +The material is not for redistribution. diff --git a/exercises/02450Toolbox_R/README.md b/exercises/02450Toolbox_R/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f5c99365a3533bee4c5b5e70b2013088f9f7fa93 --- /dev/null +++ b/exercises/02450Toolbox_R/README.md @@ -0,0 +1,51 @@ +# 02450 Toolbox + +Description of the datasets in the Data folder: + +body.mat +This is a subset of the dataset on body dimenstions available at http://www.sci.usq.edu.au/courses/STA3301/resources/Data/ +and described in +G. Heinz, L. J. Peterson, R. W. Johnson, and C. J. Kerk, “Exploring relationships in body dimensions,” Journal of Statistics Education, vol. 11, no. 2, 2003. + +faithful.mat and faithful.txt +Dataset on eruption of the Old Faithful geyser described in +A. Azzalini and A. Bowman, “A look at some data on the old faithful geyser,” Applied Statistics, pp. 357–365, 1990. +W. Härdle, Smoothing techniques: with implementation in S. Springer, 1991 + +female.txt and male.txt +Data is taken from http://www.cs.cmu.edu/afs/cs/project/ai-repository/ai/areas/nlp/corpora/names/, +Please consult the accompanying readme_male_female.txt file in the Data folder. + +iris.xls +Fisher's Iris data, for a description see also http://en.wikipedia.org/wiki/Iris_flower_data_set. The data has been downloaded from http://archive.ics.uci.edu/ml/datasets/Iris. + +nanonose.xls +This data has been taken from the nanonose project, see also http://www.nanonose.dk, it is described in +T. S. Alstrøm, J. Larsen, C. H. Nielsen, and N. B. Larsen, “Data-driven modeling of nano-nose gas sensor arrays,” in SPIE Defense, Security, and Sensing. International Society for Optics and Photonics, 2010, pp. 76 970U–76 970U. + +StopWords +A txt file of list of common words provided in the TMG toolbox. + +textDocs.txt +This example of documents for a term-document matrix is taken from +L. Eldén, Matrix Methods in Data Mining and Pattern Recognition. Philadelphia, PA, USA: Society for Industrial and Applied Mathematics, 2007. + +Wine.mat and Wine2.mat +P. Cortez, A. Cerdeira, F. Almeida, T. Matos, and J. Reis. Modeling wine preferences by data mining from physicochemical properties. In Decision Support Systems, Elsevier, 47(4):547–553, 2009. +downloaded from http://archive.ics.uci.edu/ml/datasets/Wine+Quality +Wine2 is same as Wine but with some outliers removed. + +zipdata.mat and digits.mat +USPS handwritten digits availabe at http://www.cad.zju.edu.cn/home/dengcai/Data/MLData.html, see also +J. J. Hull, “A database for handwritten text recognition research,” Pattern Analysis and Machine Intelligence, IEEE Transactions on, vol. 16, no. 5, pp. 550–554, +1994. + +wildfaces.mat and wildfaces_grayscale.mat +Taken from http://tamaraberg.com/faceDataset/ and described in Tamara L. Berg, Alexander C. Berg, Jaety Edwards, David A. Forsyth +Neural Information Processing Systems (NIPS), 2004. +The wildfaces.mat is an extract with 1000 examples of the original dataset and wildfaces_grayscale a gray scale converted version of these 1000 examples taken from the original data. + +messy_data.data +This dataset is an excerpt of the Auto MPG Data Set which has been heavily formatted to introduce comming data preprocessing isusues. +Revised from CMU StatLib library, data concerns city-cycle fuel consumption https://archive.ics.uci.edu/ml/datasets/auto+mpg +This dataset was taken from the StatLib library which is maintained at Carnegie Mellon University. The dataset was used in the 1983 American Statistical Association Exposition. diff --git a/exercises/02450Toolbox_R/Scripts/ex0_4_3.R b/exercises/02450Toolbox_R/Scripts/ex0_4_3.R new file mode 100644 index 0000000000000000000000000000000000000000..c4b19fa353971c0b88d6232676c94be0d0297645 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex0_4_3.R @@ -0,0 +1,23 @@ +#################### +# Exercise 0.4.3 +#################### + +# Remember you can mark a part of the code and press CTRL+Enter or CMD+Enter +# to run that part alone. + +# The colon notation is very important in R as it avoids +# loops, which run very slowly in R +# Generating vectors in R is easy when using the colon +# notation. + +# Define variable a with numbers in the range from 0 to 6 (inclusive) +a <- 0:6 + +# Define variable b with numbers in the range from 2 to 17 in steps of 4 +b <- seq(from = 2, by = 4, to = 17) + +c <- seq(from = 100, by = -1, to = 95) + +d <- seq(from = 1.2, by = 0.1, to = 1.9) + +e <- pi * seq(from = 0, by = 0.5, to = 2) diff --git a/exercises/02450Toolbox_R/Scripts/ex0_4_4.R b/exercises/02450Toolbox_R/Scripts/ex0_4_4.R new file mode 100644 index 0000000000000000000000000000000000000000..f1df3ff783f1eb161d5418083cce2d0237ac3560 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex0_4_4.R @@ -0,0 +1,34 @@ +#################### +# Exercise 0.4.4 +#################### + +# Extracting the elements from vectors is easy. Consider the +# following definition of x and the echoed results + +x <- c(rep(0, 2), seq(from = 0, to = 3, length.out = 6), rep(1, 3)) + +# Take out elements 2 through 5 (i.e. 6 not inclusive) +x[2:6] + +# Return the length of x +length(x) + +# Try typing '?length' +x[length(x)] # take the last element of x + +# Return every other element of x starting from the 2nd +x[seq(from = 2, by = 2, to = length(x))] + +# Inserting numbers into vectors is also easy. Using the same +# definition of x and observe the results when typing +y <- x + +# Notice that we're inserting the same scalar value "pi" into all elements +# that we index y with +y[seq(from = 2, by = 2, to = length(x))] <- pi + +# You can also try: +# y[seq(from=2, by=2, to=length(x))] = seq(from=2, by=2, to=10) + +# Observe the results when indexing the vector y with +# y[1] and y[0]. Is y[0] defined? diff --git a/exercises/02450Toolbox_R/Scripts/ex0_4_5.R b/exercises/02450Toolbox_R/Scripts/ex0_4_5.R new file mode 100644 index 0000000000000000000000000000000000000000..df73cefd04fe24ca634e6c24bb18cc6ec430432b --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex0_4_5.R @@ -0,0 +1,68 @@ +#################### +# Exercise 0.4.5 +#################### + +# Setup two matrices +x <- 1:5 +y <- seq(from = 2, to = 10, by = 2) + +# Have a look at them by typing 'x' and 'y' in the console. + +# There's a difference between matrix multiplication and element wise +# multiplication: + +# Transposition of y +t(y) + +# Element-wise multiplication +x * y + +# Matrix multiplication, however, +# since x and y are vectors the inner product is returned +x %*% y + +# There are various ways to make certain type of matrices. +a1 <- matrix(1:9, nrow = 3, ncol = 3) # define explicitly +a3 <- matrix(rep(0, len = 9), nrow = 3) # zeros matrix +a4 <- diag(3) # diagonal matrix/identity matrix +a5 <- matrix(rnorm(9), nrow = 3) # random matrix (normal distributed) +a6 <- a1 # copy (changing a1 wont change a6) + + +# It is easy to extract and/or modify selected items from matrices. +# Here is how you can index matrix elements: +m <- a1 +m[1, 1] # first element +m[1, ] # first row +m[, 2] # second column +m[1:2, 2] # specific rows in specific columns + + +# Similarly, you can selectively assign values to matrix elements or columns: +m[3, 3] <- 10000 +m[1:2, 3] <- c(100, 1000) +m[1:2, 1] <- 0 + +# Logical indexing can be used to change or take only elements that +# fulfill a certain constraint, e.g. +m <- a5 +m[m > 0] # display values in m that are larger than 0 +m[m < 0] <- 0 # set all elements that are less than 0 to 0 + +# Below, several examples of common matrix operations, +# most of which we will use in the following weeks. +# First, define two matrices: +m1 <- 10 * matrix(rep(1, len = 9), nrow = 3, ncol = 3) +m2 <- a5 + +m1 + m2 # matrix summation +m1 %*% m2 # matrix product +m1 * m2 # element-wise multiplication +m1 > m2 # element-wise comparison +m3 <- rbind(m1, m2) # combine/concatenate matrix rows, horizontally +m4 <- cbind(m1, m2) # combine/concatenate matrix columns, vertically +dim(m3) # shape of matrix +mean(m3) # mean value of all elements +colMeans(m3) # mean values of the columns, also for summing colSums +rowMeans(m3) # mean values of the rows, also for summing rowSums +t(m3) # transpose diff --git a/exercises/02450Toolbox_R/Scripts/ex0_5_1.R b/exercises/02450Toolbox_R/Scripts/ex0_5_1.R new file mode 100644 index 0000000000000000000000000000000000000000..5f3fc6de641c86f53beeb6580c9bc96bcf5ad12b --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex0_5_1.R @@ -0,0 +1,12 @@ +#################### +# Exercise 0.5.1 +#################### + +x <- seq(from = 0, by = 0.1, t = 1) +f <- exp(x) +plot(x, f, "l", + xlab = "x", + ylab = "f(x)=exp(x)", + main = "The exponential function" +) + diff --git a/exercises/02450Toolbox_R/Scripts/ex0_5_2.R b/exercises/02450Toolbox_R/Scripts/ex0_5_2.R new file mode 100644 index 0000000000000000000000000000000000000000..b80c9ebade31bd8c0d72b65fa6b0f656a1d47ade --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex0_5_2.R @@ -0,0 +1,49 @@ +#################### +# Exercise 0.5.2 +#################### + +# We simulate measurements every 100 ms for a period of 10 seconds +t <- seq(from = 0, by = 0.1, to = 10) + +# The data from the sensors are generated as either a sine or a cosine +# with some Gaussian noise added. +sensor1 <- 3 * sin(t) + 0.5 * rnorm(length(t)) +sensor2 <- 3 * cos(t) + 0.5 * rnorm(length(t)) + +# Change the font size to make axis and title readable +# font_size = 15 +# plt.rcParams.update({'font.size': font_size}) + +# Define the name of the curves +legend_strings <- c("Sensor 1", "Sensor 2") + +# Start plotting the simulated measurements +# Plot the sensor 1 output as a function of time, and +# make the curve red and fully drawn +plot(t, sensor1, # plot sensor1 as a function of t + type = "l", lty = 1, # set linetype + col = "red", # define plot colour + ann = FALSE +) # remove variable name label annotation + +# Plot the sensor 2 output as a function of time, and +# make the curve blue and dashed +lines(t, sensor2, type = "l", lty = 2, col = "blue", ann = FALSE) + +# Add a grid in the background +grid() + +# Add a legend describing each curve, place it at the "best" location +# so as to minimize the amount of curve it covers +legend(1, 1, legend_strings, col = c("red", "blue"), lty = 1:2) + +# Add labels to the axes and a title to the plot +title( + main = "Sensor outputs", + xlab = "Time [s]", + ylab = "Voltage [mV]" +) + +# Export the figure +# dev.copy(png, 'ex0_5_2.png') +# dev.off() diff --git a/exercises/02450Toolbox_R/Scripts/ex10_1_1.R b/exercises/02450Toolbox_R/Scripts/ex10_1_1.R new file mode 100644 index 0000000000000000000000000000000000000000..774488d56e97a4f000b2794ab99c64db35da0a63 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex10_1_1.R @@ -0,0 +1,38 @@ +#################### +# Exercise 10.1.1 +#################### +rm(list = ls()) # Clear work space + +source("setup.R") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth1.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +#################### +# K-means clustering +#################### + +# Number of clusters +K <- 4 + +# Run k-means +res <- kmeans(X, K) +i <- res$cluster +Xc <- res$centers + +############## +# Plot results +############## + +clusterplot(X, y, i, Xc, main = "K-means") diff --git a/exercises/02450Toolbox_R/Scripts/ex10_1_3.R b/exercises/02450Toolbox_R/Scripts/ex10_1_3.R new file mode 100644 index 0000000000000000000000000000000000000000..2e9fada020f165f01252835ddd95993cbffe0b5a --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex10_1_3.R @@ -0,0 +1,58 @@ +#################### +# Exercise 10.1.3 +#################### +rm(list = ls()) # Clear work space + +source("setup.R") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth1.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +#################### +# K-means clustering +#################### + +# Maximum number of clusters +K <- 10 + +# Allocate variables +Rand <- rep(NA, times = K) +Jaccard <- rep(NA, times = K) +NMI <- rep(NA, times = K) + +for (k in 1:K) { + # Run k-means + kmeansres <- kmeans(X, k, iter.max = 100) + i <- kmeansres$cluster + + # Compute cluster validities + res <- clusterval(y, i) + + Rand[k] <- res$Rand + Jaccard[k] <- res$Jaccard + NMI[k] <- res$NMI +} + +############## +# Plot results +############## + +cols <- c("blue", "green", "red", "lightblue") +maxy <- max(c(Rand, Jaccard, NMI), na.rm = TRUE) +miny <- min(c(Rand, Jaccard, NMI), na.rm = TRUE) +plot(c(1, K), c(miny, maxy), type = "n", main = "Cluster validity", xlab = "Number of clusters", ylab = "") +lines(1:K, Rand, col = cols[1]) +lines(1:K, Jaccard, col = cols[2]) +lines(1:K, NMI, col = cols[3]) +legend("bottomright", legend = c("Rand", "Jaccard", "NMI"), fill = cols) diff --git a/exercises/02450Toolbox_R/Scripts/ex10_1_5.R b/exercises/02450Toolbox_R/Scripts/ex10_1_5.R new file mode 100644 index 0000000000000000000000000000000000000000..141b5356145f08492766869f0dbc25ad7c48f4e0 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex10_1_5.R @@ -0,0 +1,77 @@ +#################### +# Exercise 10.1.5 +#################### +rm(list = ls()) # Clear work space + +source("setup.R") + +# Load data +library(R.matlab) + +# data <- readMat(file.path('Data', 'digits.mat')) +data <- readMat(file.path("Data", "wildfaces_grayscale.mat")) +X <- data$X +N <- dim(X)[1] +M <- dim(X)[2] + + +# Image resolution and number of colors +x <- 40 # faces +y <- 40 # faces + +# x = 16; #digits +# y = 16; #digits + +c <- 1 + +#################### +# K-means clustering +#################### + +K <- 10 # Maximum number of clusters + +# Run k-means (This will take a while to run on a large data set) +res <- kmeans(X, K) +i <- res$cluster +Xc <- res$centers + + +############## +# Plot results +############## + +L <- 5 # Number of images to plot + +# Get some random image indices +j <- sample(x = 1:N, size = L) + +# Plot centroids +n1 <- ceiling(sqrt(K / 2)) +n2 <- ceiling(K / n1) + +par(mfrow = c(n1, n2), mar = c(0, 0, 2, 0), xaxt = "n", yaxt = "n") +for (k in 1:K) { + centroid <- Xc[k, ] + dim(centroid) <- c(x, y) + image(t(centroid[nrow(centroid):1, ]), main = paste("Centroid of class", k), + col = gray((0:32) / 32)) +} + +# Plot random images and corresponding centroids +{ + dev.new() + par(mfrow = c(L, 2), mar = c(0, 0, 2, 0), xaxt = "n", yaxt = "n") + + for (l in 1:L) { + observation <- X[j[l], ] + dim(observation) <- c(x, y) + image(t(observation[nrow(observation):1, ]), + main = paste("Example image from class", i[j[l]]), col = gray((0:32) / 32)) + + centroid <- Xc[i[j[l]], ] + dim(centroid) <- c(x, y) + image(t(centroid[nrow(centroid):1, ]), + main = paste("Centroid of class", i[j[l]]), col = gray((0:32) / 32)) + } +} +graphics.off() diff --git a/exercises/02450Toolbox_R/Scripts/ex10_2_1.R b/exercises/02450Toolbox_R/Scripts/ex10_2_1.R new file mode 100644 index 0000000000000000000000000000000000000000..4f2b217e3bcdf6ccb659c19540decfde75e4f0db --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex10_2_1.R @@ -0,0 +1,46 @@ +#################### +# Exercise 10.2.1 +#################### +rm(list = ls()) # Clear work space + +source("setup.R") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth1.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +######################### +# Hierarchical clustering +######################### + +# Maximum number of clusters +Maxclust <- 4 + +# Compute hierarchical clustering +hc <- hclust(dist(X), method = "single") + +# Compute clustering by thresholding the dendrogram +i <- cutree(hc, k = Maxclust) + +############## +# Plot results +############## + +# Plot dendrogram +par(mfrow=c(1,1)) +plot(hc) + +# Plot data +par(mfrow=c(1,1)) +clusterplot(X, y, i, main = "Hierarchical") + diff --git a/exercises/02450Toolbox_R/Scripts/ex11_1_1.R b/exercises/02450Toolbox_R/Scripts/ex11_1_1.R new file mode 100644 index 0000000000000000000000000000000000000000..8d1d961470b48e8b380a5ee8b0dfbbd6fd5d1c9a --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex11_1_1.R @@ -0,0 +1,74 @@ +#################### +# Exercise 11.1.1 +#################### +rm(list = ls()) # Clear work space + +source("setup.R") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth1.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +######################## +# Gaussian mixture model +######################## + +# Number of clusters (>= 2) +K <- 4 + +######################################## +# Fit model (using the mclust package) +######################################## +library(mclust) # install.packages("mclust") + +# package that can be used to fit a gaussian mixture model. +# This package does not allow random starts of the algorithm. +# It is faster than the algorithm in mixtools. + +model <- Mclust(data = X, G = K) + +# Get clustering +i <- model$classification + +# Get cluster centers +Xc <- t(model$parameters$mean) + +# Plot clustering +clusterplot(X, y, i, Xc, main = "GMM: Clustering") + +######################################## +# Fit model (using the mixtools package) +######################################## +library(mixtools) # install.packages("mixtools") + +# Package that can be used to fit a gaussian mixture model. +# This package does allow random starts of the algorithm. + +# using the mixtools package. Defaults for maxit and epsilon are 500 and 1e-8, +# respectively. Avoid extreme running times by allowing fewer iterations and +# deeming convergence earlier by setting maxit and epsilon as done here. +# The argument verb=TRUE makes the method write output from the EM algorithm at +# each iteration. The argument verb is FALSE by default. + +model <- mvnormalmixEM(x = X, k = K, maxit = 100, epsilon = 1e-2, verb = TRUE) + +# Get clustering +i <- max_idx(model$posterior) + +# Get cluster centers +Xc <- matrix(unlist(model$mu), nrow=length(model$mu), byrow=TRUE) + +# Plot clustering +clusterplot(X, y, i, Xc, main = "GMM: Clustering") + + diff --git a/exercises/02450Toolbox_R/Scripts/ex11_1_5.R b/exercises/02450Toolbox_R/Scripts/ex11_1_5.R new file mode 100644 index 0000000000000000000000000000000000000000..7d4190c511b351fab16db94465552ca20e6338f4 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex11_1_5.R @@ -0,0 +1,153 @@ +#################### +# Exercise 11.1.5 +#################### +rm(list = ls()) + +source("setup.R") + +# library(mixtools) # install.packages("mixtools") +library(mclust) # install.packages("mclust") + +# Package for Cross-Validation +library(caret) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth1.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +######################## +# Gaussian mixture model +######################## + +# Range of K's to try +KRange <- 2:10 +T <- length(KRange) + +# Allocate variables +BIC <- rep(NA, times = T) +AIC <- rep(NA, times = T) +CVE <- rep(0, times = T) + +# Create cross validation partition for evaluation + +# For reproducibility +set.seed(1234) + +NumTestSets <- 10 + +CV <- list() +CV$which <- createFolds(y, k = NumTestSets, list = F) +CV$NumTestSets <- NumTestSets +CV$TrainSize <- c() +CV$TestSize <- c() + +# For each model order (number of clusters) +for (t in 1:T) { + # Get the current K + K <- KRange[t] + + # Display information + writeLines(paste("Fitting model for K =", K)) + + + # If using the package mclust to fit the model + model <- Mclust(data = X, G = K, verbose = F) + + # this block of code, within the "if" conditional, + # is only relevant if random restarts are allowed, + # as is the case for the package mixtools but not for the package mclust. + if (FALSE) { + # Fit model + reps <- 100 + models <- vector("list", reps) + logliks <- rep(NA, times = reps) + startsigma <- replicate(K, diag(apply(X, 2, sd)), simplify = FALSE) + for (irep in 1:reps) { + err <- TRUE + while (err) { + randobs <- sample(x = 1:N, size = K) + randmu <- lapply(X = randobs, function(X, data) data[X, ], data = as.matrix(X)) + emres <- mvnormalmixEM(X, maxit = 50, eps = 1e-2, + mu = randmu, sigma = startsigma, verb = F) + } + model <- emres + models[[irep]] <- model + logliks[irep] <- model$loglik + } + whichmaxloglik <- which.max(logliks) + model <- models[[whichmaxloglik]] + } # end of block only relevant for the package mixtools + + + # Get BIC and AIC + BIC[t] <- BIC(model) + AIC[t] <- AIC(model) + + # For each crossvalidation fold + for (k in 1:CV$NumTestSets) { + # Extract the training and test set + X_train <- X[CV$which != k, ] + X_test <- X[CV$which == k, ] + + # Fit model to training set + + # If using the package mclust to fit the model + model <- Mclust(data = X_train, G = K, verbose = F) + + # this block of code, within the "if" conditional, + # is only relevant if random restarts are allowed, + # as is the case for the package mixtools but not for the package mclust + if (FALSE) { + reps <- 5 + models <- vector("list", reps) + logliks <- rep(NA, times = reps) + startsigma <- replicate(K, diag(apply(X_train, 2, sd)), simplify = FALSE) + for (irep in 1:reps) { + err <- FALSE + while (!err) { + randobs <- sample(x = 1:dim(X_train)[1], size = K) + randmu <- lapply(X = randobs, function(X, data) data[X, ], data = as.matrix(X_train)) + emres <- mvnormalmixEM(X_train, maxit = 50, eps = 1e-2, + mu = randmu, sigma = startsigma) + } + model <- emres + models[[irep]] <- model + logliks[irep] <- model$loglik + } + whichmaxloglik <- which.max(logliks) + model <- models[[whichmaxloglik]] + } + + # Evaluation cross-validation error + res <- gmmposterior(model, X_test) + NLOGL <- res$ll + CVE[t] <- CVE[t] + NLOGL + } +} + +############## +# Plot results +############## + +library(ggplot2) +library(dplyr) +library(tidyr) + +# Organize data for plotting +df <- data.frame(KRange = KRange, BIC = BIC, AIC = AIC, CVE = 2 * CVE) +df <- pivot_longer(df, c(BIC, AIC, CVE), values_to = "Value", names_to = "Type") + +# Plot results +ggplot(df, aes(x = KRange, y = Value, color = Type)) + + geom_line() + geom_point() + ylim(min(1.5*CVE), max(2*CVE)) + diff --git a/exercises/02450Toolbox_R/Scripts/ex11_2_1.R b/exercises/02450Toolbox_R/Scripts/ex11_2_1.R new file mode 100644 index 0000000000000000000000000000000000000000..2f09c7d6a76b795c88b30857381a6d9b1f2a36fd --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex11_2_1.R @@ -0,0 +1,28 @@ +#################### +# Exercise 11.2.1 +#################### +rm(list = ls()) + +# Number of data objects +N <- 1000 +# x-values to evaluate the histogram +x <- seq(from = -10, to = 10, length.out = 50) + +# Number of attributes +M <- 1 +# Allocate variable for data +X <- array(rep(NA, times = N * M), dim = c(N, M)) + +# Mean and covariances +m <- c(1, 3, 6) +s <- c(1, .5, 2) + +# For each data object +for (n in 1:N) { + k <- sample(1:3, 1, replace = TRUE) + X[n, 1] <- rnorm(1, mean = m[k], sd = sqrt(s[k])) +} + +# Plot histogram +hist(x = X, breaks = c(min(X), x, max(X))) + diff --git a/exercises/02450Toolbox_R/Scripts/ex11_2_2.R b/exercises/02450Toolbox_R/Scripts/ex11_2_2.R new file mode 100644 index 0000000000000000000000000000000000000000..050d72165c5a21dcef0404631a7e4450d9222020 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex11_2_2.R @@ -0,0 +1,17 @@ +#################### +# Exercise 11.2.2 +#################### +source(file.path("Scripts", "ex11_2_1.R")) +graphics.off() + +source("setup.R") +library(mixtools) + +# x-values to evaluate the KDE +x <- seq(from = -10, to = 10, length.out = 100) + +# Compute kernel density estimate +f <- wkde(x = as.vector(X), u = x, bw = 1) + +# Plot kernel density estimate +plot(x, f, main = "Kernel density estimate", type = "l") diff --git a/exercises/02450Toolbox_R/Scripts/ex11_2_3.R b/exercises/02450Toolbox_R/Scripts/ex11_2_3.R new file mode 100644 index 0000000000000000000000000000000000000000..55fed0ebb3f504b04be118bd1d5f0c8f3d0854e4 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex11_2_3.R @@ -0,0 +1,39 @@ +#################### +# Exercise 11.2.3 +#################### +source(file.path("Scripts", "ex11_2_1.R")) +graphics.off() + +source("setup.R") + +# install.packages("FNN") +library(FNN) # Library for Nearest Neighbor Search + +# Number of neighbors +K <- 200 + +# x-values to evaluate the GMM +x <- seq(from = -10, to = 10, length.out = 100) + +# Find the k nearest neighbors +res <- get.knnx(data = X, query = x, k = K) +i <- res$nn.index +D <- res$nn.dist + +# Compute the density +density <- 1 / (rowSums(D) / K) + +# Compute the average relative density +res <- get.knnx(data = X, query = X, k = K + 1) +iX <- res$nn.index +DX <- res$nn.dist +densityX <- 1 / (rowSums(DX[, 2:dim(DX)[2]]) / K) +temp <- matrix(densityX[i[, 2:dim(i)[2]]], nrow = dim(i)[1]) +avg_rel_density <- density / (rowSums(temp) / K) + +# Plot KNN estimate of density +plot(x, density, main = "KNN density", type = "l") + +# Plot KNN estimate of density +plot(x, avg_rel_density, main = "KNN average relative density", type = "l") + diff --git a/exercises/02450Toolbox_R/Scripts/ex11_3_1.R b/exercises/02450Toolbox_R/Scripts/ex11_3_1.R new file mode 100644 index 0000000000000000000000000000000000000000..49b76566bdcade00da3fd57667fd7b9944852a5f --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex11_3_1.R @@ -0,0 +1,38 @@ +#################### +# Exercise 11.3.1 +#################### +source(file.path("Scripts", "ex11_2_1.R")) +graphics.off() + +source("setup.R") +library(sm) # install.packages("sm") + +X <- rbind(X, -10) + +# Kernel width +w <- 5 + +################ +# Outlier scores +################ + +# Compute kernel density estimate +f <- sm.density(X, h = w, model = "Normal", display = "none", eval.points = X) +# f <- bkde(X, bandwidth=w) +# f = ksdensity(X, X, 'width', w); +# f <- density(X, bw=w) + +# Sort the densities +res <- sort(f$estimate, index.return = TRUE) +y <- res$x +i <- res$ix + +# Display the index of the lowest density data object +# The outlier should have index 1001 (the length of the vector i, +# i.e. be the last observation in the sorted vector of densities) + +print(i[1]) + +# Plot density estimate outlier scores +barplot(y[1:20], main = "Outlier score") + diff --git a/exercises/02450Toolbox_R/Scripts/ex11_3_2.R b/exercises/02450Toolbox_R/Scripts/ex11_3_2.R new file mode 100644 index 0000000000000000000000000000000000000000..1ea87b8137a494ef04514ef38a51f0d0eb0833d6 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex11_3_2.R @@ -0,0 +1,41 @@ +#################### +# Exercise 11.3.2 +#################### +source(file.path("Scripts", "ex11_2_1.R")) +graphics.off() + +source("setup.R") + +X <- rbind(X, -10) + +# Estimate optimal kernel density width by leave-one-out cross-validation +widths <- 2^(-10:10) +logP <- rep(NA, times = length(widths)) +for (w in 1:length(widths)) { + res <- gausKernelDensity(X, widths[w]) + f <- res$density + log_f <- res$log_density + logP[w] <- sum(log_f) +} +val <- max(logP) +ind <- which.max(logP) +width <- widths[ind] +print(paste("Optimal estimated width is", width)) + +# Estimate density for each observation not including +# the observation itself in the density estimate +res <- gausKernelDensity(X, width) +f <- res$density + +# Sort the densities +sortres <- sort(f, index.return = TRUE) +y <- sortres$x +i <- sortres$ix + +# Display the index of the lowest density data object +# The outlier should have index 1001 +print(i[1]) + +# Plot density estimate outlier scores +barplot(y[1:20], main = "Outlier score") + diff --git a/exercises/02450Toolbox_R/Scripts/ex11_4_1.R b/exercises/02450Toolbox_R/Scripts/ex11_4_1.R new file mode 100644 index 0000000000000000000000000000000000000000..4846dd2bd581760e59ee4307384a399d11647236 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex11_4_1.R @@ -0,0 +1,185 @@ +#################### +# Exercise 11.4.1 +#################### +rm(list = ls()) + +source("setup.R") +library(FNN) +library(sm) + +# Load hand written digits data +library(R.matlab) +data <- readMat(file.path("Data", "digits.mat")) +X <- data$X +N <- data$N +M <- data$M +y <- data$y +classNames <- as.vector(unlist(data$classNames)) + +# Restrict the data to images of "2" +X <- X[y == 2, ] +N <- dim(X)[1] +M <- dim(X)[2] + +################################## +# Gausian Kernel density estimator +################################## + +# Cross-validate kernel width by leave-one-out-cross-validation +# Automatically implemented in the script gausKernelDensity +widths <- max(apply(X, 2, var)) * (2^(-10:2)) + +# Evaluate for a range of kernel widths +logP <- rep(NA, times = length(widths)) +for (w in 1:length(widths)) { + res <- gausKernelDensity(X, widths[w]) + density <- res$density + log_density <- res$log_density + logP[w] <- sum(log_density) +} +val <- max(logP) +ind <- which.max(logP) +width <- widths[ind] +print(paste("Optimal kernel width is", width)) + +# Evaluate density for estimated width +res <- gausKernelDensity(X, width) +density <- res$density + +# Sort the densities +sortres <- sort(density, index.return = TRUE) +y <- sortres$x +i <- sortres$ix + +# Plot outlier scores +par(mfrow = c(1,1)) +barplot(y[1:20], main = "Gaussian Kernel Density: outlier score") + +# Plot possible outliers +{ + dev.new() + par(mfrow = c(4, 5), oma = c(0, 0, 2, 0)) + for (k in 1:20) { + im <- X[i[k], ] + dim(im) <- c(16, 16) + image(t(im[16:1, ]), col = gray((32:0) / 32), main = k) + } + title(main = "Gaussian Kernel Density: Possible outliers", outer = TRUE) +} + +###################################### +# K-nearest neighbor density estimator +###################################### + +# Number of neighbors +K <- 5 + +# Find the k nearest neighbors +res <- get.knnx(data = X, query = X, k = K + 1) +idx <- res$nn.index +D <- res$nn.dist + +# Compute the density +density <- 1 / (rowSums(D[, 2:dim(D)[2]]) / K) + +# Sort the densities +sortres <- sort(density, index.return = TRUE) +y <- sortres$x +i <- sortres$ix + +# Plot outlier scores +par(mfrow = c(1,1)) +barplot(y[1:20], main = "KNN density: outlier score") + +# Plot possible outliers +{ + dev.new() + par(mfrow = c(4, 5), oma = c(0, 0, 2, 0)) + for (k in 1:20) { + im <- X[i[k], ] + dim(im) <- c(16, 16) + image(t(im[16:1, ]), col = gray((32:0) / 32), main = k) + } + title(main = "KNN density: Possible outliers", outer = TRUE) +} + +############################################ +# K-nearest neigbor average relative density +############################################ + +# Compute the average relative density +avg_rel_density <- density / (rowSums(matrix(density[idx[, 2:dim(idx)[2]]], nrow = dim(idx)[1])) / K) + +# Sort the densities +sortres <- sort(avg_rel_density, index.return = TRUE) +y <- sortres$x +i <- sortres$ix + +# Plot outlier scores +par(mfrow = c(1,1)) +barplot(y[1:20], main = "KNN average relative density: outlier score") + +# Plot possible outliers +{ + dev.new() + par(mfrow = c(4, 5), oma = c(0, 0, 2, 0)) + for (k in 1:20) { + im <- X[i[k], ] + dim(im) <- c(16, 16) + image(t(im[16:1, ]), col = gray((32:0) / 32), main = k) + } + title(main = "KNN average relative density: Possible outliers", outer = TRUE) +} + +################################################# +# Distance to 5'th nearest neighbor outlier score +################################################# + +# Neighbor to use +K <- 5 + +# Find the k nearest neighbors +res <- get.knnx(data = X, query = X, k = K + 1) +i <- res$nn.index +D <- res$nn.dist + +# Outlier score +f <- D[, K + 1] + +# Sort the outlier scores +sortres <- sort(f, decreasing = TRUE, index.return = TRUE) +y <- sortres$x +i <- sortres$ix + +# Plot kernel density estimate outlier scores +par(mfrow = c(1,1)) +barplot(y[1:20], main = "Distance: Outlier score") + +# Plot possible outliers +{ + dev.new() + par(mfrow = c(4, 5), oma = c(0, 0, 2, 0)) + for (k in 1:20) { + im <- X[i[k], ] + dim(im) <- c(16, 16) + image(t(im[16:1, ]), col = gray((32:0) / 32), main = k) + } + title(main = "Distance: Possible outliers", outer = TRUE) +} + +############################################### +# Plot of random "normal" digits for comparison +############################################### + +# Plot random digits (the first 20 in the data set) +{ + dev.new() + par(mfrow = c(4, 5), oma = c(0, 0, 2, 0)) + for (k in 1:20) { + im <- X[k, ] + dim(im) <- c(16, 16) + image(t(im[16:1, ]), col = gray((32:0) / 32), main = k) + } + title(main = "Digits", outer = TRUE) +} + diff --git a/exercises/02450Toolbox_R/Scripts/ex12_1_3.R b/exercises/02450Toolbox_R/Scripts/ex12_1_3.R new file mode 100644 index 0000000000000000000000000000000000000000..db9ffb9221d6e80fcf0d52e7b190207bf0231897 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex12_1_3.R @@ -0,0 +1,19 @@ +#################### +# Exercise 12.1.3 +#################### + +X <- read.csv(file.path("Data", "courses.txt"), header = FALSE, sep = ",") +X <- data.matrix(X, rownames.force = NA) +labels <- c("02322", "02450", "02451", "02453", "02454", "02457", "02459", "02582") + +# Binarize the dataset, handle NA values +N <- dim(X)[1] +M <- length(labels) +Xbin <- matrix(0, nrow = N, ncol = M) +for (i in 1:N) { + Xbin[i, X[i, !is.na(X[i, ])]] <- 1 +} + +# Note how the data has been transformed: +print(X) +print(Xbin) diff --git a/exercises/02450Toolbox_R/Scripts/ex12_1_4.R b/exercises/02450Toolbox_R/Scripts/ex12_1_4.R new file mode 100644 index 0000000000000000000000000000000000000000..5a826c88dfaf5b13d56cb9c2d336d2f0934ef7a6 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex12_1_4.R @@ -0,0 +1,34 @@ +#################### +# Exercise 12.1.4 +#################### + +# Load data from previous script: +source(file.path('Scripts', 'ex12_1_3.R') ) + +# Package for data mining +library(arules) # install.packages("arules") +library(arulesViz) # install.packages("arulesViz") + +# Helper function to transform binary matrix X and labels into a list of transactions: +mat2transactions <- function(X,labels){ + N <- dim(X)[1] + T <- vector("list", N) + for (i in 1:N){ + T[[i]] <- labels[ X[i,] != 0 ] + } + return(T) +} + +# Now convert to transactions +T <- mat2transactions(Xbin,labels) +print(T) + +# Now find rules using a-priori algorithm. +# Remember to install arules using the R package manager +rules <- apriori(T, parameter = list(supp = 0.8, conf = 1, target = "rules")) + +# Summary of what happened +summary(rules) + +# Print the found rules: +as(rules, "data.frame") diff --git a/exercises/02450Toolbox_R/Scripts/ex12_1_5.R b/exercises/02450Toolbox_R/Scripts/ex12_1_5.R new file mode 100644 index 0000000000000000000000000000000000000000..ad020eac76b7ad83f2a79cf9a2d81feb67210190 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex12_1_5.R @@ -0,0 +1,23 @@ +#################### +# Exercise 12.1.5 +#################### +source("setup.R") + +# Package for data mining +library(arules) # install.packages("arules") + +# Load wine dataset: +library(R.matlab) +data <- readMat(file.path('Data', 'wine.mat')) + +# Extract variables +X <- data$X +y <- data$y +classNames <- data$classNames +attributeNames <- make.names(unlist(data$attributeNames)) + +# We will now transform the wine dataset into a binary format. +print("X, i.e. the wine dataset, has now been transformed into:") +v <- binarize2(X,attributeNames) +v$X +v$attributeNames diff --git a/exercises/02450Toolbox_R/Scripts/ex12_1_6.R b/exercises/02450Toolbox_R/Scripts/ex12_1_6.R new file mode 100644 index 0000000000000000000000000000000000000000..fe2866cbf3121799a90b5a17aa6e461763af394b --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex12_1_6.R @@ -0,0 +1,20 @@ +#################### +# Exercise 12.1.6 +#################### + +# Load data and functions defined in previous scripts: +source(file.path('Scripts', 'ex12_1_4.R') ) +source(file.path('Scripts', 'ex12_1_5.R') ) + +source("setup.R") + +# Turn into transaction list: +T <- mat2transactions(v$X, v$attributeNames) + +# Run apriori and print result. See documentation for more options: +rules <- apriori(T, parameter = list(supp = 0.3, conf = 0.6, target = "rules")) +summary(rules) + +# For only taking a few rules or sorting +as(rules, "data.frame") + diff --git a/exercises/02450Toolbox_R/Scripts/ex1_5_1.R b/exercises/02450Toolbox_R/Scripts/ex1_5_1.R new file mode 100644 index 0000000000000000000000000000000000000000..938034f222814292e1af3c62c5728ee5ddc1e0a9 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex1_5_1.R @@ -0,0 +1,37 @@ +#################### +# Exercise 1.5.1 +#################### + +rm(list=ls()) # Clear work space. + +# Read data into R as data frame. +data <- read.csv("./Data/iris.csv") + +# Read more about read.csv by typing '?read.csv'. + +# Extract attributes. +X <- data[, 1:4] +classLabels <- data[, 5] + +# Extract class labels of observations. +attributeNames <- colnames(data[1:4]) + +# Column and row names can be extracted using the functions +# 'colnames' and 'rownames', respectively. + +# Column and row names can also be assigned with the functions. +colnames(X) <- attributeNames + +# Check that dimensions are as they should be (150 rows and 4 columns). +# Parentheses around code in R will auto-print the evaluation. +(N <- dim(X)[1]) +(M <- dim(X)[2]) + +# Extract numeric class assignments. +y <- as.numeric(as.factor(classLabels)) - 1 + +# Extract the class names present in data. +classNames <- unique(classLabels) + +# Extract number of classes. +(C = length(classNames)) diff --git a/exercises/02450Toolbox_R/Scripts/ex1_5_2.R b/exercises/02450Toolbox_R/Scripts/ex1_5_2.R new file mode 100644 index 0000000000000000000000000000000000000000..02953f4e95c4b539042d8e9723e813c7a0931453 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex1_5_2.R @@ -0,0 +1,43 @@ +#################### +# Exercise 1.5.2 +#################### + +rm(list=ls()) # Clear work space + +# For directly reading Excel files, we need to install readxl: +# install.packages("readxl") +library('readxl') + +# Read Excel data into R. +data <- read_excel("./Data/iris.xls") + +# Convert Excel data into data frame. +data <- as.data.frame(data) + +# Extract attributes. +X <- data[, 1:4] +classLabels <- data[, 5] + +# Extract class labels of observations. +attributeNames <- colnames(data[1:4]) + +# Column and row names can be extracted using the functions +# 'colnames' and 'rownames', respectively. + +# Column and row names can also be assigned with the functions. +colnames(X) <- attributeNames + +# Check that dimensions are as they should be (150 rows and 4 columns). +# Parentheses around code in R will auto-print the evaluation. +(N <- dim(X)[1]) +(M <- dim(X)[2]) + +# Extract numeric class assignments. +y <- as.numeric(as.factor(classLabels)) - 1 + +# Extract the class names present in data. +classNames <- unique(classLabels) + +# Extract number of classes. +(C <- length(classNames)) + diff --git a/exercises/02450Toolbox_R/Scripts/ex1_5_3.R b/exercises/02450Toolbox_R/Scripts/ex1_5_3.R new file mode 100644 index 0000000000000000000000000000000000000000..aca4d4a9a9acf06179f16695460e7b8fe912576c --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex1_5_3.R @@ -0,0 +1,31 @@ +#################### +# Exercise 1.5.3 +#################### + +rm(list=ls()) # Clear work space + +# You will need the package "R.matlab", which contains the function "readMat". +# install.packages('R.matlab'). +library('R.matlab') + +# Read Matlab data into R. +data <- readMat('./Data/iris.mat') + +# You can see the variables loaded in data by checking: +(names(data)) + +# We can then extract the information simply by: +X = data$X +y = data$y +C = data$C[1] +M = data$M[1] +N = data$N[1] +attributeNames = as.character(unlist(data$attributeNames)) +classLabels = as.character(unlist(data$classLabels)) +classNames = as.character(unlist(data$classNames)) + +# Loading the Iris data from the .mat-file was quite easy, because all the work +# of putting it into the correct format was already done. This is of course +# likely not the case for your own data, where you'll need to do something +# similar to the two previous exercises. We will, however, sometimes in the +# course use .mat-files in the exercises. diff --git a/exercises/02450Toolbox_R/Scripts/ex1_5_4.R b/exercises/02450Toolbox_R/Scripts/ex1_5_4.R new file mode 100644 index 0000000000000000000000000000000000000000..f9e84ce7603a56274d73b58ba12b6f3cb4aadd46 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex1_5_4.R @@ -0,0 +1,121 @@ +#################### +# Exercise 1.5.4 +#################### + +rm(list = ls()) # Clear work space + +# ggplot2 for plotting (https://ggplot2.tidyverse.org/) +library(ggplot2) + +# Repeat loading from exercise 1.5.3: +library("R.matlab") +data <- readMat("./Data/iris.mat") + +X <- data$X +y <- data$y +C <- data$C[1] +M <- data$M[1] +N <- data$N[1] +attributeNames <- as.character(unlist(data$attributeNames)) +classLabels <- as.character(unlist(data$classLabels)) +classNames <- as.character(unlist(data$classNames)) + +# Organize the data in a single data frame. +data <- as.data.frame(X) +colnames(data) <- make.names(attributeNames) +data$Type <- classLabels + +# --------------------------- Classification problem --------------------------- +# The current variables X and y represent a classification problem, in +# which a machine learning model will use the sepal and petal dimensions +# (stored in the matrix X) to predict the class (species of Iris, stored in +# the variable y). A relevant figure for this classification problem could +# for instance be one that shows how the classes are distributed based on +# two attributes in matrix X: + +X_c <- X +y_c <- y +attributeNames_c <- attributeNames + +# Make valid columns names to avoid bugs. +colnames(X_c) <- make.names(attributeNames_c) +colnames(y_c) <- "Type" + +# Add blank plot with Sepal Length and Sepal Width. +myplot <- ggplot(data = data, mapping = aes(x = Sepal.Length, y = Sepal.Width, color = Type)) + +# Plot points for each sensor in separate colors +myplot <- myplot + geom_point() + +# Position legend +myplot <- myplot + theme(legend.position = c(0.85, 0.83)) + +# View plot +myplot + +# Consider, for instance, if it would be possible to make a single line in +# the plot to delineate any two groups? Can you draw a line between +# the Setosas and the Versicolors? The Versicolors and the Virginicas? + +# ----------------------------- Regression problem ----------------------------- +# Since the variable we wish to predict is petal length, it cannot any longer +# be in the data matrix X. +# We know that the petal length corresponds to the third column in data: + +X_r <- data[-3] + +# To remove entries i to j from a vector x, use x[-(i:j)]. +# To remove row i from a matrix X, you can use X=X[-i,]. +# Likewise, to remove rows i to j, use 'X=X[-(i:j),]'. +# To remove columns i to j use 'X=X[,-(i:j)]'. +# Both columns and rows may be removed simultaneously. + +# It is not a data matrix yet as it need all entries to be of the same type. +# Since the iris class information (which is now the last column in X_r) is a +# categorical variable, we will do a one-out-of-K encoding of the variable. +# A simple way of doing this is using library mltools (install.packages('mltools')) +# as well as data.table: +library(mltools) +library(data.table) + +onehot <- as.matrix(one_hot(as.data.table(factor(X_r$Type)))) +colnames(onehot) <- make.names(classNames) + +# The encoded information is now a 150x3 matrix. This corresponds to 150 +# observations, and 3 possible species. For each observation, the matrix +# has a row, and each row has two 0s and a single 1. The placement of the 1 +# specifies which of the three Iris species the observations was. + +# We need to replace the last column in X (which was the not encoded +# version of the species data) with the encoded version: +X_r <- as.matrix(cbind(X_r[-4], onehot)) +attributeNames_r <- colnames(X_r) + +y_r <- as.matrix(data[3]) +targetName_r <- colnames(y_r) + +# Now, X is of size 150x6 corresponding to the three measurements of the +# Iris that are not the petal length as well as the three variables that +# specifies whether or not a given observations is or isn't a certain type. + +# Lastly, we update M, since we now have more attributes: +N <- dim(X_r)[1] +M <- dim(X_r)[2] + +# A relevant figure for this regression problem could +# for instance be one that shows how the target, that is the petal length, +# changes with one of the predictors in X: + +i <- 1 +ggplot(data = as.data.frame(X_r), aes_string(x = attributeNames_r[i], y = y_r)) + + geom_point() + + ggtitle("Iris regression problem") + + theme(plot.title = element_text(hjust = 0.5)) + +# Consider if you see a relationship between the predictor variable on the +# x-axis (the variable from X) and the target variable on the y-axis (the +# variable y). Could you draw a straight line through the data points for +# any of the attributes. +# Note that, when i is 3, 4, or 5, the x-axis is based on a binary +# variable, in which case a scatter plot is not as such the best option for +# visualizing the information. diff --git a/exercises/02450Toolbox_R/Scripts/ex1_5_5.R b/exercises/02450Toolbox_R/Scripts/ex1_5_5.R new file mode 100644 index 0000000000000000000000000000000000000000..14d2c6f49e7a4a2d5f70f7abefb51f17ba4079eb --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex1_5_5.R @@ -0,0 +1,167 @@ +#################### +# Exercise 1.5.5 +#################### + +rm(list = ls()) # Clear work space + +library(mltools) +library(data.table) + +# We start by defining the path to the file that we're we need to load. +# Upon inspection, we saw that the messy_data.data was in fact a file in the +# format of a CSV-file with a ".data" extension instead. +file_path <- "./Data/messy_data/messy_data.data" + +# First of we simply read the file in using read.csv, however, there is a lot +# of different csv formats. See " ?read.csv ". The CSV-file is tab-separated +# hence we will use "read.delim". We also need to specify that the header +# is in the second row, and so to skip the first line. +# Lastly, we tell it that if there are any empty elements, replace them with +# NA (not available) + +messy_data <- read.delim(file_path, skip = 1, na.strings = c("", NA)) +head(messy_data) + +# We also need to remove the added header line in the .data file which seems +# to have included a shortend form the variables (check head(messy_data)): +messy_data <- messy_data[-(1), ] + + +# We extract the attribute names: +attributeNames <- colnames(messy_data) + +# As we progress through this script, we might change which attributes are +# stored where. For simplicity in presenting the processing steps, we won't +# keep track of those changes in attributeNames in this example script. + +# The last column is a unique string for each observation defining the +# car make and model. We decide to extract this in a variable for itself +# for now, and then remove it from messy_data: +car_names <- messy_data["carname"] +messy_data <- messy_data[, -(9)] + +# Try to look at messy_data and see if you can identify the formatting issues +# that we need to handle. + +# First off, we remove the question marks in displacement and replace +# them NA ('Not Available'). The dplyr package ("install.packages("dplyr")") is +# great to manipulate data in data frames. +library(dplyr) +library(stringr) + +messy_data$displacement <- na_if(messy_data$displacement, "?") + +# Similarly, we remove the formatting for a thousand separator that is +# present for the weight attribute: + +messy_data <- mutate(messy_data, weight = str_remove(weight, "'")) + +# And lastly, we replace all the commas that were used as decimal separators +# in the acceleration attribute with dots: +messy_data <- mutate(messy_data, acceleration = str_replace(acceleration, ",", ".")) + +# The data has some zero values that the README.txt told us were missing +# values - this was specifically for the attributes mpg and displacement, +# so we're careful only to replace the zeros in these attributes, since a +# zero might be correct for some other variables: + +messy_data <- mutate(messy_data, mpg = replace(mpg, mpg == 0, NA)) +messy_data <- mutate(messy_data, displacement = replace(displacement, displacement == 0, NA)) + +# We later on find out that a value of 99 for the mpg is not value that is +# within reason for the MPG of the cars in this data set. The observations +# that has this value of MPG is therefore incorrect, and we should treat +# the value as missing. How would you add a line of code to this data +# cleanup script to account for this information? + +messy_data <- mutate(messy_data, mpg = replace(mpg, mpg == 99, NA)) +# messy_data$mpg[messy_data$mpg == 99] <- NA + +# Lastly, some of the columns contains strings (see messy_data$mpg). +# As our clean-up is done we can safely convert all columns to numerical values. + +messy_data <- mutate_all(messy_data, as.numeric) + +## X,y-format +# If the modelling problem of interest was a classification problem where +# we wanted to classify the origin attribute, we could now identify obtain +# the data in the X,y-format as so: +X_c <- messy_data[, -8] +y_c <- messy_data[, 8] + +# However, if the problem of interest was to model the MPG based on the +# other attributes (a regression problem), then the X, y-format is +# obtained as: +X_r <- messy_data[, -1] +y_r <- messy_data[, 1] + +# Since origin is categorical variable, we can do as in previous exercises +# and do a one-out-of-K encoding. +# The README.txt doesn't supply a lot of information about what the +# levels in the origin variable mean, you'd have to either make an educated +# guess based on the values in the context, or preferably obtain the +# information from any papers that might be references in the README. +# In this case, you can inspect origin and car_names, to see that (north) +# american makes are all value 1 (try looking at car_names[messy_data$origin==1,], +# whereas origin value 2 is European, and value 3 is Asian. + +X_r <- mutate(X_r, origin = replace(origin, origin == 1, "American")) +X_r <- mutate(X_r, origin = replace(origin, origin == 2, "European")) +X_r <- mutate(X_r, origin = replace(origin, origin == 3, "Asian")) + +X_r$origin <- as.factor(X_r$origin) +X_r <- as.matrix(one_hot(as.data.table(X_r))) +attributeNames_r <- colnames(X_r) +targetName_r <- attributeNames[1] + +## Missing values +# In the above X,y-matrices, we still have the missing values. In the +# following we will go through how you could go about handling the missing +# values before making your X,y-matrices as above. + +# Once we have identified all the missing data, we have to handle it +# some way. Various approaches can be used, but it is important +# to keep it mind to never do any of them blindly. Keep a record of what +# you do, and consider/discuss how it might affect your modelling. + +# The simplest way of handling missing values is to drop any records +# that display them, we do this by first determining where there are +# missing values: +data_drop_missing_obs <- na.omit(messy_data) +# This reduces us to 15 observations of the original 29. + +# Another approach is to first investigate where the missing values are. +# A quick way to do this is to visually look at the missing_idx: +missing_idx <- apply(messy_data, 2, is.na) +C <- t(missing_idx) + +par(xaxt = "n", yaxt = "n") +image(C, + xlab = "Attributes", ylab = "Observations", + main = "Visual inspection of missing values" +) + +# From such a plot, we can see that the issue is the third column, the +# displacement attribute. This can be confirmed by e.g. doing: +# colSums(missing_idx) +# which shows that 12 observations are missing a value in the displacement column. +# Therefore, another way to move forward is to disregard displacement +# (for now) and remove the attribute. We then remove the few remaining +# observations with missing values: + +data_wo_displacement <- messy_data[, -3] + +data_drop_disp_then_missing <- na.omit(data_wo_displacement) +# Now we have kept all but two of the observations. This however, doesn't +# necessarily mean that this approach is superior to the previous one, +# since we have now also lost any and all information that we could have +# gotten from the displacement attribute. + +# One could impute the missing values - "guess them", in some +# sense - while trying to minimize the impact of the guess. +# A simply way of imputing them is to replace the missing values +# with the median of the attribute. We would have to do this for the +# missing values for attributes 1 and 3: +data_imputed <- messy_data +data_imputed[is.na(data_imputed[, 1]), 1] <- median(data_imputed[, 1], na.rm = TRUE) +data_imputed[is.na(data_imputed[, 3]), 3] <- median(data_imputed[, 3], na.rm = TRUE) diff --git a/exercises/02450Toolbox_R/Scripts/ex2_1_1.R b/exercises/02450Toolbox_R/Scripts/ex2_1_1.R new file mode 100644 index 0000000000000000000000000000000000000000..7861e15a48b09ebbb0a87f27a7366b651ff048d0 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex2_1_1.R @@ -0,0 +1,36 @@ +#################### +# Exercise 2.1.1 +#################### + +rm(list = ls()) # Clear work space + +# Read data into R +data <- read.csv("./Data/nanonose.csv", check.names = FALSE) + +# Extract class labels of observations +classLabels <- colnames(data) +classLabels <- classLabels[-(1:2)] + +# Extract attributes, i.e. sensor names +attributeNames <- data[3:10, 1] + +# Remove first two rows and columns and transpose data matrix +X <- t(data[-(1:2), -(1:2)]) + +# Check that dimensions are as they should be (90 rows and 8 columns) +N <- dim(X)[1] +M <- dim(X)[2] + +# Assign the class labels as row names and the attributes as column names +rownames(X) <- classLabels +colnames(X) <- attributeNames + +# Extract the class names present in data +classNames <- sort(unique(classLabels)) +C <- length(classNames) + +# Extract numeric class assignments +y <- as.numeric(as.factor(classLabels)) - 1 + +# Clean up a bit in the variables, since we'll call this script from later scripts: +rm(data) diff --git a/exercises/02450Toolbox_R/Scripts/ex2_1_2.R b/exercises/02450Toolbox_R/Scripts/ex2_1_2.R new file mode 100644 index 0000000000000000000000000000000000000000..d99b5ebcc5c289c968bc0e73da451a2d85fbb7bb --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex2_1_2.R @@ -0,0 +1,20 @@ +#################### +# Exercise 2.1.2 +#################### + +# Run ex2.1.1: +source('Scripts/ex2_1_1.R') + +# Choose which sensors to plot +i = 1 +j = 2 + +# Make simple plot +plot(X[ , i], X[ , j]) + +## Make more fancy plot +library(ggplot2) +ggplot() + geom_point(aes(x = X[ , i], y = X[ , j], color = classLabels), size=4, alpha=0.5) + + theme(legend.position = c(0.88, 0.77), legend.title= element_blank()) + + labs(x = attributeNames[i], y = attributeNames[j]) + diff --git a/exercises/02450Toolbox_R/Scripts/ex2_1_3.R b/exercises/02450Toolbox_R/Scripts/ex2_1_3.R new file mode 100644 index 0000000000000000000000000000000000000000..05b805dcee60b003f1332fd99d127e29d0a09a99 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex2_1_3.R @@ -0,0 +1,45 @@ +#################### +# Exercise 2.1.3 +#################### + +source("Scripts/ex2_1_1.R") + +# Subtract the column means form columns of X +Y <- t(apply(X, 1, "-", colMeans(X))) + +# You can check the column means using: colMeans(Y) +colMeans(Y) + +# PCA by computing SVD of Y: +s <- svd(Y) +diagS <- s$d + +rho <- diagS^2 / sum(diagS^2) + +# PCA can also be done with the built-in function prcomp. +# Confirm that you get the same result. +rho2 <- summary(prcomp(X, center = TRUE))$importance[2,] + + +threshold <- 0.9 + +xlimits <- c(1, M) +plot(rho, + type = "o", + main = "Variance explained by principal componenets", + xlab = "Principal components", + ylab = "Variance explained", + xlim = xlimits, + ylim = c(0, 1), + col = "blue" +) + +lines(cumsum(rho), type = "o", col = "orange") +lines(xlimits, c(threshold, threshold), lty = "dashed") + +legend("right", # Define position + legend = c("Individual", "Cumulative", "Threshold"), # Set strings for legend + col = c("orange", "blue", "black"), lty = c(1, 1, 2), # Match appereance of lines + cex = 1, bg = "lightblue" +) # Setup how the box looks (cex controls size) + diff --git a/exercises/02450Toolbox_R/Scripts/ex2_1_4.R b/exercises/02450Toolbox_R/Scripts/ex2_1_4.R new file mode 100644 index 0000000000000000000000000000000000000000..3b43e4700e2a6c2d4f447166eee754a0f476a04a --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex2_1_4.R @@ -0,0 +1,20 @@ +#################### +# Exercise 2.1.4 +#################### +source("Scripts/ex2_1_3.R") + +# Manual projecting data onto principal component. +Z <- s$u %*% diag(s$d) + +# Doing it with the built-in function. +Z <- prcomp(X)$x + +i <- 1 +j <- 3 + +## Make fancy plot +library(ggplot2) +ggplot() + + geom_point(aes(x = Z[, i], y = Z[, j], color = classLabels), size = 4, alpha = 0.5) + + theme(legend.position = c(0.88, 0.22), legend.title = element_blank()) + + labs(x = colnames(Z)[i], y = colnames(Z)[j]) diff --git a/exercises/02450Toolbox_R/Scripts/ex2_1_5.R b/exercises/02450Toolbox_R/Scripts/ex2_1_5.R new file mode 100644 index 0000000000000000000000000000000000000000..4441f4c2b54c833f1008794ce7799a4aff91738e --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex2_1_5.R @@ -0,0 +1,45 @@ +#################### +# Exercise 2.1.5 +#################### +source("Scripts/ex2_1_1.R") + +Y <- t(apply(X, 1, "-", colMeans(X))) # subtract the column means form columns of X + +# Computing PCA: +pca <- prcomp(X) +V <- pca$rotation +Z <- pca$x + +# We saw in 2.1.3 that the first 3 components explained more than 90 +# percent of the variance. Let's look at their coefficients: +pcs <- 1:3 +test <- as.data.frame(melt(data.table(V[, pcs]))) +ggplot(test, aes(x = rep(1:8, length(pcs)), y = value, fill=variable)) + + geom_bar(position="dodge", stat = "identity") + + labs(fill="PC", x = "Attributes", y = "Component coefficients") + +# Inspecting the plot, we see that the 2nd principal component has large +# (in magnitude) coefficients for attributes A, E and H. We can confirm +# this by looking at it's numerical values directly, too: +cat("PC2:", V[, 1]) + +# How does this translate to the actual data and its projections? +# Looking at the data for water: + +# Projection of water class onto the 2nd principal component. +water <- Y[y == 4, ] +cat("First water observation:", water[1, ]) + +# Based on the coefficients and the attribute values for the observation +# displayed, would you expect the projection onto PC2 to be positive or +# negative - why? Consider *both* the magnitude and sign of *both* the +# coefficient and the attribute! + +# You can determine the projection by (remove comments): +print("...and its projection onto PC2") +print(as.numeric(t(water[1, ]) %*% V[, 2])) + +# Try to explain why. +# This is equivalent to: +Z[1, 2] + diff --git a/exercises/02450Toolbox_R/Scripts/ex2_1_6.R b/exercises/02450Toolbox_R/Scripts/ex2_1_6.R new file mode 100644 index 0000000000000000000000000000000000000000..f0a329dd022b47e14de6af383acfedf4a86092b9 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex2_1_6.R @@ -0,0 +1,102 @@ +#################### +# Exercise 2.1.6 +#################### +source("Scripts/ex2_1_1.R") + +# Try this *later* (for last), and explain the effect X_s = X +# Make a to be "scaled" version of X +# X_s[, 3] = 100*X_s[, 3] # Scale/multiply attribute C with a factor 100 +# Use X_s instead of X to in the script below to see the difference. +# Does it affect the two columns in the big plot equally? + +stds <- apply(X, 2, sd) +par(mfrow = c(1, 1)) +barplot(stds, ylab = "NanoNose: attribute standard deviation") + +# ------------------------------------------- +# Investigate how standardization affects PCA +# ------------------------------------------- + +# Subtract the column means form columns of X +Y1 <- t(apply(X, 1, "-", colMeans(X))) + +# Subtract the column means form columns of X +Y2 <- t(apply(X, 1, "-", colMeans(X))) + +# Devide by the standard deviation in Y2 +Y2 <- t(apply(Y2, 1, "*", 1 / stds)) + +# Check that the standard deviation is now one for all attributes by e.g.: +# apply(Y2, 2, sd) +i <- 1 +j <- 2 +threshold <- 0.9 + +titles <- list("Zero-mean", "Zero-mean and unit variance") + +for (k in 1:2) { + + # PCA by computing SVD of either Y1 or Y2 + if (k == 1) { + s <- svd(Y1) + } else { + s <- svd(Y2) + s$u <- -s$u # we flip U and V to obtain comparable visualizations + s$v <- -s$v # and it doesn't impact the PCA. + } + + rho <- s$d^2 / sum(s$d^2) + U <- s$u + S <- diag(s$d) + V <- s$v + Z <- U %*% S + + # Plot projection of data onto chosen principal components + dev.new() + par(mfcol = c(1, 1), pty = "s") + plot(c(min(Z[, i]), max(Z[, i])), c(min(Z[, j]), max(Z[, j])), + xlab = paste("PC", toString(i)), ylab = paste("PC", toString(j)), + main = paste(titles[k], "\nProjection"), type = "n" + ) + + # plot points for each sensor in separate colors + cols <- colorRamps::matlab.like2(C) + for (c in 0:C - 1) { + points(Z[y == c, i], Z[y == c, j], pch = 19, cex = 2) + } + legend("bottomright", legend = classNames, fill = cols) + + # Plot coefficients in the PC-space + dev.new() + par(mfcol = c(1, 1), pty = "s") + plot(c(-1, 1), c(-1, 1), + xlab = paste("PC", toString(i)), ylab = paste("PC", toString(j)), + type = "n", + main = paste(titles[k], "\nAttribute coefficients") + ) + arrows(integer(M), integer(M), + V[, i], V[, j], + length = .1, + col = "blue" + ) + text(V[, i] * 1.1, V[, j] * 1.1, attributeNames, cex = 1.5) + # Add a unit circle + th <- seq(0, 2.1 * pi, 0.1) + lines(cos(th), sin(th)) + + # Plot the variance explained + xlimits <- c(1, M) + dev.new() + par(mfcol = c(1, 1), pty = "s") + plot(cumsum(rho), + type = "o", + xlab = "Principal components", + ylab = "Cum. var. explained", + xlim = xlimits, + ylim = c(.65, 1.02), + col = "blue", + main = paste(titles[k], "\nVariance explanied") + ) + grid() + lines(xlimits, c(threshold, threshold), lty = "dashed") +} diff --git a/exercises/02450Toolbox_R/Scripts/ex2_2_1.R b/exercises/02450Toolbox_R/Scripts/ex2_2_1.R new file mode 100644 index 0000000000000000000000000000000000000000..ff04967032ed9c6df0d9c33ec81aef0f5aeafdbc --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex2_2_1.R @@ -0,0 +1,42 @@ +#################### +# Exercise 2.2.1 +#################### + +rm(list = ls()) # Clear work space + +# Load the library R.matlab to enable the function readMat, +# which allows R to read the matlab .mat format. +# Install with "install.packages("R.matlab")" +library(R.matlab) + +# The row of training data that we will look at +i <- 1 + +# Read in the data +data <- readMat(file.path("Data", "zipdata.mat")) + +# Check that the structure dat contains two matrices, testdata and traindata +names(data) + +# The features, i.e. images of digits, are stored in the rows of traindata, +# except for the first column. The first column contains the class of the row, +# i.e. the digit identity +X <- data$traindata[, 2:dim(data$traindata)[2]] +y <- data$traindata[, 1] + +par(mfrow = c(1, 2)) + +# View the i'th row of X +image(as.matrix(X[i, ]), axes = FALSE, xlab = "Pixel number", main = "Digit in vector format") + +# Make ticks corresponding to pixels, i.e. values in row i +axis(1, at = (1:length(X[i, ])) / length(X[i, ]), labels = 1:length(X[i, ])) + +# Extract the i'th row of X and store it as the matrix I +I <- X[i, ] + +# Make the matrix I have dimensions 16 by 16 +dim(I) <- c(16, 16) + +# view the digit in the i'th row of X as an image. The function image rotates the matrix, so we need to rearrange the columns in the matrix I in order to get the correct view of the digit. +image(I[, ncol(I):1], col = gray((32:0) / 32), main = "Digit as an image") diff --git a/exercises/02450Toolbox_R/Scripts/ex2_2_2.R b/exercises/02450Toolbox_R/Scripts/ex2_2_2.R new file mode 100644 index 0000000000000000000000000000000000000000..997d298cafa7666e850bf4b6854cc7a548b20897 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex2_2_2.R @@ -0,0 +1,105 @@ +#################### +# Exercise 2.2.2 +#################### +source("Scripts/ex2_2_1.R") + + +# Choose which digits to consider in the analysis + +# This is like in the exercise +digits_to_inspect <- 0:1 + +# If you want to try more digits +# digits_to_inspect = 0:9 + +# Find the observations that relate to the digits chosen in digits_to_inspect +inds <- !is.na(match(y, digits_to_inspect)) + +# extract the rows of X found above +X <- X[inds, ] +y <- y[inds] + +# Get the column means of X, subtract them from each row, +# and perform and SVD on the resulting matrix +means <- colMeans(X) +Xzeromean <- t(apply(X, 1, "-", means)) +svdres <- svd(Xzeromean) + +# Extract the matrices containing the left and right singular vectors, respectively +U <- svdres$u +V <- svdres$v + +# ---------------------------------------------------- +# Calculate and plot the variance explained by the PCs +# ---------------------------------------------------- + +pcvariance <- svdres$d^2 / sum(svdres$d^2) + +{ + par(mfrow=c(1,1)) + plot(cumsum(pcvariance), main = "Data variance explained by PCs", + xlab = "Number of PCs included in variance sum", + ylab = "Proportion of variance explained") + + # First 22 PCs should explain 90% + abline(v = 22) +} + +# --------------------------------------------------------------------- +# Plot principal components 1 and 2 against each other in a scatterplot, +# i.e. plot the projections of observations onto PCs 1 and 2 +# --------------------------------------------------------------------- + +# These two ways of calculating pc_projections are equivalent +pc_projections <- Xzeromean %*% V +pc_projections <- U %*% diag(svdres$d) + +pcproj1 <- pc_projections[, 1] +pcproj2 <- pc_projections[, 2] + +{ + par(mfrow=c(1,1)) + plot(c(min(pcproj1), max(pcproj1)), c(min(pcproj2), max(pcproj2)), + type = "n", xlab = "PC 1", ylab = "PC 2") + points(pcproj1[y == 0], pcproj2[y == 0], col = "red") + points(pcproj1[y == 1], pcproj2[y == 1], col = "green") + legend("topleft", legend = c("0", "1"), fill = c("red", "green")) +} + + +# ---------------------------------- +# Reconstruction of images of digits +# ---------------------------------- + +# Number of PCs to include in reconstruction of digits +K <- 5 + +# Digits to visualize +nD <- 60:63 + +reconstructions <- pc_projections[, 1:K] %*% t(V[, 1:K]) + +par(mar = c(1, 1, 1, 1)) +layout(matrix(c(1:length(nD), (length(nD) + 1):(2 * length(nD))), 2, length(nD), byrow = FALSE)) +for (d in 1:length(nD)) { + origImage <- X[nD[d], ] + dim(origImage) <- c(16, 16) + image(origImage[, ncol(origImage):1], main = "Original", col = gray((32:0) / 32)) + reconstructedImage <- reconstructions[nD[d], ] + means + dim(reconstructedImage) <- c(16, 16) + image(reconstructedImage[, ncol(reconstructedImage):1], main = "Reconstruction", col = gray((32:0) / 32)) +} + +# ------------- +# Visualize PCs +# ------------- + +# visualize the first 12 PCs +par(mfrow = c(3, 4), mar = c(2, 2, 2, 2)) +for (nth_pc in 1:12) { + pc <- t(V[, nth_pc]) + dim(pc) <- c(16, 16) + # view image of PC + image(pc[, ncol(pc):1], col = gray((32:0) / 32), main = paste("PC ", nth_pc)) +} + diff --git a/exercises/02450Toolbox_R/Scripts/ex2_3_1.R b/exercises/02450Toolbox_R/Scripts/ex2_3_1.R new file mode 100644 index 0000000000000000000000000000000000000000..39726ea5f21ccd4bb41fc140f5df9f6542b34891 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex2_3_1.R @@ -0,0 +1,61 @@ +#################### +# Exercise 2.3.1 +#################### + +rm(list = ls()) # Clear work space + +library(FNN) +library(R.matlab) + +# Read in the data +data <- readMat(file.path("Data", "zipdata.mat")) + +# Check that the structure dat contains two matrices, testdata and traindata +names(data) + +# The features, i.e. images of digits, are stored in the rows of traindata, +# except for the first column. The first column contains the class of the row, +# i.e. the digit identity +X <- data$traindata[, 2:dim(data$traindata)[2]] +y <- data$traindata[, 1] + +Xtest <- data$testdat[, 2:dim(data$testdat)[2]] +ytest <- data$testdat[, 1] + +# This is like in the exercise +digits_to_inspect <- 0:1 + +# If you want to try more digits +# digits_to_inspect = 0:9 + +# Find the observations that relate to the digits chosen in digits_to_inspect +inds <- !is.na(match(y, digits_to_inspect)) +indstest <- !is.na(match(ytest, digits_to_inspect)) + +# Extract the rows of X found above +X <- X[inds, ] +y <- y[inds] +Xtest <- Xtest[indstest, ] +ytest <- ytest[indstest] + + +# Get the column means of X, subtract them from each row, +# and perform and SVD on the resulting matrix +means <- colMeans(X) +Xzeromean <- t(apply(X, 1, "-", means)) +Xtestzeromean <- t(apply(Xtest, 1, "-", means)) +svdres <- svd(Xzeromean) + +# Extract the matrices containing the left and right singular vectors, respectively +U <- svdres$u +V <- svdres$v + +K <- 5 # Number of principal components to use +pc_projections <- Xzeromean %*% V[, 1:K] +pc_projectionstest <- Xtestzeromean %*% V[, 1:K] + +preds <- knn(pc_projections, pc_projectionstest, cl = y) + +error_rate <- mean(preds != ytest) +print(error_rate) + diff --git a/exercises/02450Toolbox_R/Scripts/ex3_1_2.R b/exercises/02450Toolbox_R/Scripts/ex3_1_2.R new file mode 100644 index 0000000000000000000000000000000000000000..d3a68728715b5ebcd46797215edaea83f389e448 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex3_1_2.R @@ -0,0 +1,19 @@ +#################### +# Exercise 3.1.2 +#################### + +rm(list = ls()) # Clear work space + +library(tm) +textfolder = "./Data/" + +(docs <- Corpus(DirSource(textfolder, pattern="textDocs*"), readerControl = list(language="en"))) + +inspect(docs) + +docs_nopunct <- tm_map(docs, removePunctuation) +dtm <- DocumentTermMatrix(docs_nopunct) + +inspect(dtm) + + diff --git a/exercises/02450Toolbox_R/Scripts/ex3_1_3.R b/exercises/02450Toolbox_R/Scripts/ex3_1_3.R new file mode 100644 index 0000000000000000000000000000000000000000..4180e92904af380e5417c81b30f2044db6102ea0 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex3_1_3.R @@ -0,0 +1,23 @@ +#################### +# Exercise 3.1.3 +#################### + +rm(list = ls()) # Clear work space + +library(tm) +textfolder <- "./Data/" + +(docs <- Corpus(DirSource(textfolder, pattern = "textDocs*"), readerControl = list(language = "en"))) + +inspect(docs) +docs_nopunct <- tm_map(docs, removePunctuation) +dtm <- DocumentTermMatrix(docs_nopunct) + +mystopwords <- scan("./Data/stopWords.txt", character(0)) + +docs_nostopwords <- tm_map(docs, removeWords, mystopwords) +inspect(docs_nostopwords) +dtm_nostopwords <- DocumentTermMatrix(docs_nostopwords, control = list(removePunctuation = TRUE, stopwords = TRUE)) +inspect(dtm_nostopwords) + +control <- list(stopwords = TRUE) diff --git a/exercises/02450Toolbox_R/Scripts/ex3_1_4.R b/exercises/02450Toolbox_R/Scripts/ex3_1_4.R new file mode 100644 index 0000000000000000000000000000000000000000..5ad1d634acf03543105e49b1e1e8ee6a0ba61870 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex3_1_4.R @@ -0,0 +1,29 @@ +#################### +# Exercise 3.1.4 +#################### + +rm(list = ls()) # Clear work space + +library(tm) # install.packages("tm") +library(SnowballC) # install.packages("SnowballC") + +textfolder <- "./Data/" + +(docs <- Corpus(DirSource(textfolder, pattern = "textDocs*"), readerControl = list(language = "en"))) + +inspect(docs) +docs_nopunct <- tm_map(docs, removePunctuation) +dtm <- DocumentTermMatrix(docs_nopunct) + +mystopwords <- scan("./Data/stopWords.txt", character(0)) + +docs_nostopwords <- tm_map(docs_nopunct, removeWords, mystopwords) +dtm_nostopwords <- DocumentTermMatrix(docs_nostopwords, control = list(removePunctuation = TRUE, stopwords = TRUE)) +inspect(dtm_nostopwords) + +docs_stemmed <- tm_map(docs_nostopwords, stemDocument, language = "english") + + +inspect(docs_stemmed) +dtm_stemmed <- DocumentTermMatrix(docs_stemmed, control = list(stopwords = TRUE)) +inspect(dtm_stemmed) diff --git a/exercises/02450Toolbox_R/Scripts/ex3_1_5.R b/exercises/02450Toolbox_R/Scripts/ex3_1_5.R new file mode 100644 index 0000000000000000000000000000000000000000..efe3e7b136de8bd693240e8f8168f4e460d629a9 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex3_1_5.R @@ -0,0 +1,19 @@ +#################### +# Exercise 3.1.5 +#################### + +source("Scripts/ex3_1_4.R") +source("Tools/similarity.R") + +size <- dim(dtm_stemmed) +cosmeas <- c() +q <- c(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0) +dtmat <- matrix(dtm_stemmed, dtm_stemmed$nrow, dtm_stemmed$ncol) + +for (irow in 1:size[1]) { + doc <- dtm_stemmed[irow, ] + cosmeas[irow] <- similarity(t(dtmat[irow, ]), t(q), 'cos') +} + +print("Cosine similarity from q to docs: ") +print(cosmeas) diff --git a/exercises/02450Toolbox_R/Scripts/ex3_2_1.R b/exercises/02450Toolbox_R/Scripts/ex3_2_1.R new file mode 100644 index 0000000000000000000000000000000000000000..725f7564a291d7ba29252e89ef5d0f0c1adc7679 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex3_2_1.R @@ -0,0 +1,17 @@ +#################### +# Exercise 3.2.1 +#################### + +rm(list = ls()) # Clear work space + +x <- c(-0.68, -2.11, 2.39, 0.26, 1.46, 1.33, 1.03, -0.41, -0.33, 0.47) + +mean(x) +sd(x) +median(x) +diff(range(x)) + +# Range returns the minimum and maximum of the vector x. +# To get the range, we must take the maximum minus the minimum. +# We do this using the function diff, which finds differences +# between consecutive elements in a vector. diff --git a/exercises/02450Toolbox_R/Scripts/ex3_3_1.R b/exercises/02450Toolbox_R/Scripts/ex3_3_1.R new file mode 100644 index 0000000000000000000000000000000000000000..91eccf7115949659685286b1285dced806f6039e --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex3_3_1.R @@ -0,0 +1,67 @@ +#################### +# Exercise 3.3.1 +#################### +rm(list = ls()) # Clear work space) + +source("Tools/binarize.R") +source("Tools/similarity.R") + +# Image to use as query +i <- 1 + +# Similarity: 'SMC', 'Jaccard', 'ExtendedJaccard', 'Cosine', 'Correlation' +SimilarityMeasure <- "Jaccard" + +library(R.matlab) +data <- readMat(file.path("./Data/digits.mat")) + +# You can also try it on the faces dataset: +# data <- readMat(file.path("./Data/wildfaces_grayscale.mat")) + +names(data) +X <- data$X +dimX <- dim(X) +N <- dimX[1] +M <- dimX[2] +Q <- matrix(X[i, ], ncol = M) # The query image +Y <- X[-i, ] # All images except the i'th + +# The next function is in the setup.R, load it if you have not already +# source("setup.R") +sim <- similarity(Q, Y, SimilarityMeasure) + +# Sort similarities +sort_result <- sort(sim, decreasing = TRUE, index.return = TRUE) +val <- sort_result$x +j <- sort_result$ix +nj <- length(j) + +# Plot five most similar and dissimilar images +npics <- 5 +ndigits <- 4 +mostsim <- j[1:npics] +leastsim <- j[(nj - npics + 1):nj] + +imageDim <- c(sqrt(M), sqrt(M)) +dim(Q) <- imageDim # reshape Q + +{ + dev.new(width = 2.5, height = 3) + image(t(Q[nrow(Q):1, ]), main = "Query image", col = gray((0:32) / 32)) +} + +{ + dev.new(width = 2 * npics, height = 5) + layout(matrix(c(1:length(mostsim), (length(mostsim) + 1):(2 * length(mostsim))), 2, length(mostsim), byrow = FALSE)) + for (d in 1:npics) { + similarImage <- Y[mostsim[d], ] + dim(similarImage) <- imageDim + image(t(similarImage[nrow(similarImage):1, ]), main = paste("Similarity:", format(val[d], digits = ndigits)), col = gray((0:32) / 32)) + + + dissimilarImage <- Y[leastsim[d], ] + dim(dissimilarImage) <- imageDim + + image(t(dissimilarImage[nrow(dissimilarImage):1, ]), main = paste("Similarity:", format(val[nj - d + 1], digits = ndigits)), col = gray((0:32) / 32)) + } +} diff --git a/exercises/02450Toolbox_R/Scripts/ex3_3_2.R b/exercises/02450Toolbox_R/Scripts/ex3_3_2.R new file mode 100644 index 0000000000000000000000000000000000000000..3cdc43ec18cec69145b8c9e47da735c2b53d1e34 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex3_3_2.R @@ -0,0 +1,22 @@ +#################### +# Exercise 3.3.2 +#################### +source("Tools/similarity.R") + +# Generate two data objects with M random (standard uniformly distributed) attributes +M = 5; +x = as.matrix(runif(M)); +y = as.matrix(runif(M)); + + +# Two constants +a = 1.5; +b = 1.5; + +# Check the statements in the exercise +similarity(x,y,'cos') - similarity(a*x,y,'cos') +similarity(x,y,'ext') - similarity(a*x,y,'ext') +similarity(x,y,'cor') - similarity(a*x,y,'cor') +similarity(x,y,'cos') - similarity(b+x,y,'cos') +similarity(x,y,'ext') - similarity(b+x,y,'ext') +similarity(x,y,'cor') - similarity(b+x,y,'cor') diff --git a/exercises/02450Toolbox_R/Scripts/ex4_1_1.R b/exercises/02450Toolbox_R/Scripts/ex4_1_1.R new file mode 100644 index 0000000000000000000000000000000000000000..d4716b7e6498910b1045ba7fe5a4b34a079e516f --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_1_1.R @@ -0,0 +1,26 @@ +#################### +# Exercise 4.1.1 +#################### +rm(list = ls()) # Clear work space + +# Number of samples +N <- 100 + +# Mean +mu <- 17 + +# Standard deviation +s <- 2 + +# Number of bins in histogram +NBins <- 20 + +# Generate samples from the Normal distribution +X <- rnorm(N, mean = mu, sd = s) + +# Plot a histogram +{ + par(mfrow = c(1, 2)) + plot(X, main = "Data") + hist(X, breaks = NBins, main = "Histogram of Data") +} diff --git a/exercises/02450Toolbox_R/Scripts/ex4_1_2.R b/exercises/02450Toolbox_R/Scripts/ex4_1_2.R new file mode 100644 index 0000000000000000000000000000000000000000..ddb7d43b6c0874667f899a7bb6c581dcbe30cac6 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_1_2.R @@ -0,0 +1,31 @@ +#################### +# Exercise 4.1.2 +#################### +rm(list = ls()) # Clear work space + +# Number of samples +N <- 100 + +# Mean +mu <- 17 + +# Standard deviation +s <- 2 + +# Number of bins in histogram +NBins <- 20 + +# Generate samples from the Normal distribution +X <- rnorm(N, mean = mu, sd = s) + +# Plot a histogram +{ + par(mfrow = c(1, 2)) + plot(X, main = "Generated data") + hist(X, breaks = NBins, main = "Histogram of generated data") +} + +# Compute empirical mean and standard deviation +(mu_ <- mean(X)) +(s_ <- sd(X)) + diff --git a/exercises/02450Toolbox_R/Scripts/ex4_1_3.R b/exercises/02450Toolbox_R/Scripts/ex4_1_3.R new file mode 100644 index 0000000000000000000000000000000000000000..76fb13ebda1e787b01af6133e3ceb64d009f7ce5 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_1_3.R @@ -0,0 +1,33 @@ +#################### +# Exercise 4.1.3 +#################### +rm(list = ls()) # Clear work space + +# Number of samples +N <- 1000 + +# Mean +mu <- 17 + +# Standard deviation +s <- 2 + +# Number of bins in histogram +NBins <- 50 + +# Generate samples from the Normal distribution +X <- rnorm(N, mean = mu, sd = s) + +# Plot a histogram +{ + par(mfrow=c(1,1)) + res <- hist(X, breaks = NBins, freq = FALSE) + x <- res$mids + x <- seq(from = min(x), to = max(x), length.out = 1000) + lines(x, dnorm(x, mean = mu, sd = s)) +} + +# Compute empirical mean and standard deviation +(mu_ <- mean(X)) +(s_ <- sd(X)) + diff --git a/exercises/02450Toolbox_R/Scripts/ex4_1_4.R b/exercises/02450Toolbox_R/Scripts/ex4_1_4.R new file mode 100644 index 0000000000000000000000000000000000000000..86607cf49ad4750713195466cd5274942c4af4e2 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_1_4.R @@ -0,0 +1,24 @@ +#################### +# Exercise 4.1.4 +#################### +rm(list = ls()) # Clear work space + +# Library for multivariate normal distribution +library(MASS) # install.packages("MASS") +?mvrnorm + +# Number of samples +N <- 1000 + +# Mean +mu <- c(13, 17) + +# Covariance matrix +S <- matrix(c(4, 3, 3, 9), nrow = 2, byrow = TRUE) + +# Generate samples from the Normal distribution +X <- mvrnorm(N, mu = mu, Sigma = S) + +# Inspect the dimensions of the matrix containing +# the generated multivariate normal vectors. +dim(X) diff --git a/exercises/02450Toolbox_R/Scripts/ex4_1_5.R b/exercises/02450Toolbox_R/Scripts/ex4_1_5.R new file mode 100644 index 0000000000000000000000000000000000000000..8a34abf7928a9130e1f6a660c7db14677956b703 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_1_5.R @@ -0,0 +1,45 @@ +#################### +# Exercise 4.1.5 +#################### +rm(list = ls()) # Clear work space + +# load the package "gplots", which contains the function hist2d for making 2-dimensional histograms. If the package is not already installed on your computer, an error will result from the function call library(gplots). In that case, install the package using install.packages("gplots") and then run library(gplots) again. Same for the package MASS. +#library(gplots) + +library(MASS) +# Number of samples +N <- 1000 + +# Mean +mu <- c(13, 17) + +# Standard deviation of x1 +s1 <- 2 + +# Standard deviation of x2 +s2 <- 3 + +# Correlation between x1 and x2 +corr <- 0 + +# Covariance matrix +S <- matrix(c(s1^2, corr * s1 * s2, corr * s1 * s2, s2^2), nrow = 2, byrow = TRUE) + +# Number of bins in histogram +NBins <- 20 + +# Generate samples from the Normal distribution +X <- mvrnorm(N, mu = mu, Sigma = S) + +# Plot scatter plot of data +{ + xrange <- mu[1] + S[1, 1] * c(-3, 3) + yrange <- mu[2] + S[2, 2] * c(-3, 3) + par(mfrow = c(1, 2)) + plot(xrange, yrange, type = "n", ylab = "x2", xlab = "x1", + main = "Scatter plot of data") + points(X[, 1], X[, 2]) + k <- kde2d(X[,1], X[,2]) + image(k, col = gray(32:0 / 32), + main = "2-D Normal distribution", xlab = "x1", ylab = "x2") +} diff --git a/exercises/02450Toolbox_R/Scripts/ex4_1_6.R b/exercises/02450Toolbox_R/Scripts/ex4_1_6.R new file mode 100644 index 0000000000000000000000000000000000000000..ab9e60f75eb7fa4c121a0035c2a3f677fb114e7a --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_1_6.R @@ -0,0 +1,59 @@ +#################### +# Exercise 4.1.6 +#################### +rm(list = ls()) # Clear work space + +library(MASS) + +# Digits to include in analysis (to include all, n = 1:10) +n <- c(1) # c(1,5,9) +n <- sort(n) + +# Load the library R.matlab to enable the function readMat, +# which allows R to read the matlab .mat format. +library(R.matlab) # install.packages("R.matlab") + +# The row of training data that we will look at +i <- 1 + +# Read in the data +data <- readMat(file.path("Data", "zipdata.mat")) + +# Check that the structure data contains two matrices, testdata and traindata +names(data) + +ncols <- ncol(data$traindata) + +# Extract digits +X <- data$traindata[, 2:ncols] +y <- data$traindata[, 1] +classNames <- c("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10") +classLabels <- classNames[y + 1] + +# Remove digits that are not to be inspected +j <- match(y, n) +X <- X[!is.na(j), ] +classLabels <- classLabels[!is.na(j)] +classNames <- classNames[n + 1] +y <- y[!is.na(j)] +for (k in 0:(length(n) - 1)) +{ + classlab <- n[k + 1] + y[y == classlab] <- k +} + +# Compute mean, standard deviations, and covariance matrix +mu <- colMeans(X) +s <- apply(X, 2, sd) +S <- cov(X) + +# Plot result +{ + par(mfrow = c(1, 2)) + I <- mu + dim(I) <- c(16, 16) + image(I[, 16:1], main = "Digits: Mean", col = gray(32:0 / 32)) + I <- s + dim(I) <- c(16, 16) + image(I[, 16:1], main = "Digits: SD", col = gray(32:0 / 32)) +} diff --git a/exercises/02450Toolbox_R/Scripts/ex4_1_7.R b/exercises/02450Toolbox_R/Scripts/ex4_1_7.R new file mode 100644 index 0000000000000000000000000000000000000000..2f22bd6b92d1dbc90fa3fdc9ea2fcae3cacc7cd7 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_1_7.R @@ -0,0 +1,74 @@ +#################### +# Exercise 4.1.7 +#################### +rm(list = ls()) # Clear work space + +library(MASS) + +# Digits to include in analysis (to include all, n = 1:10) +n <- c(1) # c(1,5,9) +n <- sort(n) + +# Load the library R.matlab to enable the function readMat, +# which allows R to read the matlab .mat format. +library(R.matlab) # install.packages("R.matlab") + +# The row of training data that we will look at +i <- 1 + +# Read in the data +data <- readMat(file.path("Data", "zipdata.mat")) + +# Check that the structure data contains two matrices, testdata and traindata +names(data) + +ncols <- ncol(data$traindata) + +# Extract digits +X <- data$traindata[, 2:ncols] +y <- data$traindata[, 1] +classNames <- c("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10") +classLabels <- classNames[y + 1] + +# Remove digits that are not to be inspected +j <- match(y, n) +X <- X[!is.na(j), ] +classLabels <- classLabels[!is.na(j)] +classNames <- classNames[n + 1] +y <- y[!is.na(j)] +for (k in 0:(length(n) - 1)) +{ + classlab <- n[k + 1] + y[y == classlab] <- k +} + +# Compute mean, standard deviations, and covariance matrix +mu <- colMeans(X) +s <- apply(X, 2, sd) +S <- cov(X) + +# Generate 10 images with same mean and standard deviation +Xgen <- mvrnorm(n = 10, mu = mu, Sigma = diag(s)) + +# Plot images generated using the Normal distribution +{ +par(mfrow = c(2, 3)) + for (k in 1:6) { + I <- Xgen[k, ] + dim(I) <- c(16, 16) + image(I[, 16:1], main = "Digits: 1-D Normal", col = gray(32:0 / 32)) + } +} + + +# Generate 10 images with same mean and covariance matrix +Xgen <- mvrnorm(n = 10, mu = mu, Sigma = S) + +{ + par(mfrow = c(2, 3)) + for (k in 1:6) { + I <- Xgen[k, ] + dim(I) <- c(16, 16) + image(I[, 16:1], main = "Digits: Multivariate Normal", col = gray(32:0 / 32)) + } +} diff --git a/exercises/02450Toolbox_R/Scripts/ex4_2_1.R b/exercises/02450Toolbox_R/Scripts/ex4_2_1.R new file mode 100644 index 0000000000000000000000000000000000000000..98f03304399f73d86970a8b9f0b324e750b99f96 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_2_1.R @@ -0,0 +1,30 @@ +#################### +# Exercise 4.2.1 +#################### +rm(list = ls()) # Clear work space + +# Read data into R +data <- read.csv("./Data/iris.csv") + +# Inspect the contents of the variable "data". +names(data) +head(data) + +# Extract the rows and columns corresponding to the data, i.e. the attribute values +X <- data[, 1:4] + +# Extract attribute names from the first row +attributeNames <- colnames(data)[1:(dim(data)[2] - 1)] + +# Extract unique class names from the last column +classLabels <- data[, 5] +classNames <- unique(classLabels) + +# Extract class labels that match the class names +y <- match(classLabels, classNames) - 1 + +# Get the number of data objects, attributes, and classes +N <- dim(X)[1] +M <- dim(X)[2] +C <- length(classNames) + diff --git a/exercises/02450Toolbox_R/Scripts/ex4_2_2.R b/exercises/02450Toolbox_R/Scripts/ex4_2_2.R new file mode 100644 index 0000000000000000000000000000000000000000..0ae27d25a2c7ae714db4d34e71a791827fd4c6e8 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_2_2.R @@ -0,0 +1,34 @@ +#################### +# Exercise 4.2.2 +#################### + +source("Scripts/ex4_2_1.R") + +# ---------------- +# With base R plot +# ---------------- +yvals <- c() +for (m in 1:M) +{ + res <- hist(X[, m], plot = FALSE) + yvals <- c(yvals, res$counts) +} + +# The argument ylim ensures that all histograms are plotted on the same y-axis +{ + par(mfrow = c(2, 2)) + for (m in 1:M) + { + hist(X[, m], xlab = attributeNames[m], main = "Histogram of attribute values", ylim = c(min(yvals), max(yvals))) + } +} + +# ------------ +# With ggplot2 +# ------------ +library(ggplot2) +library(tidyr) +ggplot(gather(X), aes(x = value)) + geom_histogram(bins = 10) + + facet_wrap(~key, scales = "free_x") + labs(x = "Value", y = "Count") + + diff --git a/exercises/02450Toolbox_R/Scripts/ex4_2_3.R b/exercises/02450Toolbox_R/Scripts/ex4_2_3.R new file mode 100644 index 0000000000000000000000000000000000000000..a05fc0c826c900001527be00c3633efaa865cd04 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_2_3.R @@ -0,0 +1,8 @@ +#################### +# Exercise 4.2.3 +#################### + +source("Scripts/ex4_2_1.R") + +par(mfrow=c(1,1)) +boxplot(X, main="Boxplots of attribute values") diff --git a/exercises/02450Toolbox_R/Scripts/ex4_2_4.R b/exercises/02450Toolbox_R/Scripts/ex4_2_4.R new file mode 100644 index 0000000000000000000000000000000000000000..7cff927fc7f748463e5b4b00194da1d1687c7662 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_2_4.R @@ -0,0 +1,33 @@ +#################### +# Exercise 4.2.4 +#################### +source("Scripts/ex4_2_1.R") + +# Done with base R plot +yvals <- c() +for (m in 0:(C - 1)) +{ + res <- boxplot(X[m == y, ], plot = FALSE) + yvals <- rbind(yvals, res$stats) +} + +{ + par(mfrow = c(1, 3)) + for (m in 0:(C - 1)) { + boxplot(X[m == y, ], main = paste("Boxplot for", classNames[m + 1]), ylim = c(min(yvals), max(yvals))) + } +} + +# ------------ +# With ggplot2 +# ------------ + +library(ggplot2) + +# Reorganize data with tidyr::gather +new_data <- gather(cbind(X, y), key, value, -y) + +ggplot(gather(cbind(X, y), key, value, -y), aes(x = key, y = value)) + + geom_boxplot() + facet_wrap(~classNames[y+1]) + labs(y = "Value") + + theme(axis.text.x = element_text(angle = -25)) + diff --git a/exercises/02450Toolbox_R/Scripts/ex4_2_5.R b/exercises/02450Toolbox_R/Scripts/ex4_2_5.R new file mode 100644 index 0000000000000000000000000000000000000000..bd6b45df9d785a990b7bf03f83068a30f84403f2 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_2_5.R @@ -0,0 +1,20 @@ +#################### +# Exercise 4.2.5 +#################### +source("Scripts/ex4_2_1.R") + +observationColors <- c("blue", "green3", "red")[unclass(y+1)] +{ + par(xpd=TRUE) + pairs(X, bg=observationColors, pch=21) + legend(0, 1, classNames, fill=unique(observationColors)) +} + +# ------------ +# With ggplot2 +# ------------ +library(ggplot2) +library(GGally) # install.packages("GGally") + +ggpairs(X) + diff --git a/exercises/02450Toolbox_R/Scripts/ex4_2_6.R b/exercises/02450Toolbox_R/Scripts/ex4_2_6.R new file mode 100644 index 0000000000000000000000000000000000000000..29079a731fe91884ce4451e5d626a8390b347272 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_2_6.R @@ -0,0 +1,37 @@ +#################### +# Exercise 4.2.6 +#################### +source("Scripts/ex4_2_1.R") + +# Make a non-interactive 3d plot of the data. Install the package scatterplot3d +library(scatterplot3d) # install.packages("scatterplot3d") + +# Note that if more than three classes are inspected, +# then this vector of colors is not long enough. +# Thus more colors need to be added. + +cols <- c("blue", "green3", "red") +cols <- cols[1:length(classNames)] + +par(mfrow = c(1, 1)) +s3d <- scatterplot3d(X[, 1:3], type = "n") +for (c in 1:C) { + s3d$points3d(X[(c - 1) == y, 1:3], col = cols[c]) +} +legend("top", legend = classNames, fill = unique(cols[y + 1])) + + +# Make an interactive 3d plot of the data using the package rgl. + +# For ubuntu, make sure to have the package libglu1-mesa-dev installed before +# installing the R package rgl i.e. 'sudo apt-get install libglu1-mesa-dev' +# from the terminal. + +library(rgl) # install.packages("rgl") + +# If more than three classes are inspected this code must also be modified accordingly +cols <- rep("black", times = length(y)) +cols[y == 0] <- "blue" +cols[y == 1] <- "green3" +cols[y == 2] <- "red" +plot3d(X[, 1:3], col = cols, size = 3) diff --git a/exercises/02450Toolbox_R/Scripts/ex4_2_7.R b/exercises/02450Toolbox_R/Scripts/ex4_2_7.R new file mode 100644 index 0000000000000000000000000000000000000000..c80379396992eb071da6571bf292b6fa549f43f4 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_2_7.R @@ -0,0 +1,20 @@ +#################### +# Exercise 4.2.7 +#################### +source("Scripts/ex4_2_1.R") + +# Standardize each column using the function scale (see ?scale) +X_scaled <- as.data.frame(scale(X)) + +# Sums of columns are now practically zero (difference from zero is +# due to machine error), and variance of columns are now one. +apply(X_scaled, 2, sum) +apply(X_scaled, 2, sd) + +{ + par(mfrow=c(1, 1)) + image(t(X_scaled[N:1, ]), col = gray(0:32 / 32), xaxt = "n", yaxt = "n", + ylab = "Observation number", xlab = "Attribute") + axis(1, at = seq(from = 0, to = 1, length.out = 4), labels = attributeNames) + axis(2, at = seq(from = 0, to = 1, length.out = N), labels = 1:N) +} diff --git a/exercises/02450Toolbox_R/Scripts/ex4_3_1.R b/exercises/02450Toolbox_R/Scripts/ex4_3_1.R new file mode 100644 index 0000000000000000000000000000000000000000..93603320ed68889fb953a3475fd9ff7a6928ee89 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_3_1.R @@ -0,0 +1,88 @@ +#################### +# Exercise 4.3.1 +#################### +rm(list = ls()) # Clear work space + +# Load the data +library(R.matlab) +data <- readMat(file.path("Data", "wine.mat")) + +# View content of the Matlab data structure wine.mat +names(data) + +# Extract variables +X <- data$X +y <- data$y +N <- data$N +M <- data$M +C <- data$C +classNames <- unlist(data$classNames) +attributeNames <- unlist(data$attributeNames) + +# Assign attribute names as column names of the data matrix X +colnames(X) <- make.names(attributeNames) + +# We start with a box plot of each attribute +par(mfrow = c(1, 1), mar = c(10, 4, 4, 2) + 0.1) +boxplot(X, main = "Wine: Boxplot", las = 2) + +# From this it is clear that there are some outliers in the Alcohol +# attribute (10x10^14 is clearly not a proper value for alcohol content) +# However, it is impossible to see the distribution of the data, because +# the axis is dominated by these extreme outliers. To avoid this, we plot a +# box plot of standardized data (using the zscore function). + +par(mfrow = c(1, 1), mar = c(10, 4, 4, 2) + 0.1) +boxplot(scale(X), main = "Wine: Boxplot", las = 2) + +# This plot reveals that there are clearly some outliers in the Volatile +# acidity, Density, and Alcohol attributes, i.e. attribute number 2, 8, +# and 11. + +# Next, we plot histograms of all attributes. +library("tidyr") +library("ggplot2") + +ggplot(gather(data.frame(X)), aes(value)) + + geom_histogram(bins = 10) + + facet_wrap(~key, scales = "free_x") + + labs(x = "", y = "Count") + +# This confirms our belief about outliers in attributes 2, 8, and 11. +# To take a closer look at this, we next plot histograms of the +# attributes we suspect contains outliers. + +m <- c(2, 8, 11) + +ggplot(gather(data.frame(X[, m])), aes(value)) + + geom_histogram(bins = 10) + + facet_wrap(~key, scales = "free_x") + + labs(x = "", y = "Count") + +# The histograms show that there are a few very extreme values in these +# three attributes. To identify these values as outliers, we must use our +# knowledge about the data set and the attributes. Say we expect volatide +# acidity to be around 0-2 g/dm^3, density to be close to 1 g/cm^3, and +# alcohol percentage to be somewhere between 5-20 % vol. Then we can safely +# identify the following outliers, which are a factor of 10 greater than +# the largest we expect. + +idxOutlier <- X[, 2] > 20 | X[, 8] > 10 | X[, 11] > 200 + +# Finally we will remove these from the data set +X <- X[-which(idxOutlier), ] +y <- y[-which(idxOutlier)] +N <- N - sum(idxOutlier) + +# Now, we can repeat the process to see if there are any more outliers +# present in the data. We take a look at a histogram of all attributes: + +ggplot(gather(data.frame(X)), aes(value)) + + geom_histogram(bins = 10) + + facet_wrap(~key, scales = "free_x") + + labs(x = "", y = "Count") + +# This reveals no further outliers, and we conclude that all outliers have +# been detected and removed. + + \ No newline at end of file diff --git a/exercises/02450Toolbox_R/Scripts/ex4_3_2.R b/exercises/02450Toolbox_R/Scripts/ex4_3_2.R new file mode 100644 index 0000000000000000000000000000000000000000..cc9848e5f00676464d9b198d9f8101a0bbf16be7 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex4_3_2.R @@ -0,0 +1,27 @@ +#################### +# Exercise 4.3.2 +#################### + +source("Scripts/ex4_3_1.R") +library(ggplot2) +library(GGally) # install.packages("GGally") + +# ------------ +# With ggpairs +# ------------ +m <- c(1, 4, 5, 6) +ggpairs(data.frame(X[, m]), mapping = aes(color = factor(y))) + +# --------------- +# With base plots +# --------------- +NumAtr <- length(m) +par(mfrow = c(NumAtr, NumAtr), mar = c(1, 1, 1, 1)) +for (m1 in 1:NumAtr) { + for (m2 in 1:NumAtr) { + plot(unlist(X[, m2]), unlist(X[, m1]), + col = ifelse(y == 1, "red", "black") + ) + } +} + diff --git a/exercises/02450Toolbox_R/Scripts/ex5_1_1.R b/exercises/02450Toolbox_R/Scripts/ex5_1_1.R new file mode 100644 index 0000000000000000000000000000000000000000..1ef72454749b74c13e28bf7ea50d75a7df6040ac --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_1_1.R @@ -0,0 +1,63 @@ +#################### +# Exercise 5.1.1 +#################### +rm(list = ls()) # Clear work space + +# Names of data objects +dataobjectNames <- c( + "Human", + "Python", + "Salmon", + "Whale", + "Frog", + "Komodo dragon", + "Bat", + "Pigeon", + "Cat", + "Leopard shark", + "Turtle", + "Penguin", + "Porcupine", + "Eel", + "Salamander" +) + +# Attribute names +attributeNames <- make.names(c( + "Body temperature", + "Skin cover", + "Gives birth", + "Aquatic creature", + "Aerial creature", + "Has legs", + "Hibernates" +)) + +# Attribute values +X <- rbind( + c(1, 1, 1, 0, 0, 1, 0), + c(0, 2, 0, 0, 0, 0, 1), + c(0, 2, 0, 1, 0, 0, 0), + c(1, 1, 1, 1, 0, 0, 0), + c(0, 0, 0, 2, 0, 1, 1), + c(0, 2, 0, 0, 0, 1, 0), + c(1, 1, 1, 0, 1, 1, 1), + c(1, 3, 0, 0, 1, 1, 0), + c(1, 4, 1, 0, 0, 1, 0), + c(0, 2, 1, 1, 0, 0, 0), + c(0, 2, 0, 2, 0, 1, 0), + c(1, 3, 0, 2, 0, 1, 0), + c(1, 5, 1, 0, 0, 1, 1), + c(0, 2, 0, 1, 0, 0, 0), + c(0, 0, 0, 2, 0, 1, 1) +) +# Class indices +y <- c(3, 4, 2, 3, 0, 4, 3, 1, 3, 2, 4, 1, 3, 2, 0) + +# Class names +classNames <- c("Amphibian", "Bird", "Fish", "Mammal", "Reptile") + +# Number data objects, attributes, and classes +N <- dim(X)[1] +M <- length(attributeNames) +C <- length(classNames) diff --git a/exercises/02450Toolbox_R/Scripts/ex5_1_2.R b/exercises/02450Toolbox_R/Scripts/ex5_1_2.R new file mode 100644 index 0000000000000000000000000000000000000000..9277290816396f309398fac18c11a3e51a694b51 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_1_2.R @@ -0,0 +1,34 @@ +#################### +# Exercise 5.1.2 +#################### + +source("Scripts/ex5_1_1.R") + +# If you do not already have the package "rpart" installed, +# install it with the command install.packages("rpart"). +library(rpart) + +X_frame <- data.frame(X) +colnames(X_frame) <- attributeNames +X_frame[, attributeNames] <- lapply(X_frame[, attributeNames], factor) +# Check that X_frame represents data as categorical variables +summary(X_frame) + +# Fit classification tree +formula <- classNames[y + 1] ~ Body.temperature + Skin.cover + + Gives.birth + Aquatic.creature + Aerial.creature + + Has.legs + Hibernates + +mytree <- rpart(formula, data = X_frame, + control = rpart.control(minsplit = 1, minbucket = 0, cp = 0), + parms = list(split = "gini"), method = "class") + +par(mfrow=c(1,1), xpd = NA) # Make room for text labels +plot(mytree) +text(mytree, pretty = 0) +# pretty = 0 makes attribute values show up as the numerical values +# they take in the data matrix X instead of encoding using a, b, c, etc. + +# Inspect details of tree +summary(mytree) + diff --git a/exercises/02450Toolbox_R/Scripts/ex5_1_3.R b/exercises/02450Toolbox_R/Scripts/ex5_1_3.R new file mode 100644 index 0000000000000000000000000000000000000000..ecda29349f541b31a5e79d44093509ffeb887e73 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_1_3.R @@ -0,0 +1,34 @@ +#################### +# Exercise 5.1.3 +#################### + +source("Scripts/ex5_1_1.R") + +# If you do not already have the package "rpart" installed, +# install it with the command install.packages("rpart"). +library(rpart) + +X_frame <- data.frame(X) +colnames(X_frame) <- attributeNames +X_frame[, attributeNames] <- lapply(X_frame[, attributeNames], factor) +# Check that X_frame represents data as categorical variables +summary(X_frame) + +# Fit classification tree +formula <- classNames[y + 1] ~ Body.temperature + Skin.cover + + Gives.birth + Aquatic.creature + Aerial.creature + + Has.legs + Hibernates + +mytree <- rpart(formula, data = X_frame, + control = rpart.control(minsplit = 1, minbucket = 0, cp = 0), + parms = list(split = "information"), method = "class") + +par(mfrow=c(1,1), xpd = NA) # Make room for text labels +plot(mytree) +text(mytree, pretty = 0) +# pretty = 0 makes attribute values show up as the numerical values +# they take in the data matrix X instead of encoding using a, b, c, etc. + +# Inspect details of tree +summary(mytree) + diff --git a/exercises/02450Toolbox_R/Scripts/ex5_1_4.R b/exercises/02450Toolbox_R/Scripts/ex5_1_4.R new file mode 100644 index 0000000000000000000000000000000000000000..34df3dfa20bff1ac4fbdc9f054751b257c5c5e2f --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_1_4.R @@ -0,0 +1,13 @@ +#################### +# Exercise 5.1.4 +#################### + +source("Scripts/ex5_1_3.R") + +# Define a new data object (a dragon) with the attributes given in the text +x <- data.frame(t(c(0, 2, 1, 2, 1, 1, 1))) +colnames(x) <- attributeNames +x[, attributeNames] <- lapply(x[, attributeNames], factor) + +# Evaluate the classification tree for the new data object +predict(mytree, newdata = x) diff --git a/exercises/02450Toolbox_R/Scripts/ex5_1_5.R b/exercises/02450Toolbox_R/Scripts/ex5_1_5.R new file mode 100644 index 0000000000000000000000000000000000000000..14ad9f7b611004dc153be5eef2019b9b66e441d7 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_1_5.R @@ -0,0 +1,37 @@ +#################### +# Exercise 5.1.5 +#################### +rm(list = ls()) # Clear work space + +# Load the data +library(R.matlab) +data <- readMat(file.path("Data", "wine.mat")) + +# View content of the Matlab data structure wine.mat +names(data) + +# Extract variables +X <- data$X +y <- data$y +N <- data$N +M <- data$M +C <- data$C +classNames <- unlist(data$classNames) +attributeNames <- make.names(unlist(data$attributeNames)) + +# Assign attribute names as column names of the data matrix X +colnames(X) <- attributeNames + +# Detect outliers +idxOutlier <- X[, 2] > 20 | X[, 8] > 10 | X[, 11] > 200 + +# Finally we will remove these from the data set +X <- X[-which(idxOutlier), ] +y <- y[-which(idxOutlier)] +N <- N - sum(idxOutlier) + +# Remove attribute 12, Quality score +X <- X[, -12] +attributeNames <- attributeNames[-12] +M <- dim(X)[2] + diff --git a/exercises/02450Toolbox_R/Scripts/ex5_1_6.R b/exercises/02450Toolbox_R/Scripts/ex5_1_6.R new file mode 100644 index 0000000000000000000000000000000000000000..cdf8ddef57cf9699e5d47eca27ff524ab45b60f4 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_1_6.R @@ -0,0 +1,21 @@ +#################### +# Exercise 5.1.6 +#################### +source("Scripts/ex5_1_5.R") + +library(rpart) +X_frame <- data.frame(X) +colnames(X_frame) <- attributeNames +classassignments <- classNames[y + 1] + +# Construct formula to fit automatically to avoid typing in each variable name +(fmla <- as.formula(paste("classassignments ~ ", paste(attributeNames, collapse = "+")))) + +# Fit classification tree +mytree <- rpart(fmla, data = X_frame, + control = rpart.control(minsplit = 100, minbucket = 1, cp = 0), + parms = list(split = "gini"), method = "class") + +par(mfrow=c(1,1), xpd = NA) +plot(mytree) +text(mytree) diff --git a/exercises/02450Toolbox_R/Scripts/ex5_1_7.R b/exercises/02450Toolbox_R/Scripts/ex5_1_7.R new file mode 100644 index 0000000000000000000000000000000000000000..83ed9b937e9424998762a76953650936fb297c27 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_1_7.R @@ -0,0 +1,12 @@ +#################### +# Exercise 5.1.7 +#################### +source("Scripts/ex5_1_6.R") # get data and tree model + +# Define a new data object with the attributes given in the text +x <- data.frame(t(c(6.9, 1.09, .06, 2.1, .0061, 12, 31, .99, 3.5, .44, 12))) +colnames(x) <- attributeNames + +# Evaluate the classification tree for the new data object +predict(mytree, newdata = x) + diff --git a/exercises/02450Toolbox_R/Scripts/ex5_2_1.R b/exercises/02450Toolbox_R/Scripts/ex5_2_1.R new file mode 100644 index 0000000000000000000000000000000000000000..93a904b36e055aae6632b4bee39e8e66e489a8f1 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_2_1.R @@ -0,0 +1,23 @@ +#################### +# Exercise 5.2.1 +#################### +rm(list = ls()) # Clear work space + +# Number of data objects +N <- 100 + +# Attribute values +X <- 0:(N - 1) + +# Noise +epsilon <- rnorm(mean = 0, sd = 0.1, n = N) + +# Model parameters +w0 <- -.5 +w1 <- 0.01 + +# Outputs +y <- w0 + w1 * X + epsilon + +# Make a scatter plot +plot(X, y, main = "Linear regression", xlab = "X", ylab = "y") diff --git a/exercises/02450Toolbox_R/Scripts/ex5_2_2.R b/exercises/02450Toolbox_R/Scripts/ex5_2_2.R new file mode 100644 index 0000000000000000000000000000000000000000..286888028b88433b0d9487d9ab61c2123d7567b9 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_2_2.R @@ -0,0 +1,23 @@ +#################### +# Exercise 5.2.2 +#################### +rm(list = ls()) # Clear work space + +# Get regression data generated in exercise 5.2.1 +source("Scripts/ex5_2_1.R") +dev.off() # Close the figure from exercise 5.2.1 + +# Estimate model parameters +w_est <- lm(y ~ X) + +# Plot the predictions of the model +{ + par(mfrow = c(1, 1)) + plot(X, y, main = "Linear regression", xlab = "X", ylab = "y") + y_est <- predict(w_est) #w_est$coef[1] + w_est$coef[2] * X + lines(X, y_est, col = "red") + y_true <- w0 + w1 * X + lines(X, y_true, col = "green") + legend("topleft",legend = c("Data", "Fitted model", "True model"), + fill = c("black", "red", "green")) +} diff --git a/exercises/02450Toolbox_R/Scripts/ex5_2_3.R b/exercises/02450Toolbox_R/Scripts/ex5_2_3.R new file mode 100644 index 0000000000000000000000000000000000000000..ef8963f651b607e3f911ce7c78196cc43253c972 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_2_3.R @@ -0,0 +1,60 @@ +#################### +# Exercise 5.2.3 +#################### + +rm(list = ls()) # Clear work space + +# Number of data objects +N <- 50 +# Number of non-linear terms in generated data +Kd <- 2 +# Number of non-linear terms in model +Km <- 2 +# Noise variance +s <- 0.5 +# X-values to evaluate model and fit +Xe <- seq(from = -1, to = 1, length.out = 1000) + +## Data set generation +##------------------------------------------------------------------------------ + +# Attribute values +X <- seq(from = -1, to = 1, length.out = N) +Xd <- matrix(sapply(X, FUN = "^", 1:Kd), nrow = N, byrow = TRUE) +Xde <- matrix(sapply(Xe, FUN = "^", 1:Kd), nrow = 1000, byrow = TRUE) + +# Noise +epsilon <- rnorm(mean = 0, sd = s, n = N) + +# Model parameters +w <- -(-.9)^(1:(Kd + 1)) + +# Outputs +y <- cbind(rep(1, times = N), Xd) %*% w + epsilon + +## Model to fit +##------------------------------------------------------------------------------ + +# Attribute values +Xm <- matrix(sapply(X, FUN = "^", 1:Km), nrow = N, byrow = TRUE) +Xme <- matrix(sapply(Xe, FUN = "^", 1:Km), nrow = 1000, byrow = TRUE) + +# Estimate model parameters +data <- data.frame(Xm) +xnam <- paste("X", 1:Km, sep = "") +colnames(data) <- xnam +(fmla <- as.formula(paste("y ~ ", paste(xnam, collapse = "+")))) +w_est <- lm(fmla, data = data) + +{ + # Plot the predictions of the model + plot(X, y, main = "Linear regression", xlab = "X", ylab = "y", ylim = c(-2, 8)) + newdata <- data.frame(Xme) + colnames(newdata) <- xnam + y_est <- predict(w_est, newdata = newdata) + lines(Xe, y_est, col = "red") + y_true <- w[1] + Xde %*% matrix(w[(1:Kd) + 1], ncol = 1) + lines(Xe, y_true, col = "green") + legend("topleft", legend = c("Data", "Fitted model", "True model"), + fill = c("black", "red", "green")) +} diff --git a/exercises/02450Toolbox_R/Scripts/ex5_2_4.R b/exercises/02450Toolbox_R/Scripts/ex5_2_4.R new file mode 100644 index 0000000000000000000000000000000000000000..c021f6eeea5c670d7cffe3f69b03970d40be7db3 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_2_4.R @@ -0,0 +1,22 @@ +#################### +# Exercise 5.2.4 +#################### + +# Load wine data +source("Scripts/ex5_1_5.R") + +# Fit linear regression model to predict Alcohol from all other attributes +y <- X[, 11] +Xr <- data.frame(X[, 1:10]) +(fmla <- as.formula(paste("y ~ ", paste(colnames(Xr), collapse = "+")))) +w_est <- lm(fmla, data = Xr) + +# Make a scatter plot of predicted versus true values of Alcohol +y_est <- w_est$fitted.values +plot(y, y_est, + xlab = "Alcohol (true)", ylab = "Alcohol (estimated)", + main = "Alcohol content", pch = 20 +) + +# Make a histogram of the residual error +hist(y - y_est, breaks = 41, main = "Residual error") diff --git a/exercises/02450Toolbox_R/Scripts/ex5_2_5.R b/exercises/02450Toolbox_R/Scripts/ex5_2_5.R new file mode 100644 index 0000000000000000000000000000000000000000..337d97f9c33368e00d3ed11491d751bcc6dc2f9e --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_2_5.R @@ -0,0 +1,27 @@ +#################### +# Exercise 5.2.5 +#################### + +# Load wine data +source("Scripts/ex5_1_5.R") + +# Fit linear regression model to predict Alcohol from all other attributes +y <- X[, 11] +Xr <- data.frame(cbind(X[, 1:10], X[, 1]^2, X[, 2]^2, X[, 1] * X[, 2])) +xnam <- paste("X", 1:dim(Xr)[2], sep = "") +colnames(Xr) <- xnam + +(fmla <- as.formula(paste("y ~ ", paste(xnam, collapse = "+")))) +w_est <- lm(fmla, data = Xr) + +# Make a scatter plot of predicted versus true values of Alcohol +y_est <- w_est$fitted.values +plot(y, y_est, xlab = "Alcohol (true)", ylab = "Alcohol (estimated)", + main = "Alcohol content", pch = 20) + +# Make a histogram of the residual error +hist(y - y_est, breaks = 41, main = "Residual error") + +# Compute mean squared error +mean((y - y_est)^2) + diff --git a/exercises/02450Toolbox_R/Scripts/ex5_2_6.R b/exercises/02450Toolbox_R/Scripts/ex5_2_6.R new file mode 100644 index 0000000000000000000000000000000000000000..9a9811a3859887065a16ca5a02a625512019d896 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex5_2_6.R @@ -0,0 +1,20 @@ +#################### +# Exercise 5.2.6 +#################### + +# Load wine data +source("Scripts/ex5_1_5.R") + +X <- data.frame(X) +(fmla <- as.formula(paste("y ~ ", paste(colnames(X), collapse = "+")))) + +# Fit logistic regression model to predict the type of wine +w_est <- glm(fmla, family = binomial(link = "logit"), data = X) + +# Define a new data object with the attributes given in the text +x <- data.frame(cbind(6.9, 1.09, .06, 2.1, .0061, 12, 31, .99, 3.5, .44, 12)) +colnames(x) <- colnames(X) + +# Evaluate the logistic regression for the new data object +p <- predict(w_est, newdata = x, type = "response") + diff --git a/exercises/02450Toolbox_R/Scripts/ex6_1_1.R b/exercises/02450Toolbox_R/Scripts/ex6_1_1.R new file mode 100644 index 0000000000000000000000000000000000000000..db57026e962e8ea5778ca5c33aaf66b7c5498ed2 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex6_1_1.R @@ -0,0 +1,97 @@ +#################### +# Exercise 6.1.1 +#################### +rm(list = ls()) # Clear work space + +# Package for decision trees +library(rpart) + +# Package for manual cross-validation +library(caret) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "wine2.mat")) + +# View content of the Matlab data structure wine2.mat +names(data) + +# Extract variables +X <- data$X +y <- data$y +N <- data$N +M <- data$M +C <- data$C +classNames <- unlist(data$classNames) +attributeNames <- make.names(unlist(data$attributeNames)) + +# Assign attribute names as column names of the data matrix X +colnames(X) <- attributeNames +X <- data.frame(X) + + +# ----------------------------------------- +# Create holdout cross-validation partition +# ----------------------------------------- + +# Set seed if you want reproducible results +set.seed(4321) + +CV <- createFolds(y, k = 2) + +# Add sizes of training and test data to the list CV returned by cvFolds +CV$TrainSize <- length(CV$Fold1) +CV$TestSize <- length(CV$Fold1) + +max_depths <- 1:30 + +# Variable for classification error count +Error_train <- rep(NA, times = length(max_depths)) +Error_test <- rep(NA, times = length(max_depths)) + +# Extract training and test set +X_train <- X[CV$Fold1, ] +y_train <- y[CV$Fold1] +X_test <- X[CV$Fold2, ] +y_test <- y[CV$Fold2] + +# Fit classification tree to training set +class_train <- classNames[y_train + 1] + +# Construct formula to fit automatically to avoid typing in each variable name +(fmla <- formula(paste("class_train ~ ", paste(attributeNames, collapse = "+")))) + +# Compute classification error for each pruning level +for (n in 1:length(max_depths)) { + # Fit classification tree + mytree_pruned <- rpart(fmla, + data = X_train, + control = rpart.control( + minsplit = 2, minbucket = 1, + cp = 0, maxdepth = max_depths[n] + ), + parms = list(split = "gini"), method = "class" + ) + + # Calculate train and test error + predicted_classes_train <- classNames[predict(mytree_pruned, newdata = X_train, type = "vector")] + predicted_classes_test <- classNames[predict(mytree_pruned, newdata = X_test, type = "vector")] + Error_train[n] <- sum(classNames[y_train + 1] != predicted_classes_train) + Error_test[n] <- sum(classNames[y_test + 1] != predicted_classes_test) +} + +# Reorganize data to make it easier to plot +library(tidyr) + +frame <- data.frame(Max.depth = max_depths, Train = Error_train / CV$TrainSize, + Test = Error_test / CV$TestSize) +frame <- pivot_longer(frame, cols = 2:3, names_to = "Data", values_to = "Error") + +library(ggplot2) + +ggplot(frame, aes(x = Max.depth, y = Error, color = Data)) + + geom_point() + + geom_line() + + labs(title = "Wine decision tree: Holdout crossvalidation", x = "Max depth", y = "Classification Error") + + theme(plot.title = element_text(hjust = 0.5)) + diff --git a/exercises/02450Toolbox_R/Scripts/ex6_1_2.R b/exercises/02450Toolbox_R/Scripts/ex6_1_2.R new file mode 100644 index 0000000000000000000000000000000000000000..14598ceb7e17598a4c1af8fb0470645265e5c0ee --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex6_1_2.R @@ -0,0 +1,106 @@ +#################### +# Exercise 6.1.2 +#################### +rm(list = ls()) # Clear work space + +# Package for decision trees +library(rpart) + +# Package for manual cross-validation +library(caret) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "wine2.mat")) + +# View content of the Matlab data structure wine2.mat +names(data) + +# Extract variables +X <- data$X +y <- data$y +N <- data$N +M <- data$M +C <- data$C +classNames <- unlist(data$classNames) +attributeNames <- make.names(unlist(data$attributeNames)) + +# Assign attribute names as column names of the data matrix X +colnames(X) <- attributeNames +X <- data.frame(X) + +# Number of folds for k-fold cross-validation +K <- 10 + +# Create k-fold cross validation partition +set.seed(1234) # for reproducibility + +CV <- list() +CV$which <- createFolds(y, k = K, list = F) + +# Set up vectors that will store sizes of training and test sizes +CV$TrainSize <- c() +CV$TestSize <- c() + +max_depths <- 1:30 + +# Variable for classification error +Error_train <- matrix(rep(NA, times = K * length(max_depths)), nrow = K) +Error_test <- matrix(rep(NA, times = K * length(max_depths)), nrow = K) + +for (k in 1:K) { + print(paste("Crossvalidation fold ", k, "/", K, sep = "")) + + # Extract training and test set + X_train <- X[(CV$which != k), ] + y_train <- y[(CV$which != k)] + X_test <- X[(CV$which == k), ] + y_test <- y[(CV$which == k)] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + class_train <- classNames[y_train + 1] + + # construct formula to fit automatically to avoid typing in each variable name + (fmla <- as.formula(paste("class_train ~ ", paste(attributeNames, collapse = "+")))) + + # fit classification tree + # mytree <- rpart(fmla, data=Xdataframe_train,control=rpart.control(minsplit=100, minbucket=1, cp=0), parms=list(split='gini'), method="class") + + # Compute classification error + for (n in 1:length(max_depths)) { # For each pruning level + # fit classification tree + mytree_pruned <- rpart(fmla, + data = X_train, + control = rpart.control( + minsplit = 2, minbucket = 1, + cp = 0, maxdepth = max_depths[n] + ), + parms = list(split = "gini"), method = "class" + ) + + # mytree_pruned <- prune(mytree,prune[n]) + predicted_classes_train <- classNames[predict(mytree_pruned, newdata = X_train, type = "vector")] + predicted_classes_test <- classNames[predict(mytree_pruned, newdata = X_test, type = "vector")] + Error_train[k, n] <- sum(classNames[y_train + 1] != predicted_classes_train) + Error_test[k, n] <- sum(classNames[y_test + 1] != predicted_classes_test) + } +} + + +# Reorganize data to make it easier to plot +library(tidyr) + +frame <- data.frame( + Max.depth = max_depths, Train = colSums(Error_train) / sum(CV$TrainSize), + Test = colSums(Error_test) / sum(CV$TestSize) +) +frame <- pivot_longer(frame, cols = 2:3, names_to = "Data", values_to = "Error") + +library(ggplot2) + +ggplot(frame, aes(x = Max.depth, y = Error, color = Data)) + + geom_point() + + geom_line() + + labs(title = "Wine decision tree: 10-fold crossvalidation", x = "Max depth", y = "Classification Error") + + theme(plot.title = element_text(hjust = 0.5)) diff --git a/exercises/02450Toolbox_R/Scripts/ex6_2_1.R b/exercises/02450Toolbox_R/Scripts/ex6_2_1.R new file mode 100644 index 0000000000000000000000000000000000000000..4ddbaa768b1fcf962632e9e8ec949ce25cf7d5fd --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex6_2_1.R @@ -0,0 +1,116 @@ +#################### +# Exercise 6.2.1 +#################### +rm(list = ls()) # Clear work space + +source("setup.R") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "body.mat")) + +X <- data$X +y <- data$y +N <- data$N +M <- data$M +attributeNames <- make.names(unlist(data$attributeNames)) + +# Assign attribute names as column names of the data matrix X +colnames(X) <- attributeNames +X <- data.frame(X) + +# ------------------------------------ +# Linear regression criterion function +# ------------------------------------ + +# This function takes as input a training and a test set. +# 1. It fits a linear model on the training set using lm. +# 2. It estimates the output of the test set using predict. +# 3. It computes the sum of squared errors. + +funLinreg <- function(X_train, y_train, X_test, y_test) { + X_train <- data.frame(X_train) + X_test <- data.frame(X_test) + + xnam <- paste("X", 1:dim(X_train)[2], sep = "") + colnames(X_train) <- xnam + colnames(X_test) <- xnam + (fmla <- as.formula(paste("y_train ~ ", paste(xnam, collapse = "+")))) + + mod <- lm(fmla, data = X_train) + preds <- predict(mod, newdata = X_test) + return(sum((y_test - preds)^2)) +} + +# --------------- +# Cross validation +# --------------- +# Number of folds for k-fold cross-validation +K <- 5 + +# Create k-fold cross validation partition +set.seed(1234) # for reproducibility + +CV <- list() +CV$which <- createFolds(y, k = K, list = F) + +# Set up vectors that will store sizes of training and test sizes +CV$TrainSize <- c() +CV$TestSize <- c() + +# Initialize variables +Features <- matrix(rep(NA, times = K * M), nrow = K) +Error_train <- matrix(rep(NA, times = K), nrow = K) +Error_test <- matrix(rep(NA, times = K), nrow = K) +Error_train_fs <- matrix(rep(NA, times = K), nrow = K) +Error_test_fs <- matrix(rep(NA, times = K), nrow = K) + +# For each cross-validation fold +for (k in 1:K) { + print(paste("Crossvalidation fold ", k, "/", K, sep = "")) + + # Extract training and test set + X_train <- X[(CV$which != k), ] + y_train <- y[(CV$which != k)] + X_test <- X[(CV$which == k), ] + y_test <- y[(CV$which == k)] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + # Use 10-fold cross validation for sequential feature selection + fsres <- forwardSelection(funLinreg, X_train, y_train, stoppingCrit = "minCostImprovement") + + # Extract selected features from the forward selection routing + selected.features <- fsres$featsIncluded + + # Save the selected features + Features[k, ] <- fsres$binaryFeatsIncluded + # Compute squared error without feature subset selection + Error_train[k] <- funLinreg(X_train, y_train, X_train, y_train) + Error_test[k] <- funLinreg(X_train, y_train, X_test, y_test) + # Compute squared error with feature subset selection + Error_train_fs[k] <- funLinreg(X_train[, selected.features], y_train, X_train[, selected.features], y_train) + Error_test_fs[k] <- funLinreg(X_train[, selected.features], y_train, X_test[, selected.features], y_test) + + # Show variable selection history + # mfig(sprintf('(%d) Feature selection',k)); + I <- length(fsres$costs) # Number of iterations + + par(mfrow = c(1, 2)) + # Plot error criterion + plot(fsres$costs, xlab = "Iteration", ylab = "Squared error (crossvalidation)", main = "Value of error criterion") + # Plot feature selection sequence + bmplot(attributeNames, 1:I, fsres$binaryFeatsIncludedMatrix) +} + + +# Display results +print(paste("Linear regression without feature selection:")) +print(paste("- Training error:", sum(Error_train) / sum(CV$TrainSize))) +print(paste("- Test error:", sum(Error_test) / sum(CV$TestSize))) +print(paste("Linear regression with sequential feature selection:")) +print(paste("- Training error:", sum(Error_train_fs) / sum(CV$TrainSize))) +print(paste("- Test error:", sum(Error_test_fs) / sum(CV$TestSize))) + +# Show the selected features +bmplot(attributeNames, 1:K, Features, xlab = "Crossvalidation fold", ylab = "", main = "Attributes selected") diff --git a/exercises/02450Toolbox_R/Scripts/ex6_3_1.R b/exercises/02450Toolbox_R/Scripts/ex6_3_1.R new file mode 100644 index 0000000000000000000000000000000000000000..7dea3a2faba1f21582a92a57166b70312ed56800 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex6_3_1.R @@ -0,0 +1,110 @@ +#################### +# Exercise 6.3.1 +#################### +rm(list = ls()) # Clear work space + +# If the package FNN is not already installed, +# install it using install.packages("FNN") +library(FNN) + +library(caret) +library(ggplot2) +library(scales) + + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth1.mat")) +X <- data$X +N <- data$NC +M <- data$M +y <- as.factor(data$y) +C <- data$C + +X_train <- data$X.train +N_train <- data$N.train +y_train <- factor(data$y.train) + +X_test <- data$X.test +N_test <- data$N.test +y_test <- factor(data$y.test) + +classNames <- make.names(unlist(data$classNames)) +attributeNames <- make.names(unlist(data$attributeNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +X_train <- data.frame(X_train) +colnames(X_train) <- attributeNames + +X_test <- data.frame(X_test) +colnames(X_test) <- attributeNames + + +# ------------------------------ +# Make a scatterplot of the data +# ------------------------------ + +color <- c("blue", "red", "green", "magenta") +minmaxx <- c(min(X_train[, 1]), max(X_train[, 1])) + +par(mfrow = c(1, 1)) +plot(minmaxx, minmaxx, type = "n", main = "Synthetic data", ylab = "", xlab = "") +for (c in 1:C) { + points(X_train[y_train == c - 1, 1], + X_train[y_train == c - 1, 2], + pch = 20, col = color[c] + ) +} +points(X_test[, 1], X_test[, 2], pch = 4) + +# ------------------- +# K-nearest neighbors +# ------------------- + +K <- 5 # Number of neighbors + +# Use KNN classify to find the K nearest neighbors +y_test_est <- knn(X_train, X_test, + cl = y_train, k = K, + prob = FALSE, algorithm = "kd_tree" +) + +# Plot estimated classes for test data +minmaxx <- c(min(X_test[, 1]), max(X_test[, 1])) +plot(minmaxx, minmaxx, main = "Synthetic data", ylab = "", xlab = "", type = "n") +for (c in 1:C) { + points(X_test[y_test_est == c - 1, 1], X_test[y_test_est == c - 1, 2], + pch = 21, col = color[c] + ) +} + +# Plot confusion matrix + +tr <- classNames[as.numeric(y_test)] +pr <- classNames[as.numeric(y_test_est)] + +cm <- confusionMatrix(data = factor(tr), reference = factor(pr)) +values <- as.numeric(cm$table) +accuracy <- cm$overall[1] +error_rate <- 1 - accuracy + +TClass <- rep(classNames, each = C) +PClass <- rep(classNames, times = C) + +df <- data.frame(TClass, PClass, values) + +ggplot(data = df, mapping = aes(x = PClass, y = TClass)) + + geom_tile(aes(fill = values), colour = "white") + + geom_text(aes(label = sprintf("%1.0f", values)), vjust = 1) + + scale_fill_gradient(low = "blue", high = "red") + + scale_y_discrete(limits = rev) + + labs(x = "Predicted class", y = "Actual class") + + theme_bw() + + theme(legend.position = "none") + + ggtitle(sprintf( + "Confussion matrix (Accuracy: %s, Error Rate: %s)", + label_percent()(accuracy), label_percent()(error_rate) + )) + diff --git a/exercises/02450Toolbox_R/Scripts/ex6_3_2.R b/exercises/02450Toolbox_R/Scripts/ex6_3_2.R new file mode 100644 index 0000000000000000000000000000000000000000..6f622491fac8dcfab14505257a346daaf2fcb9a0 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex6_3_2.R @@ -0,0 +1,60 @@ +#################### +# Exercise 6.3.2 +#################### +rm(list = ls()) # Clear work space + +# Package for KNN +library(FNN) + +# Load data +source("Scripts/ex4_2_1.R") + +# Leave-one-out cross-validation +K <- N +CV <- list() +CV$which <- createFolds(y, k = K, list = F) +CV$NumTestSets <- K + +# K-nearest neighbors parameters +# Maximum number of neighbors +L <- 40 + +# Variable for classification error +Error <- array(rep(NA, times = K * L), dim = c(K, L)) + +# Build in progress bar in R +pb <- txtProgressBar(min = 0, max = K, style = 3, width = 50) + +# For each cross-validation fold +print(paste("Cross-validation:")) +for (k in 1:K) { + txtProgressBar() + + + # Extract training and test set + X_train <- X[CV$which != k, ] + y_train <- y[CV$which != k] + X_test <- X[CV$which == k, ] + y_test <- y[CV$which == k] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + # For each number of neighbors + for (l in 1:L) { + + # Use KNN classify to find the l-nearest neighbors + y_test_est <- knn(X_train, X_test, cl = y_train, k = l, + prob = FALSE, algorithm = "kd_tree") + + # Compute number of classification errors + Error[k, l] <- sum(y_test != y_test_est) # Count the number of errors + } + + # Update progress bar + setTxtProgressBar(pb, k) +} + +## Plot the classification error rate +plot(colSums(Error) / sum(CV$TestSize) * 100, main = "Error rate", + xlab = "Number of neighbors", ylab = "Classification error rate (%)", + pch = 20, type = "l") diff --git a/exercises/02450Toolbox_R/Scripts/ex7_1_1.R b/exercises/02450Toolbox_R/Scripts/ex7_1_1.R new file mode 100644 index 0000000000000000000000000000000000000000..06fb6c43bfeeaf7000ff51e0c5505b5ecda05abe --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex7_1_1.R @@ -0,0 +1,54 @@ +#################### +# Exercise 7.1.1 +#################### +rm(list = ls()) # Clear work space + +# Package for KNN +library(FNN) + +# Package for Cross-Validation +library(caret) + +# Load data +source("Scripts/ex4_2_1.R") + +# Leave-one-out cross-validation +K <- N +CV <- list() +CV$which <- createFolds(y, k = K, list = F) + +# K-nearest neighbors parameters +L <- c(1, 20, 80) +yhat <- array(rep(NA, times = N * length(L)), dim = c(N, length(L))) +y_true <- array(rep(NA, times = N * length(L)), dim = c(N, 1)) + +# For each cross-validation fold +for (k in 1:K) { + print(paste("Cross-validation fold ", k, "/", K, sep = "")) + + # Extract training and test set + X_train <- X[CV$which != k, ] + y_train <- y[CV$which != k] + X_test <- X[CV$which == k, ] + y_test <- y[CV$which == k] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + y_true[k, 1] <- y_test + + # For each number of neighbors + for (dl in 1:length(L)) { + l <- L[dl] + # Use KNN classify to find the l-nearest neighbors + out <- knn(X_train, X_test, + cl = y_train, k = l, prob = FALSE, + algorithm = "kd_tree" + ) + + y_test_est <- as.numeric(as.character(out[1])) + yhat[k, dl] <- y_test_est + } +} + +## Compute accuracies here using yhat and y_true + diff --git a/exercises/02450Toolbox_R/Scripts/ex7_1_2.R b/exercises/02450Toolbox_R/Scripts/ex7_1_2.R new file mode 100644 index 0000000000000000000000000000000000000000..eb059fa055daa1922493718f96aa953ab1ab9111 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex7_1_2.R @@ -0,0 +1,17 @@ +#################### +# Exercise 7.1.2 +#################### +rm(list = ls()) # Clear work space + +# Load results from previous exercise. +source("Scripts/ex7_1_1.R") +source("setup.R") + +alpha <- 0.05 +rt <- jeffrey_interval(y_true, yhat[, 1], alpha = alpha) +thetahatA <- rt$thetahat +CI <- rt$CI + +print(paste("Theta point estimate:", thetahatA)) +print(paste("CI: ")) +print(CI) diff --git a/exercises/02450Toolbox_R/Scripts/ex7_1_4.R b/exercises/02450Toolbox_R/Scripts/ex7_1_4.R new file mode 100644 index 0000000000000000000000000000000000000000..6e3e8a9591a465efac4ca763dd64096044b146cf --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex7_1_4.R @@ -0,0 +1,14 @@ +#################### +# Exercise 7.1.4 +#################### +rm(list = ls()) # Clear work space + +# Load results from previous exercise. +source("Scripts/ex7_1_1.R") +source("setup.R") + +alpha <- 0.05 +rt <- mcnemar(y_true[, 1], yhat[, 1], yhat[, 2], alpha = alpha) +rt$CI # Confidence interval of difference theta = thetaA - thetaB +rt$p # p-value of null hypothesis thetaA = thetaB +rt$thetahat # Estimated difference in accuracy theta = thetaA - thetaB diff --git a/exercises/02450Toolbox_R/Scripts/ex7_2_1.R b/exercises/02450Toolbox_R/Scripts/ex7_2_1.R new file mode 100644 index 0000000000000000000000000000000000000000..8b74e5f0584080d473565520266e100939f36f71 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex7_2_1.R @@ -0,0 +1,62 @@ +#################### +# Exercise 7.2.1 +#################### +rm(list = ls()) # Clear work space + +# Package for decision tree +library(rpart) + +# Package for Cross-Validation +library(caret) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "wine2.mat")) +X <- data$X +N <- nrow(X) +M <- ncol(X) + +attributeNames <- make.names(unlist(data$attributeNames)) +X <- data.frame(X) +colnames(X) <- attributeNames + + +## Set the seed to make your partition reproducible +set.seed(1234) +train_ind <- createDataPartition(1:N, p = 0.2, list = F) +X_train <- X[train_ind, ] +X_test <- X[-train_ind, ] + +(fmla <- as.formula(paste(attributeNames[11], " ~ ", + paste(attributeNames[1:10], collapse = "+")))) + +mytree <- rpart(fmla, data = X_train, method = "anova") + +yhatA <- predict(mytree, newdata = X_train, type = "vector") +yhatA <- as.matrix(yhatA) + +linearMod <- lm(fmla, data = X_train) +mytree <- rpart(fmla, data = X_train, method = "anova") + +yhatA <- predict(linearMod, X_test) +yhatB <- predict(mytree, X_test) + +y_test <- X_test[attributeNames[11]] + +# -------------------------------------------- +# Perform statistical comparison of the models +# -------------------------------------------- + +# Compute z with squared error. +zA <- abs(y_test - yhatA)**2 + +# Confidence interval for model A +res <- t.test(zA, alternative = "two.sided", alpha = 0.05) + +# Example on how to extract confidence interval +(CIA <- c(res$conf.int[1], res$conf.int[2])) + +# Compute confidence interval of z = zA-zB and p-value of Null hypothesis +zB <- abs(y_test - yhatB)**2 +z <- zA - zB +t.test(z, alternative = "two.sided", alpha = 0.05) diff --git a/exercises/02450Toolbox_R/Scripts/ex7_3_1.R b/exercises/02450Toolbox_R/Scripts/ex7_3_1.R new file mode 100644 index 0000000000000000000000000000000000000000..6dfe7b03e49e583b6f9fd2d50036d241ad49648a --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex7_3_1.R @@ -0,0 +1,95 @@ +#################### +# Exercise 7.3.1 +#################### +rm(list = ls()) # Clear work space +source("setup.R") + +# Package for decision tree +library(rpart) + +# Package for Cross-Validation +library(caret) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "wine2.mat")) +X <- data$X +N <- nrow(X) +M <- ncol(X) + +attributeNames <- make.names(unlist(data$attributeNames)) +X <- data.frame(X) +colnames(X) <- attributeNames + +(fmla <- as.formula(paste( + attributeNames[11], " ~ ", + paste(attributeNames[1:10], collapse = "+") +))) + +m <- 1 # Number of cross-validation repeats +K <- 10 # Folds in (repeated) cross validation +loss <- 1 # Loss type + +y_true <- matrix(NA, 0, 1) +yhat <- matrix(NA, 0, 2) +r <- matrix(NA, 0, 1) + +# Set the seed to make your partition reproducible +set.seed(1234) + +for (dm in 1:m) { + CV <- list() + CV$which <- createFolds(1:N, k = K, list = F) + + # For each cross-validation fold + for (k in 1:K) { + print(paste(sprintf("Repeat %i / %i. Cross-validation fold %i / %i", dm, m, k, K))) + + # Extract training and test set + X_train <- X[CV$which != k, ] + X_test <- X[CV$which == k, ] + + mytree <- rpart(fmla, data = X_train, method = "anova") + + yhatA <- predict(mytree, newdata = X_train, type = "vector") + yhatA <- as.matrix(yhatA) + + linearMod <- lm(fmla, data = X_train) + mytree <- rpart(fmla, data = X_train, method = "anova") + + yhatA <- predict(linearMod, X_test) + yhatB <- predict(mytree, X_test) + + dyhat <- cbind(yhatA, yhatB) + + yhat <- rbind(yhat, dyhat) + y_test <- as.matrix(X_test[attributeNames[11]]) + y_true <- rbind(y_true, y_test) + + dr <- mean(abs(yhatA - y_test)**loss - abs(yhatB - y_test)**loss) + r <- rbind(r, dr) + } +} + +# Perform tests using methods in setup II (correlated ttest) +alpha <- 0.05 +rho <- 1 / K +res <- correlated_ttest(r, rho, alpha = alpha) + +p_setupII <- res$p +print(paste("In setup II the p-value was", p_setupII)) +print("and the CI was:") +CI_setupII <- res$CI +print(CI_setupII) + +if (m == 1) { + # Only perform setup I ttest in case m = 1 (otherwise it is not defined) + # perform statistical comparison of the models + # compute z with squared error. + zA <- abs(y_true - yhat[, 1])**loss + zB <- abs(y_true - yhat[, 2])**loss + z <- zA - zB + print("Corresponding p-values and confidence interval using methods in setup I:") + t.test(z, alternative = "two.sided", alpha = 0.05) +} + diff --git a/exercises/02450Toolbox_R/Scripts/ex7_4_3.R b/exercises/02450Toolbox_R/Scripts/ex7_4_3.R new file mode 100644 index 0000000000000000000000000000000000000000..2d351651cc494f9756a291fdc85652d6e8b83990 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex7_4_3.R @@ -0,0 +1,46 @@ +#################### +# Exercise 7.4.3 +#################### +rm(list = ls()) # Clear work space + +## Read male and female names and extract features +male <- read.table(file.path("Data", "male.txt"), sep = "\r") +female <- read.table(file.path("Data", "female.txt"), sep = "\r") + +extractNameFeatures <- function(name) { + name <- as.character(name) + name <- tolower(name) + l <- nchar(name) + name <- strsplit(name, "") + c(name[[1]][1], name[[1]][2], name[[1]][l - 1], name[[1]][l]) +} + +asc_single <- function(x) { + strtoi(charToRaw(x), 16L) +} + +asc <- function(x) { + sapply(x, asc_single) +} + +# Extract male name features +Xmale <- t(sapply(male$V1, extractNameFeatures)) +Xmale <- t(apply(Xmale, 1, asc) - asc("a") + 1) + +# Extract female name features +Xfemale <- t(sapply(female$V1, extractNameFeatures)) +Xfemale <- t(apply(Xfemale, 1, asc) - asc("a") + 1) + +# Concatenate male and female +X <- rbind(Xmale, Xfemale) + +# Make class indices etc. +y <- c(rep(0, times = dim(Xmale)[1]), rep(1, times = dim(Xfemale)[1])) +N <- dim(X)[1] +M <- dim(X)[2] +C <- 2 +attributeNames <- make.names(c("First Letter", "Second Letter", "Next-to-last Letter", "Last letter")) +classNames <- c("Female", "Male") + +X <- data.frame(X) +colnames(X) <- attributeNames diff --git a/exercises/02450Toolbox_R/Scripts/ex7_4_4.R b/exercises/02450Toolbox_R/Scripts/ex7_4_4.R new file mode 100644 index 0000000000000000000000000000000000000000..51499f95a3db0564342f8a80a8fd8a7821c0dc5f --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex7_4_4.R @@ -0,0 +1,107 @@ +#################### +# Exercise 7.4.4 +#################### +rm(list = ls()) # Clear work space + +# Load data +source("Scripts/ex7_4_3.R") +source('setup.R') + +# Package for Cross-Validation +library(caret) + +# K-fold cross validation +K <- 10; + +# For reproducibility +set.seed(12345678) + +CV <- list() +CV$which <- createFolds(y, k = K, list = F) +# Set up vectors that will store sizes of training and test sizes +CV$TrainSize <- c() +CV$TestSize <- c() + +# Parameters for naive Bayes classifier +Distribution <- c('mvmn', 'mvmn', 'mvmn', 'mvmn'); +Prior <- 'empirical'; + +# Use only the first three features +# f <- 1:3 +# X <- X[, f, drop=FALSE] +# Distribution <- Distribution[f, drop=FALSE] +# attributeNames <- attributeNames[f] + +# Variable for classification error +Error <- rep(NA, times=K) + +for(k in 1:K) { # For each crossvalidation fold + print(paste('Crossvalidation fold ', k, '/', K, sep='')); + + # Extract training and test set + X_train <- X[CV$which != k, ] + y_train <- y[CV$which != k] + X_test <- X[CV$which == k, ] + y_test <- y[CV$which == k] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + # Fit naive Bayes classifier to training set + mymod <- naiveBayes(X_train, y_train, distribution=Distribution, prior=Prior) + + # Predict model on test data + predictRes <- predict.naiveBayes(Xtest=X_test, mod=mymod) + y_test_est <- predictRes$predictedClass + + # Compute error rate + err <- y_test != y_test_est + + # Make test cases that could not be predicted count as errors + err[is.na(err)] <- 1 + + # Count the number of errors + Error[k] <- sum(err) +} + +# Print the error rate +print(paste('Error rate: ', sum(Error)/sum(CV$TestSize)*100), sep='') + +####################################################################################### +# Done with built in library that by default assumes suboptimal Gaussian distributions! +####################################################################################### +rm(predict.naiveBayes) +library(e1071) + +# Variable for classification error +Error <- rep(NA, times=K) + +for(k in 1:K) { # For each crossvalidation fold + print(paste('Crossvalidation fold ', k, '/', K, sep='')); + + # Extract training and test set + X_train <- X[CV$which != k, ] + y_train <- y[CV$which != k] + X_test <- X[CV$which == k, ] + y_test <- y[CV$which == k] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + # Fit naive Bayes classifier to training set + mymod <- e1071::naiveBayes(y_train ~ . , X_train) + + # Predict model on test data + y_test_est <- predict(mymod, newdata = X_test) + + # Compute error rate + err <- y_test != y_test_est + + # Make test cases that could not be predicted count as errors + err[is.na(err)] <- 1 + + # Count the number of errors + Error[k] <- sum(err) +} + +# Print the error rate +print(paste('Error rate: ', sum(Error)/sum(CV$TestSize)*100), sep='') + diff --git a/exercises/02450Toolbox_R/Scripts/ex8_1_1.R b/exercises/02450Toolbox_R/Scripts/ex8_1_1.R new file mode 100644 index 0000000000000000000000000000000000000000..d95a6704da0ddae4a2af0e082ae2689a137a5352 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex8_1_1.R @@ -0,0 +1,212 @@ +#################### +# Exercise 8.1.1 +#################### +rm(list = ls()) # Clear work space + +# Package for Cross-Validation +library(caret) + +# Load Data +library(R.matlab) +data <- readMat(file.path("Data", "body.mat")) +X <- data$X +N <- data$N +attributeNames <- as.vector(unlist(data$attributeNames)) +M <- data$M +y <- data$y + +# ----------------------------- +# Regularized Linear regression +# ----------------------------- + +# Include an additional attribute corresponding to the offset +X <- cbind(rep(1, N), X) +M <- M[1, 1] + 1 +attributeNames <- c("offset", attributeNames) + +# Cross-validation + +# Create cross-validation partition for evaluation of performance of optimal model +K <- 5 + +# Set seed for reproducibility +set.seed(4321) + +CV <- list() +CV$which <- createFolds(y, k = K, list = F) + +# Set up vectors that will store sizes of training and test sizes +CV$TrainSize <- c() +CV$TestSize <- c() + +# Values of lambda +lambda_tmp <- 10^(-5:8) + +# Initialize variables + +KK <- 10 # Inner loop +T <- 14 +temp <- rep(NA, M * T * KK) +w <- array(temp, c(M, T, KK)) +Error_train2 <- matrix(rep(NA, times = T * KK), nrow = T) +Error_test2 <- matrix(rep(NA, times = T * KK), nrow = T) +lambda_opt <- rep(NA, K) +w_rlr <- matrix(rep(NA, times = M * K), nrow = M) +Error_train_rlr <- rep(NA, K) +Error_test_rlr <- rep(NA, K) +w_noreg <- matrix(rep(NA, times = M * K), nrow = M) +mu <- matrix(rep(NA, times = (M - 1) * K), nrow = K) +sigma <- matrix(rep(NA, times = (M - 1) * K), nrow = K) +Error_train <- rep(NA, K) +Error_test <- rep(NA, K) +Error_train_nofeatures <- rep(NA, K) +Error_test_nofeatures <- rep(NA, K) + + +for (k in 1:K) { + paste("Crossvalidation fold ", k, "/", K, sep = "") + + # Extract the training and test set + X_train <- X[CV$which != k, ] + y_train <- y[CV$which != k] + X_test <- X[CV$which == k, ] + y_test <- y[CV$which == k] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + # Use 10-fold cross-validation to estimate optimal value of lambda + KK <- 10 + + CV2 <- list() + CV2$which <- createFolds(y_train, k = KK, list = F) + CV2$TrainSize <- c() + CV2$TestSize <- c() + + + for (kk in 1:KK) { + X_train2 <- X_train[CV2$which != kk, ] + y_train2 <- y_train[CV2$which != kk] + X_test2 <- X_train[CV2$which == kk, ] + y_test2 <- y_train[CV2$which == kk] + + mu2 <- colMeans(X_train2[, 2:24]) + sigma2 <- apply(X_train2[, 2:24], 2, sd) + + X_train2[, 2:24] <- scale(X_train2[, 2:24], mu2, sigma2) + X_test2[, 2:24] <- scale(X_test2[, 2:24], mu2, sigma2) + + CV2$TrainSize[kk] <- length(y_train) + CV2$TestSize[kk] <- length(y_test2) + + Xty2 <- t(X_train2) %*% y_train2 + XtX2 <- t(X_train2) %*% X_train2 + + for (t in 1:length(lambda_tmp)) { + # Learn parameter for current value of lambda for the given inner CV_fold + lambdaI <- lambda_tmp[t] * diag(M) + + # Don't regularize bias + lambdaI[1, 1] <- 0 + + w[, t, kk] <- solve(XtX2 + lambdaI) %*% Xty2 + + # Evaluate training and test performance + Error_train2[t, kk] <- sum((y_train2 - X_train2 %*% w[, t, kk])^2) + Error_test2[t, kk] <- sum((y_test2 - X_test2 %*% w[, t, kk])^2) + } + } + + # Select optimal value of lambda + ind_opt <- which.min(apply(Error_test2, 1, sum) / sum(CV2$TestSize)) + lambda_opt[k] <- lambda_tmp[ind_opt] + + # Standardize outer fold based on training set, and save the mean and standard + # deviations since they're part of the model (they would be needed for + # making new predictions) - for brevity we won't always store these in the scripts + mu[k, ] <- colMeans(X_train[, 2:24]) + sigma[k, ] <- apply(X_train[, 2:24], 2, sd) + + X_train[, 2:24] <- scale(X_train[, 2:24], mu[k, ], sigma[k, ]) + X_test[, 2:24] <- scale(X_test[, 2:24], mu[k, ], sigma[k, ]) + + # Estimate w for the optimal value of lambda + Xty <- t(X_train) %*% y_train + XtX <- t(X_train) %*% X_train + + lambdaI <- lambda_opt[k] * diag(M) + lambdaI[1, 1] <- 0 # don't regularize bias + + w_rlr[, k] <- solve(XtX + lambdaI) %*% Xty + + # evaluate training and test error performance for optimal selected value of lambda + Error_train_rlr[k] <- sum((y_train - X_train %*% w_rlr[, k])^2) + Error_test_rlr[k] <- sum((y_test - X_test %*% w_rlr[, k])^2) + + # Compute squared error without regularization + # Adds a small value to diagonal to avoid a singular matrix + w_noreg[, k] <- solve(XtX + (diag(M) * 1e-10)) %*% Xty + Error_train[k] <- sum((y_train - X_train %*% w_noreg[, k])^2) + Error_test[k] <- sum((y_test - X_test %*% w_noreg[, k])^2) + + # Compute squared error without using the input data at all + Error_train_nofeatures[k] <- sum((y_train - mean(y_train))^2) + Error_test_nofeatures[k] <- sum((y_test - mean(y_train))^2) + + if (k == K) { + dev.new() + # Display result for cross-validation fold + w_mean <- apply(w, c(1, 2), mean) + + # Plot weights as a function of the regularization strength (not offset) + par(mfrow = c(1, 2)) + par(cex.main = 1.5) # Define size of title + par(cex.lab = 1) # Define size of axis labels + par(cex.axis = 1) # Define size of axis labels + par(mar = c(5, 4, 3, 1) + .1) # Increase margin size to allow for larger axis labels + + plot(log(lambda_tmp), w_mean[2, ], + xlab = "log(lambda)", + ylab = "Coefficient Values", main = paste("Weights, fold ", k, "/", K), + ylim = c(min(w_mean[-1, ]), max(w_mean[-1, ])) + ) + lines(log(lambda_tmp), w_mean[2, ]) + + colors_vector <- colors()[c(1, 50, 26, 59, 101, 126, 151, 551, 71, 257, 506, 634, 639, 383)] + + for (i in 3:M) { + points(log(lambda_tmp), w_mean[i, ], col = rainbow(T)[i]) + lines(log(lambda_tmp), w_mean[i, ], col = rainbow(T)[i]) + } + + plot(log(lambda_tmp), log(apply(Error_train2, 1, sum) / sum(CV2$TrainSize)), + xlab = "log(lambda)", ylab = "log(Error)", + main = paste0("Optimal lambda: 1e", log10(lambda_opt[k])) + ) + + lines(log(lambda_tmp), log(apply(Error_train2, 1, sum) / sum(CV2$TrainSize))) + points(log(lambda_tmp), log(apply(Error_test2, 1, sum) / sum(CV2$TestSize)), col = "red") + lines(log(lambda_tmp), log(apply(Error_test2, 1, sum) / sum(CV2$TestSize)), col = "red") + + legend("bottomright", legend = c("Training", "Test"), col = c("black", "red"), lty = 1) + + } +} + +# Display Results +writeLines("Linear regression without feature selection:") +writeLines(paste("- Training error: ", sum(Error_train) / sum(CV$TrainSize))) +writeLines(paste("- Test error", sum(Error_test) / sum(CV$TestSize))) +writeLines(paste("- R^2 train: %8.2f\n", (sum(Error_train_nofeatures) - sum(Error_train)) / sum(Error_train_nofeatures))) +writeLines(paste("- R^2 test: %8.2f\n", (sum(Error_test_nofeatures) - sum(Error_test)) / sum(Error_test_nofeatures))) + +writeLines("Regularized Linear regression:") +writeLines(paste("- Training error:", sum(Error_train_rlr) / sum(CV$TrainSize))) +writeLines(paste("- Test error:", sum(Error_test_rlr) / sum(CV$TestSize))) +writeLines(paste("- R^2 train: ", (sum(Error_train_nofeatures) - sum(Error_train_rlr)) / sum(Error_train_nofeatures))) +writeLines(paste("- R^2 test:", (sum(Error_test_nofeatures) - sum(Error_test_rlr)) / sum(Error_test_nofeatures))) + + +writeLines("Weights in last fold :") +for (m in 1:M) { + writeLines(paste(attributeNames[m], w_rlr[m, k])) +} diff --git a/exercises/02450Toolbox_R/Scripts/ex8_1_2.R b/exercises/02450Toolbox_R/Scripts/ex8_1_2.R new file mode 100644 index 0000000000000000000000000000000000000000..dbfa4449fd8ad61cb5790addc770047f350df3db --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex8_1_2.R @@ -0,0 +1,148 @@ +#################### +# Exercise 8.1.2 +#################### +rm(list = ls()) # Clear work space + +# Package for Cross-Validation +library(caret) + +# Package for Logisitic Regression with regularization +library(glmnet) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "wine2.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +# ---------------- +# Cross-validation +# ---------------- + +# For reproducibility, if needed +set.seed(5142) + +CV <- list() +CV$which <- createFolds(y, k = 20, list = F) +CV$TrainSize <- c() +CV$TestSize <- c() + +# Extract the training and test set +X_train <- X[CV$which == 1, ] +# Train on 1/20 of the data, or 5 percent +y_train <- y[CV$which == 1] +X_test <- X[CV$which != 1, ] +# Test on the rest +y_test <- y[CV$which != 1] +CV$TrainSize[1] <- length(y_train) +CV$TestSize[1] <- length(y_test) + +# Standardize based on training set +mu <- colMeans(X_train) +sigma <- apply(X_train, 2, sd) + +X_train <- data.frame(scale(X_train, mu, sigma)) +X_test <- data.frame(scale(X_test, mu, sigma)) + +#---------- +# Fit model +#---------- + +# Fit logistic regression model to training data to predict the type of wine + +N_lambdas <- 20 +lambda_tmp <- 10^(seq(from = -8, to = 0, length = N_lambdas)) + +# alpha=0 gives ridge regression +# We will use glmnet to fit, which you can install using: install.packages('glmnet') +mdl <- glmnet(X_train, y_train, family = "binomial", alpha = 0, + lambda = lambda_tmp) + +train_error <- rep(NA, N_lambdas) +test_error <- rep(NA, N_lambdas) +coefficient_norm <- rep(NA, N_lambdas) +for (k in 1:N_lambdas) { + # Predict labels for both sets for current regularization strength + y_train_est <- predict(mdl, newx=as.matrix(X_train), type = "class", + s = lambda_tmp[k]) + y_test_est <- predict(mdl, newx=as.matrix(X_test), type = "class", + s = lambda_tmp[k]) + + # Determine training and test set error + train_error[k] <- sum(y_train_est != y_train) / length(y_train) + test_error[k] <- sum(y_test_est != y_test) / length(y_test) + + # Determine betas and calculate norm of parameter vector + w_est <- predict(mdl, type = "coef", s = lambda_tmp[k])[-1] + coefficient_norm[k] <- sqrt(sum(w_est^2)) +} + +min_error <- min(test_error) +lambda_opt <- lambda_tmp[which.min(test_error)] + +#------------- +# Plot results +#------------- + +par(mfrow = c(1, 1)) +par(cex.main = 1.5) # Define size of title +par(cex.lab = 1) # Define size of axis labels +par(cex.axis = 1) # Define size of axis labels + +# Plot classification error + +{ + plot(range(log10(lambda_tmp)), range(100 * c(test_error, train_error)), + type = "n", + xlab = "Log10(lambda)", ylab = "Error (%)", + main = "Classification error" + ) + + lines(log10(lambda_tmp), train_error * 100, col = "red") + lines(log10(lambda_tmp), test_error * 100, col = "blue") + points(log10(lambda_opt), min_error * 100, col = "green", cex = 5) + legend("topleft", c( + paste("Training, n=", round(length(y_train), 2)), + paste("Test, n=", round(length(y_test), 2)) + ), + col = c("red", "blue"), lty = 1, cex = 1 + ) + grid() +} + +# Plot classification error (zoomed) +{ + plot(range(-6, -1), range(0, 4), + type = "n", + xlab = "Log10(lambda)", ylab = "Error (%)", main = "Classification error (zoomed)" + ) + lines(log10(lambda_tmp), train_error * 100, col = "red") + lines(log10(lambda_tmp), test_error * 100, col = "blue") + points(log10(lambda_opt), min_error * 100, col = "green", cex = 5) + text(-4, 0.5, + labels = paste("Min error test: ", round(min_error * 100, 2), " % at 1e", + round(log10(lambda_opt), 1)), + cex = 1 + ) + grid() +} + +# Plot regularization vector +{ + plot(range(log10(lambda_tmp)), range(coefficient_norm), + type = "n", + xlab = "Log10(lambda)", ylab = "Norm", + main = "Parameter vector L2-norm" + ) + lines(log10(lambda_tmp), coefficient_norm) + grid() +} + diff --git a/exercises/02450Toolbox_R/Scripts/ex8_2_2.R b/exercises/02450Toolbox_R/Scripts/ex8_2_2.R new file mode 100644 index 0000000000000000000000000000000000000000..d992a6f591bd7ccf7f5512b2bce6845d6ebe28a1 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex8_2_2.R @@ -0,0 +1,92 @@ +#################### +# Exercise 8.2.2 +#################### +rm(list = ls()) # Clear work space + +graphics.off() + +source('setup.R') + +# install.packages("torch") +library(torch) + +# Package for Cross-Validation +library(caret) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "xor.mat")) +X <- data$X +N <- as.numeric(data$N) +attributeNames <- make.names(unlist(data$attributeNames)) +M <- as.numeric(data$M) +y <- data$y +C <- data$C +classNames <- unlist(data$classNames) + +# K-fold cross-validation +K <- 10 + +# For reproducibility +set.seed(1234) + +CV <- list() +CV$which <- createFolds(y, k = K, list = F) +CV$TrainSize <- c() +CV$TestSize <- c() + +# Parameters for neural network classifier +NHiddenUnits <- 1 + +# Variable for classification error +Error <- rep(NA, times = K) + +model <- function() { + nn_sequential( + nn_linear(M, NHiddenUnits), + nn_tanh(), + nn_linear(NHiddenUnits, 1), + nn_sigmoid() + ) +} + +loss_fn <- nn_bce_loss() + + +# For each cross-validation fold +for (k in 1:K) { + print(paste("Crossvalidation fold ", k, "/", K, sep = "")) + + # Extract training and test set + X_train <- X[CV$which != k, ] + y_train <- y[CV$which != k] + X_test <- X[CV$which == k, ] + y_test <- y[CV$which == k] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + result <- train_neural_net(model, loss_fn, X_train, y_train, + max_iter = 10000, n_replicates = 3) + + print(paste("Best loss:", result$final_loss)) + + # Predict model on test data + y_sigmoid = result$net(X_test) + y_test_est <- as.integer(y_sigmoid > 0.5) + + # Compute error rate + Error[k] <- sum(as.integer(y_test) != y_test_est) +} + +# Print the error rate +print(paste("Error rate: ", sum(Error) / sum(CV$TestSize) * 100, "%", sep = "")) + +# Display the decision boundary (given for last cross-validation fold) +predictionFunction <- function(X_train, net) { + X_train <- as.matrix(X_train) + probs <- matrix(as.array(net(X_train)), nrow = sqrt(dim(X_train)[1]), byrow = FALSE) + probs +} + +dbplot(X, attributeNames, predictionFunction, y = y, + contourLevels = 0.5, contourCols = "white", net = result$net) diff --git a/exercises/02450Toolbox_R/Scripts/ex8_2_5.R b/exercises/02450Toolbox_R/Scripts/ex8_2_5.R new file mode 100644 index 0000000000000000000000000000000000000000..7a839fd11c20749e15a835cea30b2a834c4aaf99 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex8_2_5.R @@ -0,0 +1,87 @@ +#################### +# Exercise 8.2.5 +#################### +rm(list = ls()) # Clear work space + +graphics.off() + +source("setup.R") + +# install.packages("torch") +library(torch) + +# Package for Cross-Validation +library(caret) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "wine2.mat")) +X <- data$X +N <- as.numeric(data$N) +attributeNames <- make.names(unlist(data$attributeNames)) +M <- as.numeric(data$M) +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +# Predict red cs. white wine type +# K-fold cross-validation +K <- 10 +# For reproducibility +set.seed(12345) + +CV <- list() +CV$which <- createFolds(y, k = K, list = F) +CV$TrainSize <- c() +CV$TestSize <- c() + +# Parameters for neural network classifier +NHiddenUnits <- 2 +max_iter <- 5000 +n_replicates <- 2 + +# Variable for classification error +Error <- rep(NA, times = K) + +# Define the model +model <- function() { + nn_sequential( + nn_linear(M, NHiddenUnits), + nn_tanh(), + nn_linear(NHiddenUnits, 1), + nn_sigmoid() + ) +} + +# Define the loss +loss_fn <- nn_bce_loss() + +# For each cross-validation fold +for (k in 1:K) { + print(paste("Crossvalidation fold ", k, "/", K, sep = "")) + + # Extract training and test set + X_train <- X[CV$which != k, ] + y_train <- y[CV$which != k] + X_test <- X[CV$which == k, ] + y_test <- y[CV$which == k] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + result <- train_neural_net(model, loss_fn, X_train, y_train, + max_iter = max_iter, n_replicates = n_replicates + ) + + print(paste("Best loss:", result$final_loss)) + + # Predict model on test data + y_sigmoid <- result$net(X_test) + y_test_est <- as.integer(y_sigmoid > 0.5) + + # Compute error rate + Error[k] <- sum(as.integer(y_test) != y_test_est) +} + + +# Print the error rate +print(paste("Mean Sum of Squares Error (MSSE): ", sum(Error) / sum(CV$TestSize), sep = "")) diff --git a/exercises/02450Toolbox_R/Scripts/ex8_2_6.R b/exercises/02450Toolbox_R/Scripts/ex8_2_6.R new file mode 100644 index 0000000000000000000000000000000000000000..506baa38b3aaeb07fd58ae3ea5730fd320a902f0 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex8_2_6.R @@ -0,0 +1,94 @@ +#################### +# Exercise 8.2.6 +#################### +rm(list = ls()) # Clear work space + +graphics.off() + +source("setup.R") + +# install.packages("torch") +library(torch) + +# Package for Cross-Validation +library(caret) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "wine2.mat")) +N <- as.numeric(data$N) +attributeNames <- make.names(unlist(data$attributeNames)) +M <- as.numeric(data$M) + +# Predict alcohol content +X <- data$X[, -11] +y <- data$X[, 11] +attributeNames <- attributeNames[-11] +M <- M - 1 +colnames(X) <- attributeNames + +# K-fold cross-validation +K <- 10 + +# For reproducibility +set.seed(12345) + +CV <- list() +CV$which <- createFolds(y, k = K, list = F) +CV$TrainSize <- c() +CV$TestSize <- c() + +# Parameters for neural network classifier + +# Number of hidden units +NHiddenUnits <- 2 +max_iter <- 5000 +n_replicates <- 2 +Ntrain <- 1 + +# Define the model +model <- function() { + nn_sequential( + nn_linear(M, NHiddenUnits), + nn_tanh(), + nn_linear(NHiddenUnits, 1), + ) +} + +# Define the loss +loss_fn <- nn_mse_loss() + +# Variable for classification error +Error <- rep(NA, times = K) + +# Create tensor objects for Torch +X_tensor <- torch_tensor(X) +y_tensor <- torch_tensor(y) + +for (k in 1:K) { # For each cross-validation fold + print(paste("Crossvalidation fold ", k, "/", K, sep = "")) + + # Extract training and test set + X_train <- X_tensor[CV$which != k, ] + y_train <- y_tensor[CV$which != k] + X_test <- X_tensor[CV$which == k, ] + y_test <- y_tensor[CV$which == k] + CV$TrainSize[k] <- length(y_train) + CV$TestSize[k] <- length(y_test) + + # Fit neural network to training set + result <- train_neural_net(model, loss_fn, as.matrix(X_train), y_train, + max_iter = max_iter, n_replicates = n_replicates) + + + y_test_est <- as.array(result$net(X_test)) + + # Compute error rate + Error[k] <- sum((as.array(y_test) - y_test_est)^2) # Count the number of errors +} + + +# Print the error rate +print(paste("Mean Sum of Squares Error (MSSE): ", sum(Error) / sum(CV$TestSize), sep = "")) +# Inspect the parameters of the trained network (given for last cross-validation fold) +result$net$parameters diff --git a/exercises/02450Toolbox_R/Scripts/ex8_3_1.R b/exercises/02450Toolbox_R/Scripts/ex8_3_1.R new file mode 100644 index 0000000000000000000000000000000000000000..89bf0570d80b72ef4fa864aeb20e76519aa22578 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex8_3_1.R @@ -0,0 +1,94 @@ +#################### +# Exercise 8.3.1 +#################### +rm(list = ls()) # Clear work space + +graphics.off() + +source("setup.R") + +# install.packages("torch") +library(torch) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth1.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X_train <- data$X.train +N_train <- data$N.train +y_train <- data$y.train + 1 + +X_test <- data$X.test +N_test <- data$N.test +y_test <- data$y.test + 1 + +X_train <- data.frame(X_train) +colnames(X_train) <- attributeNames +X_test <- data.frame(X_test) +colnames(X_test) <- attributeNames + +# Parameters for neural network classifier +NHiddenUnits <- 2 # Number of hidden units + +# Define the model +model <- function() { + nn_sequential( + nn_linear(M, NHiddenUnits), + nn_relu(), # 1st transfer function + nn_linear(NHiddenUnits, C), + nn_softmax(dim = 1) # final transfer function, normalization of logit output + ) +} + +# Since we're training a multiclass problem, we cannot use binary cross entropy, +# but instead use the general cross entropy loss: +loss_fn <- nn_cross_entropy_loss() + +############################################### +# Fit multiclass neural network to training set +############################################### + +X_train_torch <- torch_tensor(as.matrix(X_train), dtype = torch_float32()) +y_train_torch <- torch_tensor(y_train, dtype = torch_long())$squeeze() + +result <- train_neural_net(model, loss_fn, X_train_torch, y_train_torch, + max_iter = 10000, n_replicates = 3) + +############################## +# Compute results on test data +############################## + +# Get the predicted output for the test data +y_test_est <- as.array(result$net(as.matrix(X_test))) + +# Compute the class index by finding the class with +# highest probability for each prediction +y_test_est <- apply(y_test_est, 1, which.max) + +# Compute error rate +ErrorRate <- sum(y_test != y_test_est) / N_test + +print(paste("Error rate: ", ErrorRate * 100, "%", sep = "")) + +############## +# Plot results +############## + +# Display the decision boundary +predictionFunction <- function(Xgrid, net) { + Xgrid <- as.matrix(Xgrid) + probs <- net(Xgrid) + y_test_est <- apply(probs, 1, which.max) + return (y_test_est) +} + +dbplot(X, attributeNames, predictionFunction, y = y, + contourLevels = 0.5, contourCols = "white", net = result$net) + diff --git a/exercises/02450Toolbox_R/Scripts/ex8_3_2.R b/exercises/02450Toolbox_R/Scripts/ex8_3_2.R new file mode 100644 index 0000000000000000000000000000000000000000..52038495d23b964989de891bcf41e6bfbad299ff --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex8_3_2.R @@ -0,0 +1,70 @@ +#################### +# Exercise 8.3.2 +#################### +rm(list = ls()) # Clear work space + +graphics.off() + +source("setup.R") + +library(nnet) # install.packages("nnet") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth1.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X_train <- data$X.train +N_train <- data$N.train +y_train <- data$y.train + 1 + +X_test <- data$X.test +N_test <- data$N.test +y_test <- data$y.test + 1 + +X_train <- data.frame(X_train) +colnames(X_train) <- attributeNames +X_test <- data.frame(X_test) +colnames(X_test) <- attributeNames + +################################## +# Fit multinomial regression model +################################## + +Y_train <- factor(y_train) +Y_test <- factor(y_test) + +(fmla <- as.formula(paste("y_train ~ ", paste(attributeNames, collapse = "+")))) +model <- multinom(formula = fmla, data = X_train) + +## Compute results on test data +# Get the predicted output for the test data +Y_test_est <- predict(object = model, newdata = X_test, type = "probs") + +# Compute the class index by finding the class with highest probability +# from the multinomial regression model +y_test_est <- apply(Y_test_est, 1, which.max) + +ErrorRate <- sum(y_test != y_test_est) / N_test +print(paste("Error rate: ", ErrorRate * 100, "%", sep = "")) + +############## +# Plot results +############## + +# Display decision boundaries +predictionFunction <- function(Xgriddf, model) { + Y_test_est <- predict(object = model, newdata = Xgriddf, type = "probs") + y_test_est <- max_idx(Y_test_est) + y_test_est +} + +dbplot(X_test, attributeNames, predictionFunction, y = y_test, + contourLevels = 0.5, contourCols = "white", model = model) + diff --git a/exercises/02450Toolbox_R/Scripts/ex8_3_3.R b/exercises/02450Toolbox_R/Scripts/ex8_3_3.R new file mode 100644 index 0000000000000000000000000000000000000000..ea9ed041285fb61c79be79bb85d661045f833e96 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex8_3_3.R @@ -0,0 +1,67 @@ +#################### +# Exercise 8.3.3 +#################### +rm(list = ls()) # Clear work space + +graphics.off() + +source("setup.R") + +# Package for Logisitic Regression with regularization +library(glmnet) # install.packages("glmnet") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth1.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X_train <- data$X.train +N_train <- data$N.train +y_train <- data$y.train + 1 + +X_test <- data$X.test +N_test <- data$N.test +y_test <- data$y.test + 1 + +X_train <- data.frame(X_train) +colnames(X_train) <- attributeNames +X_test <- data.frame(X_test) +colnames(X_test) <- attributeNames + + +## Fit a regularized multinomial regression model +regularization_strength <- 1e3 + +# Try a a high strength, e.g. 1e3 and analyze the distributions of labels +# Especially for synth2, synth3, and synth 4. +model <- glmnet(X_train, y_train, family = "multinomial", alpha = 0, + lambda = regularization_strength) + +# Predict labels for both sets for current regularization strength +y_train_est <- as.integer(predict(model, as.matrix(X_train), type = "class", + s = regularization_strength)) + +# Get the predicted output for the test data +y_test_est <- as.integer(predict(model, as.matrix(X_test), type = "class", + s = regularization_strength)) + +# Compute error rate +ErrorRate <- sum(y_test != y_test_est) / N_test +print(paste("Error rate: ", ErrorRate * 100, "%", sep = "")) + +# Plot results +breaks <- c(seq(-.5, 3.5, 1)) + +par(mfrow = c(1, 1)) +par(cex.main = 2, cex.lab = 1, cex.axis = 1) # Define size of text +par(mar = c(5, 6, 4, 1) + .1) # Increase margin size to allow for larger axis labels + +hist(y_train-1, breaks, freq = FALSE, ylim = c(0, 1)) +hist(y_test-1, breaks, freq = FALSE, ylim = c(0, 1)) +hist(y_test_est-1, breaks, freq = FALSE, ylim = c(0, 1)) diff --git a/exercises/02450Toolbox_R/Scripts/ex9_1_1.R b/exercises/02450Toolbox_R/Scripts/ex9_1_1.R new file mode 100644 index 0000000000000000000000000000000000000000..f7cb9e5d3f052d16e57c49113c226a7f786cee67 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex9_1_1.R @@ -0,0 +1,78 @@ +#################### +# Exercise 9.1.1 +#################### +rm(list = ls()) # Clear work space + +source("setup.R") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth5.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +################################################# +# Fit model using bootstrap aggregation (bagging) +################################################# + +# Number of rounds of bagging +L <- 100 # Variable for model parameters + +# Make a empty list +w_est <- vector("list", L) + +# Weights for selecting samples in each bootstrap +weights <- rep.int(1, times = N) / c(N) +(fmla <- as.formula(paste("y_train ~ ", paste(attributeNames, collapse = "+")))) + +# For each round of bagging +for (l in 1:L) { + # Choose data objects by random sampling with replacement + i <- sample(x=1:N, prob=weights, replace=TRUE) + + # Extract training set + X_train <- X[i, ] + y_train <- y[i] + + # Fit logistic regression model to training data and save result + # suppress warnings to avoid warning that fitted probabilities were close to 0 or 1 + w_est[[l]] <- suppressWarnings(glm(fmla, family = binomial(link = "logit"), data = X_train)) +} + +# Evaluate the logistic regression on the training data + +predict_helper <- function(model, newdata, type) { + predict(model, newdata = newdata, type = type) +} + +plist <- lapply(w_est, FUN = predict_helper, newdata = X, type = "response") +p <- matrix(unlist(plist), nrow = N, byrow = FALSE) + +# Estimated value of class labels (using 0.5 as threshold) by majority voting +y_est <- rowSums(p > .5) > L / 2 + +# Compute error rate +ErrorRate <- sum(y != y_est) / N +print(paste("Error rate: ", ErrorRate * 100, "%", sep = "")) + +######################## +# Plot decision boundary +######################## + +predictionFunction <- function(Xgrid, model, type) { + plist <- lapply(w_est, predict_helper, newd = Xgrid, type = type) + p <- matrix(unlist(plist), nrow = dim(Xgrid)[1], byrow = FALSE) + rowMeans(p) +} + +dbplot(X, attributeNames, predictionFunction, y = y, contourLevels = 0.5, + contourCols = "white", model = w_est, type = "response") + diff --git a/exercises/02450Toolbox_R/Scripts/ex9_1_2.R b/exercises/02450Toolbox_R/Scripts/ex9_1_2.R new file mode 100644 index 0000000000000000000000000000000000000000..cdba7fa297064afa60aa9fa893dcb9d6a6d1663e --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex9_1_2.R @@ -0,0 +1,107 @@ +#################### +# Exercise 9.1.2 +#################### +rm(list = ls()) # Clear work space + +source("setup.R") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth6.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +##################################### +# Fit model using boosting (AdaBoost) +##################################### + +# Number of rounds of boosting +L <- 100 + +# Allocate variable for model parameters +w_est <- vector("list", L) + +# Allocate variable for model importance weights +alpha <- rep(NA, times = L) + +# Weights for selecting samples in each round of boosting +weights <- rep(1, times = N) / c(N) + +##################### +# Boosting (AdaBoost) +##################### + +# For each round of boosting +l <- 1 +(fmla <- as.formula(paste("y_train ~ ", paste(attributeNames, collapse = "+")))) + +while (l <= L) { + # Choose data objects by random sampling with replacement + i <- sample(x=1:N, prob=weights, replace=TRUE) + + # Extract training set + X_train <- X[i, ] + y_train <- y[i] + + # Fit logistic regression model to training data and save result + w_est[[l]] <- suppressWarnings(glm(fmla, family = binomial(link = "logit"), data = X_train)) + + # Make predictions on the whole data set + p <- predict(w_est[[l]], newdata = X, type = "response") + y_est <- p > 0.5 + + # Compute error rate + ErrorRate <- sum(weights * (y != y_est)) + + # Compute model importance weight + alpha[l] <- .5 * log((1 - ErrorRate) / ErrorRate) + + # Update weights + weights[y == y_est] <- weights[y == y_est] * exp(-alpha[l]) + weights[y != y_est] <- weights[y != y_est] * exp(alpha[l]) + weights <- weights / sum(weights) + + # Next round + l <- l + 1 +} + +# Normalize the importance weights +alpha <- alpha / sum(alpha) + +# Evaluate the logistic regression on the training data + +predict_helper <- function(model, newdata, type) { + predict(model, newdata = newdata, type = type) +} + +plist <- lapply(w_est, FUN = predict_helper, newdata = X, type = "response") +p <- matrix(unlist(plist), nrow = N, byrow = FALSE) # N is number of observations + +# The predictions is weighted according to alpha. +y_est <- rowSums(t(apply(p > 0.5, 1, function(x, weights) x * weights, weights = alpha))) > 0.5 + +# Compute error rate +ErrorRate <- sum(y != y_est) / N +print(paste("Error rate: ", ErrorRate * 100, "%", sep = "")) + +######################## +# Plot decision boundary +######################## + +predictionFunction <- function(Xgrid, model, type, alpha) { + plist <- lapply(w_est, predict_helper, newd = Xgrid, type = type) + p <- matrix(unlist(plist), nrow = dim(Xgrid)[1], byrow = FALSE) + y_est <- rowSums(t(apply(p > 0.5, 1, function(x, weights) x * weights, weights = alpha))) + y_est +} + +dbplot(X, attributeNames, predictionFunction, y = y, contourLevels = 0.5, + contourCols = "white", model = w_est, typ = "response", alpha = alpha) diff --git a/exercises/02450Toolbox_R/Scripts/ex9_1_3.R b/exercises/02450Toolbox_R/Scripts/ex9_1_3.R new file mode 100644 index 0000000000000000000000000000000000000000..6c21ad7903977ad74f68c9ed147364516f39e1af --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex9_1_3.R @@ -0,0 +1,58 @@ +#################### +# Exercise 9.1.3 +#################### +rm(list = ls()) # Clear work space + +library(randomForest) # install.packages("randomForest") + +source("setup.R") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "synth7.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(as.vector(unlist(data$attributeNames))) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +################################################# +# Fit model using bootstrap aggregation (bagging) +################################################# + +# Number of rounds of bagging +L <- 100 + +# Fit classification trees using the TreeBagger function +classAssignments <- factor(classNames[y + 1]) +(fmla <- as.formula(paste("classAssignments ~ ", paste(attributeNames, collapse = "+")))) + +B <- randomForest(fmla, data = X, ntree = L) + +# Make predictions for the whole data set. The predict function outputs a +# vector of factor levels, so y_est can be computed by comparing the returned +# factor levels to the level of the second class. This will give +# a 0 for "Class 1" and a 1 for "Class 2". + +y_est <- predict(B, X) == factor(classNames)[2] + +# Compute error rate +ErrorRate <- sum(y != y_est) / N +print(paste("Error rate: ", ErrorRate * 100, "%", sep = "")) + +######################## +# Plot decision boundary +######################## + +predictionFunction <- function(Xgrid, model, classNames) { + y_est <- predict(model, Xgrid) == factor(classNames)[2] + y_est +} + +dbplot(X, attributeNames, predictionFunction, y = y, contourLevels = 0.5, + contourCols = "white", model = B, classNames = classNames) diff --git a/exercises/02450Toolbox_R/Scripts/ex9_2_1.R b/exercises/02450Toolbox_R/Scripts/ex9_2_1.R new file mode 100644 index 0000000000000000000000000000000000000000..3b97b5e6991b3e60b4371ea0a19448c1d56f38c3 --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex9_2_1.R @@ -0,0 +1,119 @@ +#################### +# Exercise 9.2.1 +#################### +rm(list = ls()) # Clear work space + +# Package for Cross-Validation +library(caret) +library(yardstick) #install.packages("yardstick") +library(scales) #install.packages("scales") + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "wine2.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(unlist(data$attributeNames)) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +################# +# Crossvalidation +################# + +# Create crossvalidation partition for evaluation +# using 50 pct. split between training and test + +# For reproducibility +set.seed(1234) + +CV <- list() +CV$which <- createFolds(y, k = 2, list = F) +CV$TrainSize <- c() +CV$TestSize <- c() + +# Extract the training and test set +X_train <- X[CV$which != 1, ] +y_train <- y[CV$which != 1] +X_test <- X[CV$which == 1, ] +y_test <- y[CV$which == 1] +CV$TrainSize[1] <- length(y_train) +CV$TestSize[1] <- length(y_test) + +########### +# Fit model +########### + +# Fit logistic regression model to training data to predict the type of wine + +(fmla <- as.formula(paste("y_train ~ ", paste(attributeNames, collapse = "+")))) + +# Fit logistic regression model to predict the type of wine +w_est <- glm(fmla, family = binomial(link = "logit"), data = X_train) + +# Evaluate the logistic regression on the test data +p <- predict(w_est, newdata = X_test, type = "response") + +#################################################### +# Plot receiver operating characteristic (ROC) curve +#################################################### + +# Calculate ROC curve +frame <- data.frame(Prob = 1 - p, Truth = factor(y_test)) +roccurve <- roc_curve(frame, Truth, Prob) + +# Caluclate AUC +auc <- roc_auc(frame, Truth, Prob)$.estimate + +# Plot ROC curve +ggplot(roccurve, aes(x = 1 - specificity, y = sensitivity)) + + geom_line(size = 0.75, color="red") + + geom_abline(slope = 1, intercept = 0, size = 1) + + coord_fixed() + labs(y = "Truth positive rate (Sensitivity)", + x = "False positive rate (1 - Specificity)") + + ggtitle(paste0("ROC Curve (AUC = ", round(auc, 3), ")")) + + theme(plot.title = element_text(hjust = 0.5)) + + + +####################### +# Plot confusion matrix +####################### + +# We'll plot a confusion matrix as well + +y_test_est <- p > .5 # Threshold + +tr <- factor(classNames[as.numeric(y_test) + 1], levels=classNames) +pr <- factor(classNames[as.numeric(y_test_est) + 1], levels=classNames) + +cm <- confusionMatrix(data = factor(pr), reference = factor(tr)) +values <- as.numeric(cm$table) +accuracy <- cm$overall[1] +error_rate <- 1 - accuracy + +TClass <- rep(classNames, each = C) +PClass <- rep(classNames, times = C) + +df <- data.frame(TClass, PClass, values) + +par(mfrow=c(1,1)) + +ggplot(data = df, mapping = aes(x = PClass, y = TClass)) + + geom_tile(aes(fill = values), colour = "white") + + geom_text(aes(label = sprintf("%1.0f", values)), vjust = 1) + + scale_fill_gradient(low = "blue", high = "red") + + scale_y_discrete(limits = rev) + + labs(x = "Predicted class", y = "Actual class") + + theme_bw() + + theme(legend.position = "none") + + ggtitle(sprintf( + "Confussion matrix (Accuracy: %s, Error Rate: %s)", + label_percent()(accuracy), label_percent()(error_rate) + )) + diff --git a/exercises/02450Toolbox_R/Scripts/ex9_2_2.R b/exercises/02450Toolbox_R/Scripts/ex9_2_2.R new file mode 100644 index 0000000000000000000000000000000000000000..53937694bdc4ec17014df9a4bde44c8fa6be7e6d --- /dev/null +++ b/exercises/02450Toolbox_R/Scripts/ex9_2_2.R @@ -0,0 +1,115 @@ +#################### +# Exercise 9.2.2 +#################### +rm(list = ls()) # Clear work space + +# Package for Cross-Validation +library(caret) + +# Load data +library(R.matlab) +data <- readMat(file.path("Data", "wine2.mat")) +X <- data$X +N <- data$N +attributeNames <- make.names(unlist(data$attributeNames)) +M <- data$M +y <- data$y +C <- data$C +classNames <- as.vector(unlist(data$classNames)) + +X <- data.frame(X) +colnames(X) <- attributeNames + +# Remove all attributes except "Alcohol" +i <- 11 # Attribute indices to keep + +################# +# Crossvalidation +################# + +# Create crossvalidation partition for evaluation +# using 50 pct. split between training and test + +# For reproducibility +set.seed(1234) + +CV <- list() +CV$which <- createFolds(y, k = 2, list = F) +CV$TrainSize <- c() +CV$TestSize <- c() + +# Extract the training and test set +X_train <- X[CV$which != 1, ] +y_train <- y[CV$which != 1] +X_test <- X[CV$which == 1, ] +y_test <- y[CV$which == 1] +CV$TrainSize[1] <- length(y_train) +CV$TestSize[1] <- length(y_test) + +## Fit model +(fmla <- as.formula(paste("y_train ~ ", paste(attributeNames[i], collapse = "+")))) + +# Fit logistic regression model to predict the type of wine +w_est <- glm(fmla, family = binomial(link = "logit"), data = X_train) + +# Evaluate the logistic regression on the test data +p <- predict(w_est, newdata = X_test, type = "response") + +#################################################### +# Plot receiver operating characteristic (ROC) curve +#################################################### + +# Calculate ROC curve +frame <- data.frame(Prob = 1 - p, Truth = factor(y_test)) +roccurve <- roc_curve(frame, Truth, Prob) + +# Calculate AUC +auc <- roc_auc(frame, Truth, Prob)$.estimate + +# Plot ROC curve +ggplot(roccurve, aes(x = 1 - specificity, y = sensitivity)) + + geom_line(size = 0.75, color="red") + + geom_abline(slope = 1, intercept = 0, size = 1) + + coord_fixed() + labs(y = "True positive rate (Sensitivity)", + x = "False positive rate (1 - Specificity)") + + ggtitle(paste0("ROC Curve (AUC = ", round(auc, 3), ")")) + + theme(plot.title = element_text(hjust = 0.5)) + + + +####################### +# Plot confusion matrix +####################### + +# We'll plot a confusion matrix as well + +y_test_est <- p > .5 # Threshold + +tr <- factor(classNames[as.numeric(y_test) + 1], levels=classNames) +pr <- factor(classNames[as.numeric(y_test_est) + 1], levels=classNames) + +cm <- confusionMatrix(data = pr, reference = tr) +values <- as.numeric(cm$table) +accuracy <- cm$overall[1] +error_rate <- 1 - accuracy + +TClass <- rep(classNames, each = C) +PClass <- rep(classNames, times = C) + +df <- data.frame(TClass, PClass, values) + +par(mfrow=c(1,1)) + +ggplot(data = df, mapping = aes(x = PClass, y = TClass)) + + geom_tile(aes(fill = values), colour = "white") + + geom_text(aes(label = sprintf("%1.0f", values)), vjust = 1) + + scale_fill_gradient(low = "blue", high = "red") + + scale_y_discrete(limits = rev) + + labs(x = "Predicted class", y = "Actual class") + + theme_bw() + + theme(legend.position = "none") + + ggtitle(sprintf( + "Confussion matrix (Accuracy: %s, Error Rate: %s)", + label_percent()(accuracy), label_percent()(error_rate) + )) + diff --git a/exercises/02450Toolbox_R/Tools/binarize.R b/exercises/02450Toolbox_R/Tools/binarize.R new file mode 100644 index 0000000000000000000000000000000000000000..1354373ed04d0822cba8c7d0c4a877f5be79e9cb --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/binarize.R @@ -0,0 +1,33 @@ +binarize <- function(X, Y) { + # Construct binary versions of the matrices X and Y + # + # Author: Laura Frølich, lff@imm.dtu.dk + # Updated 5/12-2017 by Quoc Tien Au + if (dim(X)[2] == 1) { + X <- t(X) + } + + if (dim(Y)[2] == 1) { + Y <- t(Y) + } + + N1 <- dim(X)[1] + M <- dim(X)[2] + N2 <- dim(Y)[1] + M <- dim(Y)[2] + + + + + "Attributes non-binary: Forcing representation to be binary. +The median of X+Y is taken in order to solve ex3_3_1" + med <- apply(rbind(X, Y), 2, median) + X <- t(apply(X, 1, ">", med)) + Y <- t(apply(Y, 1, ">", med)) + + binarized <- list() + binarized$X <- X + binarized$Y <- Y + + binarized +} diff --git a/exercises/02450Toolbox_R/Tools/binarize2.R b/exercises/02450Toolbox_R/Tools/binarize2.R new file mode 100644 index 0000000000000000000000000000000000000000..9e46f17c9ff062fd1d22d76659d813a7b5c27790 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/binarize2.R @@ -0,0 +1,46 @@ +binarize2 <- function(X,attributeNames) +{ + # Construct binary version of the matrix X (with N observations and M attributes). + # Input data matrix (X) should contain only numeric attributes, input attributeNames is optional + # + # Output contains a list with X (binarized data) and attributeNames (names of binarized attributes) + # Binarized data containts (2*M) columns: + # The first M columns correspond to X values larger than median value (of each corresponding column). + # Last M columns correspond to X values smaller than median value (of each corresponding column). + # + # Ex: the first attribute of X is binarized into 2 attributes: attribute >= median and + # attribute < median. These are now the first and (M+1)th attributes of the output + # + # Author: Yashar Sabaz, s143093@student.dtu.dk + # Updated November 2017 by Quoc Tien Au + + N = dim(X)[1]; + M = dim(X)[2]; + + 'Attributes non-binary: Forcing representation to be binary.' + med = apply(X, 2, median) + X <- t(apply(X,1,'>', med)) + + binarized <- list(); + binarized$X <- X; + + 'Get attributes < median' + smaller_than_median_attributes = !(binarized$X); + binarized$X = cbind(binarized$X, smaller_than_median_attributes)*1; + + + 'Write names for "new" attributes, if it has been input' + if(missing(attributeNames)==FALSE){ + + att_names_bin = paste(attributeNames, '50%-100% percentile'); + att_names_bin2 = paste(attributeNames, '0%-50% percentile'); + binarized$attributeNames = c(att_names_bin, att_names_bin2); + + } + + + + binarized + + +} diff --git a/exercises/02450Toolbox_R/Tools/bmplot.R b/exercises/02450Toolbox_R/Tools/bmplot.R new file mode 100644 index 0000000000000000000000000000000000000000..98564cf139f80149d1e17b379843f42abf126c9c --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/bmplot.R @@ -0,0 +1,30 @@ +bmplot <- function(rowlabels, columnlabels, mat, main='Attributes selected', xlab='Iteration', ylab=''){ +# rowlabels: Labels for the rows. +# columnlabels: Labels for the columns. +# mat: The binary matrix to be plotted. +# main, xlab, and ylab: These are passed on to the plotting +# function, retaining their usual meaning in plots. +# +# Author: Laura Frølich, lff@imm.dtu.dk + +# make room for horizontal y-labels + par(mar = c(4, 7, 4, 2) + 0.1) + I <- dim(mat)[1] + M <- dim(mat)[2] + + image(1:(I+1), 1:(M+1), mat, col=gray((32:0)/32), xaxt="n", yaxt="n", xlab=xlab, ylab=ylab, main=main) + +xseq <- 1:I +yseq <- 1:M +axis(1, at=xseq, labels=columnlabels) +axis(2, at=yseq+diff(yseq)[1]/2,labels=FALSE) + +text(par("usr")[1] - 0.25, yseq+diff(yseq)[1]/2, srt = 0, adj = 1, labels = rowlabels, xpd = TRUE) + +for(ixseq in xseq){ +abline(v=ixseq) +} +for(iyseq in yseq){ +abline(h=iyseq) +} +} diff --git a/exercises/02450Toolbox_R/Tools/calcMI.R b/exercises/02450Toolbox_R/Tools/calcMI.R new file mode 100644 index 0000000000000000000000000000000000000000..3a9255a8d0b18c86a647220e7da33e00556cbf97 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/calcMI.R @@ -0,0 +1,16 @@ +# Function calculate Mutual Information between two assigment matrices +# Z1: D1 x N (# clusters times observations) +# Z2: D2 x N (# clusters times obervations) +# Written by: Søren Føns Vind Nielsen [sfvn@dtu.dk] +# October, 2016 +calcMI <- function(Z1, Z2){ + P <- Z1%*%t(Z2) + PXY <- P/sum(P) + PXPY <- rowSums(PXY)%*% t(colSums(PXY)) + greater_than_zero <- PXY > 0 + MI <- sum(PXY[greater_than_zero]*log(PXY[greater_than_zero]/PXPY[greater_than_zero]) ) + + # return + MI +# EOF +} \ No newline at end of file diff --git a/exercises/02450Toolbox_R/Tools/categoric2numeric.R b/exercises/02450Toolbox_R/Tools/categoric2numeric.R new file mode 100644 index 0000000000000000000000000000000000000000..183268eb9404759f8fd2c1d5b3c2aa48caad5e7e --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/categoric2numeric.R @@ -0,0 +1,36 @@ +categoric2numeric <- function(x) +{ + +# CATEGORIC2NUMERIC converts data matrix with categorical columns given by +# numeric values or cells to numeric columns using one out of K coding. +# +# Usage: +# result =categoric2numeric(x) +# +# Input: +# x categorical column of a data matrix +# +# Output: +# A list containing the following variables +# X Data matrix where categoric column has been +# converted to one out of K coding +# attributeNames new vector of the M attributes +# +# Author: Laura Frølich, lff@imm.dtu.dk + +N <- length(x) +val <- unique(x); +M <- length(val); +X_tmp <- matrix(rep(0, times=N*M), nrow=N) +attributeNamestmp <- rep(NaN, times=M) + +for(t in 1:M) +{ + X_tmp[,t] <- (x==val[t]) + attributeNamestmp[t] <- val[t] +} +result <- list() +result$X <- X_tmp +result$attributeNames <-attributeNamestmp +result +} diff --git a/exercises/02450Toolbox_R/Tools/clusterplot.R b/exercises/02450Toolbox_R/Tools/clusterplot.R new file mode 100644 index 0000000000000000000000000000000000000000..5ad27e7c963e8b9c6f6673b955b99ebf82a56eef --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/clusterplot.R @@ -0,0 +1,109 @@ +clusterplot <- function(X, y, i, centroids=c(), ...){ +# CLUSTERPLOT Plots a clustering of a data set as well as the true class +# labels. If data is more than 2-dimensional they are projected onto the +# first two principal components. Data objects are plotted as a dot with a +# circle around. The color of the dot indicates the true class, and the +# cicle indicates the cluster index. +# +# Usage: +# clusterplot(X, y, i) where X is an N-by-M matrix of attribute +# values, y is an N-by-1 vector of class labels, and i is an N-by-1 +# vector of cluster indices. N is the number of data objects and C is +# the number of classes. +# +# clusterplot(X, y, i, Xc) where Xc is an K-by-M matrix of cluster +# centroids plots centroids as crosses. +# +# If the number of attributes is M=2, the clustering is plotted in the +# attribute space. If M>2, the clusteringis plotted in the plane spanned +# by the first two principal components. +# +# Input: +# X N-by-M matrix of attribute values for N data objects with M +# attributes. +# y N-by-1 vector of class labels +# i N-by-1 vector of cluster indices +# Xc K-by-M matrix of cluster centroids (optional) +# +# Author: Laura Frølich, lff@imm.dtu.dk + +if(is.vector(X)){ +X <- matrix(X, nrow=length(X), byrow=FALSE) +} +N <- dim(X)[1] +M <- dim(X)[2] + + +DoPCA = M>2; + +if(DoPCA){ + xlab <- 'PC1' + ylab <- 'PC2' +} + +if(!DoPCA){ + if(is.data.frame(X)){ + xlab <- colnames(X)[1] + ylab <- colnames(X)[2] + }else{ + xlab <- 'Column 1' + ylab <- 'Column 2' + } +} + +if(DoPCA){ + cmeans = colMeans(X) + XX = sapply(X, function(z) z-mean(z)); + res <- svd(XX); + V <- res$v; + X <- XX%*%V[,1:2]; + if (length(centroids)!=0) { + # if cluster centroids have been provided, project them onto the PCA space + centroids <- sapply(1:ncol(centroids), function(i) centroids[,i]-cmeans[i])%*%V + } +} + + + +# if(DoPCA){ +# mX = colMeans(X); +# Z = sapply(t(X), function(X, meanX) X-meanX, meanX=mX); +# res <- svd(Z) +# S <- diag(res$d) +# U <- res$u +# V <- res$v +# X = U%*%S; +# centroids <- sapply(X=centroids,1, function(X, meanX) X-meanX, meanX=mX)%*%V +# } + +xRange = c(min(X[,1]), max(X[,1])) +xRange = xRange + c(-1, 1)*diff(range(xRange))*0.05; +yRange = c(min(X[,2]), max(X[,2])); +yRange = yRange + c(-1, 1)*diff(range(yRange))*0.05; + +# Plot clustering +ui = sort(unique(i)); K = length(ui); +Ncol <- K +clustercols <- rainbow(K) +plot(xRange, yRange, type='n', xlab=xlab, ylab=ylab, ...) +for(k in 1:K){ + points(X[i==ui[k],1], X[i==ui[k],2], col=clustercols[((k-1)%%Ncol)+1], lwd=6) + } + +if(length(centroids)!=0){ +# Plot cluster centroids +for(k in 1:dim(centroids)[1]){ + points(centroids[k,1], centroids[k,2], pch=4, col=clustercols[((k-1)%%Ncol)+1], cex=3, lwd=2); + } +} + +uy = sort(unique(y)); C = length(uy); +classcols <- rainbow(C+2)[3:(C+2)] +Ncol <- C +# Plot class labels +for(k in 1:C){ + points(X[y==uy[k],1], X[y==uy[k],2], col=classcols[((k-1)%%Ncol)+1], pch=20) + } + + +} diff --git a/exercises/02450Toolbox_R/Tools/clusterval.R b/exercises/02450Toolbox_R/Tools/clusterval.R new file mode 100644 index 0000000000000000000000000000000000000000..58930b3e22a48a2057d09e44171e19e85c1a75fd --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/clusterval.R @@ -0,0 +1,61 @@ +clusterval <- function(y, i){ +# CLUSTERVAL Estimate cluster validity using entroy, purity, rand index, +# and Jaccard coefficient. +# +# Usage: +# [Entropy, Purity, Rand, Jaccard] = clusterval(y, i); +# +# Input: +# y N-by-1 vector of class labels +# i N-by-1 vector of cluster indices +# +# Output: +# Rand Rand index. +# Jaccard Jaccard coefficient. +# NMI Normalized Mutual Information +# +# Author: Laura Frølich, [lff@imm.dtu.dk] and Søren Føns Vind Nielsen [sfvn@dtu.dk] +# Updated 18th of October - Only includes Rand, Jaccard and NMI now + +N = length(y); + +d1_ <- sort(unique(y)) +d2_ <- unlist(lapply(d1_, FUN=function(X, y) which(y==X)[1], y=y)) +jy <- rep(NA, times=N) +for(yvalidx in 1:length(d1_)){ +yval <- d1_[yvalidx] +jy[y==yval] <- yvalidx +} +Zy <- array(rep(0, times=(length(d1_)*N)), dim=c(length(d1_), N)) +for(id1 in 1:length(d1_)){ +Zy[id1,jy==id1] <- 1 +} +Ay = t(Zy)%*%Zy; + +d1_ <- sort(unique(i)) +d2_ <- unlist(lapply(d1_, FUN=function(X, y) which(y==X)[1], y=i)) +ji <- rep(NA, times=N) +for(ivalidx in 1:length(d1_)){ +ival <- d1_[ivalidx] +ji[i==ival] <- ivalidx +} +Zi <- array(rep(0, times=(length(d1_)*N)), dim=c(length(d1_), N)) +for(id1 in 1:length(d1_)){ +Zi[id1,ji==id1] <- 1 +} +Ai = t(Zi)%*%Zi; + + +f11 = (sum(sum(Ai*Ay))-N)/2; +f00 = sum(sum((1-Ai)*(1-Ay)))/2; + +Rand = (f11+f00)/(N*(N-1)/2); +Jaccard = f11/(N*(N-1)/2-f00); +NMI <- (calcMI(Zy,Zi))/(sqrt(calcMI(Zy,Zy)*calcMI(Zi,Zi)) ) + +res <- list() +res$Rand <- Rand +res$Jaccard <- Jaccard +res$NMI <- NMI +res +} diff --git a/exercises/02450Toolbox_R/Tools/confmatplot.R b/exercises/02450Toolbox_R/Tools/confmatplot.R new file mode 100644 index 0000000000000000000000000000000000000000..83724320689f2afc55d486cc63c0b3f7f02138d9 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/confmatplot.R @@ -0,0 +1,78 @@ +confmatplot <- function(G, GHAT){ + # Plot confusion matrix based on the true labels in G and the predicted labels in GHAT + # + # Author: Laura Frølich, lff@imm.dtu.dk + # Edited by (november 2018): Martin Jørgensen, marjor@dtu.dk + + cm = table(G, GHAT) + classes <- sort(unique(c(G, GHAT))) # classes in alphabetical order + nclasses <- length(classes) + + if(dim(cm)[2]<nclasses){ + presentCols <- colnames(cm) + matchingcols <- match(presentCols, classes) + mismatchingcols <- (1:nclasses)[-matchingcols] + while(length(mismatchingcols)!=0){ + icol <- mismatchingcols[1] + ## new code + if(icol == 1){ + cm <- cbind(rep(0, times = dim(cm)[1]), cm[,1:dim(cm)[2]]) + }else if( icol == nclasses){ + cm <- cbind(cm[,1:dim(cm)[2]],rep(0, times = dim(cm)[1])) + }else{ + cm <- cbind(cm[,1:(icol-1)],rep(0,times = dim(cm)[1]),cm[,icol:dim(cm)[2]]) + } + mismatchingcols <- mismatchingcols[-1] + ## + } + colnames(cm) <- classes[1:dim(cm)[2]] + presentCols <- colnames(cm) + matchingcols <- match(presentCols, classes) + mismatchingcols <- (1:nclasses)[-matchingcols] + } + + + # This piece is redundant (?) Actual classes < nclasses (?) - Martin J. + #if(dim(cm)[1]<nclasses){ + # presentRows <- rownames(cm) + # matchingrows <- match(presentRows, classes) + # mismatchingrows <- (1:nclasses)[-matchingrows] + # while(length(mismatchingrows)!=0){ + # irow <- mismatchingrows[1] + # if(irow<dim(cm)[1]){ + # cm <- rbind(cm[1:irow,], rep(0, times=dim(cm)[2]), cm[irow:dim(cm)[1],]) + # }else{ + # cm <- rbind(cm[1:irow,], rep(0, times=dim(cm)[2])) + # } + # + # rownames(cm) <- classes[1:dim(cm)[1]] + # presentRows <- rownames(cm) + # matchingrows <- match(presentRows, classes) + # mismatchingrows <- (1:nclasses)[-matchingrows] + # } + #} + + nclasses <- dim(cm)[1] + classNames <- colnames(cm) + + image(1:nclasses, 1:nclasses, t(cm[nclasses:1,]), main='Confusion matrix', xlab='Predicted class', ylab="Actual class", xaxt="n", yaxt="n", col=heat.colors(nclasses^2)[(nclasses^2):1]) + #image(1:nclasses, 1:nclasses, cm[nclasses:1,], main='Confusion matrix', xlab='Predicted class', ylab="Actual class", xaxt="n", yaxt="n", col=heat.colors(nclasses^2)) + errorrate <- (sum(cm)-sum(diag(cm)))/sum(cm)*100 # error rate + accuracy <- (sum(diag(cm)))/sum(cm)*100 # accuracy + + mtext(paste('Accuracy = ', round(accuracy, digits=3), '%, Error Rate = ', round(errorrate, digits=3), '%', sep='')) + + axisseq <- 1:nclasses + axis(1, at=axisseq, labels=FALSE) + axis(2, at=axisseq, labels=FALSE) + + text(par("usr")[1] - 0.15, axisseq, srt = 90, adj = 0.5, labels = classNames[length(classNames):1], xpd = TRUE) #? + text(axisseq, par("usr")[3] - 0.15, srt = 0, adj = 0.5, labels = classNames, xpd = TRUE) + + for(iclass in 1:nclasses){ + for(jclass in 1:nclasses){ + text(jclass, iclass, labels=cm[length(classNames)-iclass+1,jclass]) + } + } +} + diff --git a/exercises/02450Toolbox_R/Tools/dbplot.R b/exercises/02450Toolbox_R/Tools/dbplot.R new file mode 100644 index 0000000000000000000000000000000000000000..dc3e2cb7b26eab692ee1233e170a1aee0ccf6812 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/dbplot.R @@ -0,0 +1,96 @@ +dbplot <- function(X, attributeNames, predictionFunction, y, contourLevels = 0.5, contourCols = "white", cols = c(), ...) { + # DBPLOT Plots a decision boundary for a classification problem with two attributes. + # + # Usage: + # dbplot(X, attributeNames, predictionFunction, y, contourLevels=0.5, contourCols='white', cols= c(),...) + # N is the number of data objects and M is the number of attributes. + # X: N-by-M matrix of attribute values + # attributeNames: vector of attributenames + # predictionFunction: trained function that predicts response from data in X + # y: N-by-1 vector of class labels or probabilities of belonging to one of the classes. + # contourLevels: values that separate classes + # contourCols: color used to draw boundaries between classes + # cols: colors used to shade the areas belonging to the different classes according to the prediction function. Only used in the non-binary case. In the binary case, the colors used are always blue and green. + # + # If the number of attributes is M=2, the decision boundary is plotted + # in the attribute space. Otherwise it is plotted in the space spanned by the two first principal components. + # + # Author: Laura Frølich, lff@imm.dtu.dk + + suppressWarnings({ + + if (length(contourCols) == 1 && length(unique(y)) != 2) { + contourCols <- rep(contourCols, times = length(unique(y))) + } + + if (length(contourLevels) == 1 && length(unique(y)) != 2) { + contourLevels <- rep(contourLevels, times = length(unique(y))) + } + + if (length(contourLevels) != length(contourCols)) { + stop("The arguments contourLevels and contourCols to the function dbplot must have the same length.") + } + + if (length(cols) == 0) { + cols <- rainbow(length(unique(y))) + } + + doPCA <- FALSE + if (dim(X)[2] > 2) { + doPCA <- TRUE + means <- colMeans(X) + Xzeromean <- t(apply(X, 1, "-", means)) + svdres <- svd(Xzeromean) + + # extract the matrices containing the left and right singular vectors, respectively + U <- svdres$u + V <- svdres$v + S <- diag(svdres$d) + X <- U %*% S + } + NGrid <- 200 + minx <- min(X[, 1]) + maxx <- max(X[, 1]) + seqx <- seq(from = minx, to = maxx, length.out = NGrid) + miny <- min(X[, 2]) + maxy <- max(X[, 2]) + seqy <- seq(from = miny, to = maxy, length.out = NGrid) + + + if (doPCA) { + mat <- cbind(rep(seqx, each = length(seqy)), rep(seqy, times = length(seqx)), array(rep(0, times = (NGrid^2) * (dim(X)[2] - 2)), dim = c(NGrid^2, dim(X)[2] - 2))) %*% t(V) + mat <- t(apply(mat, 1, "+", means)) + } else { + mat <- matrix(c(rep(seqx, each = length(seqy)), rep(seqy, times = length(seqx))), ncol = 2) + } + + + Xgriddf <- data.frame(mat) + colnames(Xgriddf) <- attributeNames + + probs_vector <- predictionFunction(Xgriddf, ...) + probs <- matrix(probs_vector, nrow = length(seqx), byrow = FALSE) + + sortedclasses <- sort(as.numeric(unique(y)), decreasing = TRUE, index.return = TRUE) + classes <- sortedclasses$x + order <- sortedclasses$ix + + if (doPCA) { + attributeNames <- c("PC 1", "PC 2") + } + + if (all(0 <= probs) && all(probs <= 1)) { + image(seqx, seqy, t(probs), col = rev(rainbow(200, start = 2 / 6, end = 4 / 6)), xlab = attributeNames[1], ylab = attributeNames[2], main = "Decision boundary") + cols <- c("green", "blue") + } else { + image(seqx, seqy, t(probs), col = rev(cols), xlab = attributeNames[1], ylab = attributeNames[2], main = "Decision boundary") + contour(seqx, seqy, t(probs), levels = contourLevels, labels = "", add = TRUE, type = "l", lwd = 5, col = contourCols) + } + darkercols <- col2rgb(cols) * 0.7 + darkercols <- rgb(t(darkercols), maxColorValue = 255) + + for (iclass in 1:length(classes)) { + points(X[y == classes[iclass], 1], X[y == classes[iclass], 2], col = darkercols[iclass], pch = 20) + } + }) +} diff --git a/exercises/02450Toolbox_R/Tools/discreternd.R b/exercises/02450Toolbox_R/Tools/discreternd.R new file mode 100644 index 0000000000000000000000000000000000000000..50710c472b1ef8aec5f94a25d77d05b193c8ba37 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/discreternd.R @@ -0,0 +1,24 @@ +discreternd <- function(p, n=1){ +# DISCRETERND Random numbers from a discrete distribution +# +# Usage: +# p = [.5 .25 .25]; +# i = discreternd(p) +# Generates a random number in {1,2,3} with 50 pct. probability of +# being 1 and 25 pct. probability of being 2 or 3. +# +# +# Input: +# p Vector of (relative) probabilities. If p sums to one, each +# element in p is the probability of generating the +# corresponding integer. If p is not normalized it denotes +# the relative probability. +# +# Output: +# i Vector of random integers +# between 1 and n. +# +# Author: Laura Frølich, lff@imm.dtu.dk + + i = suppressWarnings(sample(x=1:n, prob=p, replace=TRUE)) +} diff --git a/exercises/02450Toolbox_R/Tools/expired_clusterval_not_for_use.R b/exercises/02450Toolbox_R/Tools/expired_clusterval_not_for_use.R new file mode 100644 index 0000000000000000000000000000000000000000..1c733fc8d0402447916fee9f342b5aa9f5d929b2 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/expired_clusterval_not_for_use.R @@ -0,0 +1,67 @@ +expired_clusterval_not_for_use <- function(y, i){ + # CLUSTERVAL Estimate cluster validity using entroy, purity, rand index, + # and Jaccard coefficient. + # + # Usage: + # [Entropy, Purity, Rand, Jaccard] = clusterval(y, i); + # + # Input: + # y N-by-1 vector of class labels + # i N-by-1 vector of cluster indices + # + # Output: + # Entropy Entropy measure. + # Purity Purity measure. + # Rand Rand index. + # Jaccard Jaccard coefficient. + # + # Author: Laura Frølich, lff@imm.dtu.dk + # Updated 3rd November 2015 to not include self-pairs in Rand # and Jaccard + + N = length(y); + + d1_ <- sort(unique(y)) + d2_ <- unlist(lapply(d1_, FUN=function(X, y) which(y==X)[1], y=y)) + jy <- rep(NA, times=N) + for(yvalidx in 1:length(d1_)){ + yval <- d1_[yvalidx] + jy[y==yval] <- yvalidx + } + Zy <- array(rep(0, times=(length(d1_)*N)), dim=c(length(d1_), N)) + for(id1 in 1:length(d1_)){ + Zy[id1,jy==id1] <- 1 + } + Ay = t(Zy)%*%Zy; + + d1_ <- sort(unique(i)) + d2_ <- unlist(lapply(d1_, FUN=function(X, y) which(y==X)[1], y=i)) + ji <- rep(NA, times=N) + for(ivalidx in 1:length(d1_)){ + ival <- d1_[ivalidx] + ji[i==ival] <- ivalidx + } + Zi <- array(rep(0, times=(length(d1_)*N)), dim=c(length(d1_), N)) + for(id1 in 1:length(d1_)){ + Zi[id1,ji==id1] <- 1 + } + Ai = t(Zi)%*%Zi; + + + f11 = (sum(sum(Ai*Ay))-N)/2; + f00 = sum(sum((1-Ai)*(1-Ay)))/2; + mZi = rowSums(cbind(rep(0, times=dim(Zi)[1]), Zi)); + P = 1/mZi*Zi%*%t(Zy); + e = -rowSums(cbind(rep(0, times=dim(P)[1]), P*log(P+.Machine$double.eps))); + Entropy = sum(e*mZi)/sum(mZi); + Purity = sum(apply(P, 1, max)*mZi)/sum(mZi); + Rand = (f11+f00)/(N*(N-1)/2); + Jaccard = f11/(N*(N-1)/2-f00); + + + res <- list() + res$Entropy <- Entropy + res$Purity <- Purity + res$Rand <- Rand + res$Jaccard <- Jaccard + res +} diff --git a/exercises/02450Toolbox_R/Tools/forwardSelection.R b/exercises/02450Toolbox_R/Tools/forwardSelection.R new file mode 100644 index 0000000000000000000000000000000000000000..50b0d79eddbe38d2fe17a17125054e69cd082850 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/forwardSelection.R @@ -0,0 +1,116 @@ +forwardSelection <- function(cost_function, X, y, cvK = 10, minCostImprovement = 0, nfeats = c(), stoppingCrit = "nfeats", maxIts = Inf) { + # Description: + # Select features to include in model using forward selection. No intercept is included by this function. + + # Arguments: + # cost_function: The cost function to minimize. Must take as input explanatory variables from training data, dependent variable from training data, explanatory variables from test data, dependent variable from test data, in that order (X_train, y_train, X_test, y_test). + # X: Explanatory variables, with rows corresponding to observations and each column corresponding to an explanatory variable. + # y: Dependent variable. Must have length equal to the number of rows in X. + # cvK: Number of folds to use in cross-validation when evaluating the cost_function + # minCostImprovement: The minimum improvement in the cost function required to continue adding variables to the model + # nfeats: The number of variables that the final model should contain. + # stoppingCrit: The stopping criterion to use, either the number of features ('nfeats') or minimal improvement in cost function ('minCostImprovement'). Possible values are thus 'nfeats' and 'minCostImprovement'. + + # Value: + # List containing the following variables: + # featsIncluded: Vector of column numbers included in model + # binaryFeatsIncluded: Vector of length equal to the number of columns. Each entry is TRUE or FALSE, indicating for each column whether it was included in the model. + # binaryFeatsIncludedMatrix: Matrix of vectors such as that described for binaryFeatsIncluded. First row of matrix contains the binary vector indicating chosen columns in the first iteration, the second row for the second iteration and so forth. The last row is equal to the vector binaryFeatsIncluded. + # costs: The value of the cost function after each iteration (average over cross-validation folds). + + + + if (!is.scalar(cvK) || !is.scalar(minCostImprovement)) { + warning("forwardSelection: the arguments cvK and minCostImprovement must be numeric, of the type vector, and have length one. One or or both arguments did not meet these requirements.") + } + + if (stoppingCrit != "nfeats" && stoppingCrit != "minCostImprovement") { + stop('forwardSelection: the argument stoppingCrit must be equal to one of the strings "nfeats" or "minCostImprovement".') + } + + if (stoppingCrit == "nfeats" && length(nfeats) != 1) { + if (length(nfeats) == 0) { + nfeats <- dim(X)[2] + warning('forwardSelection: the stopping criterion chosen was "nfeats" but the argument nfeats was not supplied. The argument nfeats has been set equal to the number of variables in the data matrix X.') + } + if (length(nfeats) > 1) { + nfeats <- nfeats[1] + warning("forwardSelction: the argument nfeats must be a scalar. The supplied value for nfeats had length greater than one. Only the first entry in nfeats is used.") + } + } + + res <- list() + featsIncluded <- c() + costs <- c() + binaryFeatsIncludedMatrix <- c() + counter <- 1 + unusedFeats <- 1:dim(X)[2] + previousCost <- Inf + + reqres <- require(caret) + if (!reqres) { + stop("forwardSelection: the package caret is required to run forwardSelection.") + } + + CV <- list() + CV$which <- createFolds(y, k = cvK, list = F) + + keepGoing <- TRUE + while (keepGoing && counter < maxIts && length(unusedFeats) > 0) { + binaryFeatsIncluded <- rep(FALSE, times = dim(X)[2]) + avgCVcosts <- c() + for (ifeat in 1:length(unusedFeats)) { + currentFeat <- unusedFeats[ifeat] + currentFeatset <- c(featsIncluded, currentFeat) + cvCosts <- c() + + for (k in 1:cvK) { + cvCosts[k] <- cost_function(X[CV$which != k, currentFeatset], + y[CV$which != k], + X[CV$which == k, currentFeatset], + y[CV$which == k]) + } + avgCVcosts[ifeat] <- mean(cvCosts) + } + currentCost <- min(avgCVcosts) + + if (stoppingCrit == "minCostImprovement") { + if (previousCost - currentCost < minCostImprovement) { + keepGoing <- FALSE + binaryFeatsIncluded[featsIncluded] <- TRUE + } else { + bestiFeat <- which(avgCVcosts == currentCost)[1] + bestFeat <- unusedFeats[bestiFeat] + unusedFeats <- unusedFeats[-bestiFeat] + + featsIncluded[counter] <- bestFeat + binaryFeatsIncluded[featsIncluded] <- TRUE + binaryFeatsIncludedMatrix <- rbind(binaryFeatsIncludedMatrix, binaryFeatsIncluded) + costs[counter] <- currentCost + previousCost <- currentCost + counter <- counter + 1 + } + } else { + bestiFeat <- which(avgCVcosts == currentCost)[1] + bestFeat <- unusedFeats[bestiFeat] + unusedFeats <- unusedFeats[-bestiFeat] + + featsIncluded[counter] <- bestFeat + binaryFeatsIncluded[featsIncluded] <- TRUE + binaryFeatsIncludedMatrix <- rbind(binaryFeatsIncludedMatrix, binaryFeatsIncluded) + costs[counter] <- currentCost + previousCost <- currentCost + counter <- counter + 1 + + if (length(featsIncluded) == nfeats) { + keepGoing <- FALSE + } + } + } + + res$featsIncluded <- featsIncluded + res$binaryFeatsIncluded <- binaryFeatsIncluded + res$binaryFeatsIncludedMatrix <- binaryFeatsIncludedMatrix + res$costs <- costs + res +} diff --git a/exercises/02450Toolbox_R/Tools/gausKernelDensity.R b/exercises/02450Toolbox_R/Tools/gausKernelDensity.R new file mode 100644 index 0000000000000000000000000000000000000000..674bf5c64b690f4cf3c77e521b7c9fe4b5aa9e0e --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/gausKernelDensity.R @@ -0,0 +1,34 @@ +gausKernelDensity <- function(X, width){ +# function to calculate efficiently leave-one-out Gaussian Kernel Density estimate +# Input: +# X N x M data matrix +# width variance of the Gaussian kernel +# +# Output: +# density vector of estimated densities +# log_density vector of estimated log_densities +# +# Author: Laura Frølich, lff@imm.dtu.dk + +N <- dim(as.matrix(X))[1] +M <- dim(as.matrix(X))[2] + +# Calculate squared euclidean distance between data points +# given by ||x_i-x_j||_F^2=||x_i||_F^2-2x_i^Tx_j+||x_i||_F^2 efficiently +x2=matrix(rowSums(X^2)); +D=x2[,rep(1, times=N)]-2*(X%*%t(X))+t(x2[,rep(1, times=N)]); + +# Evaluate densities to each observation +Q=exp(-1/(2*width)*D); +# do not take density generated from the data point itself into account +Q=Q-diag(diag(Q)); + +sQ <- rowSums(Q); +density=1/((N-1)*sqrt(2*pi*width)^M)*sQ; +log_density=-log(N-1)-M/2*log(2*pi*width)+log(sQ); + + result <- list() + result$density <- density + result$log_density <- log_density +result +} diff --git a/exercises/02450Toolbox_R/Tools/gmmposterior.Mclust.R b/exercises/02450Toolbox_R/Tools/gmmposterior.Mclust.R new file mode 100644 index 0000000000000000000000000000000000000000..68c4843e5f5eae9abf58f4473e304f2fa1eb74e8 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/gmmposterior.Mclust.R @@ -0,0 +1,32 @@ +gmmposterior.Mclust<- function(model, X){ + # Calculate the posterior densities of observations in X, the negative log-likelihood of X, and the log of the density according to the model. These quantities are returned in a list with the names + # post: posterior densities + # ll: negative log-likelihood + # logpdf: log of density + # + # Author: Laura Frølich, lff@imm.dtu.dk + + K <- model$G + n <- dim(X)[1] + posts <- array(rep(NA, times=K*n), dim=c(n,K)) + for(icluster in 1:K){ +reqres <- require(mixtools) + if(reqres){ + posts[,icluster] <- dmvnorm(as.matrix(X), mu = model$parameters$mean[,icluster], sigma = model$parameters$variance$sigma[,,icluster])*model$parameters$pro[icluster] + }else{ + stop('gmmposterior.Mclust: the package mixtools was not found, but is required to calculate the posterior densities according to a model of class Mclust') + } + + } +#density(i) is \sum_j \alpha_j P(x_i| \theta_j)/ exp(maxll(i)) +density = rowSums(posts); +#normalize posteriors +posts = posts/density +logpdf = log(density) +ll = sum(logpdf) +res <- list() +res$post <- posts +res$ll <- -ll +res$logpdf <- logpdf +res +} diff --git a/exercises/02450Toolbox_R/Tools/gmmposterior.R b/exercises/02450Toolbox_R/Tools/gmmposterior.R new file mode 100644 index 0000000000000000000000000000000000000000..6619847162f6c635813ac668ab24c3bb4cf9016a --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/gmmposterior.R @@ -0,0 +1,6 @@ +gmmposterior <- function(object, ...){ + # Calls either gmmposterior.Mclust or gmmposterior.mixEM depending on the class of the object. + # + # Author: Laura Frølich, lff@imm.dtu.dk +UseMethod("gmmposterior") +} diff --git a/exercises/02450Toolbox_R/Tools/gmmposterior.mixEM.R b/exercises/02450Toolbox_R/Tools/gmmposterior.mixEM.R new file mode 100644 index 0000000000000000000000000000000000000000..814c34eb446a718a451a77b7b271871dd11a00e7 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/gmmposterior.mixEM.R @@ -0,0 +1,27 @@ +gmmposterior.mixEM <- function(model, X){ + # Calculate the posterior densities of observations in X, the negative log-likelihood of X, and the log of the density according to the model. These quantities are returned in a list with the names + # post: posterior densities + # ll: negative log-likelihood + # logpdf: log of density + # + # Author: Laura Frølich, lff@imm.dtu.dk + + K <- length(model$mu) + n <- dim(X)[1] + posts <- array(rep(NA, times=K*n), dim=c(n,K)) + for(icluster in 1:K){ + posts[,icluster] <- dmvnorm(as.matrix(X), mu = model$mu[[icluster]], sigma = model$sigma[[icluster]])*model$lambda[icluster] + } + +#density(i) is \sum_j \alpha_j P(x_i| \theta_j)/ exp(maxll(i)) +density = rowSums(posts); +#normalize posteriors +posts = posts/density +logpdf = log(density) +ll = sum(logpdf) +res <- list() +res$post <- posts +res$ll <- -ll +res$logpdf <- logpdf +res +} diff --git a/exercises/02450Toolbox_R/Tools/is.scalar.R b/exercises/02450Toolbox_R/Tools/is.scalar.R new file mode 100644 index 0000000000000000000000000000000000000000..df063c4a2196d6e514f61fa4b76f326bafa3a621 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/is.scalar.R @@ -0,0 +1,6 @@ +is.scalar <- function(x){ +if(!is.vector(x) || length(x)!=1 || !is.numeric(x)){ + FALSE +}else{ + TRUE} +} diff --git a/exercises/02450Toolbox_R/Tools/is.wholenumber.R b/exercises/02450Toolbox_R/Tools/is.wholenumber.R new file mode 100644 index 0000000000000000000000000000000000000000..d311a68c679ea07199659c08db16f90951a95025 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/is.wholenumber.R @@ -0,0 +1,6 @@ +is.wholenumber <- function(x, tol = .Machine$double.eps^0.5){ + # Check whether input is a whole number. Returns TRUE if x is a whole number, otherwise FALSE is returned. + # + # Author: Laura Frølich, lff@imm.dtu.dk +abs(x - round(x)) < tol +} diff --git a/exercises/02450Toolbox_R/Tools/logLik.Mclust.R b/exercises/02450Toolbox_R/Tools/logLik.Mclust.R new file mode 100644 index 0000000000000000000000000000000000000000..f701b7f422e625a2b69a827336423cb2ec1773a9 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/logLik.Mclust.R @@ -0,0 +1,16 @@ +logLik.Mclust <- function(model){ + # Extract log-likelihood from a model of class Mclust. + # + # Author: Laura Frølich, lff@imm.dtu.dk + +nattributes <- dim(model$parameters$mean)[1] +nestimatedparameters <- model$G*(nattributes + nattributes*(nattributes+1)/2+1)-1 +#nestimatedparameters <- nattributes*model$G + nattributes*(nattributes+1)/2*models$G+model$G-1 +# number of mean values estimated plus the number of terms in covariance matrices estimated plus the number of prior probabilities estimated minus one due to constraint that probs must add up to 1 + + val <- model$loglik + attr(val, "nobs") <- model$n + attr(val, "df") <- nestimatedparameters + class(val) <- "logLik" + val +} diff --git a/exercises/02450Toolbox_R/Tools/logLik.mixEM.R b/exercises/02450Toolbox_R/Tools/logLik.mixEM.R new file mode 100644 index 0000000000000000000000000000000000000000..68e81ddc0e86829396b6d0652c5a9ed8fb55d473 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/logLik.mixEM.R @@ -0,0 +1,17 @@ +logLik.mixEM <- function(model){ + # Extract log-likelihood from a model of class mixEM. + # + # Author: Laura Frølich, lff@imm.dtu.dk + +nattributes <- dim(model$x)[2] +K <- length(model$mu) +nestimatedparameters <- K*(nattributes + nattributes*(nattributes+1)/2+1)-1 +#nestimatedparameters <- nattributes*K + nattributes*(nattributes+1)/2*K+K-1 +# number of mean values estimated plus the number of terms in covariance matrices estimated plus the number of prior probabilities estimated minus one due to constraint that probs must add up to 1 + + val <- model$loglik + attr(val, "nobs") <- dim(model$x)[1] + attr(val, "df") <- nestimatedparameters + class(val) <- "logLik" + val +} diff --git a/exercises/02450Toolbox_R/Tools/max_idx.R b/exercises/02450Toolbox_R/Tools/max_idx.R new file mode 100644 index 0000000000000000000000000000000000000000..eb11cd730518a9477352c4504cb60332c829b372 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/max_idx.R @@ -0,0 +1,6 @@ +max_idx <- function(Y){ +# function to extract the column index of the max value for each row of Y +# +# Author: Laura Frølich, lff@imm.dtu.dk + apply(Y, 1, which.max) +} diff --git a/exercises/02450Toolbox_R/Tools/naiveBayes.R b/exercises/02450Toolbox_R/Tools/naiveBayes.R new file mode 100644 index 0000000000000000000000000000000000000000..757beb52671d810385b3d7d7fbe325cdeb5fcfca --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/naiveBayes.R @@ -0,0 +1,153 @@ +naiveBayes <- function(X, y, distribution = "mvmn", prior = "empirical") { + # Input: + # X: Training data, feature values. Must be numeric. + # y: Training labels (response variable). + # distribution: The distributions of features. Can either be a single string or a vector of strings with length equal to the number of features. Each string then gives the distribution for a feature. The allowed distributions are "mvmn" for multivariate multinomial and "normal" for the normal distribution. The default is "mvmn". + # prior: The prior on classes. Can either be the string "uniform" (for equal priors for all classes) or "empirical" (for class priors equal to class proportions in training data). The default is "empirical". + + # Value: + # params: A list of fitted parameters. + # mvmnFeatsIndices: The feature indices that follow a multivariate multinomial distribution. + # normalFeatsIndices: The feature indices that follow a normal distribution. + # mvmnFeatsBinary: A binary vector with length equal to the number of features. It has the value TRUE at indices where the feature follows the multivariate multinomial distribution and is otherwise false. + # normalFeatsBinary: A binary vector with length equal to the number of features. It has the value TRUE at indices where the feature follows the normal distribution and is otherwise false. + # classLevels: The classes in training data, i.e. values present in y. + # nClasses: The number of classes. + # priorDist: The prior probability of each class. + # nFeats: The number of features, i.e. the number of columns of X. + # classSizes: The number of observations in each class. + + + allowedDists <- c("mvmn", "normal") + allowedPriors <- c("empirical", "uniform") + + nFeats <- dim(X)[2] + + # check that the argument distribution has the correct form + if (!is.character(distribution)) { + stop('naiveBayes: the argument "distribution" must be one of the strings "mvmn" or "normal", or a vector where each entry is one of these strings, and where the vector has length equal to the number of columns of X.') + } + + if (length(distribution) == 1) { + if (!(distribution %in% allowedDists)) { + stop(paste('naiveBayes: the argument "distribution" must be either ', paste(allowedDists, collapse = " or "), sep = "")) + } + } else if (length(distribution) == nFeats) { + if (!all(distribution %in% allowedDists)) { + stop(paste('naiveBayes: each string in the argument "distribution" must be either ', paste(allowedDists, collapse = " or "), sep = "")) + } + } else { + stop('naiveBayes: the argument "distribution" must have length one or length equal to the number of columns in X') + } + + # done checking that the argument distribution has the correct form + + # check that the argument prior has the correct form + if (is.character(prior)) { + if (!(prior %in% allowedPriors)) { + stop(paste('naiveBayes: the argument "prior" was of type "character" but not equal to either ', paste(allowedPriors, collapse = " or "), ", which are the only allowed types of priors.")) + } + } else if (is.numeric(prior)) { + if (length(prior) != nFeats) { + stop('naiveBayes: if the argument "prior" is of type numeric, it must be a vector of length equal to the number of columns of X') + } + priorsum <- sum(prior) + if ((priorsum > 1 + .Machine$double.eps) || (priorsum < 1 - .Machine$double.eps)) { + warning('naiveBayes: the prior distribution of classes given in the argument "prior" did not sum to one. The prior distribution has been normalized to sum to one.') + prior <- prior / sum(prior) + } + } else { + stop(paste('naiveBayes: the argument "prior" must either be a numeric vector (of length equal to the number of columns of X) or a string (equal to either ', paste(allowedPriors, collapse = " or "), " )", sep = "")) + } + # done checking that the argument prior has the correct form + + + nFeats <- dim(X)[2] + uniqy <- sort(unique(y)) + nClasses <- length(uniqy) + classLevels <- uniqy + classSizes <- table(y) + + + + if (length(distribution) == 1) { + distribution <- rep(distribution, times = nFeats) + } + normalFeats <- distribution == "normal" + mvmnFeats <- distribution == "mvmn" + params <- vector("list", length = nClasses) + ########### fit paramaters + if (any(normalFeats)) { + for (iclass in 1:nClasses) { + currentClassIndices <- y == classLevels[iclass] + if (sum(currentClassIndices) < 2) { + stop(paste("naiveBayes: to fit a feature to a normal distribution, at least two data points from each class must be available. Less than two data points were available for the class ", classLevels[iclass], sep = "")) + } + mu <- colMeans(X[currentClassIndices, normalFeats, drop = FALSE], na.rm = TRUE) + sigma <- apply(X[currentClassIndices, normalFeats, drop = FALSE], 2, fun <- function(x) { + sd(x, na.rm = TRUE) + }) # column sd's + zeroVar <- sigma < .Machine$double.eps + if (any(zeroVar)) { + stop(paste("naiveBayes: the following columns of X were found to have zero variance: ", which(zeroVar), sep = "")) + } + params[[iclass]][normalFeats] <- apply(rbind(mu, sigma), FUN = list, MARGIN = 2) + } + } + + if (any(mvmnFeats)) { + possibleFeatVals <- apply(X = X[, mvmnFeats, drop = FALSE], MARGIN = 2, FUN = function(x) { + list(sort(unique(x))) + }) # find the observed values for each feature + for (iclass in 1:nClasses) { + currentClassIndices <- y == classLevels[iclass] + if (sum(currentClassIndices) == 0) { + stop(paste("naiveBayes: there are no observations of class", classLevels[iclass])) + } + mvmnFeatInds <- which(mvmnFeats) + for (ifeat in 1:length(mvmnFeatInds)) { + nFeatValObs <- featureValueObservations(observedFeatVals = X[currentClassIndices, mvmnFeatInds[ifeat], drop = FALSE], possibleFeatVals = unlist(possibleFeatVals[[ifeat]])) # times that each value of feature was observed + featValDistribution <- (nFeatValObs + 1) / sum(nFeatValObs + 1) # avoid zero probabilities of feature values by adding one to the number of times each value was observed + params[[iclass]][mvmnFeatInds[ifeat]] <- list(featValDistribution) + } + } + } + + ########### done fitting paramaters + + + ########### calculate priors + if (prior == "uniform") { + priorDist <- rep(1, times = nClasses) / nClasses + } else if (prior == "empirical") { + priorDist <- classSizes / sum(classSizes) + } + ########### done calculating priors + res <- list() + if (any(mvmnFeats)) { + res$possibleFeatVals <- possibleFeatVals + } else { + res$possibleFeatVals <- NA + } + + res$params <- params + res$mvmnFeatsIndices <- which(mvmnFeats) + res$normalFeatsIndices <- which(normalFeats) + res$mvmnFeatsBinary <- mvmnFeats + res$normalFeatsBinary <- normalFeats + res$classLevels <- classLevels + res$nClasses <- nClasses + res$priorDist <- priorDist + res$nFeats <- nFeats + res$classSizes <- classSizes + + class(res) <- "naiveBayes" + res +} + +featureValueObservations <- function(observedFeatVals, possibleFeatVals) { + counts <- sapply(possibleFeatVals, FUN = function(x, observedFeatVals) { + sum(x == observedFeatVals) + }, observedFeatVals = observedFeatVals) + counts +} diff --git a/exercises/02450Toolbox_R/Tools/plot.nnet.R b/exercises/02450Toolbox_R/Tools/plot.nnet.R new file mode 100644 index 0000000000000000000000000000000000000000..c0b97c5a79753eac019e95b9ba649420bfa66444 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/plot.nnet.R @@ -0,0 +1,41 @@ +plot.nnet <- function(model){ + # Plot a visual representation of the neural network contained in the input model. + # + # Author: Laura Frølich, lff@imm.dtu.dk + + tryCatch(library(neuralnet), finally="The function plot.nnet depends on the package neuralnet, which was not found to be installed. Install this before using plot.nnet (or using plot to plot an object of class nnet).") +mynames <- c("error") +myvect <- c(model$value) + +inputnames <- c("Intercept", model$coefnames) +receivinghiddennames <- paste('1layhid', 1:model$n[2], sep='') +outputtinghiddennames <- c('Intercept', paste('1layhid', 1:model$n[2], sep='')) +outputnames <- model$lev # response classes +mynams <- c() +fittedweights <- vector('list', 1) +for(ireceivinghiddenname in 1:length(receivinghiddennames)){ +mynams <- c(mynams,paste(inputnames, receivinghiddennames[ireceivinghiddenname], sep='.to.')) +} +fittedweights[[1]][[1]] <- matrix(model$wts[1:(length(inputnames)*length(receivinghiddennames))], nrow=length(inputnames), byrow=FALSE) + +for(ioutputname in 1:length(outputnames)){ +mynams <- c(mynams,paste(outputtinghiddennames, outputnames[ioutputname], sep='.to.')) +} +fittedweights[[1]][[2]] <- matrix(model$wts[(length(inputnames)*length(receivinghiddennames)+1):length(model$wts)], nrow=length(outputtinghiddennames), byrow=FALSE) + +mynames <- c(mynames, mynams) +myvect <- c(myvect, model$wts) + +mymat <- matrix(myvect) +rownames(mymat) <- mynames +colnames(mymat) <- 1 +nnobj <- list() +nnobj$result.matrix <- mymat +nnobj$weights <- fittedweights +nnobj$model.list <- list() +nnobj$model.list$response <- model$lev +nnobj$model.list$variables <- model$coefnames +nnobj$call <- model$call +class(nnobj) <- 'nn' +plot(x=nnobj, information=FALSE) +} diff --git a/exercises/02450Toolbox_R/Tools/predict.naiveBayes.R b/exercises/02450Toolbox_R/Tools/predict.naiveBayes.R new file mode 100644 index 0000000000000000000000000000000000000000..6462847df0c6794403f18154405bee09d2504e20 --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/predict.naiveBayes.R @@ -0,0 +1,90 @@ +predict.naiveBayes <- function(Xtest, mod){ + # Input: + # Xtest: Matrix containing test data. The number of columns must equal the number of features in the training data. + # mod: A list of class naiveBayes as fitted by the function naiveBayes. + + # Value: + # predictedClass: the class predicted for each row of feature observations. The number of rows is equal to the number of rows in Xtest. If there were values of features in a row that were not seen during training, the value NA is given for that row. + # prob: the probabilities of each class given the observed feature values. The number of rows is equal to the number of rows in Xtest. If there were values of features in a row that were not seen during training, the value NA is given for all predicted probabilities in that row. + + + if(class(mod)!='naiveBayes'){ + stop('predict.naiveBayes: the class of the model must be "naiveBayes", as returned by the function "naiveBayes".') + } + + if(mod$nFeats!=dim(Xtest)[2]){ + stop('naiveBayes: the number of columns of the test data (the argument Xtest) must be the same as the number of columns used during training the entry "nFeats" in the argument mod') + } + + nobs <- dim(Xtest)[1] + + if(length(mod$mvmnFeatsIndices)>0){ + badRows <- c() + for(imvmnFeat in 1:length(mod$mvmnFeatsIndices)){ + currentFeatInd <- mod$mvmnFeatsIndices[imvmnFeat] + possibleFeatVals <- unlist(mod$possibleFeatVals[[imvmnFeat]]) + currentFeatVals <- Xtest[,currentFeatInd] + notSeenDuringTraining <- !(currentFeatVals %in% possibleFeatVals) + if(any(notSeenDuringTraining)){ + badRows <- c(badRows,which(notSeenDuringTraining)) + } + } + badRows <- unique(badRows) + + if(length(badRows)>0){ + Xtest <- Xtest[-badRows,,drop=FALSE] + } + } + + classProbs_nomissing <- array(rep(NA, times=mod$nClasses*dim(Xtest)[1]), dim=c(dim(Xtest)[1], mod$nClasses)) + + for(iclass in 1:mod$nClasses){ + classProbs_nomissing[,iclass] <- getClassProb(Xtest, mod$mvmnFeatsIndices, mod$normalFeatsIndices, mod$params[[iclass]], mod$possibleFeatVals)*mod$priorDist[iclass] + } + mostProbableClassInds <- apply(X=classProbs_nomissing, MARGIN=1, FUN=which.max) + predictedClass_nomissing<- mod$classLevels[mostProbableClassInds] + + predictedClass <- rep(NA, times=nobs) + classProbs <- array(rep(NA, times=mod$nClasses*nobs), dim=c(nobs, mod$nClasses)) + goodRows <- 1:nobs + + if(length(mod$mvmnFeatsIndices)>0){ + if(length(badRows)>0){ + goodRows <- goodRows[-badRows] + } +} + + predictedClass[goodRows] <- predictedClass_nomissing + classProbs[goodRows,] <- classProbs_nomissing + + mod$predictedClass <- predictedClass + mod$prob <- classProbs + mod + +} + + +getClassProb <- function(Xtest, mvmnFeatInds, normalFeatInds, classParams, possibleFeatVals){ + nFeats <- dim(Xtest)[2] + nobs <- dim(Xtest)[1] + featProbs <- array(rep(NA, times=nFeats*nobs), dim=c(nobs, nFeats)) + + if(length(mvmnFeatInds)>0){ + for(imvmnFeat in 1:length(mvmnFeatInds)){ + currentFeatInd <- mvmnFeatInds[imvmnFeat] + currentFeatVals <- Xtest[,currentFeatInd] + curParams <- unlist(classParams[[currentFeatInd]]) + featProbs[,currentFeatInd] <- unlist(sapply(X=currentFeatVals, FUN=function(x, probs, possibleFeatVals){probs[x==possibleFeatVals]}, probs=curParams, possibleFeatVals=unlist(possibleFeatVals[[imvmnFeat]]))) + } + } + + if(length(normalFeatInds)>0){ + for(inormalFeat in 1:length(normalFeatInds)){ + currentFeatInd <- normalFeatInds[inormalFeat] + curParams <- unlist(classParams[[currentFeatInd]]) + featProbs[,currentFeatInd] <- dnorm(x=Xtest[,currentFeatInd], mean=curParams[1], sd=curParams[2]) + } + } + + apply(X=featProbs, MARGIN=1, FUN=prod) # return the product of the probabilities of observing each feature value +} diff --git a/exercises/02450Toolbox_R/Tools/rocplot.R b/exercises/02450Toolbox_R/Tools/rocplot.R new file mode 100644 index 0000000000000000000000000000000000000000..38cfb472e77c867e4582519b3126a2eb45705d3d --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/rocplot.R @@ -0,0 +1,85 @@ +rocplot <- function(p, y){ +# ROCPLOT Plots the receiver operating characteristic (ROC) curve and +# calculates the area under the curve (AUC). +# Notice: The method requires the package caTools to be installed! +# +# Usage: +# rocplot(p, y); +# res = rocplot(p, y); +# +# Input: +# p: Estimated probability of class 1. (Between 0 and 1.) +# y: True class indices. (Equal to 0 or 1.) +# +# Output: +# list containing: +# AUC: The area under the ROC curve +# TPR: True positive rate +# FPR: False positive rate +# +# Author: Laura Frølich, lff@imm.dtu.dk + + ## old code assuming values of p are distinct +#res <- sort(p, decreasing=FALSE, index.return=TRUE); +#val <- res$x +#ind <- res$ix +#x = y[ind]; +#FNR = cumsum(x==1)/sum(x==1); +#TPR = 1-FNR; +#TNR = cumsum(x==0)/sum(x==0); +#FPR = 1-TNR; +#TPR = c(1, TPR); +#FPR = c(1, FPR); +#AUC = t(-diff(FPR)) %*% (TPR[1:(length(TPR)-1)]+TPR[2:length(TPR)])/2; + + ## new code that does not require values of p to be distinct + + + res <- sort(p, decreasing=FALSE, index.return=TRUE); + val <- res$x + ind <- res$ix + x = y[ind]; + + N0=sum(1-x); + N1=sum(x); + FNR=c(rep(0, times = length(x)), 1) # false negative rate + TNR=c(rep(0, times = length(x)), 1) # true negative rate + N_true=x[1]; + N_false=1-x[1]; + t=1; + for(k in 2:length(val)){ + if(val[k-1]!=val[k]){ + t=t+1; + FNR[t]=N_true/N1; + TNR[t]=N_false/N0; + } + N_true=N_true+x[k]; + N_false=N_false+(1-x[k]); + } + FNR[t+1]=1; + FNR = FNR[1:(t+1)] + TNR[t+1]=1; + TNR = TNR[1:(t+1)] + TPR = 1-FNR; + FPR = 1-TNR; + if(require(caTools)){ + AUC = -trapz(FPR,TPR); + } else { + error('rocplot.R: The package caTools is required to compute the AUC (Area Under Curve).') + } + +plot(c(0, 1), c(0, 1), col='black', type='l', xlab='False positive rate (1-Specificity)', ylab='True positive rate (Sensitivity)', main='Receiver operating characteristic (ROC)', yaxt='n', xaxt='n') +ticks <- seq(from=0, to=1, by=0.1) +axis(1, at=ticks) +axis(2, at=ticks) +mtext(paste('AUC =', round(AUC, digits=3))) +lines(FPR, TPR, col='red') +grid(nx=length(ticks), ny=length(ticks), lwd=2) + +res <- list() +res$AUC <- AUC +res$TPR <- TPR +res$FPR <- FPR + +res +} diff --git a/exercises/02450Toolbox_R/Tools/similarity.R b/exercises/02450Toolbox_R/Tools/similarity.R new file mode 100644 index 0000000000000000000000000000000000000000..a29bf6c60b3013c6743ceb6b213fd0a1cf4676be --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/similarity.R @@ -0,0 +1,87 @@ +similarity <- function(X, Y, method){ +# SIMILARITY Computes similarity matrices +# +# Usage: +# sim = similarity(X, Y, method) +# +# Input: +# X N1 x M matrix +# Y N2 x M matrix +# method string defining one of the following similarity measure +# 'SMC', 'smc' : Simple Matching Coefficient +# 'Jaccard', 'jac' : Jaccard coefficient +# 'ExtendedJaccard', 'ext' : The Extended Jaccard coefficient +# 'Cosine', 'cos' : Cosine Similarity +# 'Correlation', 'cor' : Correlation coefficient +# +# Output: +# sim Estimated similarity matrix between X and Y +# If input is not binary, SMC and Jaccard will make each +# attribute binary according to x>median(x) +# +# Author: Laura Frølich, lff@imm.dtu.dk +# Updated 5/12-2017 by Quoc Tien Au + +if(dim(X)[2]==1) + { + X = t(X) +} + +if(dim(Y)[2]==1) + { + Y = t(Y) +} + +N1 = dim(X)[1]; M = dim(X)[2]; +N2 = dim(Y)[1]; M = dim(Y)[2]; + + +switch(tolower(substr(method, 1,3)), + 'smc'= {# SMC + if(!is.logical(X) || !is.logical(Y)) + { + binarized <- binarize(X,Y) + X <- binarized$X + Y <- binarized$Y + } + + sim = ((X%*%t(Y))+((1-X)%*%t((1-Y))))/M;}, + 'jac'= { # Jaccard + if(!is.logical(X) || !is.logical(Y)) + { + binarized <- binarize(X,Y) + X <- binarized$X + Y <- binarized$Y + } + divide = function(x,y) {if(y==0) 0 else x/y} + sim = mapply(divide,(X%*%t(Y)),(M-(1-X)%*%t(1-Y)));}, + 'ext'= { # Extended Jaccard + XYt = X%*%t(Y); + sim = XYt/(log(t(exp(sum(t(X)^2)))*exp(colSums(t(Y)^2)))-XYt);}, + 'cos'={ # Cosine + sim = (X%*%t(Y))/as.numeric(sqrt(t(sum(t(X)^2)))%*%sqrt(colSums(t(Y)^2)));}, + 'cor'={ # Correlation + if(dim(X)[1]==1) + { + X_= X-mean(X) + X_ = t(apply(X_,1,'/', sd(as.vector(X_)))); + } else + { + X_ = t(apply(as.matrix(X),1,'-', colMeans(as.matrix(X)))); + X_ = t(apply(X_,1,'/', apply(X_,2,sd))); + } + + if(dim(Y)[1]==1) + { + Y_ <- Y-mean(Y) + Y_ = t(apply(Y_,1,'/', sd(as.vector(Y_)))); + } else + { + Y_ = t(apply(as.matrix(Y),1,'-', colMeans(as.matrix(Y)))); + Y_ = t(apply(Y_,1,'/', apply(Y_,2,sd))); + } + sim = 1/(M-1)*X_%*%t(Y_); } +) + +as.vector(sim) +} diff --git a/exercises/02450Toolbox_R/Tools/source_tools.R b/exercises/02450Toolbox_R/Tools/source_tools.R new file mode 100644 index 0000000000000000000000000000000000000000..41730849cf9d8a095bbb9f7fa83b8fdd148eee3f --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/source_tools.R @@ -0,0 +1,12 @@ +## If you want to source() a bunch of files, something like + ## the following may be useful: + sourceDir <- function(path, trace = TRUE, exceptions=c(), ...) { + for (nm in list.files(path, pattern = "\\.[RrSsQq]$", include.dirs=TRUE, recursive=TRUE)) { + if(!(nm %in% exceptions)){ + if(trace) cat(nm,":") + source(file.path(path, nm), ...) + if(trace) cat("\n") + } + } + } + diff --git a/exercises/02450Toolbox_R/Tools/standardize.R b/exercises/02450Toolbox_R/Tools/standardize.R new file mode 100644 index 0000000000000000000000000000000000000000..3727e2392e49676f0b75d8623e45bc5647321cba --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/standardize.R @@ -0,0 +1,11 @@ +standardize <- function(X) { + # Standardize the matrix X, that is, subtract mean and divide by standard deviation to yield matrix of zero mean and variance one. + # + # Author: Laura Frølich, lff@imm.dtu.dk + Xmean <- colMeans(X) + Xnomean <- X - matrix(rep(Xmean, times = N), byrow = TRUE, nrow = N) + + Xsd <- apply(Xnomean, 2, sd) + Xstandardized <- Xnomean / matrix(rep(Xsd, times = N), byrow = TRUE, nrow = N) + Xstandardized +} diff --git a/exercises/02450Toolbox_R/Tools/statistics.R b/exercises/02450Toolbox_R/Tools/statistics.R new file mode 100644 index 0000000000000000000000000000000000000000..c3542b4712f861d6dd563c213d6d98f8ab242fcf --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/statistics.R @@ -0,0 +1,65 @@ +correlated_ttest <- function(r, rho, alpha=0.05){ + rhat = mean(r) + shat = sd(r) + J = length(r) + sigmatilde = shat * sqrt(1 / J + rho / (1 - rho)) + + CI = c( qt( alpha/2, df=J-1) * sigmatilde + rhat, pt(1-alpha/2, df=J-1) * sigmatilde + rhat) + p = 2*pt( -abs(rhat) / sigmatilde, df=J - 1) # p-value + + rt = list("p"=p, "CI"=CI) + return(rt) +} + +jeffrey_interval <- function(y, yhat, alpha=0.05) { + + m = sum(y - yhat == 0) + n = length(y) + a = m+.5 + b = n-m + .5 + + CI <- c(qbeta( alpha/2, a, b), qbeta(1-alpha/2, a, b)) + thetahat <- a/(a+b) + rt = list("thetahat"=thetahat, "CI"=CI) + return(rt) +} + +mcnemar <- function(y_true, yhatA, yhatB, alpha=0.05){ + nn <- matrix(, nrow = 2, ncol = 2) + c1 = yhatA - y_true == 0 + c2 = yhatB - y_true == 0 + + nn[1,1] = sum(c1 & c2) + nn[1,2] = sum(c1 & !c2) + nn[2,1] = sum(!c1 & c2) + nn[2,2] = sum(!c1 & !c2) + + n12 = nn[1,2] + n21 = nn[2,1] + n <- sum(nn) + Etheta = (n12-n21)/n + Q = n**2 * (n+1) * (Etheta+1) * (1-Etheta) / ( (n*(n12+n21) - (n12-n21)**2) ) + p = (Etheta + 1)/2 * (Q-1) + q = (1-Etheta)/2 * (Q-1) + + thetaL = + CI <- c( 2*qbeta( alpha/2, p, q)-1, 2*qbeta(1-alpha/2, p, q)-1) + # thetahat <- 2*p/(p+q) - 1 + + p <- 2*pbinom(min( n12, n21), size=n12+n21, prob=0.5 ) + + + print(paste("Result of McNemars test using alpha=", alpha)) + + print("Comparison matrix n") + print(nn) + if(n12+n21 <= 10){ + print(paste("Warning, n12+n21 is low: n12+n21=",(n12+n21))) + } + print("Approximate 1-alpha confidence interval of theta: [thetaL,thetaU] = ") + print(CI) + print(paste( "p-value for two-sided test A and B have same accuracy (exact binomial test): p=", p) ) + + rt = list("thetahat"=Etheta, "CI"=CI, "p"=p) + return(rt) +} \ No newline at end of file diff --git a/exercises/02450Toolbox_R/Tools/train_neural_network.R b/exercises/02450Toolbox_R/Tools/train_neural_network.R new file mode 100644 index 0000000000000000000000000000000000000000..fe05c98615273c86f2c01e8b2693239522a8ea7e --- /dev/null +++ b/exercises/02450Toolbox_R/Tools/train_neural_network.R @@ -0,0 +1,55 @@ +library(torch) + +train_neural_net <- function(model, loss_fn, X, y, n_replicates = 3, + max_iter = 10000, tolerance = 1e-6) { + best_final_loss <- 1e100 + logging_frequency <- 1000 + + for (r in seq_len(n_replicates)) { + cat("\n\tReplicate: ", r, "/", n_replicates, "\n") + + net <- model() + + nn_init_xavier_uniform_(net$parameters$"0.weight") + nn_init_xavier_uniform_(net$parameters$"2.weight") + + # We can optimize the weights by means of stochastic gradient descent + optimizer <- optim_adam(net$parameters, lr = 0.01) + + learning_curve <- c() + old_loss <- 1e6 + for (i in seq_len(max_iter)) { + y_est <- net(X) + loss <- loss_fn(y_est, y) + + loss_value <- loss$item() + learning_curve <- c(learning_curve, loss_value) + + p_delta_loss <- abs(loss_value - old_loss) / old_loss + if (p_delta_loss < tolerance) { + break + } + old_loss <- loss_value + + if (i != 1 && i %% logging_frequency == 0) { + cat("\t\tIteration: ", i, "/", max_iter, " loss: ", loss_value, "\n") + } + + optimizer$zero_grad() + loss$backward() + optimizer$step() + } + + if (loss_value < best_final_loss) { + best_final_loss <- loss_value + best_net <- net + best_learning_curve <- learning_curve + } + } + + return(list( + net = best_net, + final_loss = best_final_loss, + learning_curve = best_learning_curve + )) +} diff --git a/exercises/02450Toolbox_R/setup.R b/exercises/02450Toolbox_R/setup.R new file mode 100644 index 0000000000000000000000000000000000000000..2d9f58174412940dfa5dddaf08a5ac8a700b28b4 --- /dev/null +++ b/exercises/02450Toolbox_R/setup.R @@ -0,0 +1,7 @@ +source("Tools/source_tools.R") +path = "Tools/" +sourceDir(path, exceptions=c("source_tools.R")) +#pathsep <- .Platform$file.sep # get file separator on operating system. We use the function file.path to ensure that filenames are compatible with the operating system instead of using .Platform$file.sep and the "paste" function. + + + diff --git a/exercises/02450Toolbox_R/testAllScripts.R b/exercises/02450Toolbox_R/testAllScripts.R new file mode 100644 index 0000000000000000000000000000000000000000..4890bea6ce7a9dffcce0e61fb7b278e716f848f5 --- /dev/null +++ b/exercises/02450Toolbox_R/testAllScripts.R @@ -0,0 +1,7 @@ +# Check All Scripts +cpath=getwd() +scripts=list.files(paste(cpath,"/Scripts", sep = ""), full.names = TRUE, recursive = TRUE) +for (x in scripts) { + print(x) + source(x) +} \ No newline at end of file diff --git a/exercises/README.md b/exercises/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5bcc72a0eebcd71aa366f19eb1691380165df340 --- /dev/null +++ b/exercises/README.md @@ -0,0 +1,3 @@ +# 02450 Book + +The book is currently only available for student enrolled on the course via DTU Learn. \ No newline at end of file