Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [python]

Programming questions are off-topic here. Do not ask questions about how to write code in Python. However, conceptual questions about computer science are more appropriate. See our help center for the scope of this site.

0
votes
0answers
11 views

How do you explain each step of these two lines? [on hold]

I came across this on the internet, and wasn't sure how each step of the code execution worked.
0
votes
0answers
36 views

How to perform particle swarm optimization clustering of results obtained from tf-idf vectorizer?

I have a collection of news articles. I have performed tf-idf operations on them. I am using python as programming language so it was just the use of TF-IDF vectorizer function. I now have the ...
0
votes
0answers
18 views

Random Forest - Conditional Permutation Importance

I've been looking for the most unbiased algorithm to find out the feature importances in random forests if there are correlations among the input features. Besides the most commonly preferred ...
0
votes
0answers
13 views

Code to enter Passwords into pptx [closed]

I intend to start a new project to create a code (ideally in Python) for a Brute Force algorithm and A Dictionary Search algorithm. I wish to test it on a MS Powerpoint File. However, I don't know how ...
0
votes
0answers
15 views

Cluster with categorical / ordinal

i have a dataset with movies review. I wish cluster my element but inside i have a categorical / ordinal values. i seen that exist: MCA (Multiple Correspondence Analysis) https://www.utdallas.edu/~...
0
votes
0answers
16 views

how can I write an algorithm in python that converts a natural number n into base b? [duplicate]

I only know simple python but I'm not sure how to write an algorithm that takes values n and b, where n is a positive integer and b is the base, and converts n into base b. Note b<=10.
1
vote
0answers
14 views

How to go about designing a quiz that changes difficulty based on user performance?

I thought about using a machine learning algorithm to learn the performance patterns of the quiz taker and model the next quiz based on how he/she performed. So each question will have a difficulty ...
1
vote
0answers
19 views

If statement not capturing the conditional I'm seeking [closed]

I'm working on a hw assignment, and my if statement isn't working the way it's intended. This is an ATM machine project. I've already gotten the program to read the csv file and stored it into a ...
0
votes
1answer
35 views

Ant Colony optimisation for finding subsets with ~0 sum

I have a set A = [x1, x2...xn] where xi in R (real). I need to find all non intersecting subsets with subset sum ~0 (approximately equal to zero). Since the set can have non zero real numbers, I have ...
0
votes
0answers
9 views

Composite and Non-Composite User-Defined Data Types

I have a learning resource which claims the following about user-defined data types Non-composite include: Enumerated Pointer Composite include: Record Set This confuses me, and I would ...
-1
votes
1answer
57 views

Does this sorting algorithm already exist? And if so, what is its name?

I created this algorithm off the top of my head this morning. It has one loop, therefore it has a time complexity of O(n) and only stores two variable during loop so it has a space complexity O(1) ...
1
vote
1answer
23 views

After how many iterations will an integer circle back to 0 in Python? [closed]

If this question is completely garbage I apologize because I am new to CS and haven't understood at how programming languages (Python specifically) work. I was reading about how in a standard two-...
0
votes
1answer
27 views

My code works, But how do I make this code run in a deterministic time?

The Problem: Given 3 inputs Bounce, Ball drop height, and ball view height. How do I calculate the number of times the observer can see the ball pass. So my code gives correct output, but it takes ...
2
votes
1answer
48 views

Minimum cost node cut

I am interested in solving the following problem: Given an undirected graph whose vertices are weighted, find a subset of vertices of minimal weight whose removal disconnects the graph. Is there ...
0
votes
2answers
106 views

Help with Time Complexity

Suppose we have the function below: ...
-1
votes
1answer
159 views

What is the procedure to find the time complexity of python program? [duplicate]

Is there any kind of function which is used in python to calculate the time complexity of another function?
1
vote
0answers
28 views

Is this solution is bad for the coin change problem? [closed]

was doing coin change problem as an assignment(didnt know before), after came with this solution i checked the solutions available couldnt find a similar one like this, just curious. removing the ...
1
vote
1answer
49 views

Finding a minimum weight path with certain restrictions

I have a directed weighted multigraph whose vertices are sets of URLs. We add to this multigraph all edges of the form $i\to j$ where $i\subset j$ (such edges are of zero weight), where $i$, $j$ are ...
2
votes
1answer
240 views

Why is this n^2 growth?

I am attempting to understand the growth of the following algorithm, which is described as $n^2$ growth in the book I am reading: "... performs of the order of $n^2$ steps on a sequence of length $n$....
2
votes
1answer
41 views

Why does parallelising slow down this simple problem against looping through all the data?

I've been using multiprocessing and parallelisation for the first time this week on a very large data set using 32 CPUs. I decided to explore it for a smaller task just to see if I could learn ...
1
vote
1answer
34 views

A problem about slicing and indexing in numpy in Python [closed]

I learned that in numpy, given a vector, slicing and indexing could give different results. I ran the following codes: ...
2
votes
1answer
325 views

