 If we are live or not, it takes about 10 seconds or so. Yeah, we have the link, start in a second. Yeah, let's see if we have the sound, anything working today. Some of the streams are just... You start the stream and nothing works. Hey, what is that? Murphy's Law? Okay, seem to have the correct microphone. So I won't be monitoring my own sound because I don't like my own voice. I know if I don't unplug any USBs or anything, the microphones and camera keep working okay, so I don't have to keep monitoring. That being said, let's monitor it. Okay, just check. So still this fuzzy logic tool. That'd be a long one as well, like the music out of EEG. It took about 20 live streams. So it will be over 20 hours or so of development and probably more. I try not to do things offline but sometimes it's very tempting. It's also a lot of the time you finish a stream that nothing worked and you try something and just start working after you stopped recording. So that happens as well. Hopefully today it will actually happen during the recording. So we have that fuzzy logic tool. Can select a waveform type. Later we'll try to have a scroll and it just scrolls through them and those values change as you scroll. They do change when you adjust the input parameters at the moment. Now we discovered that originally the bot suggested something that was wrong. So now we're trying to fix it. So yeah, there was a misunderstanding. It was calculating, it was giving an array of feature extracted features. So essentially for each data point this input waveform will have value for symmetry and sharpness which is not correct. We need it for the whole waveform. So now it suggests that we should correct the code. However, I tried something new where GP4 has a lot of the context. You can load all the code into it and it doesn't forget it. It seems to forget what just happened a couple seconds ago. So what we're doing right here is when the original GPT generated the code. We also asked to generate prompts for the changes in the last response and the new GPT because yeah that was it was going places there. It was wrong. So we're now replacing a calculate peak sharpness array and symmetry array into one value. So for example we already took it from GPT but just so it has the context. Let's quickly do this again. It should essentially produce the same code, calculate waveform symmetry. It says the symmetry is dividing. It's dividing the whole waveform into two parts. This is the first half, second half. It makes more sense on the left and right. This is really good. Yeah this is actually much better because there would be a problem if there's an odd number of data points that should not be the case. It should be always 100. There should always be 100. So maybe that is not necessary. Symmetry. Let's calculate symmetry. All right, it kind of makes more sense in the original code if the if the numbers of the data points is not even it just returns symmetry equals zero because that kind of makes sense because if it's because that means the signal is not symmetrical the symmetry itself absolutely variates a different calculation. So the original one is calculating the arithmetic mean and the second one is will be a problem after this. Yeah so those yeah but we should be just calculate symmetry. Should not be an array. Calculate sharpness. Remove the waveform from there. And now it's bad, dark sharpness. So I expected to work getting an error sign with it. Yes, fuzzy data is missing or invalid. Okay, you probably need to do that new one. Sharpness. I also had the prompt to modify fuzzy logic function to use the new whole waveform symmetry and sharpness features. Now yeah this will give us output. We'll try it anyway. Already have fine peaks, fine drops. I don't know why it's starting to regenerate the whole thing. Data membership function. You can trip what to this as well because co-pilot for the reason. Try to update the whole code. I don't know why. Added more membership functions. Now the membership function is going from zero to ten instead of zero to one. Let's read that quickly. To update your fuzzy underscore logic function in a way that it uses the overall symmetry and sharpness of the entire waveform to make classification decisions, you need to modify how the function interprets these features and how it applies the fuzzy rules based on them. Here's a step by step guide to do this. Update feature inputs. Change the inputs to the fuzzy underscore logic functions so that it receives the overall symmetry and sharpness values of the entire waveform instead of arrays representing these features at each point. Revise membership functions. Redefine the membership functions for symmetry and sharpness to reflect their new, holistic interpretations. For example, the range and shape of these functions might change to accommodate the new range of values that the overall symmetry and sharpness can have. Modify fuzzy rules. Adjust the fuzzy rules to make decisions based on the overall characteristics of the waveform. The thing is those rules, the membership function, the zero to ten should correspond to the range of outputs for symmetry and sharpness. I think that is correct. What is the range of output for symmetry and sharpness? Calculations. It says it doesn't have access to the specific data or calculations. There's no doubt it should be in the code. Range, output, symmetry, channel calculation depends on the specific methods, blah blah. Expecting something more specific. Yeah, not having much. Not having much luck with our pilot. Adjust the fuzzy rules to make decisions based on the overall characteristics of the waveform. The logic of these rules might change significantly because you're now dealing with a global assessment of the waveform rather than point-by-point analysis. Based on the outputs of these rules, implement the logic to classify the waveform into categories like square, triangle, trapezoid, etc. This will likely involve aggregating the rule outputs and using a defuzzification method to make a final decision. Choose an appropriate defuzzification method, like centroid, bisector, etc. To convert the fuzzy outputs into a single crisp output, which will be your waveform classification. After implementing these changes, test the fuzzy underscore logic function with various waveforms to see how well it classifies them. Based on the results, you might need to further adjust the membership functions, rule definitions, or the classification logic. That's actually suggesting to simplify the code to have only symmetry low and high, sharpness low and high. We have the rule. It's not the complete code, obviously. Can you look at the code above and regenerate the whole fuzzy logic function? Why did it change the input universe? It's back to three levels, low, medium, high. The membership functions between zero and one. They are trapezoid. That's what I have in the code, isn't it? Yes. Okay, now just copy pasting from the earlier code. I have another rule for unknown sharpness. Go ahead and run. It's as if it's forgotten about the unknown. Did I edit later? I'm still editing it later. You're getting stuck. Certainly. Here are prompts for implementing the changes suggested in the last response. Prompts for adjusting symmetry calculation. Update the calculator underscore waveform underscore symmetry function to assess the symmetry of the entire waveform. This function should take the entire signal as input, split it in half, and compare the two halves. Calculate the symmetry as the average difference between corresponding points in the two halves. Also, include handling for waveforms with an odd number of points. Prompt for adjusting sharpness calculation. Create a new function calculator underscore waveform underscore sharpness to measure the overall sharpness of the waveform. This function should identify peaks and troughs in the waveform and calculate sharpness based on the average absolute difference between these peaks and troughs. Implement helper functions find underscore peaks and find underscore troughs to detect these features in the waveform. Prompt for modifying fuzzy logic function. Modify the fuzzy underscore logic function to use the new whole waveform symmetry and sharpness features. Update the membership functions and fuzzy rules to classify the waveform based on its overall characteristics. Ensure that the fuzzy logic system can now make decisions about the group or type of the entire waveform based on these updated features. Prompt for implementing peak and trough detection. Develop find underscore peaks and find underscore troughs functions to detect peaks and troughs in the waveform. These functions should analyze the signal to find local maxima and minima which will be used in the sharpness calculation. Ensure these functions are robust to noise and can accurately identify significant peaks and troughs. Prompt for handling odd length waveforms in symmetry calculation. In the calculator underscore waveform underscore symmetry function add a specific condition to handle waveforms with an odd number of data points. Decide on a strategy for handling the middle point in fuzzy logic function. To modify the fuzzy underscore logic function in your code to use the new whole waveform symmetry and sharpness features and to update the membership functions and fuzzy rules accordingly follow these steps. Update membership functions. Redefine your membership functions to reflect the global characteristics of symmetry and sharpness for the entire waveform. This might involve adjusting the ranges and shapes of the membership functions to better suit the global features. Redefine fuzzy rules. Change the fuzzy rules to make decisions based on the overall waveform characteristics. The rules should now consider the global symmetry and sharpness to classify the waveform. Modify fuzzy underscore logic function. Incorporate these changes into your fuzzy underscore logic function. This involves using the new symmetry and sharpness calculations and applying the updated membership functions and rules. It looks more like it like this one so let's modify the functions step by step So we're already calculating global features. Don't need to pull, actually called at the waveform in the name. It's okay to take in the noisy signal. Getting this information from it is the noisy signal. It's the noisy signal. Okay. Symmetry. I like what we have so far but now the membership functions. So let's say just think two low and high. I have three low, medium, high. Let's stick to the low, medium, high. So those are the membership functions. Then you have a degree of membership, just sharpness. That's the fuzzy interpolation, interpolation, interpolation universe. Okay, that looks legit. Then we have the fuzzy rules. So we have suggesting to have type A, step A. So square has low symmetry, low sharpness. Triangle has low symmetry, high sharpness. Okay, there's a problem there. That's because we're not using the medium stuff. We're sure we would need three levels but and then this code is not complete because all types. This updated backward fuzzy underscore logic backward function now analyzes the entire waveform using the global symmetry and sharpness features, applies the redefined membership functions and rules, and then classifies the waveform into a specific type based on the aggregated fuzzy logic output. Remember, the specific membership functions, fuzzy rules, and mapping of defuzzified output to waveform types depend on the characteristics of your waveforms and the types you want to classify. You may need to experiment with different configurations of these elements to achieve accurate and meaningful classifications. A couple of issues. First of all, wouldn't three levels be better than two? So for symmetry and sharpness have membership functions of low, medium, and high instead of low and high alone. Second issue, can you look at the code that I provided and update the rule names? There should be rule square, rule triangle, and rule trapezoid. A third problem is we need to include an option where the algorithm doesn't know what the waveform is and producing a unknown as an answer. Yep, it's a good idea. Okay, dating rule names. Yes, handling unknown. An unknown classification can be handled by setting up a condition that if none of the rules are sufficiently activated, the algorithm defaults an unknown output. That sounds good. Okay, let's say using triangular membership functions again. Okay, rule square, symmetry, high. Yeah, that's incorrect. You know what happened there? This was producing, yeah, this says python, then all of a sudden it says what? But it's the continuation, some threshold instead of threshold. To define a threshold for unknown, we need to return the centroid as well. Membership functions are updated to include three levels, low, medium, and high. Fuzzy rules are renamed and adjusted to classify waveforms as square, triangle, or trapezoid based on the overall symmetry and sharpness. An unknown classification is introduced for cases where the maximum activation of the rules is below a certain threshold, indicating that the algorithm is unsure about the waveform classification. You should define back quote some underscore threshold back quote based on your specific requirements and experimentation. This threshold determines the confidence level below which the algorithm decides that the waveform does not sufficiently match any of the defined types. A couple of issues with it, but I've trouble integrating creative membership. We have the rules. Let's go over the rules again. Square, a symmetry should be high, sharpness low, medium, and triangle sharpness high. A symmetry low, depends which triangle we're talking about. Currently, getting a 500 response, sharpness high, trapezoid, rule square, what it does. That's adding zeros to make the length to match the length of the rays. What's the difference between these two? Yeah, let's go with the more recent one. Where's the defuzzify? This here, okay, centroid. It's meant to be five single quotes or double quotes. And there's still a problem. Yeah, we need to watch the JavaScript as well. It's being used. What's the problem? It's a noisy signal instead of signal, isn't it? Something I don't get in co-pilot. Go JavaScript. How to modify this JavaScript code based on recent changes in the Python server backend? It doesn't actually need to modify the JavaScript to work with this Python code. Are you kidding me? This is the Python backend. That's it. Okay, the shit is hopeless. Can you see the above JavaScript code that I provided earlier? Based on the changes, the recent changes in Python code. Do we need to modify anything in the JavaScript as well? Yeah, co-pilot is hopeless with context. Update the function that displays the output of the fuzzy logic. Update output. To handle the unknown classification. Ensure that the front end can display information about the medium membership levels for symmetry and sharpness. Modify the function plot fuzzy logic parameters to include the visualization of the new medium membership functions for both symmetry and sharpness. I already have it. Adjust the plotting logic in plot fuzzy logic parameters to display the activations of the new rules. Rule underscore square, rule underscore triangle and rule underscore trapezoid. If these are still relevant, ensure that the logic for calculating and displaying detection error and unknown percentage is updated to reflect the new unknown classification. Yeah, this is all to say. The fuzzy data is now called something else. It's doing these funny things now where it's generating another response if how to in what uh nothing works. Your flask application seems to be structured for analyzing signals, adding noise and using fuzzy logic to classify the signal type. The code includes various routes and helper functions. Renders the home page. Analyze accepts post requests to analyze signal data. It generates a signal, adds noise, analyzes the signal using fuzzy logic and calculates detection error and unknown percentage. Generate underscore signal input underscore wave generates different types of waveforms based on input. Add underscore noise signal noise underscore amplitude adds noise to the signal. Analyze underscore signal noisy underscore signal analyzes the noisy signal using fuzzy logic. Fuzzy underscore logic noisy underscore signal applies fuzzy logic to classify the signal. Calculate underscore symmetry signal calculates the symmetry of the signal. The errors you're encountering in the console suggest issues with data retrieval or parsing from your server's response. Here are the key points related to your errors and some potential solutions. Centroid and fuzzy data undefined. The centroid, undefined and fuzzy data undefined errors indicate that these properties are not present in the response data object. Ensure that the server correctly includes centroid and fuzzy data in the JSON response. Debug by logging the entire data object received from a server console.log data to see if these properties are actually being sent. Noisy signal data missing or invalid this error suggests that the noisy signal property is either not present in the response or it's not in the expected array format. Verify the server side logic that adds noisy signal to the response. Check if the noisy signal property exists in the response and if it's formatted as an array. Detection error and unknown percentage history data issues. The error messages error, detection error history or unknown percentage history data is missing or invalid indicates similar issues for detection error history and unknown percentage history properties. Confirm that these arrays are included in the server response and that they're in the correct format. Possible causes and debugging steps. Server side issues. The flask server might not be processing the request correctly or might not be including the expected properties in the response. Review the server code to ensure that all necessary data is computed and included in the response. Request payload issues. Make sure the request payload, input wave value and noise amplitude value is correctly formatted and sent to server. Network issues. There might be a network issue preventing the request from reaching the server or the response from coming back. Check the network tab in your browser's developer tools to inspect the request and response. Asynchronous timing issues. Ensure that your javascript logic correctly waits for the server's response before attempting to access properties on the data object. As a general debugging tip, use console.log statements in both your server side python code and your client side javascript code to trace the flow of data and identify where the breakdown is occurring. The error message, length of x and fuzzy membership function must be identical, indicates a mismatch in the lengths of the arrays being used in your fuzzy logic calculations on the server side. This issue is causing the server to fail in generating the expected response, leading to undefined values for centroid, fuzzy data and noisy signal in your javascript console. Here's how you can address it. Check membership function array lengths. In your python server code, ensure that the arrays used for x coordinates and membership function values, mf underscore asterisk, have the same length. This is crucial for the fuzzy logic functions to work correctly. The lengths of symmetry underscore universe, peak underscore sharpness underscore universe, and the membership functions like mf underscore symmetry underscore low, mf underscore symmetry underscore mid, etc, should match. Debug fuzzy logic function. Outprint statements or user debugger to inspect the lengths of the relevant arrays, symmetry underscore universe, mf underscore symmetry underscore low, etc, in the fuzzy underscore logic function. This will help you identify where the length mismatch is occurring. Adjust array generation logic. If you find that the lengths are not equal, adjust your code to ensure that they are. This might involve changing how you generate these arrays or how you calculate the membership functions. Error handling. Improve error handling in your flask app. When an exception occurs, make sure to log detailed error information. This will help in diagnosing issues more effectively. Client side error handling. On the javascript side, enhance error handling to gracefully handle cases where the server response contains an error message. This could involve displaying a user-friendly message or handling missing data more elegantly. Test with different inputs. Once you fix the issue, test your server with various inputs to ensure the problem is resolved and that your fuzzy logic functions are working as expected. Remember, the key to resolving this issue is ensuring that all arrays used in your fuzzy logic calculations have the same length. This is a common requirement in fuzzy logic libraries to perform operations on corresponding elements of these arrays. The line, noisy signal, noisy underscore signal. Tollist, in your flask application is intended to convert the NumPyArray noisy underscore signal into a list before sending it as part of a JSON response. JSON responses cannot directly handle NumPyArray formats, so this conversion is necessary. However, the error you are encountering seems unrelated to this line. If you are still receiving errors like length of X and fuzzy membership function must be identical, it indicates an issue in the fuzzy logic processing part of your server side code, not in the conversion of noisy underscore signal to a list. The problem lies in the way you are defining or using the membership functions and the corresponding X-axis values in the fuzzy logic calculations. To troubleshoot this, verify lengths of arrays, ensure that the arrays for the X-axis, symmetry underscore universe, peak underscore sharpness underscore universe, and the arrays for the membership functions, mf underscore symmetry underscore low, mf underscore symmetry underscore mid, etc. have the same length. This is crucial for fuzzy logic calculations. Debug fuzzy logic function. Your fuzzy underscore logic function looks well structured for processing the noisy signal using fuzzy logic. It calculates symmetry and sharpness features, defines membership functions, computes rule activations, aggregates these activations, and then uses defuzzification to determine the output wave type. It also prepares data for plotting. However, the error you encountered earlier, length of X and fuzzy membership function must be identical, suggests there may be an issue in how the membership functions or their activations are being calculated. To troubleshoot, consider the following steps. Verify membership function lengths, ensure that the arrays mf underscore symmetry underscore low, mf underscore symmetry underscore mid, mf underscore symmetry underscore high, mf underscore sharpness underscore low, mf underscore sharpness underscore mid, and mf underscore sharpness underscore high have the same length as check symmetry and sharpness calculations. The variable symmetry and sharpness should be scalar values representing respective features of the noisy signal. Ensure that these values are being calculated correctly in the calculate underscore symmetry and calculate underscore sharpness functions. Inspect rule activations, the NP, fmin functions used in calculating rule underscore square, rule underscore triangle, and rule underscore trapezoid should work correctly as long as symmetry underscore asterisk and sharpness underscore asterisk values are scalar and within the range of the corresponding membership functions. Double check these calculations. Inspect rule activations, the NP, fmin functions used in calculating rule underscore square, rule underscore triangle, and rule underscore trapezoid should work correctly as long as symmetry underscore asterisk and sharpness underscore asterisk values are scalar and within the range of the corresponding membership functions. Double check these calculations. Defuzzification, the call to fuzz. Defuzz uses the aggregated array and symmetry underscore universe to calculate the centroid. Ensure that aggregated is correctly formed and has the same length as symmetry underscore universe. Output decision logic, the logic for deciding output underscore wave based on the centroid value seems reasonable. However, ensure that the thresholds 0.2, 0.4, 0.6 align well with the expected output types. Logging for debugging, add more print statements or logging throughout this function to track the values of key variables and identify where the issue might be occurring. Remember, the most critical aspect is to ensure that all arrays used in fuzzy logic calculations for membership functions, activations, and aggregation are correctly aligned in terms of their lengths and values. By carefully checking each step and ensuring that the data aligns correctly, you should be able to resolve the error. Based on the output you shared, it seems there is an issue with how the fuzzy logic membership functions are being applied or interpreted. Let's break down the information. Symmetry value, the calculated symmetry is 0.9460389751007992. This is a scalar value representing the symmetry of your noisy signal. Membership function mf underscore symmetry underscore low, the membership function array mf underscore symmetry underscore low shows decreasing values from 1 to 0. It's designed to represent the degree to which the symmetry value is considered low. However, the function should ideally start with 0, peak at the range where symmetry is considered low, and then decrease back to 0. Symmetry low activation symmetry underscore low, the symmetry underscore low activation is 0.0. This makes sense given the high symmetry value, which falls outside the low range of the mf underscore symmetry underscore low membership function. Rule square activation rule underscore square, the rule underscore square is calculated as 0.07666682012619914. This is derived from the fuzzy logic rule, which likely involves a combination of symmetry underscore high and sharpness underscore mid, or similar. From this output, it appears that the mf underscore symmetry underscore low membership function may not be correctly defined for your use case. Given the symmetry is high, you would expect low membership in the low category, which is what you see. However, the shape of mf underscore symmetry underscore low is unusual, as it starts at one and decreases, which is not typical for a fuzzy membership function. Consider the following adjustments. Redefine membership functions. Membership functions should reflect the fuzzy categorization of your input variables. For example, low symmetry membership functions should peak where symmetry values are considered low and table offers values move away from this range. It's unusual for a membership function like mf underscore symmetry underscore low to start at one and then decrease. Review membership function definitions. Ensure that the parameters defining the trapezoidal membership functions, fuzz, trap mf, correctly reflect the ranges you intend for, low, mid, and high categories. The four parameters define the feet and shoulders of the trapezoid. For a low function, you might expect it to start and end at zero, peaking in the low range. Check all membership functions. Review the definitions for all your membership functions to ensure they accurately represent the intended fuzzy logic. Consider visualization for debugging. Visualizing these membership functions can greatly aid in understanding and debugging them. You might plot these functions to see their shapes and adjust as necessary. By carefully revising the line symmetry underscore universe equals mp linspace 0 1 then noisy underscore signal is creating a numpy array named symmetry underscore universe that ranges from 0 to 1 with as many elements as the length of noisy underscore signal. However, using the length of noisy underscore signal to define the universe for the symmetry variable, this array is intended to represent the universe. However, using the length of noisy underscore signal to define the universe for the symmetry variable might not be appropriate depending on the context of your application. The length of noisy underscore signal could be quite large, especially if it's a time series data and it's not necessarily related to the range of values that symmetry variable can take. Appropriate range for symmetry, the symmetry in most contexts would be a value between 0 and 1, where 0 represents complete asymmetry and 1 represents perfect symmetry. The universe of discourse for this variable should reflect this range. In your case, np linspace 0 1 100 or similar might be more appropriate if you want to define 100 discrete points within this range. Consistency with membership functions. The universe of discourse should be consistent with the ranges used in your membership functions. If symmetry underscore universe has a different range or number of points than expected by your membership functions, it can lead to errors or unexpected behavior. Simplification for debugging. If you're debugging your fuzzy logic system, you might want to simplify things. Start with a smaller, more manageable universe of discourse until you're sure everything works as expected. Then, you can scale it up if necessary. Reviewing the context, ensure that the way you're using symmetry underscore universe makes sense in the context of your application. If symmetry is a feature calculated from noisy underscore signal and it's meant to have a range between 0 and 1, then the approach should be fine. However, if symmetry is not directly related to the length of noisy underscore signal, reconsider the logic behind using len noisy underscore signal to define its universe. In summary, make sure that the definition of symmetry underscore universe aligns with the expected range and usage of the symmetry variable in your fuzzy logic system. It seems like you want to continue working on the fuzzy underscore logic function for your signal processing application. Given the information and context from your previous queries, here are some key aspects to focus on while you refine this function. This function will use fuzzy logic to analyze the signal, involving steps like calculating key features, setting up membership functions, defining rules, and applying defusification. Here's a structured approach to rebuilding the function. What happened to chgpt? It's producing the code as text outside the python window and then another window called bash, which doesn't make any sense. It's having these super bold letters and something is up. It's going down. Let's see, out the company again. We'll go down at some stage. Okay, we got another 10 minutes or so. Let's go quickly over some questions and stuff. Someone's suggesting to stream on Twitch. Well, yeah, good luck with that because from OBS it seems to be impossible to stream into two different platforms. So you have to use another tool so it becomes rather complicated. And I have to stick to YouTube because I'm trying to get monetized. All the project is for it to be sustainable. There's another comment that I can't find. Right, I was asking, do you have a video on denoising a channel using a different channel as noise reference? So I did have videos on denoising channels but not using a different channel as noise reference. I don't know why we should do it in EEG considering you don't know which one is essentially the denoising channel should be used as reference. It can be tricky. The solution likely involved adaptive filtering. Yeah, we've done adaptive filtering as well. Add some noise reduction. Make windows size small. You can see what the difference is. This noise reduction is a wavelet based and select your wavelet type. Someone was using DB5. You can probably add it. I'm doing up to four. There's normally in this particular data there's a buggerall difference. Some of them reduce more noise than others. Some other channels that noise reduction is more pronounced. If you do detraining actually you overlaid. It's a bit buggy this thing. Filter order doesn't change much. I don't expect that to change anything. You'll be more than happy to revisit this tool, make improvements on it. So if you have any more specific suggestions, they are more than welcome. We have some music. So we haven't published a tool yet. We normally deploy Fridays. We develop the first day deploy Fridays. That tool is currently a bit different in the sense that it's only client side. It's only client side. The camera is being used. There's one work that video shows. Okay, that won't work. Can we remove the camera from the stream? Stuffed something up, didn't it? Let's try this again. Anyway, the previous videos were me using it, so nothing really works today. Nothing in the shit. No one wants to interact. Makes me sad. So I'll see you next time. Bye!