Please evaluate my Python codes and outputs, if you are able to check my SQL also please do.
In this MySQL challenge, your query should return the vendor information along with the values from the table cb_vendorinformation.
You should combine the values of the two tables based on the GroupID column.
The final query should only print out the GroupID, CompanyName,
and final count of all rows that are grouped into each company name under a column titled Count.
The output table should be then sorted by the Count column and then sorted by GroupID so that a higher number appears first.
Your output should look like the following table. i__________+
GroupID I CompanyName Count
i__________+
+
27 Machinx 1
5 WaterBus Enterprise 1
36 Johnson and Sons 2
35 Shipping & Co. 3 I
6 Alloy LLC 3 I
40 FireConsulting 5 I
39 News Corp. 6 I
SELECT v.GroupID, v.CompanyName, COUNT(*) AS Count
FROM cb_vendorinformation v
JOIN cb_vendorinformation vi
ON v.GroupID = vi.GroupID
GROUP BY v.GroupID, v.CompanyName
ORDER BY Count DESC, v.GroupID;
See: https://drive.google.com/file/d/104ssMQC…sp=sharing
“In the Python file, you will be creating a model to predict the age of abalone’s from a subset of the abalone dataset which we provide in CSV format.
Part of the program is already implemented, your goal is to set up the model, train the model on the training data set, and print out some results.”

“Python Age Prediction Project: In the Python file, you will be creating a model to predict the age of abalone’s from a subset of the abalone dataset which we provide in CSV format.”

“Part of the program is already implemented, your goal is to set up the model, train the model on the training data set, and print out some results.”

“These are the following details you need to implement: First, you’ll convert the feature dataset into a numpy array.”

“Then you should create a Sequential model with 2 layers. The first layer should be a Dense layer with 64 units, and the second layer should also be a Dense one with units set to 1.”

“Once the model is set up, you should compile it with a MeanSquaredError() loss and the optimizer set to optimizers.Adam().”

“Then, when you fit the dataset on abalone_features and abalone_features, make sure to set the following values: epochs=10, verbose=0.”

“Finally, you should print both the history from fitting the model, and the model summary.”
import pandas as pd
import numpy as np
import tensorflow as tf
from tensorflow.keras import layers
abalone_train = pd.read_csv(
r"C:\Users\Anthony.DESKTOPES5HL78\Downloads\abalone.data",
sep=“,”,
names=[
“Sex”, “Length”, “Diameter”, “Height”, “Whole weight”,
“Shucked weight”, “Viscera weight”, “Shell weight”, “Age”
]
)
Perform onehot encoding for the ‘Sex’ column
abalone_train = pd.get_dummies(abalone_train, columns=[‘Sex’])
abalone_features = abalone_train.copy()
abalone_labels = abalone_features.pop(‘Age’)
Convert to numpy array and float32 data type
abalone_features = abalone_features.astype(‘float32’)
abalone_labels = abalone_labels.astype(‘float32’)
Create a sequential model
model = tf.keras.Sequential([
layers.Dense(64, activation=‘relu’),
layers.Dense(1)
])
Compile the model
model.compile(optimizer=tf.keras.optimizers.Adam(), loss=tf.keras.losses.MeanSquaredError())
Fit the model
history = model.fit(abalone_features, abalone_labels, epochs=10, verbose=0)
Print history and model summary
print(history.history)
model.summary()
{ [74.98324584960938, 12.322690963745117, 7.765621185302734, 7.502653121948242, 7.229104518890381, 6.997042179107666, 6.799757957458496, 6.645227432250977, 6.521533489227295, 6.418800354003906]}
Model: “sequential”
Layer (type) Output Shape Param #
dense (Dense) (None, 64) 704
dense_1 (Dense) (None, 1) 65
=================================================================
Total params: 769
Trainable params: 769
Nontrainable params: 0
Data for this Question: https://drive.google.com/file/d/1iSgWZUK…sp=sharing
Python Linear Regression Project
In the Python file, write a script that will perfom a linear regression on the data in data.txt and then calculate the coefficient of determination of the prediction.
The first line in data.txt represents the X column, and the second line represents the Y column.
3.
import numpy as np
from sklearn.linear_model import LinearRegression
Read data from file
with open(r’C:\Users\Anthony.DESKTOPES5HL78\Downloads\abalone.data’, ‘r’) as file:
lines = file.readlines()
Extract X and Y data
X =
Y =
for line in lines:
data = line.strip().split(‘,’)
X.append(data[1:1])
Y.append(data[1])
Convert data to numpy arrays
X = np.array(X, dtype=float)
Y = np.array(Y, dtype=float)
Create a linear regression model
model = LinearRegression()
Fit the model to the data
model.fit(X, Y)
Calculate the coefficient of determination (Rsquared)
coefficient_of_determination = model.score(X, Y)
Print the coefficient of determination
print(“coefficient:”, coefficient_of_determination)
Here is my answer:
https://drive.google.com/file/d/1eNJQJBr…sp=sharing
Data for this question: https://drive.google.com/file/d/16VdNW4Z…sp=sharing