Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6798861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:46:50+00:00 2026-05-26T18:46:50+00:00

In my theoretical data analytics course, I have to find a co-occurence matrix for

  • 0

In my theoretical data analytics course, I have to find a co-occurence matrix for courses which were taken together by students.
I was asked to do it manually since this is not a programming course. The problem is, the question I have has 20 courses and 20 students!

Is there any programming language like Octave/Matlab or Python which have api functions to do this?

If not where can I find an algorithm to find the the co-occurrence matrix. I can convert the algorithm into code. Googling didn’t lead me to the algorithm.

An example of the data I have:

IT  421 540 531 582 
IT  549 561 528 578
IT  571 532 563 543

IT  421 561 571 519
IT  540 563 578 411
IT  411 421 581 578

IT  421 540 561 411
IT  541 548 528 546
IT  411 422 540 571
........
........

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:46:51+00:00Added an answer on May 26, 2026 at 6:46 pm

    A simple approach is to use spreadsheet software (for example oocalc). Make one row per student, and one column per course; put a 1 (or other nonblank mark) in appropriate cells, and use a sum(range) function to count number of marks in each column.

    Update: In the above approach one manually inputs an incidence matrix; which I previously assumed was what you wanted to create. However, you might mean something else by “co-occurence matrix”. Anyhow, programs in languages like Python, Perl, Awk, Ruby will take no more than a handful of lines to output an incidence matrix from data in the form shown. For example, the lengthy Perl program below can be adapted to print a matrix instead of a table:

      #!/usr/bin/perl
      for (<>) {             # Read all data lines
          ++$i;              # compute student #
          chomp $_;          # Remove newlines
          @s = split (/  */);
          foreach (@s) {     # Add student to each course
              $c{$_} .= " $i"
          }
      }
      foreach $course (sort keys %c) {
          print "Course $course : $c{$course}\n"
      }
      __END__ 
    

    As is, from the data sample you gave it produces output like:

      Course 411 :  6 7 9 11
      Course 421 :  1 5 7 9
      Course 422 :  11
      Course 519 :  5
      Course 528 :  2 10
      Course 531 :  1
      Course 532 :  3
      Course 540 :  1 6 9 11
      ...
      Course 582 :  1
      Course IT :  1 2 3 5 6 7 9 10 11
    

    when given the data via standard input.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a data streaming application which uses local caching to reduce future downloads.
I'm writing an Android app which receives data from a server. Theoretical there could
I have a very theoretical question: Is there a way to ban the use
I have a rather theoretical question. My company has a working standard (documented) that
I have a theoretical question: 1) How pass a variable to the system of
This is more of a theoretical question than an actual problem I have. If
I have a theoretical question about the .net framework. As I see it Microsoft
I have implemented the Data Mapper pattern with the Identity Map pattern. In short:
I have theoretical question, is there a possibility to access server response or source
This is a more theoretical question, not a specific scenario: Let's assume, we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.