How can I optimize 3 variables in order to maximize the end product?

I am in the process of making a cryptocurrency trading bot. Currently, I am doing backtesting over a period of 7 months in which I provide a portion of historical data as if it were in real-life. By ...
3
votes
1answer
296 views

How to use Latin hypercube sampling with fixed points?

I use Latin hypercube sampling to select what point to evaluate my function. As evaluations take a lot of time, I want to limit the time by adding already evaluated points. I thought about taking the ...
0
votes
1answer
714 views

Python: Clustering based on pairwise distance matrix [closed]

I have a matrix which represents the distances between every two relevant items. For example, M[i][j] holds the distance between items i and j. My next aim is to cluster items by these distances. I ...
0
votes
0answers
35 views

how to build logical representation from dependency tree

I'm trying to build logical representation from dependency tree with python. i created the tree with stanford parser. How can I derive logical presentation from it using Lambda-calculus?
0
votes
0answers
36 views

Van Emde Boas Cluster recursion

I have been trying to implement a Van Emde Boas tree in python, but I'm having trouble understanding how exactly it works. In the notes here, It states that the summary of a VEB structure is another ...
1
vote
0answers
25 views

Open source implementation of Multiscale Combinatorial Grouping [closed]

I would like to use Multiscale Combinatorial Grouping for my PhD research. However, I am restricted to use open-source implementations and this one runs on Matlab. Does anyone know of an equivalent ...
3
votes
1answer
125 views

Understanding Applicative Evaluation Order with the Z-Combinator

I am trying to understand how the Z-combinator (Y-combinator for applicative order languages) definition came about. As Python is applicative I am using Python for this. So I know Python's evaluation ...
0
votes
0answers
28 views

What data structure would be best for a code cross referencer?

I want to write a JavaScript cross referencer (in Python) that will build a cross-reference of JavaScript functions for a given input file. I am trying to think of what Abstract Data Type would work ...
0
votes
0answers
27 views

Unusual function - operations on lists / sets - possible optimization

I have a problem. Below I present a function in Python. ...
1
vote
1answer
196 views

Control of the combinatorial aspects of a dynamic programming solution

I am exploring how a Dynamic Programming design approach relates to the underlying combinatorial properties of problems. For this, I am looking at the canonical instance of the coin exchange problem: ...
-1
votes
1answer
24 views

How is ReLU used in machine learning functions

I've seen how sigmoid would be used in machine learning sigmoid(dot(activations, weights)-bias) like this ^ but sigmoid makes sure your values are between 0 and ...
-1
votes
1answer
39 views

Using computer vision instead of algorithms?

I have been thinking of a problem i have here with a calendar scheduler where i basically want to split a year into seconds and have access to the dataset of whole year. In this year i assign blocks ...
1
vote
0answers
22 views

Need a game with AI techqniques [closed]

I want to learn Artificial Intelligence techniques by writing a game (or maybe any fun project). Can you suggest any games? Consider that I'm a beginner in AI, but have basic knowledge Algorithms and ...
1
vote
2answers
18 views

Distinguishing between side-by-side liquid streams

I'm new to computer vision and am looking for advice. I'd like to perform computer vision on a spiral system, in this system a down flowing liquid separates into different regions based on density: ...
-1
votes
1answer
299 views

list('\a','\b','\c') prints '\x07', '\x08', '\\c' [closed]

In python3.6, I tried In [60]: a = '\a' In [61]: b = '\b' In [62]: c = '\c' In [63]: l =[a, b, c] If test l ...
2
votes
1answer
205 views

Conditional Shortest Path Through Weighted Cyclic Directed Graph

Vertices in my graph are composed of {name, category} where category is one of {red, grn, blu, ylw}. Edges in my graph are weighted and directed. In the visualization, the thick end of the edge ...
0
votes
0answers
37 views

Are the terms “Language Implementation”, “Runtime” and “Virtual Machine” synonymous?

To describe the implementation of a dynamic programming language, I have seen the terms "Runtime" (e.g. Security transparency in the Python runtime), "Virtual Machine" (Python Virtual Machine (PVM), ...
1
vote
2answers
537 views

Determining time complexity of this function in python [duplicate]

I would like to determine the time complexity of this function, in $\mathcal{O}$-Notation. ...
0
votes
1answer
33 views

Grammar types constraint after adding a couple of types (and a statement involving them) to a “typeless” language

Foreword : by "typeless programming language", I naively mean "language in which you don't write statements like type x (=) ... to declare(define) ...
1
vote
0answers
28 views

Order of domino tiles function [closed]

The domino tiles can be listed in an orderly way as shown in the figure : figure link Write a function such that given two variables ("minor" and "major") where "minor" is the lowest value and "...
1
vote
1answer
85 views

Truth value of a proposition [closed]

I'm trying to write a function in Python that takes it argument as a Python list and returns a boolean value based on the truth vale of the proposition $E(x) \to \exists y \text{ s.t. } x=2y$, where ...