code snippets to practice applications of data structures used in ml: refer to https://www.kdnuggets.com/2018/01/data-structures-related-machine-learning-algorithms.html/2 Problems:
If you want to practice and realize data structures for ML algorithm yourself, try to solve some of problems below:
- Encapsulate the matrix-vector multiplication code snippet into a subroutine called matrix_times_vector. Design the calling syntax for the subroutine.
- Using struct, typedef or class, encapsulate both vectors and matrices into a pair of abstract types called vect and matrix, respectively. Design an API for the types.
- Find at least three libraries online that do the above.
- Download and install the LIBSVM library. Consider the method Kernel::k_function on line 316 of “svm.cpp”. What are the advantages and disadvantages of the data structure used to hold vectors?
- How would you re-factor calculation of kernel functions in the LIBSVM library?
- Which data structures described in the text are abstract types?
- What internal representation or data structure could you use to implement the abstract data types? Are there any that are not included in the list above?
- Using a binary tree, design an associative array.
- Consider the vector type in LIBSVM. How can this be used to represent a sparse matrix? Contrast this with the sparse matrix class described above. Look at the complete type. What are the advantages and disadvantages of each representation?
- Implement a treesort and a heapsort. Now use the same data structures to find the top k elements. What common machine learning algorithm is this good for?
- Implement your favorite data structure in your favourite language.