Page 314 - AI Ver 3.0 Class 11
P. 314

3.  Define the following:
                        • pyplot
                        • Semi structured data
                        • Feature Selection
                   Ans  •   pyplot: Data visualisation in Python can be accomplished using the Matplotlib library. The ‘pyplot’ submodule
                          of Matplotlib offers a MATLAB-like interface and includes numerous convenience functions that simplify the
                          process of creating basic plots.
                        •  Semi structured data: Text files with an apparent pattern enabling analysis e.g. HTML files.
                        •   Feature Selection: This step is part of the data preprocessing pipeline. It involves choosing a subset of important
                          features from the dataset. Feature selection is commonly done to eliminate irrelevant or redundant features
                          from the dataset.
                     4.  When is a scatterplot suitable?
                   Ans.  •   It is used to track the connections between two numerical variables. When the data are seen as a whole, the dots
                          on the plot indicate both the variable's value and any trends.
                        •   The scatterplot is a valuable tool for calculating correlation. Variable relationships can be categorised in a variety
                          of ways, including positive or negative, strong or weak, linear or nonlinear.

                        •   This graph’s strength lies in its ability to clearly depict trends, clusters, and relationships within datasets.
              C.   Competency-based/Application-based questions:
                                                                                        #Coding & Computational Thinking
                   1.   In a training session the employees were given the following table:
                              Student           Hours Studied         Exam Score
                                 A                    2                   65
                                 B                    3                   70
                                 C                    4                   75
                                 D                    5                   80
                                 E                    6                   85
                                 F                    7                   90
                                 G                    8                   95
                   The employees were asked to create a visualisation for a presentation to the Principal showing the effect of hours put
                   to study and the corresponding exam score of the students. Which visualisation tool would you use to display the data
                   effectively.
              Ans.   The data is well suited for a scatter plot. So a scatter plot will effectively show how the data relates to the final exam score
                   recorded for various students.
                   Code to present the given data in the form of scatterplot in Python is:

                        import matplotlib.pyplot as plt
                        # Data from the table
                        students = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
                        hours_studied = [2, 3, 4, 5, 6, 7, 8]
                        exam_scores = [65, 70, 75, 80, 85, 90, 95]
                        # Creating a scatter plot
                        plt.scatter(hours_studied, exam_scores, color='blue', marker='o')
                        # Adding titles and labels
                        plt.title('Hours Studied vs. Exam Scores')
                        plt.xlabel('Hours Studied')
                        plt.ylabel('Exam Score')
                        plt.show()
                    312     Touchpad Artificial Intelligence (Ver. 3.0)-XI
   309   310   311   312   313   314   315   316   317   318   319