BestPromptFinder
HomeCoding › Below is an instruction that describes a task. Write a respo...

Below is an instruction that describes a task. Write a respo...

Coding · General · Coding
48Quality
90%Useful
87Reliability

The prompt

Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: Create a neural network class in Python to model a linear regression function. ### Input: ### Output: import numpy as np class LinearRegressionModel: def __init__(self, input_dim, output_dim): ''' Initialises the weights and bias of the linear regression model Arguments: input_dim {int} -- Number of input features output_dim {int} -- Number of outputs ''' self.weights = np.zeros((input_dim, output_dim)) self.bias = np.zeros((1, output_dim)) def forward(self, x): ''' Calculates the forward pass of the linear regression model Arguments: x {numpy array} -- Input data of size (N, input_dim) Returns: out {numpy array} -- Output of the linear regression model of size (N, output_dim) ''' out = np.dot(x, self.weights) + self.bias return out
Find similar in the app →

Why this prompt

Source

Hugging Face

Related Coding prompts

PRD to MVP Technical Plan
Quality 93 · Claude Code
Full-Stack CRUD App Builder
Quality 93 · Claude Code
Legacy Refactor Planner
Quality 93 · Claude Code
Test Suite Generator
Quality 93 · Claude Code
Third-Party API Integration
Quality 93 · Claude Code
Database Schema and Migration
Quality 93 · Claude Code