Answers.Body: <p>I might be wrong, but I would suggest you approach this problem more simply rather than using neural networks or other machine learning constructs. Machine learning is concerned with making a computer learn from a lot of data. You do not need a lot of data to score how well the student's code compares to the teacher's code. You also do not need recommender systems to suggest the next question. Recommender systems suggest by infering the user's preferences, whereas in your case you can simply suggest the next question based on how well the student did on the current question and the type of current question.</p>
  <p>I would first identify the following three subproblems:</p>
  <ol>
  <li>Scoring and assigning a difficulty score to a teacher's code piece.</li>
  <li>Scoring how similar the student's solution is to the true solution.</li>
  <li>Predicting next question based on the current problem difficulty and student score for the current problem.</li>
  </ol>
  <p>For the first you can develop some algorithms to do <em>feature extraction</em> from the html, css or whatever code piece you want to evaluate. Features can be the following: length of the code piece, number of tags, number of different tags, number of attributes and so on. Combine them in a mathematical formula to calculate a difficulty score for the code piece. I would suggest a linear combination like the following: <span class="math-container">$Y = \sum{a_i X_i}$</span> where <span class="math-container">$X_i$</span> is the <span class="math-container">$i$</span>th feature. Then, normalizing all the scores of all questions to a range of <span class="math-container">$[0, 100]$</span>. You can even have an upper decision boundary such that whenever a certain score is reached, the normalized difficulty score will be <span class="math-container">$100$</span>.</p>
  <p>For the second you should start by checking if the student's code compiles, i.e. there are no syntax errors. Then, you can use <a href="https://en.wikipedia.org/wiki/Levenshtein_distance" rel="nofollow noreferrer">Levenshtein Distance</a> to calculate how many characters the student was wrong from the original solution. The goal of a good training should be for the student to infer the exact tags and attributes, so the exact sequence of characters. Calculate the percentage of mistakes over total length of code piece and assign it to <span class="math-container">$x$</span>. Use a mathematical formula of your liking to score how well the student did given <span class="math-container">$x$</span>. I would suggest you consider the following formula: <span class="math-container">$e^{-0.1x}$</span>. It is <span class="math-container">$100\%$</span> score for <span class="math-container">$0$</span> mistakes and <span class="math-container">$50\%$</span> score for having <span class="math-container">$8\%$</span> of mistakes. Have a look at the graph at <a href="https://www.desmos.com/" rel="nofollow noreferrer">desmos.com</a>.</p>
  <p>Similarly, you can construct a formula or recipe for choosing the difficulty of the next problem. It should be based on the current score and the current problem's difficulty. You can even force the student to repeat the question, or a question of similar difficulty if the score is below <span class="math-container">$50\%$</span>. If the score is above <span class="math-container">$50\%$</span>, you can for example increase the difficulty level of the questions by 1 point every 3 correctly solved problems. Nevertheless, there are many ways you can approach this.</p>
  <p>Hope this helps. Good luck in your thesis.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-01-24T13:42:46.963Z
Answers.Text: Sorry for this very late reply. Your answer helped a lot in deciding the flow and building this application. Thank you!
Answers.UserDisplayName: Kobe Marchal
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-11-19T15:26:03.440Z
Answers.LastActivityDate: 2021-11-19T15:26:03.440Z
Answers.UserDisplayName: devidduma
Body: <p>I'm a senior in a bachelor Multimedia and Creative Technology. My experience is mostly full-stack web app development.</p>
  <p>For my bachelor's thesis, I need to do research in a subject I have no experience in. I want to build an application where students can exercise HTML and CSS. Teachers can upload simple code pieces (e.g. h1, h2, and list with elements) with difficulty levels and students can try to copy these exercises with a code editor on the web with live preview.</p>
  <p>My question:</p>
  <ul>
  <li><p>Is it possible to use AI for grading these &quot;copies&quot;, give the students scores, and, based on these scores, adjust the difficulty level so the next exercise is harder or easier?</p>
  </li>
  <li><p>And if so, could you put me in the right direction?</p>
  </li>
  </ul>
  
Tags: <applications><research><algorithm-request><education>
Title: Can AI be used for grading code copy exercises and adjust difficulty based on these scores?
UserDisplayName: Kobe Marchal
ThreadText: # Can AI be used for grading code copy exercises and adjust difficulty based on these scores?
  
  (Asked by: username_0 on 2021-11-16)
  
  I'm a senior in a bachelor Multimedia and Creative Technology. My experience is mostly full-stack web app development.
  
  For my bachelor's thesis, I need to do research in a subject I have no experience in. I want to build an application where students can exercise HTML and CSS. Teachers can upload simple code pieces (e.g. h1, h2, and list with elements) with difficulty levels and students can try to copy these exercises with a code editor on the web with live preview.
  
  My question:
  
  * Is it possible to use AI for grading these "copies", give the students scores, and, based on these scores, adjust the difficulty level so the next exercise is harder or easier?
  * And if so, could you put me in the right direction?
  
  **Tags:** applications, research, algorithm-request, education
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-11-19. Score: 2 | Accepted answer
  
  I might be wrong, but I would suggest you approach this problem more simply rather than using neural networks or other machine learning constructs. Machine learning is concerned with making a computer learn from a lot of data. You do not need a lot of data to score how well the student's code compares to the teacher's code. You also do not need recommender systems to suggest the next question. Recommender systems suggest by infering the user's preferences, whereas in your case you can simply suggest the next question based on how well the student did on the current question and the type of current question.
  
  I would first identify the following three subproblems:
  
  1. Scoring and assigning a difficulty score to a teacher's code piece.
  2. Scoring how similar the student's solution is to the true solution.
  3. Predicting next question based on the current problem difficulty and student score for the current problem.
  
  For the first you can develop some algorithms to do *feature extraction* from the html, css or whatever code piece you want to evaluate. Features can be the following: length of the code piece, number of tags, number of different tags, number of attributes and so on. Combine them in a mathematical formula to calculate a difficulty score for the code piece. I would suggest a linear combination like the following: $Y = \sum{a\_i X\_i}$ where $X\_i$ is the $i$th feature. Then, normalizing all the scores of all questions to a range of $[0, 100]$. You can even have an upper decision boundary such that whenever a certain score is reached, the normalized difficulty score will be $100$.
  
  For the second you should start by checking if the student's code compiles, i.e. there are no syntax errors. Then, you can use [Levenshtein Distance](https://en.wikipedia.org/wiki/Levenshtein_distance) to calculate how many characters the student was wrong from the original solution. The goal of a good training should be for the student to infer the exact tags and attributes, so the exact sequence of characters. Calculate the percentage of mistakes over total length of code piece and assign it to $x$. Use a mathematical formula of your liking to score how well the student did given $x$. I would suggest you consider the following formula: $e^{-0.1x}$. It is $100\%$ score for $0$ mistakes and $50\%$ score for having $8\%$ of mistakes. Have a look at the graph at [desmos.com](https://www.desmos.com/).
  
  Similarly, you can construct a formula or recipe for choosing the difficulty of the next problem. It should be based on the current score and the current problem's difficulty. You can even force the student to repeat the question, or a question of similar difficulty if the score is below $50\%$. If the score is above $50\%$, you can for example increase the difficulty level of the questions by 1 point every 3 correctly solved problems. Nevertheless, there are many ways you can approach this.
  
  Hope this helps. Good luck in your thesis.
  
  > **Comments:**
  > **username_0**: Sorry for this very late reply. Your answer helped a lot in deciding the flow and building this application. Thank you!  
  
  ---
  
  